commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13 values | lang stringclasses 23 values |
|---|---|---|---|---|---|---|---|---|
ea75c5583051b53e91bb067874e305b088a755d5 | Make UI resilient to delete user | Inner89/Orchard,LaserSrl/Orchard,Sylapse/Orchard.HttpAuthSample,DonnotRain/Orchard,fassetar/Orchard,aaronamm/Orchard,bigfont/orchard-cms-modules-and-themes,Praggie/Orchard,salarvand/Portal,stormleoxia/Orchard,salarvand/orchard,dcinzona/Orchard,JRKelso/Orchard,smartnet-developers/Orchard,patricmutwiri/Orchard,yonglehou/Orchard,rtpHarry/Orchard,arminkarimi/Orchard,NIKASoftwareDevs/Orchard,OrchardCMS/Orchard-Harvest-Website,dmitry-urenev/extended-orchard-cms-v10.1,Cphusion/Orchard,jerryshi2007/Orchard,vairam-svs/Orchard,patricmutwiri/Orchard,jersiovic/Orchard,vard0/orchard.tan,vairam-svs/Orchard,qt1/Orchard,alejandroaldana/Orchard,Praggie/Orchard,enspiral-dev-academy/Orchard,jerryshi2007/Orchard,emretiryaki/Orchard,RoyalVeterinaryCollege/Orchard,Praggie/Orchard,qt1/Orchard,jimasp/Orchard,brownjordaninternational/OrchardCMS,planetClaire/Orchard-LETS,caoxk/orchard,sfmskywalker/Orchard,jerryshi2007/Orchard,bedegaming-aleksej/Orchard,MetSystem/Orchard,huoxudong125/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,armanforghani/Orchard,hannan-azam/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,andyshao/Orchard,Lombiq/Orchard,OrchardCMS/Orchard-Harvest-Website,omidnasri/Orchard,SzymonSel/Orchard,Dolphinsimon/Orchard,mvarblow/Orchard,aaronamm/Orchard,hbulzy/Orchard,vairam-svs/Orchard,Serlead/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,neTp9c/Orchard,AEdmunds/beautiful-springtime,luchaoshuai/Orchard,omidnasri/Orchard,OrchardCMS/Orchard,huoxudong125/Orchard,angelapper/Orchard,SzymonSel/Orchard,Inner89/Orchard,JRKelso/Orchard,AdvantageCS/Orchard,kgacova/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,ericschultz/outercurve-orchard,vard0/orchard.tan,smartnet-developers/Orchard,Serlead/Orchard,geertdoornbos/Orchard,grapto/Orchard.CloudBust,angelapper/Orchard,qt1/orchard4ibn,luchaoshuai/Orchard,tobydodds/folklife,emretiryaki/Orchard,dcinzona/Orchard,asabbott/chicagodevnet-website,sfmskywalker/Orchard,xiaobudian/Orchard,austinsc/Orchard,JRKelso/Orchard,hannan-azam/Orchard,oxwanawxo/Orchard,jagraz/Orchard,andyshao/Orchard,xiaobudian/Orchard,SeyDutch/Airbrush,qt1/orchard4ibn,infofromca/Orchard,phillipsj/Orchard,SzymonSel/Orchard,harmony7/Orchard,OrchardCMS/Orchard,DonnotRain/Orchard,openbizgit/Orchard,fassetar/Orchard,NIKASoftwareDevs/Orchard,johnnyqian/Orchard,hbulzy/Orchard,Codinlab/Orchard,huoxudong125/Orchard,stormleoxia/Orchard,jchenga/Orchard,bedegaming-aleksej/Orchard,fassetar/Orchard,TaiAivaras/Orchard,KeithRaven/Orchard,DonnotRain/Orchard,Lombiq/Orchard,escofieldnaxos/Orchard,dozoft/Orchard,dcinzona/Orchard-Harvest-Website,sfmskywalker/Orchard,TalaveraTechnologySolutions/Orchard,vairam-svs/Orchard,li0803/Orchard,Anton-Am/Orchard,mgrowan/Orchard,grapto/Orchard.CloudBust,openbizgit/Orchard,rtpHarry/Orchard,bigfont/orchard-continuous-integration-demo,MpDzik/Orchard,geertdoornbos/Orchard,RoyalVeterinaryCollege/Orchard,KeithRaven/Orchard,ehe888/Orchard,vard0/orchard.tan,yersans/Orchard,hhland/Orchard,aaronamm/Orchard,jchenga/Orchard,OrchardCMS/Orchard-Harvest-Website,TalaveraTechnologySolutions/Orchard,harmony7/Orchard,hbulzy/Orchard,NIKASoftwareDevs/Orchard,patricmutwiri/Orchard,Anton-Am/Orchard,jaraco/orchard,li0803/Orchard,emretiryaki/Orchard,hbulzy/Orchard,vard0/orchard.tan,enspiral-dev-academy/Orchard,brownjordaninternational/OrchardCMS,ehe888/Orchard,Dolphinsimon/Orchard,li0803/Orchard,gcsuk/Orchard,huoxudong125/Orchard,jaraco/orchard,Codinlab/Orchard,cooclsee/Orchard,TalaveraTechnologySolutions/Orchard,aaronamm/Orchard,SeyDutch/Airbrush,NIKASoftwareDevs/Orchard,TaiAivaras/Orchard,Ermesx/Orchard,Anton-Am/Orchard,Sylapse/Orchard.HttpAuthSample,sebastienros/msc,MetSystem/Orchard,huoxudong125/Orchard,MetSystem/Orchard,stormleoxia/Orchard,TaiAivaras/Orchard,brownjordaninternational/OrchardCMS,oxwanawxo/Orchard,ericschultz/outercurve-orchard,Codinlab/Orchard,ehe888/Orchard,omidnasri/Orchard,phillipsj/Orchard,OrchardCMS/Orchard,dburriss/Orchard,jagraz/Orchard,ericschultz/outercurve-orchard,Anton-Am/Orchard,sebastienros/msc,spraiin/Orchard,MpDzik/Orchard,SeyDutch/Airbrush,Cphusion/Orchard,abhishekluv/Orchard,Dolphinsimon/Orchard,xiaobudian/Orchard,SzymonSel/Orchard,abhishekluv/Orchard,qt1/orchard4ibn,SeyDutch/Airbrush,qt1/Orchard,yersans/Orchard,jimasp/Orchard,mvarblow/Orchard,yersans/Orchard,Codinlab/Orchard,xkproject/Orchard,kgacova/Orchard,gcsuk/Orchard,grapto/Orchard.CloudBust,brownjordaninternational/OrchardCMS,AdvantageCS/Orchard,sfmskywalker/Orchard,jagraz/Orchard,cryogen/orchard,luchaoshuai/Orchard,abhishekluv/Orchard,jtkech/Orchard,KeithRaven/Orchard,RoyalVeterinaryCollege/Orchard,dozoft/Orchard,andyshao/Orchard,kouweizhong/Orchard,enspiral-dev-academy/Orchard,dcinzona/Orchard-Harvest-Website,bedegaming-aleksej/Orchard,TalaveraTechnologySolutions/Orchard,angelapper/Orchard,mgrowan/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,jimasp/Orchard,dburriss/Orchard,spraiin/Orchard,SouleDesigns/SouleDesigns.Orchard,AndreVolksdorf/Orchard,sfmskywalker/Orchard,ehe888/Orchard,Sylapse/Orchard.HttpAuthSample,stormleoxia/Orchard,angelapper/Orchard,Inner89/Orchard,dburriss/Orchard,xkproject/Orchard,planetClaire/Orchard-LETS,vard0/orchard.tan,AEdmunds/beautiful-springtime,alejandroaldana/Orchard,fortunearterial/Orchard,TalaveraTechnologySolutions/Orchard,ehe888/Orchard,yonglehou/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,oxwanawxo/Orchard,bedegaming-aleksej/Orchard,jagraz/Orchard,Fogolan/OrchardForWork,cryogen/orchard,hannan-azam/Orchard,sebastienros/msc,harmony7/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,escofieldnaxos/Orchard,salarvand/orchard,jagraz/Orchard,abhishekluv/Orchard,omidnasri/Orchard,Serlead/Orchard,RoyalVeterinaryCollege/Orchard,infofromca/Orchard,IDeliverable/Orchard,cooclsee/Orchard,qt1/Orchard,jaraco/orchard,m2cms/Orchard,emretiryaki/Orchard,gcsuk/Orchard,xkproject/Orchard,MpDzik/Orchard,jchenga/Orchard,infofromca/Orchard,li0803/Orchard,yonglehou/Orchard,omidnasri/Orchard,JRKelso/Orchard,LaserSrl/Orchard,dcinzona/Orchard-Harvest-Website,jersiovic/Orchard,m2cms/Orchard,qt1/Orchard,johnnyqian/Orchard,sfmskywalker/Orchard,arminkarimi/Orchard,armanforghani/Orchard,sebastienros/msc,xiaobudian/Orchard,fortunearterial/Orchard,brownjordaninternational/OrchardCMS,qt1/orchard4ibn,dcinzona/Orchard-Harvest-Website,Cphusion/Orchard,jimasp/Orchard,openbizgit/Orchard,SzymonSel/Orchard,xkproject/Orchard,hbulzy/Orchard,TalaveraTechnologySolutions/Orchard,rtpHarry/Orchard,Ermesx/Orchard,mvarblow/Orchard,stormleoxia/Orchard,gcsuk/Orchard,hhland/Orchard,asabbott/chicagodevnet-website,tobydodds/folklife,sfmskywalker/Orchard,jersiovic/Orchard,kouweizhong/Orchard,SeyDutch/Airbrush,andyshao/Orchard,bigfont/orchard-cms-modules-and-themes,tobydodds/folklife,openbizgit/Orchard,sebastienros/msc,OrchardCMS/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,Fogolan/OrchardForWork,Fogolan/OrchardForWork,mvarblow/Orchard,grapto/Orchard.CloudBust,Codinlab/Orchard,dcinzona/Orchard-Harvest-Website,tobydodds/folklife,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes,armanforghani/Orchard,abhishekluv/Orchard,caoxk/orchard,Morgma/valleyviewknolls,Dolphinsimon/Orchard,planetClaire/Orchard-LETS,LaserSrl/Orchard,marcoaoteixeira/Orchard,qt1/orchard4ibn,m2cms/Orchard,Fogolan/OrchardForWork,armanforghani/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,spraiin/Orchard,kgacova/Orchard,bedegaming-aleksej/Orchard,Lombiq/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,spraiin/Orchard,Ermesx/Orchard,m2cms/Orchard,Lombiq/Orchard,fassetar/Orchard,austinsc/Orchard,AndreVolksdorf/Orchard,Praggie/Orchard,andyshao/Orchard,luchaoshuai/Orchard,mgrowan/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,jaraco/orchard,salarvand/Portal,asabbott/chicagodevnet-website,caoxk/orchard,marcoaoteixeira/Orchard,LaserSrl/Orchard,mvarblow/Orchard,cryogen/orchard,patricmutwiri/Orchard,johnnyqian/Orchard,caoxk/orchard,Sylapse/Orchard.HttpAuthSample,fortunearterial/Orchard,marcoaoteixeira/Orchard,oxwanawxo/Orchard,bigfont/orchard-continuous-integration-demo,jtkech/Orchard,yonglehou/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,Serlead/Orchard,SouleDesigns/SouleDesigns.Orchard,alejandroaldana/Orchard,Anton-Am/Orchard,neTp9c/Orchard,bigfont/orchard-cms-modules-and-themes,Ermesx/Orchard,dcinzona/Orchard-Harvest-Website,spraiin/Orchard,neTp9c/Orchard,SouleDesigns/SouleDesigns.Orchard,dcinzona/Orchard,cooclsee/Orchard,fassetar/Orchard,jersiovic/Orchard,escofieldnaxos/Orchard,harmony7/Orchard,jtkech/Orchard,IDeliverable/Orchard,omidnasri/Orchard,hhland/Orchard,hannan-azam/Orchard,omidnasri/Orchard,emretiryaki/Orchard,marcoaoteixeira/Orchard,Fogolan/OrchardForWork,yonglehou/Orchard,smartnet-developers/Orchard,TalaveraTechnologySolutions/Orchard,rtpHarry/Orchard,johnnyqian/Orchard,SouleDesigns/SouleDesigns.Orchard,vairam-svs/Orchard,rtpHarry/Orchard,planetClaire/Orchard-LETS,salarvand/Portal,gcsuk/Orchard,Lombiq/Orchard,IDeliverable/Orchard,AndreVolksdorf/Orchard,enspiral-dev-academy/Orchard,arminkarimi/Orchard,DonnotRain/Orchard,MetSystem/Orchard,jtkech/Orchard,phillipsj/Orchard,JRKelso/Orchard,jerryshi2007/Orchard,hhland/Orchard,dcinzona/Orchard,AndreVolksdorf/Orchard,TalaveraTechnologySolutions/Orchard,qt1/orchard4ibn,MpDzik/Orchard,IDeliverable/Orchard,geertdoornbos/Orchard,cooclsee/Orchard,li0803/Orchard,neTp9c/Orchard,escofieldnaxos/Orchard,harmony7/Orchard,salarvand/orchard,MpDzik/Orchard,AdvantageCS/Orchard,salarvand/orchard,LaserSrl/Orchard,smartnet-developers/Orchard,kouweizhong/Orchard,AndreVolksdorf/Orchard,NIKASoftwareDevs/Orchard,hhland/Orchard,arminkarimi/Orchard,jtkech/Orchard,alejandroaldana/Orchard,AdvantageCS/Orchard,KeithRaven/Orchard,sfmskywalker/Orchard,cooclsee/Orchard,AEdmunds/beautiful-springtime,alejandroaldana/Orchard,RoyalVeterinaryCollege/Orchard,dburriss/Orchard,neTp9c/Orchard,fortunearterial/Orchard,OrchardCMS/Orchard,infofromca/Orchard,escofieldnaxos/Orchard,salarvand/orchard,cryogen/orchard,salarvand/Portal,Sylapse/Orchard.HttpAuthSample,jchenga/Orchard,Praggie/Orchard,dburriss/Orchard,geertdoornbos/Orchard,tobydodds/folklife,johnnyqian/Orchard,TaiAivaras/Orchard,dcinzona/Orchard,AEdmunds/beautiful-springtime,dozoft/Orchard,armanforghani/Orchard,luchaoshuai/Orchard,vard0/orchard.tan,Inner89/Orchard,hannan-azam/Orchard,xkproject/Orchard,oxwanawxo/Orchard,mgrowan/Orchard,phillipsj/Orchard,austinsc/Orchard,MetSystem/Orchard,salarvand/Portal,aaronamm/Orchard,angelapper/Orchard,abhishekluv/Orchard,xiaobudian/Orchard,asabbott/chicagodevnet-website,smartnet-developers/Orchard,infofromca/Orchard,dozoft/Orchard,patricmutwiri/Orchard,OrchardCMS/Orchard-Harvest-Website,AdvantageCS/Orchard,phillipsj/Orchard,OrchardCMS/Orchard-Harvest-Website,enspiral-dev-academy/Orchard,arminkarimi/Orchard,jimasp/Orchard,jersiovic/Orchard,planetClaire/Orchard-LETS,Morgma/valleyviewknolls,DonnotRain/Orchard,omidnasri/Orchard,kgacova/Orchard,tobydodds/folklife,SouleDesigns/SouleDesigns.Orchard,Ermesx/Orchard,omidnasri/Orchard,grapto/Orchard.CloudBust,marcoaoteixeira/Orchard,dozoft/Orchard,Morgma/valleyviewknolls,MpDzik/Orchard,Morgma/valleyviewknolls,yersans/Orchard,ericschultz/outercurve-orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,kgacova/Orchard,OrchardCMS/Orchard-Harvest-Website,Dolphinsimon/Orchard,geertdoornbos/Orchard,openbizgit/Orchard,kouweizhong/Orchard,austinsc/Orchard,grapto/Orchard.CloudBust,Morgma/valleyviewknolls,yersans/Orchard,austinsc/Orchard,jerryshi2007/Orchard,kouweizhong/Orchard,Cphusion/Orchard,fortunearterial/Orchard,bigfont/orchard-continuous-integration-demo,mgrowan/Orchard,Cphusion/Orchard,KeithRaven/Orchard,Serlead/Orchard,IDeliverable/Orchard,jchenga/Orchard,m2cms/Orchard,Inner89/Orchard,bigfont/orchard-continuous-integration-demo,TaiAivaras/Orchard | src/Orchard.Web/Core/Common/Views/Parts.Common.Metadata.SummaryAdmin.cshtml | src/Orchard.Web/Core/Common/Views/Parts.Common.Metadata.SummaryAdmin.cshtml | @using Orchard.ContentManagement;
@using Orchard.Core.Common.Models;
@using Orchard.Security;
@{
CommonPart commonPart = Model.ContentPart;
DateTime? modifiedUtc = commonPart.As<CommonPart>() == null ? null : commonPart.As<CommonPart>().ModifiedUtc;
// owner isn't really who last modified this, is it?
IUser owner = commonPart.As<CommonPart>() == null ? null : commonPart.As<CommonPart>().Owner;
}
<ul class="pageStatus">
<li>@if (modifiedUtc.HasValue) {
@T("Last modified: {0}", Display.DateTimeRelative(dateTimeUtc: modifiedUtc.Value))} |
</li>
<li>@T("By {0}", owner == null ? "<null>" : owner.UserName)</li>
</ul> | @using Orchard.ContentManagement;
@using Orchard.Core.Common.Models;
@using Orchard.Security;
@{
CommonPart commonPart = Model.ContentPart;
DateTime? modifiedUtc = commonPart.As<CommonPart>() == null ? null : commonPart.As<CommonPart>().ModifiedUtc;
// owner isn't really who last modified this, is it?
IUser owner = commonPart.As<CommonPart>() == null ? null : commonPart.As<CommonPart>().Owner;
}
<ul class="pageStatus">
<li>@if (modifiedUtc.HasValue) {
@T("Last modified: {0}", Display.DateTimeRelative(dateTimeUtc: modifiedUtc.Value))} |
</li>
<li>@T("By {0}", owner.UserName)</li>
</ul> | bsd-3-clause | C# |
0f235f780decc6ae64945f3d6d7a60e13a7d8a33 | Fix typo that don't compile. | pleonex/NitroDebugger,pleonex/NitroDebugger,pleonex/NitroDebugger | NitroDebugger/RSP/Packets/ReadRegisters.cs | NitroDebugger/RSP/Packets/ReadRegisters.cs | //
// ReadRegisters.cs
//
// Author:
// Benito Palacios Sánchez <benito356@gmail.com>
//
// Copyright (c) 2015 Benito Palacios Sánchez
//
// This program 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.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU 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;
namespace NitroDebugger.RSP.Packets
{
public class ReadRegisters : CommandPacket
{
public ReadRegisters()
: base("g")
{
}
protected override string PackArguments()
{
return "";
}
}
}
| //
// ReadRegisters.cs
//
// Author:
// Benito Palacios Sánchez <benito356@gmail.com>
//
// Copyright (c) 2015 Benito Palacios Sánchez
//
// This program 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.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU 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;
namespace NitroDebugger.RSP.Packets
{
public class ReadRegisters : CommandPacket
{
public ReadRegisters()
: base('g')
{
}
protected override string PackArguments()
{
return "";
}
}
}
| mit | C# |
829903157de9976ddeeb8fa2209d51d91959cf53 | Revert "Change levy run date to 24th" | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EmployerFinance.Jobs/ScheduledJobs/ImportLevyDeclarationsJob.cs | src/SFA.DAS.EmployerFinance.Jobs/ScheduledJobs/ImportLevyDeclarationsJob.cs | using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using NServiceBus;
using SFA.DAS.EmployerFinance.Messages.Commands;
namespace SFA.DAS.EmployerFinance.Jobs.ScheduledJobs
{
public class ImportLevyDeclarationsJob
{
private readonly IMessageSession _messageSession;
public ImportLevyDeclarationsJob(IMessageSession messageSession)
{
_messageSession = messageSession;
}
public Task Run([TimerTrigger("0 0 15 20 * *")] TimerInfo timer, ILogger logger)
{
return _messageSession.Send(new ImportLevyDeclarationsCommand());
}
}
} | using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using NServiceBus;
using SFA.DAS.EmployerFinance.Messages.Commands;
namespace SFA.DAS.EmployerFinance.Jobs.ScheduledJobs
{
public class ImportLevyDeclarationsJob
{
private readonly IMessageSession _messageSession;
public ImportLevyDeclarationsJob(IMessageSession messageSession)
{
_messageSession = messageSession;
}
public Task Run([TimerTrigger("0 0 10 24 * *")] TimerInfo timer, ILogger logger)
{
return _messageSession.Send(new ImportLevyDeclarationsCommand());
}
}
} | mit | C# |
64f995292226d27116651b9f59fb9fee5312d52e | fix version | Fody/Virtuosity | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("Virtuosity")]
[assembly: AssemblyProduct("Virtuosity")]
[assembly: AssemblyVersion("1.20.0")]
[assembly: AssemblyFileVersion("1.20.0")]
| using System.Reflection;
[assembly: AssemblyTitle("Virtuosity")]
[assembly: AssemblyProduct("Virtuosity")]
[assembly: AssemblyVersion("1.19.12")]
[assembly: AssemblyFileVersion("1.19.12")]
| mit | C# |
2b494c8613d154077c05daa009ebd03cedd46cb6 | remove RegisterArea in QueryClient | MehdyKarimpour/extensions,AlejandroCano/extensions,signumsoftware/extensions,signumsoftware/extensions,signumsoftware/framework,signumsoftware/framework,AlejandroCano/extensions,MehdyKarimpour/extensions | Signum.Web.Extensions/Basic/QueryClient.cs | Signum.Web.Extensions/Basic/QueryClient.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Signum.Entities;
using Signum.Services;
using System.Reflection;
using Signum.Utilities.Reflection;
using Signum.Utilities;
using Signum.Entities.Basics;
namespace Signum.Web.Basic
{
public static class QueryClient
{
public static string ViewPrefix = "~/basic/Views/{0}.cshtml";
public static void Start()
{
if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod()))
{
Navigator.AddSettings(new List<EntitySettings>
{
new EntitySettings<QueryEntity>
{
MappingMain = new EntityMapping<QueryEntity>(true).GetValue,
MappingLine = new EntityMapping<QueryEntity>(true).GetValue
}
});
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Signum.Entities;
using Signum.Services;
using System.Reflection;
using Signum.Utilities.Reflection;
using Signum.Utilities;
using Signum.Entities.Basics;
namespace Signum.Web.Basic
{
public static class QueryClient
{
public static string ViewPrefix = "~/basic/Views/{0}.cshtml";
public static void Start()
{
if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod()))
{
Navigator.RegisterArea(typeof(QueryClient));
Navigator.AddSettings(new List<EntitySettings>
{
new EntitySettings<QueryEntity>
{
MappingMain = new EntityMapping<QueryEntity>(true).GetValue,
MappingLine = new EntityMapping<QueryEntity>(true).GetValue
}
});
}
}
}
}
| mit | C# |
86fa229f48a8825102e241cea79cc21afd35595d | Update EntityHealth.cs | Sprakle/PaintTD | Assets/Scripts/EntityHealth.cs | Assets/Scripts/EntityHealth.cs | using UnityEngine;
using System.Collections;
public class EntityHealth : MonoBehaviour
{
[SerializeField]
int MaxHealth;
[SerializeField]
bool IsInvincible;
int health { get; set; }
// Use this for initialization
void Start()
{
health = MaxHealth;
}
void DamageEntity(int value)
{
if (!IsInvincible)
{
health -= value;
if (health <= 0)
KillEntity();
}
}
void KillEntity()
{
Destroy(gameObject);
}
}
| using UnityEngine;
using System.Collections;
public class EntityHealth : MonoBehaviour
{
[SerializeField]
int MaxHealth;
[SerializeField]
bool IsInvincible;
int health { get; set; }
// Use this for initialization
void Start()
{
health = MaxHealth;
}
void DamageEntity(int value)
{
if (!IsInvincible)
{
health -= value;
if (health <= 0)
KillEntity();
}
}
void KillEntity()
{
}
}
| mit | C# |
24a0e1e806ef655e1fafdd3649dcf83fcc67c317 | update datasource | tobyclh/UnityCNTK,tobyclh/UnityCNTK | Assets/UnityCNTK/DataSource.cs | Assets/UnityCNTK/DataSource.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace UnityCNTK
{
public class DataSource : MonoBehaviour
{
public Object source;
public enum PredefinedSource
{
none, pos, rot, quat, velocity, acceleration
}
private CNTKManager manager;
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DataSource : MonoBehaviour {
public UnityEngine.Object source;
public enum PredefinedSource
{
none, position, rotation, quaternion
}
/// <summary>
///
/// </summary>
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
| mit | C# |
687dff9543eefbe1dad20afc8d09edeae0f78ac1 | Update ApiControllerBase.cs | dlidstrom/Tasks,dlidstrom/Tasks,dlidstrom/Tasks | Tasks/Controllers/Api/ApiControllerBase.cs | Tasks/Controllers/Api/ApiControllerBase.cs | using System;
using System.Threading.Tasks;
using System.Web.Http;
using Tasks.Data.Commands;
using Tasks.Data.Models;
using Tasks.Data.Queries;
namespace Tasks.Controllers.Api
{
public abstract class ApiControllerBase : ApiController
{
public IDbContext Context { get; set; }
protected async Task<TResult> ExecuteQueryAsync<TResult>(IQuery<TResult> query)
{
return await query.ExecuteAsync(Context);
}
protected Task ExecuteCommand(ICommand command)
{
if (command == null) throw new ArgumentNullException("command");
return command.Execute(Context);
}
}
}
| using System;
using System.Threading.Tasks;
using System.Web.Http;
using Tasks.Data.Commands;
using Tasks.Data.Models;
using Tasks.Data.Queries;
namespace Tasks.Controllers.Api
{
public abstract class ApiControllerBase : ApiController
{
public IDbContext Context { get; set; }
protected async Task<TResult> ExecuteQueryAsync<TResult>(IQuery<TResult> query)
{
return await query.ExecuteAsync(Context);
}
protected async void ExecuteCommand(ICommand command)
{
if (command == null) throw new ArgumentNullException("command");
await command.Execute(Context);
}
}
} | mit | C# |
614636bd7c767348b294184b36cd094e9373e17f | fix build server compatibility with assemblyinfo | ParagonTruss/GeometryClassLibrary | GeometryClassLibrary/Properties/AssemblyInfo.cs | GeometryClassLibrary/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("GeometryClassLibrary")]
[assembly: AssemblyDescription("GeometryClassLibrary")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Clearspan Components")]
[assembly: AssemblyProduct("GeometryClassLibrary")]
[assembly: AssemblyCopyright("2015 Clearspan")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
//[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
//[assembly: Guid("166ff822-d022-49f2-8d04-a68f1254f5b5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.2.*")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
| 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("GeometryClassLibrary")]
[assembly: AssemblyDescription("GeometryClassLibrary")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Clearspan Components")]
[assembly: AssemblyProduct("GeometryClassLibrary")]
[assembly: AssemblyCopyright("2015 Clearspan")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("166ff822-d022-49f2-8d04-a68f1254f5b5")]
// 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")]
[assembly: AssemblyVersionAttribute("1.2.0.0")]
[assembly: AssemblyFileVersionAttribute("1.2.0.0")]
| lgpl-2.1 | C# |
9a562617b09245180cd0e7c31075af6bcbf2e617 | Add OpenAPI definition endpoint | openchargemap/ocm-system,openchargemap/ocm-system,openchargemap/ocm-system,openchargemap/ocm-system | API/OCM.Net/OCM.API.Web/Controllers/MiscEndpointController.cs | API/OCM.Net/OCM.API.Web/Controllers/MiscEndpointController.cs | using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace OCM.API.Web.Standard.Controllers
{
[ApiController]
public class MiscEndpointController : ControllerBase
{
private readonly ILogger _logger;
public MiscEndpointController(ILogger<MiscEndpointController> logger)
{
_logger = logger;
}
[HttpGet]
[Route("/map")]
public IActionResult Get()
{
return Redirect("https://map.openchargemap.io");
}
[HttpGet]
[Route("/v3/openapi")]
public IActionResult GetOpenAPIDefinition()
{
return Redirect("https://raw.githubusercontent.com/openchargemap/ocm-docs/master/Model/schema/ocm-api-schema.yaml");
}
}
}
| using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace OCM.API.Web.Standard.Controllers
{
[ApiController]
public class MiscEndpointController : ControllerBase
{
private readonly ILogger _logger;
public MiscEndpointController(ILogger<MiscEndpointController> logger)
{
_logger = logger;
}
[HttpGet]
[Route("/map")]
public IActionResult Get()
{
return Redirect("https://map.openchargemap.io");
}
}
}
| mit | C# |
31f2a3f80f46f9a8bb5c4186532556355c14b5da | Disable warning | viciousviper/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,dokan-dev/dokan-dotnet,magol/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,dokan-dev/dokan-dotnet,dokan-dev/dokan-dotnet,magol/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,viciousviper/dokan-dotnet,magol/dokan-dotnet,viciousviper/dokan-dotnet | DokanNet/FileSystemFeatures.cs | DokanNet/FileSystemFeatures.cs | using System;
namespace DokanNet
{
[Flags]
#pragma warning disable 3009
public enum FileSystemFeatures : uint
#pragma warning restore 3009
{
None = 0,
CaseSensitiveSearch = 1,
CasePreservedNames = 2,
UnicodeOnDisk = 4,
PersistentAcls = 8,
SupportsRemoteStorage = 256,
VolumeQuotas = 32,
SupportsSparseFiles = 64,
SupportsReparsePoints = 128,
VolumeIsCompressed = 32768,
SupportsObjectIDs = 65536,
SupportsEncryption = 131072,
NamedStreams = 262144,
ReadOnlyVolume = 524288,
SequentialWriteOnce = 1048576,
SupportsTransactions = 2097152,
}
} | using System;
namespace DokanNet
{
[Flags]
public enum FileSystemFeatures : uint
{
None = 0,
CaseSensitiveSearch = 1,
CasePreservedNames = 2,
UnicodeOnDisk = 4,
PersistentAcls = 8,
SupportsRemoteStorage = 256,
VolumeQuotas = 32,
SupportsSparseFiles = 64,
SupportsReparsePoints = 128,
VolumeIsCompressed = 32768,
SupportsObjectIDs = 65536,
SupportsEncryption = 131072,
NamedStreams = 262144,
ReadOnlyVolume = 524288,
SequentialWriteOnce = 1048576,
SupportsTransactions = 2097152,
}
} | mit | C# |
7f82999a3827fa01a6e18f92545d89dfb4f32c6d | Set send/receive buffer sizes to zero. | YuvalItzchakov/aerospike-client-csharp | AerospikeClient/Async/AsyncConnection.cs | AerospikeClient/Async/AsyncConnection.cs | /*
* Aerospike Client - C# Library
*
* Copyright 2013 by Aerospike, Inc. All rights reserved.
*
* Availability of this source code to partners and customers includes
* redistribution rights covered by individual contract. Please check your
* contract for exact rights and responsibilities.
*/
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace Aerospike.Client
{
/// <summary>
/// Asynchronous socket channel connection wrapper.
/// </summary>
public sealed class AsyncConnection
{
private readonly Socket socket;
private readonly SocketAsyncEventArgs args;
private readonly double maxSocketIdleMillis;
private DateTime timestamp;
public AsyncConnection(IPEndPoint address, AsyncCluster cluster, AsyncCommand command, EventHandler<SocketAsyncEventArgs> handler)
{
this.maxSocketIdleMillis = (double)(cluster.maxSocketIdle * 1000);
try
{
socket = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
socket.NoDelay = true;
// Docs say Blocking flag is ignored for async operations.
// socket.Blocking = false;
// Avoid internal TCP send/receive buffers.
// Use application buffers directly.
socket.SendBufferSize = 0;
socket.ReceiveBufferSize = 0;
args = new SocketAsyncEventArgs();
args.Completed += handler;
args.RemoteEndPoint = address;
args.UserToken = command;
timestamp = DateTime.UtcNow;
}
catch (Exception e)
{
throw new AerospikeException.Connection(e);
}
}
public SocketAsyncEventArgs SetCommand(AsyncCommand command)
{
args.UserToken = command;
return args;
}
public bool ConnectAsync()
{
return socket.ConnectAsync(args);
}
public bool SendAsync(SocketAsyncEventArgs args)
{
return socket.SendAsync(args);
}
public bool ReceiveAsync(SocketAsyncEventArgs args)
{
return socket.ReceiveAsync(args);
}
public bool IsConnected()
{
return socket.Connected;
}
/// <summary>
/// Is socket connected and used within specified limits.
/// </summary>
public bool IsValid()
{
return socket.Connected && (DateTime.UtcNow.Subtract(timestamp).TotalMilliseconds <= maxSocketIdleMillis);
}
public void UpdateLastUsed()
{
this.timestamp = DateTime.UtcNow;
}
public SocketAsyncEventArgs Args
{
get { return args; }
}
/// <summary>
/// Shutdown and close socket.
/// </summary>
public void Close()
{
try
{
socket.Shutdown(SocketShutdown.Both);
}
catch (Exception)
{
}
socket.Close();
args.Dispose();
}
}
} | /*
* Aerospike Client - C# Library
*
* Copyright 2013 by Aerospike, Inc. All rights reserved.
*
* Availability of this source code to partners and customers includes
* redistribution rights covered by individual contract. Please check your
* contract for exact rights and responsibilities.
*/
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace Aerospike.Client
{
/// <summary>
/// Asynchronous socket channel connection wrapper.
/// </summary>
public sealed class AsyncConnection
{
private readonly Socket socket;
private readonly SocketAsyncEventArgs args;
private readonly double maxSocketIdleMillis;
private DateTime timestamp;
public AsyncConnection(IPEndPoint address, AsyncCluster cluster, AsyncCommand command, EventHandler<SocketAsyncEventArgs> handler)
{
this.maxSocketIdleMillis = (double)(cluster.maxSocketIdle * 1000);
try
{
socket = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
socket.NoDelay = true;
socket.Blocking = false;
args = new SocketAsyncEventArgs();
args.Completed += handler;
args.RemoteEndPoint = address;
args.UserToken = command;
timestamp = DateTime.UtcNow;
}
catch (Exception e)
{
throw new AerospikeException.Connection(e);
}
}
public SocketAsyncEventArgs SetCommand(AsyncCommand command)
{
args.UserToken = command;
return args;
}
public bool ConnectAsync()
{
return socket.ConnectAsync(args);
}
public bool SendAsync(SocketAsyncEventArgs args)
{
return socket.SendAsync(args);
}
public bool ReceiveAsync(SocketAsyncEventArgs args)
{
return socket.ReceiveAsync(args);
}
public bool IsConnected()
{
return socket.Connected;
}
/// <summary>
/// Is socket connected and used within specified limits.
/// </summary>
public bool IsValid()
{
return socket.Connected && (DateTime.UtcNow.Subtract(timestamp).TotalMilliseconds <= maxSocketIdleMillis);
}
public void UpdateLastUsed()
{
this.timestamp = DateTime.UtcNow;
}
public SocketAsyncEventArgs Args
{
get { return args; }
}
/// <summary>
/// Shutdown and close socket.
/// </summary>
public void Close()
{
try
{
socket.Shutdown(SocketShutdown.Both);
}
catch (Exception)
{
}
socket.Close();
args.Dispose();
}
}
} | apache-2.0 | C# |
02bafe2fb5c7a5e8e530f4fe49ea081082820ba0 | Add notes editing only when over auxiliary line | setchi/NoteEditor,setchi/NotesEditor | Assets/Scripts/NotesEditor/NoteObject.cs | Assets/Scripts/NotesEditor/NoteObject.cs | using UnityEngine;
public class NoteObject : MonoBehaviour
{
public NotePosition notePosition;
public int noteType;
NotesEditorModel model;
RectTransform rectTransform;
void Awake()
{
model = NotesEditorModel.Instance;
rectTransform = GetComponent<RectTransform>();
rectTransform.localPosition = CalcPosition(notePosition);
}
void LateUpdate()
{
rectTransform.localPosition = CalcPosition(notePosition);
}
Vector3 CalcPosition(NotePosition notePosition)
{
return new Vector3(
model.SamplesToScreenPositionX(notePosition.samples),
model.BlockNumToScreenPositionY(notePosition.blockNum) * model.CanvasScaleFactor.Value,
0);
}
public void OnMouseEnter()
{
model.IsMouseOverCanvas.Value = true;
}
public void OnMouseDown()
{
if (model.ClosestNotePosition.Value.Equals(notePosition))
{
model.NormalNoteObservable.OnNext(notePosition);
}
}
}
| using UnityEngine;
public class NoteObject : MonoBehaviour
{
public NotePosition notePosition;
public int noteType;
NotesEditorModel model;
RectTransform rectTransform;
void Awake()
{
model = NotesEditorModel.Instance;
rectTransform = GetComponent<RectTransform>();
rectTransform.localPosition = CalcPosition(notePosition);
}
void LateUpdate()
{
rectTransform.localPosition = CalcPosition(notePosition);
}
Vector3 CalcPosition(NotePosition notePosition)
{
return new Vector3(
model.SamplesToScreenPositionX(notePosition.samples),
model.BlockNumToScreenPositionY(notePosition.blockNum) * model.CanvasScaleFactor.Value,
0);
}
public void OnMouseEnter()
{
model.IsMouseOverCanvas.Value = true;
}
public void OnMouseDown()
{
model.NormalNoteObservable.OnNext(notePosition);
}
}
| mit | C# |
c14cd501e8a35e002282c5010b0ad04588f55cf2 | Add a ToString() to CodeDefinitionWindowLocation | jasonmalinowski/roslyn,mavasani/roslyn,sharwell/roslyn,weltkante/roslyn,diryboy/roslyn,dotnet/roslyn,KevinRansom/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,diryboy/roslyn,mavasani/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,weltkante/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,sharwell/roslyn,KevinRansom/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn | src/EditorFeatures/Core/CodeDefinitionWindowLocation.cs | src/EditorFeatures/Core/CodeDefinitionWindowLocation.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Editor
{
internal struct CodeDefinitionWindowLocation
{
public string DisplayName { get; }
public string FilePath { get; }
public int Line { get; }
public int Character { get; }
public CodeDefinitionWindowLocation(string displayName, string filePath, int line, int character)
{
DisplayName = displayName;
FilePath = filePath;
Line = line;
Character = character;
}
public CodeDefinitionWindowLocation(string displayName, string filePath, LinePositionSpan position)
: this (displayName, filePath, position.Start.Line, position.Start.Character)
{
}
public CodeDefinitionWindowLocation(string displayName, FileLinePositionSpan position)
: this (displayName, position.Path, position.Span)
{
}
public override string ToString()
{
return base.ToString() + $" - (DisplayName: '{DisplayName}', FilePath: '{FilePath}', Line: '{Line}', '{Character}')";
}
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Editor
{
internal struct CodeDefinitionWindowLocation
{
public string DisplayName { get; }
public string FilePath { get; }
public int Line { get; }
public int Character { get; }
public CodeDefinitionWindowLocation(string displayName, string filePath, int line, int character)
{
DisplayName = displayName;
FilePath = filePath;
Line = line;
Character = character;
}
public CodeDefinitionWindowLocation(string displayName, string filePath, LinePositionSpan position)
: this (displayName, filePath, position.Start.Line, position.Start.Character)
{
}
public CodeDefinitionWindowLocation(string displayName, FileLinePositionSpan position)
: this (displayName, position.Path, position.Span)
{
}
}
}
| mit | C# |
cfe944c01047f7628eab0b104be7414a9243cbde | Correct the return type of the extension method GetService for the IServiceProvider. | edwardmeng/FluentMethods | src/Core/System.IServiceProvider/GetService.cs | src/Core/System.IServiceProvider/GetService.cs | using System;
public static partial class Extensions
{
/// <summary>
/// Gets the service object of the specified type.
/// </summary>
/// <typeparam name="T">The type of service object to get. </typeparam>
/// <param name="provider">The <see cref="IServiceProvider"/> to get service.</param>
/// <returns>A service object of type <typeparamref name="T"/>.-or- null if there is no service object of type <typeparamref name="T"/>.</returns>
public static T GetService<T>(this IServiceProvider provider) where T : class
{
return (T)provider.GetService(typeof(T));
}
} | using System;
public static partial class Extensions
{
/// <summary>
/// Gets the service object of the specified type.
/// </summary>
/// <typeparam name="T">The type of service object to get. </typeparam>
/// <param name="provider">The <see cref="IServiceProvider"/> to get service.</param>
/// <returns>A service object of type <typeparamref name="T"/>.-or- null if there is no service object of type <typeparamref name="T"/>.</returns>
public static object GetService<T>(this IServiceProvider provider) where T : class
{
return (T)provider.GetService(typeof(T));
}
} | mit | C# |
b78892d8abf03238201ffee02d9833727509c5e4 | Add a default value for the VS Designer | Yuisbean/WebMConverter,nixxquality/WebMConverter,o11c/WebMConverter | Components/PreviewFrame.cs | Components/PreviewFrame.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace WebMConverter
{
public partial class PreviewFrame : UserControl
{
private uint frame;
[DefaultValue(0)]
public int Frame
{
get { return (int)frame; }
set { frame = (uint)value; GeneratePreview(); }
}
public PreviewFrame()
{
InitializeComponent();
}
public void GeneratePreview()
{
if (Program.VideoSource == null)
return;
// Prepare our "list" of accepted pixel formats
List<int> pixelformat = new List<int>();
pixelformat.Add(FFMSSharp.FFMS2.GetPixelFormat("bgra"));
// Calculate width and height
int w, h;
float s;
FFMSSharp.Frame frame;
frame = Program.VideoSource.GetFrame((int)this.frame);
s = Math.Min((float)this.Size.Width / (float)frame.EncodedResolution.Width, (float)this.Size.Height / (float)frame.EncodedResolution.Height);
w = (int)(frame.EncodedResolution.Width * s);
h = (int)(frame.EncodedResolution.Height * s);
// Do all the work
Program.VideoSource.SetOutputFormat(pixelformat, w, h, FFMSSharp.Resizer.Bilinear);
frame = Program.VideoSource.GetFrame((int)this.frame);
Picture.BackgroundImage = frame.Bitmap;
Picture.ClientSize = new Size(w, h);
// Center the pictureBox in our control
if (w == Width || w - 1 == Width || w + 1 == Width) // this looks weird but keep in mind we're dealing with an ex float here
{
Padding = new Padding(0, (Height - h) / 2, 0, 0);
}
else
{
Padding = new Padding((Width - w) / 2, 0, 0, 0);
}
}
private void pictureBoxFrame_SizeChanged(object sender, EventArgs e)
{
GeneratePreview();
}
}
}
| using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace WebMConverter
{
public partial class PreviewFrame : UserControl
{
private uint frame;
public int Frame
{
get { return (int)frame; }
set { frame = (uint)value; GeneratePreview(); }
}
public PreviewFrame()
{
InitializeComponent();
}
public void GeneratePreview()
{
if (Program.VideoSource == null)
return;
// Prepare our "list" of accepted pixel formats
List<int> pixelformat = new List<int>();
pixelformat.Add(FFMSSharp.FFMS2.GetPixelFormat("bgra"));
// Calculate width and height
int w, h;
float s;
FFMSSharp.Frame frame;
frame = Program.VideoSource.GetFrame((int)this.frame);
s = Math.Min((float)this.Size.Width / (float)frame.EncodedResolution.Width, (float)this.Size.Height / (float)frame.EncodedResolution.Height);
w = (int)(frame.EncodedResolution.Width * s);
h = (int)(frame.EncodedResolution.Height * s);
// Do all the work
Program.VideoSource.SetOutputFormat(pixelformat, w, h, FFMSSharp.Resizer.Bilinear);
frame = Program.VideoSource.GetFrame((int)this.frame);
Picture.BackgroundImage = frame.Bitmap;
Picture.ClientSize = new Size(w, h);
// Center the pictureBox in our control
if (w == Width || w - 1 == Width || w + 1 == Width) // this looks weird but keep in mind we're dealing with an ex float here
{
Padding = new Padding(0, (Height - h) / 2, 0, 0);
}
else
{
Padding = new Padding((Width - w) / 2, 0, 0, 0);
}
}
private void pictureBoxFrame_SizeChanged(object sender, EventArgs e)
{
GeneratePreview();
}
}
}
| mit | C# |
967a9c9e444a5cb881262881d5495aea9b224472 | Update version to 1.0.2 | GAnatoliy/ViewModelLoader | ViewModelLoader/Properties/AssemblyInfo.cs | ViewModelLoader/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("ViewModelLoader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ViewModelLoader")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("26173ffd-2a06-4dee-941d-fd3164cf4054")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2")]
[assembly: AssemblyFileVersion("1.0.2")]
| 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("ViewModelLoader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ViewModelLoader")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("26173ffd-2a06-4dee-941d-fd3164cf4054")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1")]
| mit | C# |
64549273177264ecbabc5c4926acab6c8634d465 | Make IFatalErrorHandler public so that it can be replaced by users (#6170) | ibondy/orleans,jthelin/orleans,yevhen/orleans,amccool/orleans,hoopsomuah/orleans,ibondy/orleans,galvesribeiro/orleans,waynemunro/orleans,hoopsomuah/orleans,jason-bragg/orleans,ElanHasson/orleans,amccool/orleans,ReubenBond/orleans,dotnet/orleans,veikkoeeva/orleans,benjaminpetit/orleans,amccool/orleans,yevhen/orleans,waynemunro/orleans,ElanHasson/orleans,dotnet/orleans,galvesribeiro/orleans | src/Orleans.Runtime/Core/IFatalErrorHandler.cs | src/Orleans.Runtime/Core/IFatalErrorHandler.cs | using System;
namespace Orleans.Runtime
{
public interface IFatalErrorHandler
{
bool IsUnexpected(Exception exception);
void OnFatalException(object sender = null, string context = null, Exception exception = null);
}
}
| using System;
namespace Orleans.Runtime
{
internal interface IFatalErrorHandler
{
bool IsUnexpected(Exception exception);
void OnFatalException(object sender = null, string context = null, Exception exception = null);
}
}
| mit | C# |
4570401cd3e3129e3bec13b4ce8a3bf7b96e1027 | Refactor user expirience | mikemajesty/coolvalidator | CoolValidator/Validator.cs | CoolValidator/Validator.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
namespace CoolValidator
{
public static class formValidator
{
public static List<TextBox> GetTextBoxInComponent(this Form form, Func<TextBox, bool> predicate = null)
{
var txtList = new List<TextBox>();
var txtInPanel = GetTextBoxInGroupBox(form);
var txtInManyPanel = GetInHierarchicalPanel(form);
var txtInGroupBox = GetTextBoxInGroupBox(form);
var txtInManyGroupBox = GetInHierarchicalGroupBox(form);
var txtInForm = GetTextBoxInForm(form);
txtList.AddRange(txtInPanel);
txtList.AddRange(txtInManyPanel);
txtList.AddRange(txtInForm);
return predicate == null ? txtList : txtList.Where(predicate).ToList();
}
private static List<TextBox> GetTextBoxInForm(Form form)
{
return form.Controls.OfType<TextBox>().Where(c => string.IsNullOrEmpty(c.Text.Trim())).ToList();
}
private static List<TextBox> GetInHierarchicalPanel(Form form)
{
return form.Controls.OfType<Panel>().SelectMany(panel => panel.Controls.OfType<Panel>()).SelectMany(textBox => textBox.Controls.OfType<TextBox>()).OrderBy(t => t.TabIndex).Where(c => string.IsNullOrEmpty(c.Text.Trim())).ToList();
}
private static List<TextBox> GetTextBoxInGroupBox(Form form)
{
return form.Controls.OfType<Panel>().SelectMany(panel => panel.Controls.OfType<TextBox>()).OrderBy(t => t.TabIndex).Where(c => string.IsNullOrEmpty(c.Text.Trim())).ToList();
}
private static List<TextBox> GetInHierarchicalGroupBox(Form form)
{
return form.Controls.OfType<GroupBox>().SelectMany(panel => panel.Controls.OfType<GroupBox>()).SelectMany(textBox => textBox.Controls.OfType<TextBox>()).OrderBy(t => t.TabIndex).Where(c => string.IsNullOrEmpty(c.Text.Trim())).ToList();
}
private static List<TextBox> dfdfd(Form form)
{
return form.Controls.OfType<GroupBox>().SelectMany(panel => panel.Controls.OfType<TextBox>()).OrderBy(t => t.TabIndex).Where(c => string.IsNullOrEmpty(c.Text.Trim())).ToList();
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
namespace CoolValidator
{
public static class formValidator
{
public static List<TextBox> GetTextBoxInComponent<T>(this Form form, Func<TextBox, bool> predicate = null)
where T : Control
{
var txtList = new List<TextBox>();
var txtInPanel = GetTextBoxInContainer<T>(form);
var txtInManyPanel = GetTextBoxHierarchicalContainer<T>(form);
var txtInForm = GetTextBoxInForm(form);
txtList.AddRange(txtInPanel);
txtList.AddRange(txtInManyPanel);
txtList.AddRange(txtInForm);
return predicate == null ? txtList : txtList.Where(predicate).ToList();
}
private static List<TextBox> GetTextBoxInForm(Form form)
{
return form.Controls.OfType<TextBox>().Where(c => string.IsNullOrEmpty(c.Text.Trim())).ToList();
}
private static List<TextBox> GetTextBoxHierarchicalContainer<T>(Form form) where T : Control
{
return form.Controls.OfType<T>().SelectMany(groupBox => groupBox.Controls.OfType<T>()).SelectMany(textBox => textBox.Controls.OfType<TextBox>()).OrderBy(t => t.TabIndex).Where(c => string.IsNullOrEmpty(c.Text.Trim())).ToList();
}
private static List<TextBox> GetTextBoxInContainer<T>(Form form) where T : Control
{
return form.Controls.OfType<T>().SelectMany(groupBox => groupBox.Controls.OfType<TextBox>()).OrderBy(t => t.TabIndex).Where(c => string.IsNullOrEmpty(c.Text.Trim())).ToList();
}
}
}
| mit | C# |
f3d486427a3ecae07c3592d9e838c9b5084b8042 | Fix build on netfx | MetacoSA/NBitcoin,MetacoSA/NBitcoin,NicolasDorier/NBitcoin | NBitcoin.Bench/UInt256Bench.cs | NBitcoin.Bench/UInt256Bench.cs | using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
using System.Text;
namespace NBitcoin.Bench
{
public class UInt256Bench
{
uint256 Value;
byte[] Bytes;
byte[] EmptyArray;
[GlobalSetup]
public void Setup()
{
Value = RandomUtils.GetUInt256();
Bytes = Value.ToBytes();
EmptyArray = new byte[32];
}
[Benchmark]
public void Read()
{
new uint256(Bytes);
}
[Benchmark]
public void WriteToArray()
{
Value.ToBytes(EmptyArray);
}
#if HAS_SPAN
[Benchmark]
public void WriteToSpan()
{
Value.ToBytes(EmptyArray.AsSpan());
}
#endif
}
}
| using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
using System.Text;
namespace NBitcoin.Bench
{
public class UInt256Bench
{
uint256 Value;
byte[] Bytes;
byte[] EmptyArray;
[GlobalSetup]
public void Setup()
{
Value = RandomUtils.GetUInt256();
Bytes = Value.ToBytes();
EmptyArray = new byte[32];
}
[Benchmark]
public void Read()
{
new uint256(Bytes);
}
[Benchmark]
public void WriteToArray()
{
Value.ToBytes(EmptyArray);
}
[Benchmark]
public void WriteToSpan()
{
Value.ToBytes(EmptyArray.AsSpan());
}
}
}
| mit | C# |
dbbdb3f12a4617fc84735e3c81bae7fc319af2dc | Fix for failing test | owerkop/fluent-nhibernate,chester89/fluent-nhibernate,bogdan7/nhibernate,chester89/fluent-nhibernate,oceanho/fluent-nhibernate,narnau/fluent-nhibernate,lingxyd/fluent-nhibernate,lingxyd/fluent-nhibernate,owerkop/fluent-nhibernate,hzhgis/ss,hzhgis/ss,chester89/fluent-nhibernate,HermanSchoenfeld/fluent-nhibernate,oceanho/fluent-nhibernate,narnau/fluent-nhibernate,bogdan7/nhibernate,HermanSchoenfeld/fluent-nhibernate,hzhgis/ss,bogdan7/nhibernate | src/FluentNHibernate.Testing/ConventionsTests/Inspection/CascadeTests.cs | src/FluentNHibernate.Testing/ConventionsTests/Inspection/CascadeTests.cs | using FluentNHibernate.Conventions.Inspections;
using NUnit.Framework;
namespace FluentNHibernate.Testing.ConventionsTests.Inspection.ValueTypes
{
[TestFixture]
public class CascadeTests
{
[Test]
public void ShouldBeEqualToAnotherTheSame()
{
Cascade.None.ShouldEqual(Cascade.None);
}
[Test]
public void ShouldNotBeEqualToADifferentOne()
{
Cascade.None.ShouldNotEqual(Cascade.All);
}
[Test]
public void NoneShouldHaveCorrectValue()
{
Cascade.None.ToString().ShouldEqual("none");
}
[Test]
public void AllShouldHaveCorrectValue()
{
Cascade.All.ToString().ShouldEqual("all");
}
[Test]
public void AllDeleteOrphanShouldHaveCorrectValue()
{
Cascade.AllDeleteOrphan.ToString().ShouldEqual("all-delete-orphan");
}
[Test]
public void VersionShouldHaveCorrectValue()
{
Cascade.Delete.ToString().ShouldEqual("delete");
}
[Test]
public void DirtyShouldHaveCorrectValue()
{
Cascade.SaveUpdate.ToString().ShouldEqual("save-update");
}
[Test]
public void MergeShouldHaveCorrectValue()
{
Cascade.Merge.ToString().ShouldEqual("merge");
}
}
} | using FluentNHibernate.Conventions.Inspections;
using NUnit.Framework;
namespace FluentNHibernate.Testing.ConventionsTests.Inspection.ValueTypes
{
[TestFixture]
public class CascadeTests
{
[Test]
public void ShouldBeEqualToAnotherTheSame()
{
Cascade.None.ShouldEqual(Cascade.None);
}
[Test]
public void ShouldNotBeEqualToADifferentOne()
{
Cascade.None.ShouldNotEqual(Cascade.All);
}
[Test]
public void NoneShouldHaveCorrectValue()
{
Cascade.None.ToString().ShouldEqual("none");
}
[Test]
public void AllShouldHaveCorrectValue()
{
Cascade.All.ToString().ShouldEqual("all");
}
[Test]
public void AllDeleteOrphanShouldHaveCorrectValue()
{
Cascade.AllDeleteOrphan.ToString().ShouldEqual("all-delete-orphan");
}
[Test]
public void VersionShouldHaveCorrectValue()
{
Cascade.Delete.ToString().ShouldEqual("delete");
}
[Test]
public void DirtyShouldHaveCorrectValue()
{
Cascade.SaveUpdate.ToString().ShouldEqual("save-update");
}
[Test]
public void MergeShouldHaveCorrectValue()
{
Cascade.All.ToString().ShouldEqual("merge");
}
}
} | bsd-3-clause | C# |
cd2351b8953102617a9b51186c67cc3d71647137 | Fix for duplicate type in assembly error | peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype | src/Glimpse.Agent.AspNet/Internal/Inspectors/Mvc/Proxies/ProxyAdapter.cs | src/Glimpse.Agent.AspNet/Internal/Inspectors/Mvc/Proxies/ProxyAdapter.cs | using System;
using System.Collections.Generic;
using Microsoft.Extensions.DiagnosticAdapter.Internal;
namespace Glimpse.Agent.Internal.Inspectors.Mvc.Proxies
{
public class ProxyAdapter
{
private static readonly ProxyTypeCache _cache = new ProxyTypeCache();
public ProxyAdapter()
{
Listener = new Dictionary<string, Subscription>();
}
private IDictionary<string, Subscription> Listener { get; }
public void Register(string typeName)
{
var subscription = new Subscription();
Listener.Add(typeName, subscription);
}
public T Process<T>(string typeName, object target)
{
Subscription subscription;
if (!Listener.TryGetValue(typeName, out subscription))
{
return default(T);
}
if (subscription.ProxiedType == null)
{
lock (subscription)
{
if (subscription.ProxiedType == null)
{
var proxiedType = ProxyTypeEmitter.GetProxyType(_cache, typeof(T), target.GetType());
subscription.ProxiedType = proxiedType;
}
}
}
var instance = (T)Activator.CreateInstance(subscription.ProxiedType, target);
return instance;
}
private class Subscription
{
public Type ProxiedType { get; set; }
}
}
} | using System;
using System.Collections.Generic;
using Microsoft.Extensions.DiagnosticAdapter.Internal;
namespace Glimpse.Agent.Internal.Inspectors.Mvc.Proxies
{
public class ProxyAdapter
{
private static readonly ProxyTypeCache _cache = new ProxyTypeCache();
public ProxyAdapter()
{
Listener = new Dictionary<string, Subscription>();
}
private IDictionary<string, Subscription> Listener { get; }
public void Register(string typeName)
{
var subscription = new Subscription();
Listener.Add(typeName, subscription);
}
public T Process<T>(string typeName, object target)
{
Subscription subscription;
if (!Listener.TryGetValue(typeName, out subscription))
{
return default(T);
}
if (subscription.ProxiedType == null)
{
var proxiedType = ProxyTypeEmitter.GetProxyType(_cache, typeof(T), target.GetType());
subscription.ProxiedType = proxiedType;
}
var instance = (T)Activator.CreateInstance(subscription.ProxiedType, target);
return instance;
}
private class Subscription
{
public Type ProxiedType { get; set; }
}
}
} | mit | C# |
08c806022debd8382d39e7eea38446754fb1130d | expire SF health reports | aloneguid/logmagic | src/LogMagic.Microsoft.Azure.ServiceFabric/Writers/HealthReportWriter.cs | src/LogMagic.Microsoft.Azure.ServiceFabric/Writers/HealthReportWriter.cs | using LogMagic.Enrichers;
using System;
using System.Collections.Generic;
using System.Fabric;
using System.Fabric.Health;
namespace LogMagic.Microsoft.Azure.ServiceFabric.Writers
{
class HealthReportWriter : ILogWriter
{
private readonly ServiceContext _context;
public HealthReportWriter(ServiceContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
}
public void Write(IEnumerable<LogEvent> events)
{
foreach (LogEvent e in events)
{
object healthProperty = e.GetProperty(KnownProperty.ClusterHealthProperty);
if (healthProperty == null) continue;
var hi = new HealthInformation(e.SourceName, healthProperty.ToString(),
e.ErrorException == null ? HealthState.Warning : HealthState.Error);
hi.Description = e.FormattedMessage;
hi.TimeToLive = TimeSpan.FromMinutes(5);
hi.RemoveWhenExpired = true;
if (e.ErrorException != null)
{
hi.Description += Environment.NewLine;
hi.Description += e.GetProperty(KnownProperty.Error).ToString();
};
_context.CodePackageActivationContext.ReportDeployedServicePackageHealth(hi);
}
}
public void Dispose()
{
throw new NotImplementedException();
}
}
}
| using LogMagic.Enrichers;
using System;
using System.Collections.Generic;
using System.Fabric;
using System.Fabric.Health;
namespace LogMagic.Microsoft.Azure.ServiceFabric.Writers
{
class HealthReportWriter : ILogWriter
{
private readonly ServiceContext _context;
public HealthReportWriter(ServiceContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
}
public void Write(IEnumerable<LogEvent> events)
{
foreach (LogEvent e in events)
{
object healthProperty = e.GetProperty(KnownProperty.ClusterHealthProperty);
if (healthProperty == null) continue;
var hi = new HealthInformation(e.SourceName, healthProperty.ToString(),
e.ErrorException == null ? HealthState.Warning : HealthState.Error);
hi.Description = e.FormattedMessage;
if (e.ErrorException != null)
{
hi.Description += Environment.NewLine;
hi.Description += e.GetProperty(KnownProperty.Error).ToString();
};
_context.CodePackageActivationContext.ReportDeployedServicePackageHealth(hi);
}
}
public void Dispose()
{
throw new NotImplementedException();
}
}
}
| mit | C# |
959bfc90ae6de9a0486eb7c96d775a65c718c946 | add covariance and contravariance information | mstama/Merchant | Merchant/Interfaces/IConverter.cs | Merchant/Interfaces/IConverter.cs | namespace Merchant.Interfaces
{
/// <summary>
/// Interface for the converters
/// </summary>
public interface IConverter<in TSource, out TTarget>
{
/// <summary>
/// Executes the conversion
/// </summary>
/// <param name="value"></param>
/// <returns>Converted value</returns>
TTarget Convert(TSource value);
}
} | namespace Merchant.Interfaces
{
/// <summary>
/// Interface for the converters
/// </summary>
public interface IConverter<TSource, TTarget>
{
/// <summary>
/// Executes the conversion
/// </summary>
/// <param name="value"></param>
/// <returns>Converted value</returns>
TTarget Convert(TSource value);
}
} | mit | C# |
346f8602831701d4be251c363447f919c551eb11 | Update IMap.cs | ser910/uwp | NetGames/IGame/IMap.cs | NetGames/IGame/IMap.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
namespace IGame
{
interface IMap: ISerializable
{
//Размер карты
int X { get; }
int Y { get; }
List<IGameObject> GameObjects { get; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
namespace IGame
{
interface IMap: ISerializable
{
//Розмер карты
int X { get; }
int Y { get; }
List<IGameObject> GameObjects { get; }
}
}
| mit | C# |
0557e8945fb2ecb7e4240dbd81725d84a7aeaccf | Fix MainCameraSingleton not tracking correct cameras | Barleytree/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare | Assets/Scripts/Camera/MainCameraSingleton.cs | Assets/Scripts/Camera/MainCameraSingleton.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
public class MainCameraSingleton : MonoBehaviour
{
private const string MainCameraTag = "MainCamera";
private static List<Camera> cameraInstances;
private Camera camera;
public static Camera instance
{
get
{
if (cameraInstances == null)
cameraInstances = new List<Camera>();
var markedForRemoval = new List<Camera>();
Camera returnCamera = null;
foreach (var camera in cameraInstances)
{
if (camera == null)
markedForRemoval.Add(camera);
else if (camera.tag.Equals("MainCamera") && camera.isActiveAndEnabled)
{
returnCamera = camera;
break;
}
}
if (markedForRemoval.Any())
cameraInstances = cameraInstances.Except(markedForRemoval).ToList();
return returnCamera;
}
}
void Awake()
{
if (cameraInstances == null)
cameraInstances = new List<Camera>();
camera = GetComponent<Camera>();
cameraInstances.Add(camera);
}
private void OnDestroy()
{
cameraInstances.Remove(camera);
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
public class MainCameraSingleton : MonoBehaviour
{
private const string MainCameraTag = "MainCamera";
private static List<Camera> cameraInstances;
private Camera camera;
public static Camera instance
{
get
{
if (cameraInstances == null)
cameraInstances = new List<Camera>();
var markedForRemoval = new List<Camera>();
Camera returnCamera = null;
foreach (var camera in cameraInstances)
{
if (camera == null)
markedForRemoval.Add(camera);
else if (camera.tag == "MainCamera")
{
returnCamera = camera;
break;
}
}
if (markedForRemoval.Any())
cameraInstances = cameraInstances.Except(markedForRemoval).ToList();
return returnCamera;
}
}
void Awake()
{
cameraInstances = new List<Camera>();
camera = GetComponent<Camera>();
cameraInstances.Add(camera);
}
private void OnDestroy()
{
cameraInstances.Remove(camera);
}
}
| mit | C# |
772ecabe8e9293d187c8bba20ad0a45cb9b0ca65 | Change Message Key to use a GUID. | SaxxonPike/NextLevelSeven | NextLevelSeven/Cursors/Message.cs | NextLevelSeven/Cursors/Message.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NextLevelSeven.Core;
namespace NextLevelSeven.Cursors
{
sealed internal class Message : Element
{
public Message(string message)
: base(message)
{
_encodingConfiguration = new EncodingConfiguration(this);
KeyGuid = new Guid();
}
protected override char Delimiter
{
get { return '\n'; }
}
private readonly EncodingConfiguration _encodingConfiguration;
public override EncodingConfiguration EncodingConfiguration
{
get { return _encodingConfiguration; }
}
public override IElement GetDescendant(int index)
{
return GetSegment(index);
}
public ISegment GetSegment(int index)
{
return new Segment(this, index - 1, index);
}
public override string Key
{
get { return KeyGuid.ToString(); }
}
Guid KeyGuid
{
get;
set;
}
public IEnumerable<ISegment> Segments
{
get { return new SegmentEnumerable(this); }
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NextLevelSeven.Core;
namespace NextLevelSeven.Cursors
{
sealed internal class Message : Element
{
public Message(string message)
: base(message)
{
_encodingConfiguration = new EncodingConfiguration(this);
}
protected override char Delimiter
{
get { return '\n'; }
}
private readonly EncodingConfiguration _encodingConfiguration;
public override EncodingConfiguration EncodingConfiguration
{
get { return _encodingConfiguration; }
}
public override IElement GetDescendant(int index)
{
return GetSegment(index);
}
public ISegment GetSegment(int index)
{
return new Segment(this, index - 1, index);
}
public IEnumerable<ISegment> Segments
{
get { return new SegmentEnumerable(this); }
}
}
}
| isc | C# |
058b72f43f590c6ee5c5a9830ca98575e82602f3 | Update copyright year | NJAldwin/Pequot | Pequot/Properties/AssemblyInfo.cs | Pequot/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("Pequot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Shaken Software")]
[assembly: AssemblyProduct("Pequot")]
[assembly: AssemblyCopyright("©2009-2011 Shaken Software")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("83e5cf5c-13c9-4367-b1be-e9574b2e4680")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.4.1.*")]
[assembly: AssemblyFileVersion("0.4.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("Pequot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Shaken Software")]
[assembly: AssemblyProduct("Pequot")]
[assembly: AssemblyCopyright("©2009-2010 Shaken Software")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("83e5cf5c-13c9-4367-b1be-e9574b2e4680")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.4.1.*")]
[assembly: AssemblyFileVersion("0.4.1.0")]
| mit | C# |
2bea4338b53c27fa3fe4bec6a2da012cab59d836 | Split WCF functionality out of Autofac.Extras.Multitenant into a separate assembly/package, Autofac.Extras.Multitenant.Wcf. Both packages are versioned 3.1.0. | autofac/Autofac.Extras.AttributeMetadata | Properties/VersionAssemblyInfo.cs | Properties/VersionAssemblyInfo.cs | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-12-03 10:23")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Extras.Attributed 3.1.0")]
| //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-10-23 22:48")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Extras.Attributed 3.1.0")]
| mit | C# |
8796d652c6af0f1593f78a266768a23f032af6fc | Create plugged wallet test didn't used plugged wallet type. | anastasia-tarasova/indy-sdk,Artemkaaas/indy-sdk,anastasia-tarasova/indy-sdk,Artemkaaas/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,korsimoro/indy-sdk,peacekeeper/indy-sdk,korsimoro/indy-sdk,srottem/indy-sdk,korsimoro/indy-sdk,korsimoro/indy-sdk,korsimoro/indy-sdk,Artemkaaas/indy-sdk,srottem/indy-sdk,anastasia-tarasova/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,Artemkaaas/indy-sdk,anastasia-tarasova/indy-sdk,peacekeeper/indy-sdk,srottem/indy-sdk,peacekeeper/indy-sdk,srottem/indy-sdk,peacekeeper/indy-sdk,Artemkaaas/indy-sdk,peacekeeper/indy-sdk,srottem/indy-sdk,anastasia-tarasova/indy-sdk,Artemkaaas/indy-sdk,srottem/indy-sdk,srottem/indy-sdk,Artemkaaas/indy-sdk,peacekeeper/indy-sdk,Artemkaaas/indy-sdk,srottem/indy-sdk,korsimoro/indy-sdk,anastasia-tarasova/indy-sdk,anastasia-tarasova/indy-sdk,anastasia-tarasova/indy-sdk,korsimoro/indy-sdk,Artemkaaas/indy-sdk,srottem/indy-sdk,anastasia-tarasova/indy-sdk,srottem/indy-sdk,srottem/indy-sdk,anastasia-tarasova/indy-sdk,korsimoro/indy-sdk,korsimoro/indy-sdk,anastasia-tarasova/indy-sdk,Artemkaaas/indy-sdk,peacekeeper/indy-sdk,anastasia-tarasova/indy-sdk,srottem/indy-sdk,anastasia-tarasova/indy-sdk,Artemkaaas/indy-sdk,peacekeeper/indy-sdk,Artemkaaas/indy-sdk,srottem/indy-sdk,Artemkaaas/indy-sdk,korsimoro/indy-sdk | wrappers/dotnet/indy-sdk-dotnet-test/Wrapper/WalletTests/CreateWalletTest.cs | wrappers/dotnet/indy-sdk-dotnet-test/Wrapper/WalletTests/CreateWalletTest.cs | using Indy.Sdk.Dotnet.Wrapper;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
namespace Indy.Sdk.Dotnet.Test.Wrapper.WalletTests
{
[TestClass]
public class CreateWalletTest : IndyIntegrationTestBase
{
[TestMethod]
public async Task TestCreateWalletWorks()
{
await Wallet.CreateWalletAsync("default", "createWalletWorks", "default", null, null);
}
[TestMethod]
public async Task TestCreateWalletWorksForEmptyType()
{
await Wallet.CreateWalletAsync("default", "createWalletWorks", null, null, null);
}
[TestMethod]
public async Task TestCreateWalletWorksForConfigJson()
{
await Wallet.CreateWalletAsync("default", "createWalletWorks", null, "{\"freshness_time\":1000}", null);
}
[TestMethod]
public async Task TestCreateWalletWorksForUnknownType()
{
var ex = await Assert.ThrowsExceptionAsync<IndyException>(() =>
Wallet.CreateWalletAsync("default", "createWalletWorks", "unknown_type", null, null)
);
Assert.AreEqual(ErrorCode.WalletUnknownTypeError, ex.ErrorCode);
}
[TestMethod]
public async Task TestCreateWalletWorksForEmptyName()
{
var ex = await Assert.ThrowsExceptionAsync<IndyException>(() =>
Wallet.CreateWalletAsync(string.Empty, "createWalletWorks", "default", null, null)
);
Assert.AreEqual(ErrorCode.CommonInvalidParam2, ex.ErrorCode);
}
[TestMethod]
public async Task TestCreateWalletWorksForDuplicateName()
{
var poolName = "default";
var walletName = "deleteWalletWorks";
var type = "default";
await Wallet.CreateWalletAsync(poolName, walletName, type, null, null);
var ex = await Assert.ThrowsExceptionAsync<IndyException>(() =>
Wallet.CreateWalletAsync(poolName, walletName, type, null, null)
);
Assert.AreEqual(ErrorCode.WalletAlreadyExistsError, ex.ErrorCode);
}
[TestMethod]
public async Task TestCreateWalletWorksForPlugged()
{
await Wallet.CreateWalletAsync("default", "createPluggedWalletWorks", "inmem", null, null);
}
}
}
| using Indy.Sdk.Dotnet.Wrapper;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
namespace Indy.Sdk.Dotnet.Test.Wrapper.WalletTests
{
[TestClass]
public class CreateWalletTest : IndyIntegrationTestBase
{
[TestMethod]
public async Task TestCreateWalletWorks()
{
await Wallet.CreateWalletAsync("default", "createWalletWorks", "default", null, null);
}
[TestMethod]
public async Task TestCreateWalletWorksForEmptyType()
{
await Wallet.CreateWalletAsync("default", "createWalletWorks", null, null, null);
}
[TestMethod]
public async Task TestCreateWalletWorksForConfigJson()
{
await Wallet.CreateWalletAsync("default", "createWalletWorks", null, "{\"freshness_time\":1000}", null);
}
[TestMethod]
public async Task TestCreateWalletWorksForUnknownType()
{
var ex = await Assert.ThrowsExceptionAsync<IndyException>(() =>
Wallet.CreateWalletAsync("default", "createWalletWorks", "unknown_type", null, null)
);
Assert.AreEqual(ErrorCode.WalletUnknownTypeError, ex.ErrorCode);
}
[TestMethod]
public async Task TestCreateWalletWorksForEmptyName()
{
var ex = await Assert.ThrowsExceptionAsync<IndyException>(() =>
Wallet.CreateWalletAsync(string.Empty, "createWalletWorks", "default", null, null)
);
Assert.AreEqual(ErrorCode.CommonInvalidParam2, ex.ErrorCode);
}
[TestMethod]
public async Task TestCreateWalletWorksForDuplicateName()
{
var poolName = "default";
var walletName = "deleteWalletWorks";
var type = "default";
await Wallet.CreateWalletAsync(poolName, walletName, type, null, null);
var ex = await Assert.ThrowsExceptionAsync<IndyException>(() =>
Wallet.CreateWalletAsync(poolName, walletName, type, null, null)
);
Assert.AreEqual(ErrorCode.WalletAlreadyExistsError, ex.ErrorCode);
}
[TestMethod]
public async Task TestCreateWalletWorksForPlugged()
{
await Wallet.CreateWalletAsync("default", "createWalletWorks", "default", null, null);
}
}
}
| apache-2.0 | C# |
c6902c4ae0b17eb973df8cdb36eac7d5e5da96f2 | Add Should().BeApproximately(…) | bradphelan/SketchSolve.NET,bradphelan/SketchSolve.NET,bradphelan/SketchSolve.NET | SketchSolveC#.NET.Spec/Test.cs | SketchSolveC#.NET.Spec/Test.cs | using System;
using NUnit.Framework;
using FluentAssertions;
using SketchSolve;
using System.Linq;
using FluentAssertions.Numeric;
namespace SketchSolve.Spec
{
public static class FluentExtensionsX {
public static AndConstraint<NumericAssertions<double>> BeApproximately
(this NumericAssertions<double> This, double val, double eps)
{
return This.BeInRange (val - eps/2, val + eps / 2);
}
}
[TestFixture()]
public class Solver
{
[Test()]
public void HorizontalConstraintShouldWork ()
{
var line = new line () { p1 = new point(0,1), p2 = new point(2, 3) };
SketchSolve.Solver.solve
( true
, line.IsHorizontal()
);
line.p1.y.Value.Should ().BeApproximately (line.p2.y.Value, 0.001);
}
[Test()]
public void VerticalConstraintShouldWork ()
{
var line = new line () { p1 = new point(0,1), p2 = new point(2, 3) };
SketchSolve.Solver.solve
( true
, line.IsVertical()
);
line.p1.x.Value.Should ().BeApproximately (line.p2.x.Value, 0.001);
}
}
}
| using System;
using NUnit.Framework;
using FluentAssertions;
using SketchSolve;
using System.Linq;
namespace SketchSolve.Spec
{
[TestFixture()]
public class Solver
{
[Test()]
public void HorizontalConstraintShouldWork ()
{
var line = new line () { p1 = new point(0,1), p2 = new point(2, 3) };
SketchSolve.Solver.solve
( true
, line.IsHorizontal()
);
line.p1.y.Value.Should ().BeInRange (line.p2.y.Value-0.001, line.p2.y.Value+0.001);
}
[Test()]
public void VerticalConstraintShouldWork ()
{
var line = new line () { p1 = new point(0,1), p2 = new point(2, 3) };
SketchSolve.Solver.solve
( true
, line.IsVertical()
);
line.p1.x.Value.Should ().BeInRange (line.p2.x.Value-0.001, line.p2.x.Value+0.001);
}
}
}
| bsd-3-clause | C# |
9f10ebf181f51210dfdf38063fbb0f7f0407ecd6 | add BuildOnEQueueMessageReceived in equeue client provider | IvanZheng/IFramework,IvanZheng/IFramework,IvanZheng/IFramework | Src/iFramework.Plugins/IFramework.MessageQueue.EQueue/EQueueClientProvider.cs | Src/iFramework.Plugins/IFramework.MessageQueue.EQueue/EQueueClientProvider.cs | using System;
using System.Collections.Generic;
using System.Text;
using IFramework.Infrastructure;
using IFramework.Message;
using IFramework.Message.Impl;
using IFramework.MessageQueue.Client.Abstracts;
using IFramework.MessageQueue.EQueue.MessageFormat;
namespace IFramework.MessageQueue.EQueue
{
public class EQueueClientProvider : IMessageQueueClientProvider
{
private OnEQueueMessageReceived BuildOnEQueueMessageReceived(OnMessagesReceived onMessagesReceived)
{
return (consumer, message) =>
{
var equeueMessage = Encoding.UTF8.GetString(message.Body).ToJsonObject<EQueueMessage>();
var messageContext = new MessageContext(equeueMessage, message.BrokerName, message.QueueId, message.QueueOffset);
onMessagesReceived(messageContext);
};
}
public IMessageConsumer CreateQueueConsumer(string commandQueueName, OnMessagesReceived onMessagesReceived, string consumerId, ConsumerConfig consumerConfig, bool start = true)
{
throw new NotImplementedException();
}
public IMessageProducer CreateQueueProducer(string queue)
{
throw new NotImplementedException();
}
public IMessageProducer CreateTopicProducer(string topic)
{
throw new NotImplementedException();
}
public IMessageConsumer CreateTopicSubscription(string topic, string subscriptionName, OnMessagesReceived onMessagesReceived, string consumerId, ConsumerConfig consumerConfig, bool start = true)
{
throw new NotImplementedException();
}
public void Dispose()
{
throw new NotImplementedException();
}
public IMessageContext WrapMessage(object message, string correlationId = null, string topic = null, string key = null, string replyEndPoint = null, string messageId = null, SagaInfo sagaInfo = null, string producer = null)
{
throw new NotImplementedException();
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using IFramework.Message;
using IFramework.Message.Impl;
using IFramework.MessageQueue.Client.Abstracts;
namespace IFramework.MessageQueue.EQueue
{
public class EQueueClientProvider : IMessageQueueClientProvider
{
public IMessageConsumer CreateQueueConsumer(string commandQueueName, OnMessagesReceived onMessagesReceived, string consumerId, ConsumerConfig consumerConfig, bool start = true)
{
throw new NotImplementedException();
}
public IMessageProducer CreateQueueProducer(string queue)
{
throw new NotImplementedException();
}
public IMessageProducer CreateTopicProducer(string topic)
{
throw new NotImplementedException();
}
public IMessageConsumer CreateTopicSubscription(string topic, string subscriptionName, OnMessagesReceived onMessagesReceived, string consumerId, ConsumerConfig consumerConfig, bool start = true)
{
throw new NotImplementedException();
}
public void Dispose()
{
throw new NotImplementedException();
}
public IMessageContext WrapMessage(object message, string correlationId = null, string topic = null, string key = null, string replyEndPoint = null, string messageId = null, SagaInfo sagaInfo = null, string producer = null)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
ff8f03959bc19c586f060b422637254ba540ba4a | Update CuidCorrelationServiceTests.cs | tiksn/TIKSN-Framework | TIKSN.UnitTests.Shared/Integration/Correlation/CuidCorrelationServiceTests.cs | TIKSN.UnitTests.Shared/Integration/Correlation/CuidCorrelationServiceTests.cs | using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using System;
using TIKSN.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
namespace TIKSN.Integration.Correlation.Tests
{
public class CuidCorrelationServiceTests
{
private readonly ICorrelationService _correlationService;
private readonly ITestOutputHelper _testOutputHelper;
public CuidCorrelationServiceTests(ITestOutputHelper testOutputHelper)
{
var services = new ServiceCollection();
services.AddFrameworkPlatform();
services.AddSingleton<ICorrelationService, CuidCorrelationService>();
var serviceProvider = services.BuildServiceProvider();
_correlationService = serviceProvider.GetRequiredService<ICorrelationService>();
_testOutputHelper = testOutputHelper ?? throw new ArgumentNullException(nameof(testOutputHelper));
}
[Fact]
public void GenerateCoupleOfIds()
{
LogOutput(_correlationService.Generate(), "Correlation ID 1");
LogOutput(_correlationService.Generate(), "Correlation ID 2");
LogOutput(_correlationService.Generate(), "Correlation ID 3");
}
[Fact]
public void GenerateAndParse()
{
var correlationID = _correlationService.Generate();
LogOutput(correlationID, nameof(correlationID));
var correlationIDFromString = _correlationService.Create(correlationID.ToString());
LogOutput(correlationIDFromString, nameof(correlationIDFromString));
var correlationIDFromBytes = _correlationService.Create(correlationID.ToByteArray());
LogOutput(correlationIDFromBytes, nameof(correlationIDFromBytes));
correlationIDFromString.Should().Be(correlationID);
correlationIDFromBytes.Should().Be(correlationID);
correlationIDFromString.Should().Be(correlationIDFromBytes);
}
private void LogOutput(CorrelationID correlationID, string name)
{
_testOutputHelper.WriteLine("-------------------------");
_testOutputHelper.WriteLine(name);
_testOutputHelper.WriteLine(correlationID.ToString());
_testOutputHelper.WriteLine(BitConverter.ToString(correlationID.ToByteArray()));
_testOutputHelper.WriteLine("");
}
[Fact]
public void ParseExample()
{
var correlationID = _correlationService.Create("ch72gsb320000udocl363eofy");
LogOutput(correlationID, nameof(correlationID));
}
}
} | using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using System;
using TIKSN.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
namespace TIKSN.Integration.Correlation.Tests
{
public class CuidCorrelationServiceTests
{
private readonly ICorrelationService _correlationService;
private readonly ITestOutputHelper _testOutputHelper;
public CuidCorrelationServiceTests(ITestOutputHelper testOutputHelper)
{
var services = new ServiceCollection();
services.AddFrameworkPlatform();
services.AddSingleton<ICorrelationService, CuidCorrelationService>();
var serviceProvider = services.BuildServiceProvider();
_correlationService = serviceProvider.GetRequiredService<ICorrelationService>();
_testOutputHelper = testOutputHelper ?? throw new ArgumentNullException(nameof(testOutputHelper));
}
[Fact]
public void GenerateCoupleOfIds()
{
LogOutput(_correlationService.Generate(), "Correlation ID 1");
LogOutput(_correlationService.Generate(), "Correlation ID 2");
LogOutput(_correlationService.Generate(), "Correlation ID 3");
}
[Fact]
public void GenerateAndParse()
{
var correlationID = _correlationService.Generate();
LogOutput(correlationID, nameof(correlationID));
var correlationIDFromString = _correlationService.Create(correlationID.ToString());
var correlationIDFromBytes = _correlationService.Create(correlationID.ToByteArray());
correlationIDFromString.Should().Be(correlationID);
correlationIDFromBytes.Should().Be(correlationID);
correlationIDFromString.Should().Be(correlationIDFromBytes);
}
private void LogOutput(CorrelationID correlationID, string name)
{
_testOutputHelper.WriteLine("-------------------------");
_testOutputHelper.WriteLine(name);
_testOutputHelper.WriteLine(correlationID.ToString());
_testOutputHelper.WriteLine(BitConverter.ToString(correlationID.ToByteArray()));
_testOutputHelper.WriteLine("");
}
[Fact]
public void ParseExample()
{
var correlationID = _correlationService.Create("ch72gsb320000udocl363eofy");
LogOutput(correlationID, nameof(correlationID));
}
}
} | mit | C# |
4395ea3850baaf67047cc910c4e60a028e76af5c | Add applied suggestions. | UselessToucan/osu,DrabWeb/osu,smoogipoo/osu,Drezi126/osu,UselessToucan/osu,Damnae/osu,2yangk23/osu,naoey/osu,ZLima12/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,johnneijzen/osu,peppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,EVAST9919/osu,naoey/osu,smoogipooo/osu,EVAST9919/osu,johnneijzen/osu,naoey/osu,Frontear/osuKyzer,Nabile-Rahmani/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,ZLima12/osu,DrabWeb/osu,DrabWeb/osu,2yangk23/osu,smoogipoo/osu,peppy/osu | osu.Game.Rulesets.Mania/ManiaInputManager.cs | osu.Game.Rulesets.Mania/ManiaInputManager.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 System.ComponentModel;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania
{
public class ManiaInputManager : RulesetInputManager<ManiaAction>
{
public ManiaInputManager(RulesetInfo ruleset, int variant)
: base(ruleset, variant, SimultaneousBindingMode.Unique)
{
}
}
public enum ManiaAction
{
[Description("Special")]
Special,
[Description("Key 1")]
Key1 = 10,
[Description("Key 2")]
Key2,
[Description("Key 3")]
Key3,
[Description("Key 4")]
Key4,
[Description("Key 5")]
Key5,
[Description("Key 6")]
Key6,
[Description("Key 7")]
Key7,
[Description("Key 8")]
Key8,
[Description("Key 9")]
Key9
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania
{
public class ManiaInputManager : RulesetInputManager<ManiaAction>
{
public ManiaInputManager(RulesetInfo ruleset, int variant)
: base(ruleset, variant, SimultaneousBindingMode.Unique)
{
}
}
public enum ManiaAction
{
[Description("Key 1")]
Key1,
[Description("Key 2")]
Key2,
[Description("Key 3")]
Key3,
[Description("Key 4")]
Key4,
[Description("Key 5")]
Key5,
[Description("Key 6")]
Key6,
[Description("Key 7")]
Key7,
[Description("Key 8")]
Key8,
[Description("Key 9")]
Key9,
[Description("Special")]
Special
}
}
| mit | C# |
d607bde824f1ebbbb8cc59f0baa52f2fb23fa8be | Improve MultiMiner Remoting compatibility on Linux+Mono | IWBWbiz/MultiMiner,nwoolls/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner | MultiMiner.Remoting.Server/RemotingServer.cs | MultiMiner.Remoting.Server/RemotingServer.cs | using System;
using System.Net;
using System.ServiceModel;
namespace MultiMiner.Remoting.Server
{
public class RemotingServer
{
private bool serviceStarted = false;
private ServiceHost myServiceHost = null;
public void Startup()
{
//use Dns.GetHostName() instead of localhost for compatibility with Mono+Linux
//https://github.com/nwoolls/MultiMiner/issues/62
Uri baseAddress = new Uri(String.Format("net.tcp://{0}:{1}/RemotingService", Dns.GetHostName(), Config.RemotingPort));
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
myServiceHost = new ServiceHost(typeof(RemotingService), baseAddress);
myServiceHost.AddServiceEndpoint(typeof(IRemotingService), binding, baseAddress);
myServiceHost.Open();
serviceStarted = true;
}
public void Shutdown()
{
if (!serviceStarted)
return;
myServiceHost.Close();
myServiceHost = null;
serviceStarted = false;
}
}
}
| using System;
using System.ServiceModel;
namespace MultiMiner.Remoting.Server
{
public class RemotingServer
{
private bool serviceStarted = false;
private ServiceHost myServiceHost = null;
public void Startup()
{
Uri baseAddress = new Uri("net.tcp://localhost:" + Config.RemotingPort + "/RemotingService");
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
myServiceHost = new ServiceHost(typeof(RemotingService), baseAddress);
myServiceHost.AddServiceEndpoint(typeof(IRemotingService), binding, baseAddress);
myServiceHost.Open();
serviceStarted = true;
}
public void Shutdown()
{
if (!serviceStarted)
return;
myServiceHost.Close();
myServiceHost = null;
serviceStarted = false;
}
}
}
| mit | C# |
d9bf4507cd7dfa628c408d577cd7dcb5861412c7 | Add armv7s to libwrappers.linkwith.cs | realm/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet,Shaddix/realm-dotnet,realm/realm-dotnet,realm/realm-dotnet | Realm.XamarinIOS/libwrappers.linkwith.cs | Realm.XamarinIOS/libwrappers.linkwith.cs | ////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm 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;
using ObjCRuntime;
[assembly: LinkWith ("libwrappers.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Arm64 | LinkTarget.Simulator | LinkTarget.Simulator64, SmartLink = true, LinkerFlags = "-lstdc++ -lz")]
| ////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm 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;
using ObjCRuntime;
[assembly: LinkWith ("libwrappers.a", LinkTarget.ArmV7 | LinkTarget.Simulator | LinkTarget.Simulator64 | LinkTarget.Arm64, SmartLink = true, LinkerFlags = "-lstdc++ -lz")]
| apache-2.0 | C# |
201276ee65c490786d936d8865db2a267c002c43 | Fix Triage | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.Models/Classi/Triage/TreeTriage.cs | src/backend/SO115App.Models/Classi/Triage/TreeTriage.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace SO115App.Models.Classi.Triage
{
public class TreeTriage
{
public string Text { get; set; }
public string Value { get; set; }
public bool internalChecked { get; set; }
public bool internalCollapsed { get; set; }
public bool internalDisabled { get; set; }
public List<TreeTriage> InternalChildren { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace SO115App.Models.Classi.Triage
{
public class TreeTriage
{
public string Text { get; set; }
public string Value { get; set; }
public bool internalChecked { get; set; }
public bool internalCollapsed { get; set; }
public bool internalDisabled { get; set; }
public List<Triage> InternalChildren { get; set; }
}
}
| agpl-3.0 | C# |
62db5deb2a46b0276360dd8bef2b4113b208bcd9 | Add null check to ReferenceCollection | asbjornu/GitVersion,GitTools/GitVersion,asbjornu/GitVersion,gep13/GitVersion,gep13/GitVersion,GitTools/GitVersion | src/GitVersion.LibGit2Sharp/Git/ReferenceCollection.cs | src/GitVersion.LibGit2Sharp/Git/ReferenceCollection.cs | using GitVersion.Extensions;
namespace GitVersion;
internal sealed class ReferenceCollection : IReferenceCollection
{
private readonly LibGit2Sharp.ReferenceCollection innerCollection;
internal ReferenceCollection(LibGit2Sharp.ReferenceCollection collection)
=> this.innerCollection = collection.NotNull();
public IEnumerator<IReference> GetEnumerator() => this.innerCollection.Select(reference => new Reference(reference)).GetEnumerator();
public void Add(string name, string canonicalRefNameOrObject, bool allowOverwrite = false) => this.innerCollection.Add(name, canonicalRefNameOrObject, allowOverwrite);
public void UpdateTarget(IReference directRef, IObjectId targetId) => RepositoryExtensions.RunSafe(() => this.innerCollection.UpdateTarget((Reference)directRef, (ObjectId)targetId));
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public IReference? this[string name]
{
get
{
var reference = this.innerCollection[name];
return reference is null ? null : new Reference(reference);
}
}
public IReference? this[ReferenceName referenceName] => this[referenceName.Canonical];
public IReference? Head => this["HEAD"];
public IEnumerable<IReference> FromGlob(string prefix) => this.innerCollection.FromGlob(prefix).Select(reference => new Reference(reference));
}
| namespace GitVersion;
internal sealed class ReferenceCollection : IReferenceCollection
{
private readonly LibGit2Sharp.ReferenceCollection innerCollection;
internal ReferenceCollection(LibGit2Sharp.ReferenceCollection collection) => this.innerCollection = collection;
public IEnumerator<IReference> GetEnumerator() => this.innerCollection.Select(reference => new Reference(reference)).GetEnumerator();
public void Add(string name, string canonicalRefNameOrObject, bool allowOverwrite = false) => this.innerCollection.Add(name, canonicalRefNameOrObject, allowOverwrite);
public void UpdateTarget(IReference directRef, IObjectId targetId) => RepositoryExtensions.RunSafe(() => this.innerCollection.UpdateTarget((Reference)directRef, (ObjectId)targetId));
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public IReference? this[string name]
{
get
{
var reference = this.innerCollection[name];
return reference is null ? null : new Reference(reference);
}
}
public IReference? this[ReferenceName referenceName] => this[referenceName.Canonical];
public IReference? Head => this["HEAD"];
public IEnumerable<IReference> FromGlob(string prefix) => this.innerCollection.FromGlob(prefix).Select(reference => new Reference(reference));
}
| mit | C# |
343e92cb03fa9b1247ce160a5d65a8ff33dfcc70 | fix multiple WWW-Authenticate to one | MienDev/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4 | src/IdentityServer4/src/Endpoints/Results/ProtectedResourceErrorResult.cs | src/IdentityServer4/src/Endpoints/Results/ProtectedResourceErrorResult.cs | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System.Threading.Tasks;
using IdentityServer4.Extensions;
using Microsoft.Extensions.Primitives;
using IdentityServer4.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Net.Http.Headers;
using IdentityModel;
namespace IdentityServer4.Endpoints.Results
{
internal class ProtectedResourceErrorResult : IEndpointResult
{
public string Error;
public string ErrorDescription;
public ProtectedResourceErrorResult(string error, string errorDescription = null)
{
Error = error;
ErrorDescription = errorDescription;
}
public Task ExecuteAsync(HttpContext context)
{
context.Response.StatusCode = 401;
context.Response.SetNoCache();
if (Constants.ProtectedResourceErrorStatusCodes.ContainsKey(Error))
{
context.Response.StatusCode = Constants.ProtectedResourceErrorStatusCodes[Error];
}
if (Error == OidcConstants.ProtectedResourceErrors.ExpiredToken)
{
Error = OidcConstants.ProtectedResourceErrors.InvalidToken;
ErrorDescription = "The access token expired";
}
var errorString = string.Format($"error=\"{Error}\"");
if (ErrorDescription.IsMissing())
{
context.Response.Headers.Add(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString }).ToString());
}
else
{
var errorDescriptionString = string.Format($"error_description=\"{ErrorDescription}\"");
context.Response.Headers.Add(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString, errorDescriptionString }).ToString());
}
return Task.CompletedTask;
}
}
}
| // Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using System.Threading.Tasks;
using IdentityServer4.Extensions;
using Microsoft.Extensions.Primitives;
using IdentityServer4.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Net.Http.Headers;
using IdentityModel;
namespace IdentityServer4.Endpoints.Results
{
internal class ProtectedResourceErrorResult : IEndpointResult
{
public string Error;
public string ErrorDescription;
public ProtectedResourceErrorResult(string error, string errorDescription = null)
{
Error = error;
ErrorDescription = errorDescription;
}
public Task ExecuteAsync(HttpContext context)
{
context.Response.StatusCode = 401;
context.Response.SetNoCache();
if (Constants.ProtectedResourceErrorStatusCodes.ContainsKey(Error))
{
context.Response.StatusCode = Constants.ProtectedResourceErrorStatusCodes[Error];
}
if (Error == OidcConstants.ProtectedResourceErrors.ExpiredToken)
{
Error = OidcConstants.ProtectedResourceErrors.InvalidToken;
ErrorDescription = "The access token expired";
}
var errorString = string.Format($"error=\"{Error}\"");
if (ErrorDescription.IsMissing())
{
context.Response.Headers.Add(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString }));
}
else
{
var errorDescriptionString = string.Format($"error_description=\"{ErrorDescription}\"");
context.Response.Headers.Add(HeaderNames.WWWAuthenticate, new StringValues(new[] { "Bearer realm=\"IdentityServer\"", errorString, errorDescriptionString }));
}
return Task.CompletedTask;
}
}
}
| apache-2.0 | C# |
0faea95449190eeb296e994ba9f4cd1762e2e752 | Add const for the standard scope "phone" (#1720) | AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet,AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet,AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet,AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet | src/Microsoft.IdentityModel.Protocols.OpenIdConnect/OpenIdConnectScope.cs | src/Microsoft.IdentityModel.Protocols.OpenIdConnect/OpenIdConnectScope.cs | //------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// 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.
//
//------------------------------------------------------------------------------
namespace Microsoft.IdentityModel.Protocols.OpenIdConnect
{
/// <summary>
/// Specific scope values that are interesting to OpenID Connect. See http://openid.net/specs/openid-connect-messages-1_0.html#scopes
/// </summary>
/// <remarks>Can be used to determine the scope by consumers of an <see cref="OpenIdConnectMessage"/>.
/// For example: OpenIdConnectMessageTests.Publics() sets <see cref="OpenIdConnectMessage.Scope"/>
/// to <see cref="OpenIdConnectScope.OpenIdProfile"/>.</remarks>
public static class OpenIdConnectScope
{
/// <summary>
/// Indicates email scope see: http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string Email = "email";
/// <summary>
/// Indicates offline_access scope see: http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string OfflineAccess = "offline_access";
/// <summary>
/// Indicates openid scope see: http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string OpenId = "openid";
/// <summary>
/// Indicates openid profile scope see: http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string OpenIdProfile = "openid profile";
/// <summary>
/// Indicates phone profile scope see: https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string Phone = "phone";
/// <summary>
/// Indicates user_impersonation scope see: http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string UserImpersonation = "user_impersonation";
}
}
| //------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// 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.
//
//------------------------------------------------------------------------------
namespace Microsoft.IdentityModel.Protocols.OpenIdConnect
{
/// <summary>
/// Specific scope values that are interesting to OpenID Connect. See http://openid.net/specs/openid-connect-messages-1_0.html#scopes
/// </summary>
/// <remarks>Can be used to determine the scope by consumers of an <see cref="OpenIdConnectMessage"/>.
/// For example: OpenIdConnectMessageTests.Publics() sets <see cref="OpenIdConnectMessage.Scope"/>
/// to <see cref="OpenIdConnectScope.OpenIdProfile"/>.</remarks>
public static class OpenIdConnectScope
{
/// <summary>
/// Indicates email scope see: http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string Email = "email";
/// <summary>
/// Indicates offline_access scope see: http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string OfflineAccess = "offline_access";
/// <summary>
/// Indicates openid scope see: http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string OpenId = "openid";
/// <summary>
/// Indicates openid profile scope see: http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string OpenIdProfile = "openid profile";
/// <summary>
/// Indicates user_impersonation scope see: http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims.
/// </summary>
public const string UserImpersonation = "user_impersonation";
}
}
| mit | C# |
8728f4b833974a29ddd963889e5a671650978bdd | Update DelegateTemplate.cs | NMSLanX/Natasha | src/Natasha.CSharp/Natasha.CSharp.Template/Template/Method/DelegateTemplate.cs | src/Natasha.CSharp/Natasha.CSharp.Template/Template/Method/DelegateTemplate.cs | using Natasha.CSharp.Builder;
using Natasha.CSharp.Reverser;
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Natasha.CSharp.Template
{
public class DelegateTemplate<T> : MethodBodyTemplate<T> where T : DelegateTemplate<T>, new()
{
private readonly List<Type> _parametersRecoder;
public DelegateTemplate()
{
_parametersRecoder = new List<Type>();
this.Return(typeof(void));
}
public T ReadonlyReturn<S>()
{
return this.ReadonlyReturn(typeof(S));
}
public T ReadonlyReturn(Type type)
{
if (type != typeof(void))
{
Modifier(ModifierFlags.Readonly);
}
return Type(type);
}
public T ReadonlyReturn(MethodInfo info)
{
ModifierAppend(DeclarationReverser.GetReturnPrefix(info));
return ReadonlyReturn(info.ReturnType);
}
public T Return<S>()
{
return this.Return(typeof(S));
}
public T Return(Type type)
{
return Type(type);
}
public T Return(MethodInfo info)
{
ModifierAppend(DeclarationReverser.GetReturnPrefix(info));
return this.Return(info.ReturnType);
}
public T Return(string returnTypeString)
{
return this.Type(returnTypeString);
}
public override T Param(Type type, string paramName, string keywords = default)
{
_parametersRecoder.Add(type);
return base.Param(type, paramName, keywords);
}
public Type DelegateType { get { return DelegateBuilder.GetDelegate(_parametersRecoder.ToArray(), _type); } }
}
}
| using Natasha.CSharp.Builder;
using Natasha.CSharp.Reverser;
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Natasha.CSharp.Template
{
public class DelegateTemplate<T> : MethodBodyTemplate<T> where T : DelegateTemplate<T>, new()
{
private readonly List<Type> _parametersRecoder;
public DelegateTemplate()
{
_parametersRecoder = new List<Type>();
this.Return(typeof(void));
}
public T ReadonlyReturn<S>()
{
return this.ReadonlyReturn(typeof(S));
}
public T ReadonlyReturn(Type type)
{
if (type != typeof(void))
{
Modifier(ModifierFlags.Readonly);
}
return Type(type);
}
public T ReadonlyReturn(MethodInfo info)
{
ModifierAppend(DeclarationReverser.GetReturnPrefix(info));
return ReadonlyReturn(info.ReturnType);
}
public T Return<S>()
{
return this.Return(typeof(S));
}
public T Return(Type type)
{
return Type(type);
}
public T Return(MethodInfo info)
{
ModifierAppend(DeclarationReverser.GetReturnPrefix(info));
return this.Return(info.ReturnType);
}
public T Return(string returnTypeString)
{
return this.Type(returnTypeString);
}
public override T Param(Type type, string paramName, string keywords = default)
{
_parametersRecoder.Add(type);
return base.Param(type, paramName, keywords);
}
public Type DelegateType { get { return DelegateBuilder.GetDelegate(_parametersRecoder.ToArray(), _type); } }
}
}
| mpl-2.0 | C# |
02f429069be691d0b38c878f631b6a3c1de3ff08 | Update ProviderCommonTests.cs | alex-simonov/RedisAspNetProviders | tests/RedisAspNetProviders.Tests/ProviderCommonTests.cs | tests/RedisAspNetProviders.Tests/ProviderCommonTests.cs | using System.Collections.Specialized;
using System.Configuration;
using System.Configuration.Provider;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace RedisAspNetProviders.Tests
{
public class ProviderCommonTests<T> where T : ProviderBase, new()
{
private static readonly object s_providerLock = new object();
private static readonly PrivateType s_providerType = new PrivateType(typeof (T));
protected T CreateProvider()
{
var provider = new T();
provider.Initialize("", new NameValueCollection
{
{ "connectionString", "192.168.0.195:6379,connectTimeout=10000" }
});
return provider;
}
[TestInitialize]
public void ResetInitialization()
{
Monitor.Enter(s_providerLock);
s_providerType.SetStaticField("s_oneTimeInitCalled", false);
}
[TestCleanup]
public void ReleaseLock()
{
Monitor.Exit(s_providerLock);
}
[TestMethod]
[ExpectedException(typeof (ConfigurationErrorsException))]
public void ThrowsConfigurationErrorsExceptionOnRedisHostMissing()
{
var config = new NameValueCollection();
var provider = new T();
provider.Initialize(null, config);
}
[TestMethod]
[ExpectedException(typeof (ConfigurationErrorsException))]
public void ThrowsConfigurationErrorsExceptionOnRedisHostEmptyValue()
{
var config = new NameValueCollection
{
{ "connectionString", "" }
};
var provider = new T();
provider.Initialize(null, config);
}
[TestMethod]
public void CanInitialize()
{
CreateProvider();
}
}
}
| using System.Collections.Specialized;
using System.Configuration;
using System.Configuration.Provider;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace RedisAspNetProviders.Tests
{
public class ProviderCommonTests<T> where T : ProviderBase, new()
{
private static readonly object s_providerLock = new object();
private static readonly PrivateType s_providerType = new PrivateType(typeof (T));
protected T CreateProvider()
{
var provider = new T();
provider.Initialize("", new NameValueCollection
{
{ "connectionString", "192.168.0.195:6379,connectionTimeout=10000" }
});
return provider;
}
[TestInitialize]
public void ResetInitialization()
{
Monitor.Enter(s_providerLock);
s_providerType.SetStaticField("s_oneTimeInitCalled", false);
}
[TestCleanup]
public void ReleaseLock()
{
Monitor.Exit(s_providerLock);
}
[TestMethod]
[ExpectedException(typeof (ConfigurationErrorsException))]
public void ThrowsConfigurationErrorsExceptionOnRedisHostMissing()
{
var config = new NameValueCollection();
var provider = new T();
provider.Initialize(null, config);
}
[TestMethod]
[ExpectedException(typeof (ConfigurationErrorsException))]
public void ThrowsConfigurationErrorsExceptionOnRedisHostEmptyValue()
{
var config = new NameValueCollection
{
{ "connectionString", "" }
};
var provider = new T();
provider.Initialize(null, config);
}
[TestMethod]
public void CanInitialize()
{
CreateProvider();
}
}
} | mit | C# |
cbb92a742a90a080fcb5464124feddbc6c9ca1f0 | Improve Enum display. Work Item #1985 | CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork,CslaGenFork/CslaGenFork | trunk/Solutions/CslaGenFork/Metadata/PersistenceType.cs | trunk/Solutions/CslaGenFork/Metadata/PersistenceType.cs | using System.ComponentModel;
namespace CslaGenerator.Metadata
{
public enum PersistenceType
{
[Description("SQL Connection Manager")]
SqlConnectionManager = 1,
[Description("SQL Connection Unshared")]
SqlConnectionUnshared = 2,
LinqContext = 3,
EFContext = 4
}
} | namespace CslaGenerator.Metadata
{
public enum PersistenceType
{
SqlConnectionManager = 1,
SqlConnectionUnshared = 2,
LinqContext = 3,
EFContext = 4
}
} | mit | C# |
953582c5aac5934ab244c06949a426113ff117be | rename for consistency | aonweb/fluent-http | AonWeb.FluentHttp/Caching/CacheEntry.cs | AonWeb.FluentHttp/Caching/CacheEntry.cs | using System.Net.Http;
using AonWeb.FluentHttp.Helpers;
using AonWeb.FluentHttp.Serialization;
namespace AonWeb.FluentHttp.Caching
{
public class CacheEntry
{
private CacheEntry()
: this(new ResponseMetadata())
{
IsEmpty = true;
}
public CacheEntry(object result, HttpRequestMessage request, HttpResponseMessage response, ICacheMetadata metadata)
: this(result, CachingHelpers.CreateResponseMetadata(result, request, response, metadata)) { }
public CacheEntry(object value, IResponseMetadata metadata)
:this(metadata)
{
Value = value;
}
public CacheEntry(IResponseMetadata metadata)
{
Metadata = metadata;
}
public IResponseMetadata Metadata { get; private set; }
public object Value { get; set; }
public bool IsHttpResponseMessage { get; set; }
public bool IsEmpty { get; }
public void UpdateResponseMetadata(HttpRequestMessage request, HttpResponseMessage response, ICacheMetadata metadata)
{
Metadata = CachingHelpers.CreateResponseMetadata(Value, request, response, metadata);
}
public static CacheEntry Empty = new CacheEntry();
}
} | using System.Net.Http;
using AonWeb.FluentHttp.Helpers;
using AonWeb.FluentHttp.Serialization;
namespace AonWeb.FluentHttp.Caching
{
public class CacheEntry
{
private CacheEntry()
: this(new ResponseMetadata())
{
IsEmpty = true;
}
public CacheEntry(object result, HttpRequestMessage request, HttpResponseMessage response, ICacheMetadata metadata)
: this(result, CachingHelpers.CreateResponseMetadata(result, request, response, metadata)) { }
public CacheEntry(object value, IResponseMetadata metadata)
:this(metadata)
{
Value = value;
}
public CacheEntry(IResponseMetadata metadata)
{
Metadata = metadata;
}
public IResponseMetadata Metadata { get; private set; }
public object Value { get; set; }
public bool IsHttpResponseMessage { get; set; }
public bool IsEmpty { get; }
public void UpdateResponseInfo(HttpRequestMessage request, HttpResponseMessage response, ICacheMetadata metadata)
{
Metadata = CachingHelpers.CreateResponseMetadata(Value, request, response, metadata);
}
public static CacheEntry Empty = new CacheEntry();
}
} | mit | C# |
eea0627ba4affc4ee1fefd6aea526c776df27694 | Revert "no" | a312b/SteamMaster | SteamMaster/RecommenderSystemCore/Program.cs | SteamMaster/RecommenderSystemCore/Program.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.Forms;
using DatabaseCore;
using MongoDB.Bson.IO;
using GameRank;
using RecommenderSystemCore.Controller;
using SteamSharpCore;
using SteamSharpCore.steamStore;
using SteamSharpCore.steamStore.models;
using SteamUI;
namespace RecommenderSystemCore
{
class Program
{
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
SteamTheme UI = new SteamTheme();
RSController controller = new RSController(UI);
Application.Run(UI); //StartSearchPage()
}
}
}
| 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.Forms;
using DatabaseCore;
using MongoDB.Bson.IO;
using GameRank;
using RecommenderSystemCore.Controller;
using SteamSharpCore;
using SteamSharpCore.steamStore;
using SteamSharpCore.steamStore.models;
using SteamUI;
namespace RecommenderSystemCore
{
class Program
{
static void Main(string[] args)
{
Application.EnableVisualStyles();//
Application.SetCompatibleTextRenderingDefault(false);
SteamTheme UI = new SteamTheme();
RSController controller = new RSController(UI);
Application.Run(UI); //StartSearchPage()
}
}
}
| mit | C# |
4469f15b87b86d37da133041b40d74ccb9ad8294 | Add RequiresElevation constant | JeremyKuhne/buildtools,joperezr/buildtools,naamunds/buildtools,ianhays/buildtools,schaabs/buildtools,tarekgh/buildtools,AlexGhiondea/buildtools,jhendrixMSFT/buildtools,schaabs/buildtools,JeremyKuhne/buildtools,ericstj/buildtools,MattGal/buildtools,dotnet/buildtools,jhendrixMSFT/buildtools,AlexGhiondea/buildtools,jhendrixMSFT/buildtools,tarekgh/buildtools,weshaggard/buildtools,ericstj/buildtools,stephentoub/buildtools,jthelin/dotnet-buildtools,weshaggard/buildtools,nguerrera/buildtools,joperezr/buildtools,nguerrera/buildtools,joperezr/buildtools,mmitche/buildtools,MattGal/buildtools,ianhays/buildtools,roncain/buildtools,karajas/buildtools,schaabs/buildtools,mmitche/buildtools,dotnet/buildtools,crummel/dotnet_buildtools,jhendrixMSFT/buildtools,JeremyKuhne/buildtools,ChadNedzlek/buildtools,karajas/buildtools,ianhays/buildtools,jthelin/dotnet-buildtools,ericstj/buildtools,ChadNedzlek/buildtools,mmitche/buildtools,naamunds/buildtools,jthelin/dotnet-buildtools,crummel/dotnet_buildtools,AlexGhiondea/buildtools,stephentoub/buildtools,alexperovich/buildtools,nguerrera/buildtools,karajas/buildtools,MattGal/buildtools,tarekgh/buildtools,roncain/buildtools,schaabs/buildtools,dotnet/buildtools,chcosta/buildtools,tarekgh/buildtools,MattGal/buildtools,dotnet/buildtools,mmitche/buildtools,roncain/buildtools,jthelin/dotnet-buildtools,nguerrera/buildtools,crummel/dotnet_buildtools,naamunds/buildtools,chcosta/buildtools,JeremyKuhne/buildtools,naamunds/buildtools,stephentoub/buildtools,ChadNedzlek/buildtools,stephentoub/buildtools,AlexGhiondea/buildtools,alexperovich/buildtools,chcosta/buildtools,tarekgh/buildtools,roncain/buildtools,weshaggard/buildtools,ChadNedzlek/buildtools,alexperovich/buildtools,chcosta/buildtools,mmitche/buildtools,ianhays/buildtools,alexperovich/buildtools,weshaggard/buildtools,joperezr/buildtools,joperezr/buildtools,MattGal/buildtools,karajas/buildtools,alexperovich/buildtools,ericstj/buildtools,crummel/dotnet_buildtools | src/xunit.netcore.extensions/XunitConstants.cs | src/xunit.netcore.extensions/XunitConstants.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;
using Xunit.Sdk;
namespace Xunit.NetCore.Extensions
{
public struct XunitConstants
{
internal const string NonFreeBSDTest = "nonfreebsdtests";
internal const string NonLinuxTest = "nonlinuxtests";
internal const string NonNetBSDTest = "nonnetbsdtests";
internal const string NonOSXTest = "nonosxtests";
internal const string NonWindowsTest = "nonwindowstests";
internal const string Failing = "failing";
internal const string ActiveIssue = "activeissue";
internal const string OuterLoop = "outerloop";
public const string Category = "category";
public const string IgnoreForCI = "ignoreforci";
public const string RequiresElevation = "requireselevation";
}
}
| // 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;
using Xunit.Sdk;
namespace Xunit.NetCore.Extensions
{
public struct XunitConstants
{
internal const string NonFreeBSDTest = "nonfreebsdtests";
internal const string NonLinuxTest = "nonlinuxtests";
internal const string NonNetBSDTest = "nonnetbsdtests";
internal const string NonOSXTest = "nonosxtests";
internal const string NonWindowsTest = "nonwindowstests";
internal const string Failing = "failing";
internal const string ActiveIssue = "activeissue";
internal const string OuterLoop = "outerloop";
public const string Category = "category";
public const string IgnoreForCI = "ignoreforci";
}
}
| mit | C# |
2faea3692ea74a7ac172cee8db23d2c2aa5db8ff | Change business logic | nigel-sampson/talks,nigel-sampson/talks | mobile-services/Spending.Core/Services/ExpenseService.cs | mobile-services/Spending.Core/Services/ExpenseService.cs | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.MobileServices;
using Microsoft.WindowsAzure.MobileServices.SQLiteStore;
using Microsoft.WindowsAzure.MobileServices.Sync;
namespace Spending.Core.Services
{
public class ExpenseService : IExpenseService
{
private readonly IMobileServiceClient mobileService;
private readonly IMobileServiceSyncTable<ExpenseItem> table;
public ExpenseService(IMobileServiceClient mobileService)
{
this.mobileService = mobileService;
table = mobileService.GetSyncTable<ExpenseItem>();
}
public async Task InitaliseAsync()
{
if (mobileService.SyncContext.IsInitialized)
return;
var store = new MobileServiceSQLiteStore("localstore.db");
store.DefineTable<ExpenseItem>();
await mobileService.SyncContext.InitializeAsync(store);
}
public async Task<IReadOnlyCollection<ExpenseItem>> GetTodaysExpensesAsync()
{
var limit = DateTimeOffset.UtcNow.AddHours(-24);
var expenses = await table
.Where(e => e.Occurred >= limit)
.OrderByDescending(e => e.Occurred)
.ToListAsync();
return expenses.ToArray();
}
public async Task<ExpenseItem> CreateAsync(decimal amount)
{
var expenseItem = new ExpenseItem
{
Amount = amount,
Occurred = DateTimeOffset.UtcNow
};
await table.InsertAsync(expenseItem);
return expenseItem;
}
public Task PushAsync()
{
return mobileService.SyncContext.PushAsync();
}
public Task PullAsync()
{
return table.PullAsync("expenses", table.CreateQuery());
}
}
}
| using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.MobileServices;
using Microsoft.WindowsAzure.MobileServices.SQLiteStore;
using Microsoft.WindowsAzure.MobileServices.Sync;
namespace Spending.Core.Services
{
public class ExpenseService : IExpenseService
{
private readonly IMobileServiceClient mobileService;
private readonly IMobileServiceSyncTable<ExpenseItem> table;
public ExpenseService(IMobileServiceClient mobileService)
{
this.mobileService = mobileService;
table = mobileService.GetSyncTable<ExpenseItem>();
}
public async Task InitaliseAsync()
{
if (mobileService.SyncContext.IsInitialized)
return;
var store = new MobileServiceSQLiteStore("localstore.db");
store.DefineTable<ExpenseItem>();
await mobileService.SyncContext.InitializeAsync(store);
}
public async Task<IReadOnlyCollection<ExpenseItem>> GetTodaysExpensesAsync()
{
var midnight = new DateTimeOffset(DateTime.Today, DateTimeOffset.Now.Offset);
var expenses = await table.Where(e => e.Occurred >= midnight).ToListAsync();
return expenses.ToArray();
}
public async Task<ExpenseItem> CreateAsync(decimal amount)
{
var expenseItem = new ExpenseItem
{
Amount = amount,
Occurred = DateTimeOffset.UtcNow
};
await table.InsertAsync(expenseItem);
return expenseItem;
}
public Task PushAsync()
{
return mobileService.SyncContext.PushAsync();
}
public Task PullAsync()
{
return table.PullAsync("expenses", table.CreateQuery());
}
}
}
| mit | C# |
e2fab62dae900b5f1b2cc60093bf71018c0be234 | fix IsolationController namespace | signumsoftware/framework,signumsoftware/framework | Signum.React.Extensions/Isolation/IsolationController.cs | Signum.React.Extensions/Isolation/IsolationController.cs | using Microsoft.AspNetCore.Mvc;
using Signum.React.Filters;
using Signum.Entities.Isolation;
using Signum.Engine.Isolation;
using Signum.Entities.Authorization;
namespace Signum.React.Isolation;
[ValidateModelFilter]
public class IsolationController : Controller
{
[HttpGet("api/isolations")]
public List<Lite<IsolationEntity>> Isolations()
{
var current = UserEntity.Current.Retrieve().TryMixin<IsolationMixin>()?.Isolation;
if (current != null)
throw new UnauthorizedAccessException("User is only allowed to see isolation:" + current);
return IsolationLogic.Isolations.Value;
}
}
| using Microsoft.AspNetCore.Mvc;
using Signum.React.Filters;
using Signum.Entities.Isolation;
using Signum.Engine.Isolation;
using Signum.Entities.Authorization;
namespace Signum.React.Workflow;
[ValidateModelFilter]
public class IsolationController : Controller
{
[HttpGet("api/isolations")]
public List<Lite<IsolationEntity>> Isolations()
{
var current = UserEntity.Current.Retrieve().TryMixin<IsolationMixin>()?.Isolation;
if (current != null)
throw new UnauthorizedAccessException("User is only allowed to see isolation:" + current);
return IsolationLogic.Isolations.Value;
}
}
| mit | C# |
215967ff9821ab0d333e088bee1f6a6b6288ac75 | delete method updated | Elhior/TestMVC,Elhior/TestMVC,Elhior/TestMVC | UsersMVC/DAL/UserRepository.cs | UsersMVC/DAL/UserRepository.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using UsersMVC.Models;
using System.Data.Entity;
using System.Data.Entity.Migrations;
namespace UsersMVC.DAL
{
public class UserRepository : IRepository<User>
{
private UserContext db;
public UserRepository()
{
this.db = new UserContext();
}
public IEnumerable<User> GetUserList()
{
return db.User.ToList();
}
public User GetUser(long id)
{
User user = db.User.First(n => n.ID == (int)id);
return user;
}
public void Create(User user)
{
db.User.Add(user);
}
public void Update(User user)
{
db.User.AddOrUpdate(h => h.ID, user);
}
public void Delete(long id)
{
User userToRemove = db.User.First(n => n.ID == id);
if (userToRemove != null)
db.User.Remove(userToRemove);
}
public void Save()
{
db.SaveChanges();
}
private bool disposed = false;
public virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
db.Dispose();
}
}
this.disposed = true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using UsersMVC.Models;
using System.Data.Entity;
using System.Data.Entity.Migrations;
namespace UsersMVC.DAL
{
public class UserRepository : IRepository<User>
{
private UserContext db;
public UserRepository()
{
this.db = new UserContext();
}
public IEnumerable<User> GetUserList()
{
return db.User.ToList();
}
public User GetUser(long id)
{
User user = db.User.First(n => n.ID == (int)id);
return user;
}
public void Create(User user)
{
db.User.Add(user);
}
public void Update(User user)
{
db.User.AddOrUpdate(h => h.ID, user);
}
public void Delete(string login)
{
User userToRemove = db.User.First(n => n.Login == login);
if (userToRemove != null)
db.User.Remove(userToRemove);
}
public void Save()
{
db.SaveChanges();
}
private bool disposed = false;
public virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
db.Dispose();
}
}
this.disposed = true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
} | apache-2.0 | C# |
c99158518a794db6c3e62c29af2f250e6befc430 | Add onPause and onUnPause to PauseManager | plrusek/NitoriWare,NitorInc/NitoriWare,uulltt/NitoriWare,Barleytree/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare | Assets/Scripts/Scenario/PauseManager.cs | Assets/Scripts/Scenario/PauseManager.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class PauseManager : MonoBehaviour
{
public UnityEvent onPause, onUnPause;
//Whitelisted items won't be affected by pause
public AudioSource[] audioSourceWhitelist;
public MonoBehaviour[] scriptWhitelist;
private bool paused;
private float timeScale;
private List<AudioSource> pausedAudioSources;
private List<MonoBehaviour> disabledScripts;
void Start ()
{
paused = false;
}
void Update ()
{
if (Input.GetKeyDown(KeyCode.Escape))
if (!paused)
pause();
else
unPause();
}
void pause()
{
timeScale = Time.timeScale;
Time.timeScale = 0f;
AudioSource[] audioSources = FindObjectsOfType(typeof(AudioSource)) as AudioSource[];
pausedAudioSources = new List<AudioSource>();
List<AudioSource> whitelistedAudioSources = new List<AudioSource>(audioSourceWhitelist);
foreach (AudioSource source in audioSources)
{
if (!whitelistedAudioSources.Remove(source) && source.isPlaying)
{
source.Pause();
pausedAudioSources.Add(source);
}
}
MonoBehaviour[] scripts = FindObjectsOfType(typeof(MonoBehaviour)) as MonoBehaviour[];
disabledScripts = new List<MonoBehaviour>();
List<MonoBehaviour> whitelistedScripts = new List<MonoBehaviour>(scriptWhitelist);
foreach( MonoBehaviour script in scripts)
{
if (!whitelistedScripts.Remove(script) && script.enabled && script != this)
{
script.enabled = false;
disabledScripts.Add(script);
}
}
onPause.Invoke();
if (MicrogameController.instance != null)
MicrogameController.instance.onPause.Invoke();
paused = true;
}
void unPause()
{
Time.timeScale = timeScale;
foreach (AudioSource source in pausedAudioSources)
{
source.UnPause();
}
foreach (MonoBehaviour script in disabledScripts)
{
script.enabled = true;
}
onUnPause.Invoke();
if (MicrogameController.instance != null)
MicrogameController.instance.onUnPause.Invoke();
paused = false;
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseManager : MonoBehaviour
{
//Whitelisted items won't be affected by pause
public AudioSource[] audioSourceWhitelist;
public MonoBehaviour[] scriptWhitelist;
private bool paused;
private float timeScale;
private List<AudioSource> pausedAudioSources;
private List<MonoBehaviour> disabledScripts;
void Start ()
{
paused = false;
}
void Update ()
{
if (Input.GetKeyDown(KeyCode.Escape))
if (!paused)
pause();
else
unPause();
}
void pause()
{
timeScale = Time.timeScale;
Time.timeScale = 0f;
AudioSource[] audioSources = FindObjectsOfType(typeof(AudioSource)) as AudioSource[];
pausedAudioSources = new List<AudioSource>();
List<AudioSource> whitelistedAudioSources = new List<AudioSource>(audioSourceWhitelist);
foreach (AudioSource source in audioSources)
{
if (!whitelistedAudioSources.Remove(source) && source.isPlaying)
{
source.Pause();
pausedAudioSources.Add(source);
}
}
MonoBehaviour[] scripts = FindObjectsOfType(typeof(MonoBehaviour)) as MonoBehaviour[];
disabledScripts = new List<MonoBehaviour>();
List<MonoBehaviour> whitelistedScripts = new List<MonoBehaviour>(scriptWhitelist);
foreach( MonoBehaviour script in scripts)
{
if (!whitelistedScripts.Remove(script) && script.enabled && script != this)
{
script.enabled = false;
disabledScripts.Add(script);
}
}
if (MicrogameController.instance != null)
MicrogameController.instance.onPause.Invoke();
paused = true;
}
void unPause()
{
Time.timeScale = timeScale;
foreach (AudioSource source in pausedAudioSources)
{
source.UnPause();
}
foreach (MonoBehaviour script in disabledScripts)
{
script.enabled = true;
}
if (MicrogameController.instance != null)
MicrogameController.instance.onUnPause.Invoke();
paused = false;
}
}
| mit | C# |
2010d87de0e532f9d8d2b25120d7e4a205d41aa4 | Add null check to cache refresher | TeaCommerce/Tea-Commerce-for-Umbraco,TeaCommerce/Tea-Commerce-for-Umbraco,TeaCommerce/Tea-Commerce-for-Umbraco | Source/TeaCommerce.Umbraco.Application/Caching/TeaCommerceCacheRefresherBase.cs | Source/TeaCommerce.Umbraco.Application/Caching/TeaCommerceCacheRefresherBase.cs | using Autofac;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using TeaCommerce.Api.Dependency;
using TeaCommerce.Api.Infrastructure.Caching;
using umbraco.interfaces;
using Umbraco.Core.Cache;
namespace TeaCommerce.Umbraco.Application.Caching
{
public abstract class TeaCommerceCacheRefresherBase<TInstanceType, TEntity, TId> : JsonCacheRefresherBase<TInstanceType>
where TInstanceType : ICacheRefresher
{
protected ICacheService CacheService => DependencyContainer.Instance.Resolve<ICacheService>();
public abstract string CacheKeyFormat { get; }
public override void Refresh(string jsonPayload)
{
var payload = JsonConvert.DeserializeObject<TeaCommerceCacheRefresherPayload<TId>>(jsonPayload);
// Make sure it wasn't this instance that sent the payload
if (payload != null && payload.InstanceId != Constants.InstanceId)
{
var cacheKey = string.Format(CacheKeyFormat, payload.StoreId, payload.Id);
var cache = CacheService.GetCacheValue<ConcurrentDictionary<TId, TEntity>>(cacheKey);
if (cache != null && cache.ContainsKey(payload.Id))
{
cache.TryRemove(payload.Id, out var removed);
}
base.Refresh(jsonPayload);
}
}
public override void Refresh(int id)
{
throw new NotSupportedException();
}
public override void Refresh(Guid id)
{
throw new NotSupportedException();
}
public override void RefreshAll()
{
throw new NotSupportedException();
}
public override void Remove(int id)
{
throw new NotSupportedException();
}
}
} | using Autofac;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using TeaCommerce.Api.Dependency;
using TeaCommerce.Api.Infrastructure.Caching;
using umbraco.interfaces;
using Umbraco.Core.Cache;
namespace TeaCommerce.Umbraco.Application.Caching
{
public abstract class TeaCommerceCacheRefresherBase<TInstanceType, TEntity, TId> : JsonCacheRefresherBase<TInstanceType>
where TInstanceType : ICacheRefresher
{
protected ICacheService CacheService => DependencyContainer.Instance.Resolve<ICacheService>();
public abstract string CacheKeyFormat { get; }
public override void Refresh(string jsonPayload)
{
var payload = JsonConvert.DeserializeObject<TeaCommerceCacheRefresherPayload<TId>>(jsonPayload);
// Make sure it wasn't this instance that sent the payload
if (payload.InstanceId != Constants.InstanceId)
{
var cacheKey = string.Format(CacheKeyFormat, payload.StoreId, payload.Id);
var cache = CacheService.GetCacheValue<ConcurrentDictionary<TId, TEntity>>(cacheKey);
if (cache.ContainsKey(payload.Id))
{
cache.TryRemove(payload.Id, out var removed);
}
base.Refresh(jsonPayload);
}
}
public override void Refresh(int id)
{
throw new NotSupportedException();
}
public override void Refresh(Guid id)
{
throw new NotSupportedException();
}
public override void RefreshAll()
{
throw new NotSupportedException();
}
public override void Remove(int id)
{
throw new NotSupportedException();
}
}
} | mit | C# |
ad650adab0b9ea2b226b10523193f96439265c6c | Fix speed note count sum | peppy/osu,peppy/osu,ppy/osu,ppy/osu,ppy/osu,peppy/osu | osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.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.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty.Evaluators;
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
{
/// <summary>
/// Represents the skill required to press keys with regards to keeping up with the speed at which objects need to be hit.
/// </summary>
public class Speed : OsuStrainSkill
{
private double skillMultiplier => 1375;
private double strainDecayBase => 0.3;
private double currentStrain;
private double currentRhythm;
protected override int ReducedSectionCount => 5;
protected override double DifficultyMultiplier => 1.04;
private readonly double greatWindow;
private readonly List<double> objectStrains = new List<double>();
public Speed(Mod[] mods, double hitWindowGreat)
: base(mods)
{
greatWindow = hitWindowGreat;
}
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime);
protected override double StrainValueAt(DifficultyHitObject current)
{
currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime);
currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current, greatWindow) * skillMultiplier;
currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, greatWindow);
double totalStrain = currentStrain * currentRhythm;
objectStrains.Add(totalStrain);
return totalStrain;
}
public double RelevantNoteCount()
{
if (objectStrains.Count == 0)
return 0;
double maxStrain = objectStrains.Max();
if (maxStrain == 0)
return 0;
return objectStrains.Sum(strain => 1.0 / (1.0 + Math.Exp(-(strain / maxStrain * 12.0 - 6.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.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty.Evaluators;
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
{
/// <summary>
/// Represents the skill required to press keys with regards to keeping up with the speed at which objects need to be hit.
/// </summary>
public class Speed : OsuStrainSkill
{
private double skillMultiplier => 1375;
private double strainDecayBase => 0.3;
private double currentStrain;
private double currentRhythm;
protected override int ReducedSectionCount => 5;
protected override double DifficultyMultiplier => 1.04;
private readonly double greatWindow;
private readonly List<double> objectStrains = new List<double>();
public Speed(Mod[] mods, double hitWindowGreat)
: base(mods)
{
greatWindow = hitWindowGreat;
}
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime);
protected override double StrainValueAt(DifficultyHitObject current)
{
currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime);
currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current, greatWindow) * skillMultiplier;
currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, greatWindow);
double totalStrain = currentStrain * currentRhythm;
objectStrains.Add(totalStrain);
return totalStrain;
}
public double RelevantNoteCount()
{
if (objectStrains.Count == 0)
return 0;
double maxStrain = objectStrains.Max();
if (maxStrain == 0)
return 0;
return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Exp(-(next / maxStrain * 12.0 - 6.0)))));
}
}
}
| mit | C# |
f9ae51775d010c4547947cc854afd165063d78f0 | Create an empty Home controller. | ismaelbelghiti/Tigwi,ismaelbelghiti/Tigwi | Tigwi/Tigwi.UI/Controllers/HomeController.cs | Tigwi/Tigwi.UI/Controllers/HomeController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Tigwi.UI.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
this.ViewBag.CurrentUser = "Zak";
return this.View();
}
public ActionResult About()
{
return View();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Tigwi.UI.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
throw new NotImplementedException("HomeController.Index");
}
public ActionResult About()
{
return View();
}
}
}
| bsd-3-clause | C# |
39f4771faa73681591fd2281ba4ed30c546206e5 | Remove unnecessary object creation of IAnnotation | criteo/zipkin4net,criteo/zipkin4net | Criteo.Profiling.Tracing/Annotations.cs | Criteo.Profiling.Tracing/Annotations.cs | using System.Net;
using Criteo.Profiling.Tracing.Annotation;
namespace Criteo.Profiling.Tracing
{
/// <summary>
/// Factory for annotations
/// </summary>
public static class Annotations
{
private static readonly IAnnotation AnnClientReceive = new ClientRecv();
private static readonly IAnnotation AnnClientSend = new ClientSend();
private static readonly IAnnotation AnnServerReceive = new ServerRecv();
private static readonly IAnnotation AnnServerSend = new ServerSend();
public static IAnnotation ClientRecv()
{
return AnnClientReceive;
}
public static IAnnotation ClientSend()
{
return AnnClientSend;
}
public static IAnnotation ServerRecv()
{
return AnnServerReceive;
}
public static IAnnotation ServerSend()
{
return AnnServerSend;
}
public static IAnnotation Rpc(string name)
{
return new Rpc(name);
}
public static IAnnotation ServiceName(string name)
{
return new ServiceName(name);
}
public static IAnnotation LocalAddr(IPEndPoint endPoint)
{
return new LocalAddr(endPoint);
}
public static IAnnotation Binary(string key, object value)
{
return new BinaryAnnotation(key, value);
}
public static IAnnotation Event(string name)
{
return new Event(name);
}
}
}
| using System.Net;
using Criteo.Profiling.Tracing.Annotation;
namespace Criteo.Profiling.Tracing
{
/// <summary>
/// Factory for annotations
/// </summary>
public static class Annotations
{
public static IAnnotation ClientRecv()
{
return new ClientRecv();
}
public static IAnnotation ClientSend()
{
return new ClientSend();
}
public static IAnnotation ServerRecv()
{
return new ServerRecv();
}
public static IAnnotation ServerSend()
{
return new ServerSend();
}
public static IAnnotation Rpc(string name)
{
return new Rpc(name);
}
public static IAnnotation ServiceName(string name)
{
return new ServiceName(name);
}
public static IAnnotation LocalAddr(IPEndPoint endPoint)
{
return new LocalAddr(endPoint);
}
public static IAnnotation Binary(string key, object value)
{
return new BinaryAnnotation(key, value);
}
public static IAnnotation Event(string name)
{
return new Event(name);
}
}
}
| apache-2.0 | C# |
6fa02a2441a07c1ef93f0748cb7f64a788f365ea | Remove browser type param | LiquidThinking/Xenon,LiquidThinking/Xenon | Xenon.Tests/MoveToElementTests/BaseMoveToElementTests.cs | Xenon.Tests/MoveToElementTests/BaseMoveToElementTests.cs | using NUnit.Framework;
using Xenon.Tests.Integration;
namespace Xenon.Tests.MoveToElementTests
{
public abstract class BaseMoveToElementTests<T> : BaseXenonIntegrationTest where T : BaseXenonTest<T>
{
protected abstract BaseXenonTest<T> CreateInstance( IXenonBrowser browser );
public BaseMoveToElementTests()
{
XenonTestsResourceLookup.Folder( "MoveToElementTests" );
}
public void MoveToElement_WhenMovingToElement_MovesToElement()
{
var html = XenonTestsResourceLookup.GetContent( "MoveToElement" );
using ( var browserTest = new BrowserTest( html ) )
{
var browser = browserTest.Start();
CreateInstance( browser )
.GoToUrl( "/" )
.MoveToElement( "#element" );
Assert.AreEqual( "worked", browserTest.GetPostResult()[ "temp" ] );
}
}
}
} | using NUnit.Framework;
using Xenon.Tests.Integration;
namespace Xenon.Tests.MoveToElementTests
{
public abstract class BaseMoveToElementTests<T> : BaseXenonIntegrationTest where T : BaseXenonTest<T>
{
protected abstract BaseXenonTest<T> CreateInstance( IXenonBrowser browser );
public BaseMoveToElementTests()
{
XenonTestsResourceLookup.Folder( "MoveToElementTests" );
}
public void MoveToElement_WhenMovingToElement_MovesToElement( BrowserType browserType )
{
var html = XenonTestsResourceLookup.GetContent( "MoveToElement" );
using ( var browserTest = new BrowserTest( html ) )
{
var browser = browserTest.Start( browserType );
CreateInstance( browser )
.GoToUrl( "/" )
.MoveToElement( "#element" );
Assert.AreEqual( "worked", browserTest.GetPostResult()[ "temp" ] );
}
}
}
} | mit | C# |
5a49a72ad1e2e7e2fb036b2ceaded6213f478aac | Fix more dependencies | michael-reichenauer/Dependinator | Dependinator/ModelViewing/CodeViewing/CodeDialog.xaml.cs | Dependinator/ModelViewing/CodeViewing/CodeDialog.xaml.cs | using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Xml;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
namespace Dependinator.ModelViewing.CodeViewing
{
/// <summary>
/// Interaction logic for ReferencesDialog.xaml
/// </summary>
public partial class CodeDialog : Window
{
internal CodeDialog(Window owner, string title, Task<string> codeTask)
{
Owner = owner;
InitializeComponent();
DataContext = new CodeViewModel(title);
SetSyntaxHighlighting();
SetCodeText(codeTask);
}
private async void SetCodeText(Task<string> codeTask)
{
CodeView.Text = "Getting code ...";
CodeView.Text = await codeTask;
}
private void SetSyntaxHighlighting()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string name = executingAssembly.FullName.Split(',')[0];
string resourceName = $"{name}.Common.Resources.CSharp-Mode.xshd";
using (Stream stream = executingAssembly.GetManifestResourceStream(resourceName))
using (XmlTextReader reader = new XmlTextReader(stream))
{
CodeView.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance);
}
}
}
}
| using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Xml;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
namespace Dependinator.ModelViewing.CodeViewing
{
/// <summary>
/// Interaction logic for ReferencesDialog.xaml
/// </summary>
public partial class CodeDialog : Window
{
internal CodeDialog(Window owner, string title, Task<string> codeTask)
{
Owner = owner;
InitializeComponent();
DataContext = new CodeViewModel(title);
SetSyntaxHighlighting();
SetCodeText(codeTask);
}
private async void SetCodeText(Task<string> codeTask)
{
CodeView.Text = "Getting code ...";
CodeView.Text = await codeTask;
}
private void SetSyntaxHighlighting()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string resourceName = $"{Product.Name}.Common.Resources.CSharp-Mode.xshd";
using (Stream stream = executingAssembly.GetManifestResourceStream(resourceName))
using (XmlTextReader reader = new XmlTextReader(stream))
{
CodeView.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance);
}
}
}
}
| mit | C# |
688ced0c629deff3a51875e9674be604964297a6 | Add missing completion list icons | mrward/monodevelop-powershell-addin | src/MonoDevelop.PowerShell/MonoDevelop.PowerShell/PowerShellCompletionData.cs | src/MonoDevelop.PowerShell/MonoDevelop.PowerShell/PowerShellCompletionData.cs | //
// PowerShellCompletionData.cs
//
// Author:
// Matt Ward <matt.ward@xamarin.com>
//
// Copyright (c) 2016 Xamarin Inc. (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
using MonoDevelop.Core;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Gui;
namespace MonoDevelop.PowerShell
{
class PowerShellCompletionData : CompletionData
{
public PowerShellCompletionData (CompletionItem item)
{
CompletionItem = item;
CompletionText = item.InsertText;
Icon = GetIcon (item);
}
public CompletionItem CompletionItem { get; private set; }
/// <summary>
/// Returns InsertText instead of Label so parameters are handled (e.g. -path).
/// VSCode shows only the parameter name without the '-'. It is simpler to
/// show the '-' as part of the text in the code completion list in MonoDevelop
/// than to support it as VSCode does.
/// </summary>
public override string DisplayText {
get { return CompletionItem.InsertText; }
set { base.DisplayText = value; }
}
public override string Description {
get {
return GLib.Markup.EscapeText (CompletionItem.Detail ?? string.Empty);
}
set { base.Description = value; }
}
static IconId GetIcon (CompletionItem item)
{
if (!item.Kind.HasValue)
return null;
switch (item.Kind) {
case CompletionItemKind.Property:
return Stock.Property;
case CompletionItemKind.Constructor:
case CompletionItemKind.Method:
case CompletionItemKind.Function:
return Stock.Method;
case CompletionItemKind.Text:
case CompletionItemKind.Keyword:
return Stock.Literal;
case CompletionItemKind.Class:
return Stock.Class;
case CompletionItemKind.Field:
return Stock.PrivateField;
case CompletionItemKind.Interface:
return Stock.Interface;
case CompletionItemKind.Module:
return Stock.NameSpace;
case CompletionItemKind.Enum:
return Stock.Enum;
case CompletionItemKind.Variable:
return "md-variable";
case CompletionItemKind.File:
return Stock.EmptyFileIcon;
default:
return null;
}
}
}
}
| //
// PowerShellCompletionData.cs
//
// Author:
// Matt Ward <matt.ward@xamarin.com>
//
// Copyright (c) 2016 Xamarin Inc. (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using Microsoft.PowerShell.EditorServices.Protocol.LanguageServer;
using MonoDevelop.Core;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Gui;
namespace MonoDevelop.PowerShell
{
class PowerShellCompletionData : CompletionData
{
public PowerShellCompletionData (CompletionItem item)
{
CompletionItem = item;
CompletionText = item.InsertText;
Icon = GetIcon (item);
}
public CompletionItem CompletionItem { get; private set; }
/// <summary>
/// Returns InsertText instead of Label so parameters are handled (e.g. -path).
/// VSCode shows only the parameter name without the '-'. It is simpler to
/// show the '-' as part of the text in the code completion list in MonoDevelop
/// than to support it as VSCode does.
/// </summary>
public override string DisplayText {
get { return CompletionItem.InsertText; }
set { base.DisplayText = value; }
}
public override string Description {
get {
return GLib.Markup.EscapeText (CompletionItem.Detail ?? string.Empty);
}
set { base.Description = value; }
}
static IconId GetIcon (CompletionItem item)
{
if (!item.Kind.HasValue)
return null;
switch (item.Kind) {
case CompletionItemKind.Property:
return Stock.Property;
case CompletionItemKind.Constructor:
case CompletionItemKind.Method:
case CompletionItemKind.Function:
return Stock.Method;
case CompletionItemKind.Text:
case CompletionItemKind.Keyword:
return Stock.Literal;
case CompletionItemKind.Class:
return Stock.Class;
case CompletionItemKind.Field:
return Stock.PrivateField;
case CompletionItemKind.Interface:
return Stock.Interface;
case CompletionItemKind.Module:
return Stock.NameSpace;
case CompletionItemKind.Enum:
return Stock.Enum;
default:
return null;
}
}
}
}
| mit | C# |
251c76601eaccb341200f89f9420aeea4d017326 | Add !OsuFileLocation! command | Piotrekol/StreamCompanion,Piotrekol/StreamCompanion | osu!StreamCompanion/Code/Modules/MapDataReplacements/Map/MapReplacement.cs | osu!StreamCompanion/Code/Modules/MapDataReplacements/Map/MapReplacement.cs | using System.Collections.Generic;
using osu_StreamCompanion.Code.Core;
using osu_StreamCompanion.Code.Core.DataTypes;
using osu_StreamCompanion.Code.Helpers;
using osu_StreamCompanion.Code.Interfeaces;
namespace osu_StreamCompanion.Code.Modules.MapDataReplacements.Map
{
class MapReplacement :IModule,IMapDataReplacements,ISettings
{
private Settings _settings;
public bool Started { get; set; }
public void Start(ILogger logger){ Started = true; }
public Dictionary<string, string> GetMapReplacements(MapSearchResult map)
{
if (map.FoundBeatmaps)
{
var dict = map.BeatmapsFound[0].GetDict(map.Mods);
var osuLocation = _settings.Get("MainOsuDirectory", "");
if (string.IsNullOrWhiteSpace(osuLocation))
dict.Add("!OsuFileLocation!","");
else
dict.Add("!OsuFileLocation!",System.IO.Path.Combine(osuLocation, "Songs", map.BeatmapsFound[0].Dir, map.BeatmapsFound[0].OsuFileName));
return dict;
}
return new Dictionary<string, string>();
}
public void SetSettingsHandle(Settings settings)
{
_settings = settings;
}
}
}
| using System.Collections.Generic;
using osu_StreamCompanion.Code.Core.DataTypes;
using osu_StreamCompanion.Code.Helpers;
using osu_StreamCompanion.Code.Interfeaces;
namespace osu_StreamCompanion.Code.Modules.MapDataReplacements.Map
{
class MapReplacement :IModule,IMapDataReplacements
{
public bool Started { get; set; }
public void Start(ILogger logger){ Started = true; }
public Dictionary<string, string> GetMapReplacements(MapSearchResult map)
{
if (map.FoundBeatmaps)
{
var dict = map.BeatmapsFound[0].GetDict(map.Mods);
return dict;
}
return new Dictionary<string, string>();
}
}
}
| mit | C# |
eb76957dafb06dc564529f48df8f820ffcbb20dc | Change the way to use underlying enumerator. | skahal/Buildron,skahal/Buildron,skahal/Buildron | src/Buildron/Assets/_Assets/Scripts/Domain/Sorting/SortingAlgorithmBase.cs | src/Buildron/Assets/_Assets/Scripts/Domain/Sorting/SortingAlgorithmBase.cs | #region Usings
using System.Collections.Generic;
using System;
using System.Linq;
using System.Collections;
using UnityEngine;
#endregion
namespace Buildron.Domain.Sorting
{
public abstract class SortingAlgorithmBase<TItem> : ISortingAlgorithm<TItem> where TItem : System.IComparable<TItem>
{
#region Constructors
protected SortingAlgorithmBase (string name)
{
Name = name;
}
#endregion
#region Properties
public string Name { get; private set;}
private IComparer<TItem> Comparer { get; set; }
#endregion
#region Methods
public void Sort (IList<TItem> items, IComparer<TItem> equalityComparer)
{
Messenger.Send ("OnSortingBegin");
Comparer = equalityComparer;
SH.StartCoroutine (CallPerformSort(items));
}
protected abstract IEnumerator PerformSort (IList<TItem> items);
protected bool IsGreaterThan (TItem it, TItem than)
{
return Comparer.Compare(it, than) > 0;
}
protected bool IsLowerThan (TItem it, TItem than)
{
return Comparer.Compare (it, than) < 0;
}
protected WaitForSeconds Swap (IList<TItem> items, int item1Index, int item2Index)
{
var item1 = items [item1Index];
var item2 = items [item2Index];
items [item1Index] = item2;
items [item2Index] = item1;
Messenger.Send ("OnSortingItemsSwapped", new TItem[] { item1, item2 });
return new WaitForSeconds(SortingAlgorithmFactory.SwappingTime);
}
private IEnumerator CallPerformSort(IList<TItem> items)
{
var enumerator = PerformSort(items);
yield return enumerator;
Messenger.Send("OnSortingEnded");
}
#endregion
}
} | #region Usings
using System.Collections.Generic;
using System;
using System.Linq;
using System.Collections;
using UnityEngine;
#endregion
namespace Buildron.Domain.Sorting
{
public abstract class SortingAlgorithmBase<TItem> : ISortingAlgorithm<TItem> where TItem : System.IComparable<TItem>
{
#region Constructors
protected SortingAlgorithmBase (string name)
{
Name = name;
}
#endregion
#region Properties
public string Name { get; private set;}
private IComparer<TItem> Comparer { get; set; }
#endregion
#region Methods
public void Sort (IList<TItem> items, IComparer<TItem> equalityComparer)
{
Messenger.Send ("OnSortingBegin");
Comparer = equalityComparer;
SH.StartCoroutine (CallPerformSort(items));
}
protected abstract IEnumerator PerformSort (IList<TItem> items);
protected bool IsGreaterThan (TItem it, TItem than)
{
return Comparer.Compare(it, than) > 0;
}
protected bool IsLowerThan (TItem it, TItem than)
{
return Comparer.Compare (it, than) < 0;
}
protected WaitForSeconds Swap (IList<TItem> items, int item1Index, int item2Index)
{
var item1 = items [item1Index];
var item2 = items [item2Index];
items [item1Index] = item2;
items [item2Index] = item1;
Messenger.Send ("OnSortingItemsSwapped", new TItem[] { item1, item2 });
return new WaitForSeconds(SortingAlgorithmFactory.SwappingTime);
}
private IEnumerator CallPerformSort(IList<TItem> items)
{
yield return PerformSort(items);
Messenger.Send("OnSortingEnded");
}
#endregion
}
} | mit | C# |
9e5a58a5a75dbe5fb03cd9adad08d5eee082bea9 | Improve DotNetVersionFinder | canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor | src/SyncTrayzor/Utils/DotNetVersionFinder.cs | src/SyncTrayzor/Utils/DotNetVersionFinder.cs | using Microsoft.Win32;
using System;
using System.Collections.Generic;
namespace SyncTrayzor.Utils
{
public static class DotNetVersionFinder
{
// See https://msdn.microsoft.com/en-us/library/hh925568.aspx#net_d
private static readonly Dictionary<int, string> versionMapping = new Dictionary<int, string>()
{
{ 378389, "4.5" },
{ 378675, "4.5.1 on Windows 8.1 or Windows Server 2012 R2" },
{ 378758, "4.5.1 on WIndows 8, Wwndows 7 SPI1, or Windows Vista SP2" },
{ 379893, "4.5.2" },
{ 393295, "4.6 on Windows 10" },
{ 393297, "4.6 on all other OS versions" },
{ 394254, "4.6.1 on Windows 10 November Update systems" },
{ 394271, "4.6.1 on all other OS versions" },
};
public static string FindDotNetVersion()
{
try
{
using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\"))
{
int releaseKey = Convert.ToInt32(ndpKey.GetValue("Release"));
return $"{DescriptionForReleaseKey(releaseKey)} ({releaseKey})";
}
}
catch (Exception e)
{
return $"Unknown ({e.Message})";
}
}
private static string DescriptionForReleaseKey(int releaseKey)
{
string description;
if (!versionMapping.TryGetValue(releaseKey, out description))
description = "Unknown";
return description;
}
}
}
| using Microsoft.Win32;
using System;
namespace SyncTrayzor.Utils
{
public static class DotNetVersionFinder
{
// See https://msdn.microsoft.com/en-us/library/hh925568.aspx#net_d
public static string FindDotNetVersion()
{
try
{
using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\"))
{
int releaseKey = Convert.ToInt32(ndpKey.GetValue("Release"));
return $"{CheckFor45DotVersion(releaseKey)} ({releaseKey})";
}
}
catch (Exception e)
{
return $"Unknown ({e.Message})";
}
}
private static string CheckFor45DotVersion(int releaseKey)
{
if (releaseKey == 394271)
{
return "4.6.1 on all other Windows OS versions";
}
if (releaseKey == 394254)
{
return "4.6.1 on Windows 10";
}
if (releaseKey == 393297)
{
return "4.6 on all other Windows OS versions";
}
if (releaseKey == 393295)
{
return "4.6 or later on Windows 10";
}
if ((releaseKey >= 379893))
{
return "4.5.2 or later";
}
if ((releaseKey >= 378675))
{
return "4.5.1 or later";
}
if ((releaseKey >= 378389))
{
return "4.5 or later";
}
// This line should never execute. A non-null release key should mean
// that 4.5 or later is installed.
return "No 4.5 or later version detected";
}
}
}
| mit | C# |
5efdfee7d88bb4dd1dd6ee49c3016c82ee9cd1b5 | Update Program.cs | citizenkraft/UpsStreetAddressValidation | ValidatorExample/ValidatorExample/Program.cs | ValidatorExample/ValidatorExample/Program.cs | using citizenkraft.UpsStreetAddressValidation.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ValidatorExample
{
class Program
{
static void Main(string[] args)
{
//Usage:
//create the object
var validator = new citizenkraft.UpsStreetAddressValidation.UpsStreetAddressValidator("username", "password", "license key", false);
//get the response
var validatorResponse = validator.ValidateAddress("1865 GAYLORD ST", "DENVER", "CO", "80206-1236", "US");
switch (validatorResponse.Status)
{
case AddressValidationResult.ResponseStatus.CorrectionFound:
//corrected address can be found here: validatorResponse.CorrectedAddress.Street validatorResponse.CorrectedAddress.Whatever
Console.WriteLine(validatorResponse.CorrectedAddress.Street);
break;
case AddressValidationResult.ResponseStatus.NoCorrectionFound:
//no corrected address was found, but everything went fine.
Console.WriteLine(validatorResponse.ResponseMessage);
break;
case AddressValidationResult.ResponseStatus.ErrorInResponse:
//there was an error sent back from UPS, usually bad credentials. Find the details under validatorResponse.ErrorDetail.whatever
Console.WriteLine(validatorResponse.ErrorDetail.PrimaryErrorCode.Description);
break;
case AddressValidationResult.ResponseStatus.Exception:
//big break, bad connection probably. I pass the sometimes helpful exception message back
Console.WriteLine(validatorResponse.ResponseMessage);
break;
default:
break;
}
//Voila!
}
}
}
| using citizenkraft.UpsStreetAddressValidation.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ValidatorExample
{
class Program
{
static void Main(string[] args)
{
//Usage:
//create the object
var validator = new citizenkraft.UpsStreetAddressValidation.UpsStreetAddressValidator("peaches5915", "3surdej3", "FC56AE12C4C7DF60", false);
//get the response
var validatorResponse = validator.ValidateAddress("1865 GAYLORD ST", "DENVER", "CO", "80206-1236", "US");
switch (validatorResponse.Status)
{
case AddressValidationResult.ResponseStatus.CorrectionFound:
//corrected address can be found here: validatorResponse.CorrectedAddress.Street validatorResponse.CorrectedAddress.Whatever
Console.WriteLine(validatorResponse.CorrectedAddress.Street);
break;
case AddressValidationResult.ResponseStatus.NoCorrectionFound:
//no corrected address was found, but everything went fine.
Console.WriteLine(validatorResponse.ResponseMessage);
break;
case AddressValidationResult.ResponseStatus.ErrorInResponse:
//there was an error sent back from UPS, usually bad credentials. Find the details under validatorResponse.ErrorDetail.whatever
Console.WriteLine(validatorResponse.ErrorDetail.PrimaryErrorCode.Description);
break;
case AddressValidationResult.ResponseStatus.Exception:
//big break, bad connection probably. I pass the sometimes helpful exception message back
Console.WriteLine(validatorResponse.ResponseMessage);
break;
default:
break;
}
//Voila!
}
}
}
| mit | C# |
1121dda1d34d384f027fa0f3ee467c2e268df9c8 | Standardize GetOrDefault usage for boolean settings (#1034) | Neurosploit/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode | src/Stratis.Bitcoin.Features.BlockStore/StoreSettings.cs | src/Stratis.Bitcoin.Features.BlockStore/StoreSettings.cs | using System;
using Stratis.Bitcoin.Configuration;
namespace Stratis.Bitcoin.Features.BlockStore
{
/// <summary>
/// Configuration related to storage of transactions.
/// </summary>
public class StoreSettings
{
/// <summary><c>true</c> to maintain a full transaction index.</summary>
public bool TxIndex { get; set; }
/// <summary><c>true</c> to rebuild chain state and block index from block data files on disk.</summary>
public bool ReIndex { get; set; }
/// <summary><c>true</c> to enable pruning to reduce storage requirements by enabling deleting of old blocks.</summary>
public bool Prune { get; set; }
private Action<StoreSettings> callback = null;
public StoreSettings()
{
}
public StoreSettings(Action<StoreSettings> callback)
: this()
{
this.callback = callback;
}
public StoreSettings(NodeSettings nodeSettings, Action<StoreSettings> callback = null)
: this(callback)
{
this.Load(nodeSettings);
}
/// <summary>
/// Loads the storage related settings from the application configuration.
/// </summary>
/// <param name="nodeSettings">Application configuration.</param>
public virtual void Load(NodeSettings nodeSettings)
{
var config = nodeSettings.ConfigReader;
this.Prune = config.GetOrDefault<bool>("prune", false);
this.TxIndex = config.GetOrDefault<bool>("txindex", false);
this.ReIndex = config.GetOrDefault<bool>("reindex", false);
this.callback?.Invoke(this);
if (this.Prune && this.TxIndex)
throw new ConfigurationException("Prune mode is incompatible with -txindex");
}
}
}
| using System;
using Stratis.Bitcoin.Configuration;
namespace Stratis.Bitcoin.Features.BlockStore
{
/// <summary>
/// Configuration related to storage of transactions.
/// </summary>
public class StoreSettings
{
/// <summary><c>true</c> to maintain a full transaction index.</summary>
public bool TxIndex { get; set; }
/// <summary><c>true</c> to rebuild chain state and block index from block data files on disk.</summary>
public bool ReIndex { get; set; }
/// <summary><c>true</c> to enable pruning to reduce storage requirements by enabling deleting of old blocks.</summary>
public bool Prune { get; set; }
private Action<StoreSettings> callback = null;
public StoreSettings()
{
}
public StoreSettings(Action<StoreSettings> callback)
: this()
{
this.callback = callback;
}
public StoreSettings(NodeSettings nodeSettings, Action<StoreSettings> callback = null)
: this(callback)
{
this.Load(nodeSettings);
}
/// <summary>
/// Loads the storage related settings from the application configuration.
/// </summary>
/// <param name="nodeSettings">Application configuration.</param>
public virtual void Load(NodeSettings nodeSettings)
{
var config = nodeSettings.ConfigReader;
this.Prune = config.GetOrDefault("prune", 0) != 0;
this.TxIndex = config.GetOrDefault("txindex", 0) != 0;
this.ReIndex = config.GetOrDefault("reindex", 0) != 0;
this.callback?.Invoke(this);
if (this.Prune && this.TxIndex)
throw new ConfigurationException("Prune mode is incompatible with -txindex");
}
}
}
| mit | C# |
9d0f4b0a297e01f73e2cf840321a9c2bf7e67d73 | Allow base master page to be overridden | EminentTechnology/CodeTorch | src/webforms/CodeTorch.Web/MasterPages/BaseMasterPage.cs | src/webforms/CodeTorch.Web/MasterPages/BaseMasterPage.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using System.Reflection;
using System.Web.UI;
namespace CodeTorch.Web.MasterPages
{
public class BaseMasterPage : System.Web.UI.MasterPage
{
protected Label currentYear;
protected Label currentAppVersion;
protected Label copyrightCompanyName;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (currentYear != null)
this.currentYear.Text = DateTime.Now.Year.ToString();
if (currentAppVersion != null)
this.currentAppVersion.Text = GetCurrentVersion();
if (copyrightCompanyName != null)
this.copyrightCompanyName.Text = CodeTorch.Core.Configuration.GetInstance().App.CopyrightCompanyName;
}
protected string GetCurrentVersion()
{
Assembly currentAssembly = Assembly.GetExecutingAssembly();
Version appVersion = currentAssembly.GetName().Version;
return string.Format("{0}.{1}.{2}", appVersion.Major.ToString(), appVersion.Minor.ToString(), appVersion.Build.ToString());
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using System.Reflection;
using System.Web.UI;
namespace CodeTorch.Web.MasterPages
{
public class BaseMasterPage : System.Web.UI.MasterPage
{
protected Label currentYear;
protected Label currentAppVersion;
protected Label copyrightCompanyName;
protected void Page_Load(object sender, EventArgs e)
{
if (currentYear != null)
this.currentYear.Text = DateTime.Now.Year.ToString();
if (currentAppVersion != null)
this.currentAppVersion.Text = GetCurrentVersion();
if (copyrightCompanyName != null)
this.copyrightCompanyName.Text = CodeTorch.Core.Configuration.GetInstance().App.CopyrightCompanyName;
}
protected string GetCurrentVersion()
{
Assembly currentAssembly = Assembly.GetExecutingAssembly();
Version appVersion = currentAssembly.GetName().Version;
return string.Format("{0}.{1}.{2}", appVersion.Major.ToString(), appVersion.Minor.ToString(), appVersion.Build.ToString());
}
}
}
| mit | C# |
7cdc1153384b923f43f32d6b22d558072d12a05d | fix test store | geeklearningio/gl-dotnet-storage | tests/GeekLearning.Storage.Integration.Test/TestStore.cs | tests/GeekLearning.Storage.Integration.Test/TestStore.cs | namespace GeekLearning.Storage.Integration.Test
{
using GeekLearning.Storage.Configuration;
using System.Collections.Generic;
using System.Linq;
public class TestStore : IStoreOptions
{
public TestStore()
{
this.Name = "TestStore";
this.ProviderType = "FileSystem";
}
public string ProviderName { get; set; }
public string ProviderType { get; set; }
public AccessLevel AccessLevel { get; set; }
public string FolderName { get; set; }
public string Name { get; set; }
public string AuthenticationMode { get; set; }
public IEnumerable<IOptionError> Validate(bool throwOnError = true)
{
return Enumerable.Empty<IOptionError>();
}
}
}
| namespace GeekLearning.Storage.Integration.Test
{
using GeekLearning.Storage.Configuration;
using System.Collections.Generic;
using System.Linq;
public class TestStore : IStoreOptions
{
public TestStore()
{
this.Name = "TestStore";
this.ProviderType = "FileSystem";
}
public string ProviderName { get; set; }
public string ProviderType { get; set; }
public AccessLevel AccessLevel { get; set; }
public string FolderName { get; set; }
public string Name { get; set; }
public IEnumerable<IOptionError> Validate(bool throwOnError = true)
{
return Enumerable.Empty<IOptionError>();
}
}
}
| mit | C# |
0ae0e096767f0ea2d873676c25b68c0305a816e7 | Add a unified method to make an editor-only object | YesAndGames/YesAndEngine | Editor/YesAndEditor/YesAndEditorUtil.cs | Editor/YesAndEditor/YesAndEditorUtil.cs | using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using System.Linq;
namespace YesAndEditor {
// Static class packed to the brim with helpful Unity editor utilities.
public static class YesAndEditorUtil {
// Forcefully mark open loaded scenes dirty and save them.
[MenuItem ("File/Force Save")]
public static void ForceSaveOpenScenes () {
EditorSceneManager.MarkAllScenesDirty ();
EditorSceneManager.SaveOpenScenes ();
}
// Mark an object editor-only.
public static void SetEditorOnly(this MonoBehaviour obj, bool editorOnly = true) {
if (editorOnly) {
obj.gameObject.hideFlags ^= HideFlags.NotEditable;
obj.gameObject.hideFlags ^= HideFlags.HideAndDontSave;
}
else {
obj.gameObject.hideFlags &= HideFlags.NotEditable;
obj.gameObject.hideFlags &= HideFlags.HideAndDontSave;
}
}
}
}
| using UnityEditor;
using UnityEditor.SceneManagement;
namespace YesAndEditor {
// Static class packed to the brim with helpful Unity editor utilities.
public static class YesAndEditorUtil {
// Forcefully mark open loaded scenes dirty and save them.
[MenuItem ("File/Force Save")]
public static void ForceSaveOpenScenes () {
EditorSceneManager.MarkAllScenesDirty ();
EditorSceneManager.SaveOpenScenes ();
}
}
}
| apache-2.0 | C# |
db5df240284a5cd0ad5e1f00068f403790d63985 | Revert "#12404 For Admin and Caregiver Add patient allow patient creation wit…" | SnapMD/connectedcare-sdk | SnapMD.VirtualCare.ApiModels/AddPatientProfileRequest.cs | SnapMD.VirtualCare.ApiModels/AddPatientProfileRequest.cs | using System;
using SnapMD.Web.Api.Models;
using System.Collections.Generic;
namespace SnapMD.VirtualCare.ApiModels
{
/// <summary>
/// The API uses JSON camel case serialization, so the variables supplied in the incoming request will have lower case.
/// </summary>
public class AddPatientProfileRequest
{
public string EmailAddress { get; set; }
public PatientUpdateRequest PatientProfileData { get; set; }
public LegacyMedicalHistoryForm PatientMedicalHistoryData { get; set; }
public List<PatientAllergyItem> MedicationAllergies { get; set; }
public PatientProfileFieldChangesTrackingRequest PatientProfileFieldsTracing { get; set; }
public int? TimeZoneId { get; set; }
public Guid? ImageId { get; set; }
}
} | using System;
using SnapMD.Web.Api.Models;
using System.Collections.Generic;
namespace SnapMD.VirtualCare.ApiModels
{
/// <summary>
/// The API uses JSON camel case serialization, so the variables supplied in the incoming request will have lower case.
/// </summary>
public class AddPatientProfileRequest
{
public bool CreateUserWithoutEmail { get; set; }
public string EmailAddress { get; set; }
public PatientUpdateRequest PatientProfileData { get; set; }
public LegacyMedicalHistoryForm PatientMedicalHistoryData { get; set; }
public List<PatientAllergyItem> MedicationAllergies { get; set; }
public PatientProfileFieldChangesTrackingRequest PatientProfileFieldsTracing { get; set; }
public int? TimeZoneId { get; set; }
public Guid? ImageId { get; set; }
}
} | apache-2.0 | C# |
6c87b4399be453f4148048512ca0204e3027fad3 | add default no-param constructor for ShipStationItemWeight | agileharbor/shipStationAccess | src/ShipStationAccess/V2/Models/ShipStationItemWeight.cs | src/ShipStationAccess/V2/Models/ShipStationItemWeight.cs | using System.Runtime.Serialization;
namespace ShipStationAccess.V2.Models
{
[ DataContract ]
public sealed class ShipStationItemWeight
{
[ DataMember( Name = "value" ) ]
public decimal Value{ get; set; }
[ DataMember( Name = "units" ) ]
public string Units{ get; set; }
public ShipStationItemWeight()
{
}
public ShipStationItemWeight( decimal value, string units )
{
this.Value = value;
this.Units = units;
}
}
} | using System.Runtime.Serialization;
namespace ShipStationAccess.V2.Models
{
[ DataContract ]
public sealed class ShipStationItemWeight
{
[ DataMember( Name = "value" ) ]
public decimal Value{ get; set; }
[ DataMember( Name = "units" ) ]
public string Units{ get; set; }
public ShipStationItemWeight( decimal value, string units )
{
this.Value = value;
this.Units = units;
}
}
} | bsd-3-clause | C# |
ca48f91c971cedcec75403cc248d6556a4d700b8 | Remove 100sec boot screen =D | pingzing/fridge-shopping-list | FridgeShoppingList/Views/Splash.xaml.cs | FridgeShoppingList/Views/Splash.xaml.cs | using System;
using System.Threading.Tasks;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
namespace FridgeShoppingList.Views
{
public sealed partial class Splash : UserControl
{
public Task SplashInProgress { get; private set; }
public Splash(SplashScreen splashScreen)
{
InitializeComponent();
Window.Current.SizeChanged += (s, e) => Resize(splashScreen);
Resize(splashScreen);
SplashInProgress = BeginSplashProcess();
}
private async Task BeginSplashProcess()
{
//Simulate some kind of fun login text here
await Task.Delay(10000);
}
private void Resize(SplashScreen splashScreen)
{
TextTransform.TranslateY = splashScreen.ImageLocation.Height * .75;
}
private void Image_Loaded(object sender, RoutedEventArgs e)
{
StarfleetRotateStoryboard.Begin();
}
}
}
| using System;
using System.Threading.Tasks;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
namespace FridgeShoppingList.Views
{
public sealed partial class Splash : UserControl
{
public Task SplashInProgress { get; private set; }
public Splash(SplashScreen splashScreen)
{
InitializeComponent();
Window.Current.SizeChanged += (s, e) => Resize(splashScreen);
Resize(splashScreen);
SplashInProgress = BeginSplashProcess();
}
private async Task BeginSplashProcess()
{
await Task.Delay(100000);
}
private void Resize(SplashScreen splashScreen)
{
TextTransform.TranslateY = splashScreen.ImageLocation.Height * .75;
}
private void Image_Loaded(object sender, RoutedEventArgs e)
{
StarfleetRotateStoryboard.Begin();
}
}
}
| mit | C# |
90dc0fcca8de6aa977e919ace5c5a221fe8ffbf5 | Add documentation for BaseEstablisher | tjb042/Establishment | Establishment/BaseEstablisher.cs | Establishment/BaseEstablisher.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Establishment {
/// <summary>
/// Base establishment provider for all types
/// </summary>
/// <typeparam name="TType">Any generic struct or class type</typeparam>
public abstract class BaseEstablisher<TType> {
/// <summary>
/// Initializes a new instance of <see cref="BaseEstablisher"/>
/// </summary>
/// <param name="value">An instance of <paramref name="TType"/> used for tests</param>
protected BaseEstablisher(TType value) {
Value = value;
ThrowExceptionOnFailure = true;
GenericType = typeof(TType);
DefaultComparer = EqualityComparer<TType>.Default;
}
/// <summary>
/// The <paramref name="TType"/> value provided to this establisher
/// </summary>
public TType Value {
get;
protected set;
}
/// <summary>
/// The runtime type of <paramref name="TType"/>
/// </summary>
protected Type GenericType {
get;
private set;
}
/// <summary>
/// The default .NET comparer for <paramref name="TType"/>
/// </summary>
protected IEqualityComparer<TType> DefaultComparer {
get;
private set;
}
/// <summary>
/// Indicates if any exceptions have been thrown during test methods
/// </summary>
public bool HasExceptions {
get;
protected set;
}
/// <summary>
/// The last excpetion thrown
/// </summary>
public Exception LastException {
get;
protected set;
}
/// <summary>
/// Indicates if a test should throw an exception is a value does not meet the supplied criteria, or fail silently
/// </summary>
public bool ThrowExceptionOnFailure {
get;
set;
}
/// <summary>
/// Base error handler that throws or catches exceptions based on <see cref="ThrowExceptionOnFailure"/>
/// </summary>
/// <param name="ex"></param>
protected virtual void HandleFailure(Exception ex) {
HasExceptions = true;
LastException = ex;
if (ThrowExceptionOnFailure) {
throw ex;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Establishment {
public abstract class BaseEstablisher<TType> {
protected BaseEstablisher(TType value) {
Value = value;
ThrowExceptionOnFailure = true;
GenericType = typeof(TType);
DefaultComparer = EqualityComparer<TType>.Default;
}
public TType Value {
get;
protected set;
}
protected Type GenericType {
get;
private set;
}
protected IEqualityComparer<TType> DefaultComparer {
get;
private set;
}
public bool HasExceptions {
get;
protected set;
}
public Exception LastException {
get;
protected set;
}
public bool ThrowExceptionOnFailure {
get;
set;
}
protected virtual void HandleFailure(Exception ex) {
HasExceptions = true;
LastException = ex;
if (ThrowExceptionOnFailure) {
throw ex;
}
}
}
}
| mit | C# |
1a26092d90b5ab7db9a0b1da6d2a415911fd7e83 | Fix small typo | DanH91/vuwall-motion,VuWall/VuWall-Motion | vuwall-motion/vuwall-motion/TransparentForm.cs | vuwall-motion/vuwall-motion/TransparentForm.cs | using System;
using System.Drawing;
using System.Windows.Forms;
namespace vuwall_motion {
public partial class TransparentForm : Form {
public TransparentForm() {
InitializeComponent();
DoubleBuffered = true;
ShowInTaskbar = false;
}
private void TransparentForm_Load(object sender, EventArgs e)
{
int wl = TransparentWindowAPI.GetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle);
wl = wl | 0x80000 | 0x20;
TransparentWindowAPI.SetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle, wl);
TransparentWindowAPI.SetLayeredWindowAttributes(this.Handle, 0, 128, TransparentWindowAPI.LWA.Alpha);
Invalidate();
}
private void TransparentForm_Paint(object sender, PaintEventArgs e) {
e.Graphics.DrawEllipse(Pens.Red, 250, 250, 20, 20);
}
// TODO: Method to get an event from MYO to get x & y positions, used to invalidate
}
}
| using System;
using System.Drawing;
using System.Windows.Forms;
namespace vuwall_motion {
public partial class TransparentForm : Form {
public TransparentForm() {
InitializeComponent();
DoubleBuffered = true;
ShowInTaskbar = false;
}
private void TransparentForm_Load(object sender, EventArgs e)
{
int wl = TransparentWindowAPI.GetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle);
wl = wl | 0x80000 | 0x20;
TransparentWindowAPI.SetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle, wl);
TransparentWindowAPI.SetLayeredWindowAttributes(this.Handle, 0, 128, TransparentWindowAPI.LWA.Alpha);
Invalidate();
}
private void TransparentForm_Paint(object sender, PaintEventArgs e) {
e.Graphics.DrawEllipse(Pens.Red, 250, 250, 20, 20);
}
// TODO: Method to get an event from MYO to get x & w positions, used to invalidate
}
}
| mit | C# |
7b0112b82dd454930a38068d21ab54f93a09c6a7 | Fix RequestDateTime field | precizeman/get-pdf-online,precizeman/get-pdf-online,precizeman/get-pdf-online,precizeman/get-pdf-online,precizeman/get-pdf-online | src/PrecizeSoft.GetPdfOnline.Domain/Services/LoggerService.cs | src/PrecizeSoft.GetPdfOnline.Domain/Services/LoggerService.cs | using PrecizeSoft.GetPdfOnline.Data;
using PrecizeSoft.GetPdfOnline.Domain.Handlers;
using PrecizeSoft.GetPdfOnline.Domain.Models;
using PrecizeSoft.IO.Contracts.Converters;
using PrecizeSoft.GetPdfOnline.Domain.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PrecizeSoft.GetPdfOnline.Domain.Services
{
public class LoggerService : ILogService
{
protected IConvertLogRepository convertLogRepository;
public LoggerService(IConvertLogRepository convertLogRepository)
{
this.convertLogRepository = convertLogRepository;
}
public void LogRequest(RequestLog request)
{
ConvertRequestLog data = new ConvertRequestLog
{
RequestId = request.RequestId,
RequestDateUtc = request.RequestDateUtc,
SenderIp = request.SenderIp,
FileExtension = request.FileExtension,
FileSize = request.FileSize,
CustomAttributes = request.CustomAttributes
};
new CreateConvertRequestLog(this.convertLogRepository).Execute(data);
}
public void LogResponse(ResponseLog response)
{
ConvertResponseLog data = new ConvertResponseLog
{
RequestId = response.RequestId,
ResponseDateUtc = response.ResponseDateUtc,
ResultFileSize = response.ResultFileSize,
ResultType = response.ErrorType.ToResultType()
};
new CreateConvertResponseLog(this.convertLogRepository).Execute(data);
}
}
}
| using PrecizeSoft.GetPdfOnline.Data;
using PrecizeSoft.GetPdfOnline.Domain.Handlers;
using PrecizeSoft.GetPdfOnline.Domain.Models;
using PrecizeSoft.IO.Contracts.Converters;
using PrecizeSoft.GetPdfOnline.Domain.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PrecizeSoft.GetPdfOnline.Domain.Services
{
public class LoggerService : ILogService
{
protected IConvertLogRepository convertLogRepository;
public LoggerService(IConvertLogRepository convertLogRepository)
{
this.convertLogRepository = convertLogRepository;
}
public void LogRequest(RequestLog request)
{
ConvertRequestLog data = new ConvertRequestLog
{
RequestId = request.RequestId,
RequestDateUtc = request.RequestDateUtc.UtcDateTime,
SenderIp = request.SenderIp,
FileExtension = request.FileExtension,
FileSize = request.FileSize,
CustomAttributes = request.CustomAttributes
};
new CreateConvertRequestLog(this.convertLogRepository).Execute(data);
}
public void LogResponse(ResponseLog response)
{
ConvertResponseLog data = new ConvertResponseLog
{
RequestId = response.RequestId,
ResponseDateUtc = response.ResponseDateUtc,
ResultFileSize = response.ResultFileSize,
ResultType = response.ErrorType.ToResultType()
};
new CreateConvertResponseLog(this.convertLogRepository).Execute(data);
}
}
}
| apache-2.0 | C# |
cb28926fc6847154667970a60b5df5a5db76a2a0 | make color helpers public (#957) | lbochenek/react-native-windows,lbochenek/react-native-windows,lbochenek/react-native-windows,lbochenek/react-native-windows | ReactWindows/ReactNative.Shared/UIManager/ColorHelpers.cs | ReactWindows/ReactNative.Shared/UIManager/ColorHelpers.cs | #if WINDOWS_UWP
using Windows.UI;
#else
using System.Windows.Media;
#endif
namespace ReactNative.UIManager
{
public static class ColorHelpers
{
public const uint Transparent = 0x00FFFFFF;
public static Color Parse(uint value)
{
var color = value;
var b = (byte)color;
color >>= 8;
var g = (byte)color;
color >>= 8;
var r = (byte)color;
color >>= 8;
var a = (byte)color;
return Color.FromArgb(a, r, g, b);
}
}
}
| #if WINDOWS_UWP
using Windows.UI;
#else
using System.Windows.Media;
#endif
namespace ReactNative.UIManager
{
static class ColorHelpers
{
public const uint Transparent = 0x00FFFFFF;
public static Color Parse(uint value)
{
var color = value;
var b = (byte)color;
color >>= 8;
var g = (byte)color;
color >>= 8;
var r = (byte)color;
color >>= 8;
var a = (byte)color;
return Color.FromArgb(a, r, g, b);
}
}
}
| mit | C# |
af215e6112f240feef2403ae2c40425216491d77 | fix snippet | eclaus/docs.particular.net,WojcikMike/docs.particular.net,yuxuac/docs.particular.net,pedroreys/docs.particular.net | Snippets/Snippets_Misc/EfEdmx/EntityConnectionCreation.cs | Snippets/Snippets_Misc/EfEdmx/EntityConnectionCreation.cs | using System.Data.Entity.Core.EntityClient;
namespace Snippets_Misc.EfEdmx
{
class EntityConnectionCreation
{
void Temp()
{
#region EntityConnectionCreationAndUsage
var entityBuilder = new EntityConnectionStringBuilder
{
Provider = "System.Data.SqlClient",
ProviderConnectionString = "the database connection string",
Metadata = @"res://*/MySample.csdl|res://*/MySample.ssdl|res://*/MySample.msl"
};
var entityConn = new EntityConnection(entityBuilder.ToString());
using (var ctx = new MySampleContainer(entityConn))
{
//use the DbContext as required
}
#endregion
}
}
} | using System.Data.Entity.Core.EntityClient;
namespace Snippets_Misc.EfEdmx
{
class EntityConnectionCreation
{
void Temp()
{
#region EntityConnectionCreationAndUsage
var entityBuilder = new EntityConnectionStringBuilder()
{
Provider = "System.Data.SqlClient",
ProviderConnectionString = "the database connection string",
Metadata = @"res://*/MySample.csdl|res://*/MySample.ssdl|res://*/MySample.msl"
};
var entityConn = new EntityConnection(entityBuilder.ToString());
using (var ctx = new MySampleContainer(entityConn))
{
//use the DbContext as required
}
#endregion
}
}
} | apache-2.0 | C# |
8161dc7b81c2606b8f2cf5f1867b45ef86b73fca | Bump version | samiy-xx/keysndr,samiy-xx/keysndr,samiy-xx/keysndr | KeySndr.Base/Properties/AssemblyInfo.cs | KeySndr.Base/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("KeySndr.Base")]
[assembly: AssemblyDescription("Base library for KeySndr server")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("blockz3d.com")]
[assembly: AssemblyProduct("KeySndr.Base")]
[assembly: AssemblyCopyright("Copyright © Sami Ylönen 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9413db07-5510-46a4-82b0-38485af52792")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.3.*")]
| 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("KeySndr.Base")]
[assembly: AssemblyDescription("Base library for KeySndr server")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("blockz3d.com")]
[assembly: AssemblyProduct("KeySndr.Base")]
[assembly: AssemblyCopyright("Copyright © Sami Ylönen 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9413db07-5510-46a4-82b0-38485af52792")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.1.*")]
| mit | C# |
a3cc99f8fe6dd9549531665eb1db6b3554bb87a8 | Fix string escaping | sachintaware/ng-file-upload,komsanb/ng-file-upload,wrenth04/ng-file-upload,wrenth04/ng-file-upload,lewis-ing/ng-file-upload,sachintaware/ng-file-upload,sjava9s/ng-file-upload,simudream/ng-file-upload,sjava9s/ng-file-upload,itonics/ng-file-upload,edgibbs/ng-file-upload,tpsumeta/ng-file-upload,IRlyDontKnow/ng-file-upload,kejwmen/ng-file-upload,mujiansu/ng-file-upload,IRlyDontKnow/ng-file-upload,Verdier/ng-file-upload,bullitbd/ng-file-upload,Verdier/ng-file-upload,lookfirst/ng-file-upload,johan--/ng-file-upload,simudream/ng-file-upload,mujiansu/ng-file-upload,maninga/ng-file-upload,maninga/ng-file-upload,lookfirst/ng-file-upload,edivancamargo/ng-file-upload,lewis-ing/ng-file-upload,jbarrus/ng-file-upload,edgibbs/ng-file-upload,kejwmen/ng-file-upload,AzharWeb/ng-file-upload,krystiangw/angular-file-upload,mujiansu/ng-file-upload,sachintaware/ng-file-upload,sjava9s/ng-file-upload,lewis-ing/ng-file-upload,yan5845hao/ng-file-upload,myssteriion/ng-file-upload-myssteriion,komsanb/ng-file-upload,edgibbs/ng-file-upload,meghna1711/ng-file-upload,IRlyDontKnow/ng-file-upload,mujiansu/ng-file-upload,tpsumeta/ng-file-upload,komsanb/ng-file-upload,partap/ng-file-upload,yan5845hao/ng-file-upload,waysay/ng-file-upload,xtrepo/ng-file-upload,wrenth04/ng-file-upload,wrenth04/ng-file-upload,tpsumeta/ng-file-upload,AzharWeb/ng-file-upload,sjava9s/ng-file-upload,sachintaware/ng-file-upload,johnofkorea/ng-file-upload,krystiangw/angular-file-upload,AzharWeb/ng-file-upload,maninga/ng-file-upload,waysay/ng-file-upload,yan5845hao/ng-file-upload,danialfarid/ng-file-upload,mujiansu/ng-file-upload,tpsumeta/ng-file-upload,jbarrus/ng-file-upload,krystiangw/angular-file-upload,simudream/ng-file-upload,edgibbs/ng-file-upload,danialfarid/ng-file-upload,xtrepo/ng-file-upload,waysay/ng-file-upload,Verdier/ng-file-upload,romelgomez/ng-file-upload,AzharWeb/ng-file-upload,IRlyDontKnow/ng-file-upload,maninga/ng-file-upload,partap/ng-file-upload,edgibbs/ng-file-upload,meghna1711/ng-file-upload,romelgomez/ng-file-upload,kejwmen/ng-file-upload,lewis-ing/ng-file-upload,meghna1711/ng-file-upload,johnofkorea/ng-file-upload,johnofkorea/ng-file-upload,simudream/ng-file-upload,krystiangw/angular-file-upload,itonics/ng-file-upload,partap/ng-file-upload,johan--/ng-file-upload,johan--/ng-file-upload,edivancamargo/ng-file-upload,romelgomez/ng-file-upload,krystiangw/angular-file-upload,simudream/ng-file-upload,meghna1711/ng-file-upload,meghna1711/ng-file-upload,komsanb/ng-file-upload,bullitbd/ng-file-upload,itonics/ng-file-upload,kejwmen/ng-file-upload,myssteriion/ng-file-upload-myssteriion,kejwmen/ng-file-upload,edivancamargo/ng-file-upload,bullitbd/ng-file-upload,romelgomez/ng-file-upload,komsanb/ng-file-upload,waysay/ng-file-upload,yan5845hao/ng-file-upload,jbarrus/ng-file-upload,xtrepo/ng-file-upload,partap/ng-file-upload,itonics/ng-file-upload,sjava9s/ng-file-upload,edivancamargo/ng-file-upload,sachintaware/ng-file-upload,Verdier/ng-file-upload,johan--/ng-file-upload,danialfarid/ng-file-upload,johnofkorea/ng-file-upload,yan5845hao/ng-file-upload,itonics/ng-file-upload,waysay/ng-file-upload,bullitbd/ng-file-upload,xtrepo/ng-file-upload,AzharWeb/ng-file-upload,tpsumeta/ng-file-upload,Verdier/ng-file-upload,partap/ng-file-upload,edivancamargo/ng-file-upload,lookfirst/ng-file-upload,wrenth04/ng-file-upload,johnofkorea/ng-file-upload,lewis-ing/ng-file-upload,maninga/ng-file-upload,xtrepo/ng-file-upload,myssteriion/ng-file-upload-myssteriion,lookfirst/ng-file-upload,IRlyDontKnow/ng-file-upload,romelgomez/ng-file-upload,johan--/ng-file-upload,bullitbd/ng-file-upload,lookfirst/ng-file-upload | demo/C#/UploadHandler.ashx.cs | demo/C#/UploadHandler.ashx.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MyApp.Uploads
{
/// <summary>
/// Summary description for UploadHandler
/// </summary>
public class UploadHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
if (context.Request.Files.Count > 0)
{
HttpFileCollection files = context.Request.Files;
var userName = context.Request.Form["name"];
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile file = files[i];
string fname = context.Server.MapPath("Uploads\"" + userName.ToUpper() + "\\" + file.FileName);
file.SaveAs(fname);
}
}
context.Response.ContentType = "text/plain";
context.Response.Write("File/s uploaded successfully!");
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MyApp.Uploads
{
/// <summary>
/// Summary description for UploadHandler
/// </summary>
public class UploadHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
if (context.Request.Files.Count > 0)
{
HttpFileCollection files = context.Request.Files;
var userName = context.Request.Form["name"];
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile file = files[i];
string fname = context.Server.MapPath("Uploads\"+userName.ToUpper() + "\\" + file.FileName);
file.SaveAs(fname);
}
}
context.Response.ContentType = "text/plain";
context.Response.Write("File/s uploaded successfully!");
}
public bool IsReusable
{
get
{
return false;
}
}
}
} | mit | C# |
a98be6c0813f4403c6f2e9c6a335a1638212f42c | support loading configuration from AppData folder | IsNull/Archimedes | Archimedes.Framework/Configuration/ConfigurationLoader.cs | Archimedes.Framework/Configuration/ConfigurationLoader.cs | using System;
using System.IO;
using Archimedes.Patterns.Utils;
namespace Archimedes.Framework.Configuration
{
public class ConfigurationLoader
{
public Properties LoadConfiguration(string[] commandLineArgs = null)
{
return LoadConfigurationFromPropertiesFile()
.Merge(LoadConfigurationFromCommandLine(commandLineArgs));
}
private Properties LoadConfigurationFromCommandLine(string[] commandLineArgs)
{
var cmdProps = new Properties();
if (commandLineArgs != null && commandLineArgs.Length != 0)
{
var argsCmd = CommandLineParser.ParseCommandLineArgs(commandLineArgs);
cmdProps.Merge(argsCmd.ToParameterMap());
}
return cmdProps;
}
private Properties LoadConfigurationFromPropertiesFile()
{
const string propertiesFileName = "application.properties";
var levelOnePath = AppUtil.ApplicaitonBinaryFolder + @"\" + propertiesFileName;
var levelTwoPath = AppUtil.AppDataFolder + @"\" + propertiesFileName;
return LoadProperties(levelOnePath).Merge(LoadProperties(levelTwoPath));
}
private Properties LoadProperties(string path)
{
var properties = new Properties();
if (File.Exists(path))
{
var tmp = PropertiesParser.Parse(path);
properties.Merge(tmp);
}
return properties;
}
}
}
| using System;
using System.IO;
namespace Archimedes.Framework.Configuration
{
public class ConfigurationLoader
{
public Properties LoadConfiguration(string[] commandLineArgs = null)
{
return LoadConfigurationFromPropertiesFile()
.Merge(LoadConfigurationFromCommandLine(commandLineArgs));
}
private Properties LoadConfigurationFromCommandLine(string[] commandLineArgs)
{
var cmdProps = new Properties();
if (commandLineArgs != null && commandLineArgs.Length != 0)
{
var argsCmd = CommandLineParser.ParseCommandLineArgs(commandLineArgs);
cmdProps.Merge(argsCmd.ToParameterMap());
}
return cmdProps;
}
private Properties LoadConfigurationFromPropertiesFile()
{
var cmdProps = new Properties();
var path = AppDomain.CurrentDomain.BaseDirectory + @"\application.properties";
if (File.Exists(path))
{
var properties = PropertiesParser.Parse(path);
cmdProps.Merge(properties);
}
return cmdProps;
}
}
}
| mit | C# |
e7e9c8d4b6395d6fb026d97757e5494a5f834b24 | Remove white space from version checker warnings | iBicha/UnityNativePluginBuilder,iBicha/UnityNativePluginBuilder | Assets/NativePluginBuilder/Editor/NativeVersionChecker.cs | Assets/NativePluginBuilder/Editor/NativeVersionChecker.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.Build;
using UnityEditor;
using System.Text;
using System;
namespace iBicha
{
public class NativeVersionChecker : IPreprocessBuild {
public void OnPreprocessBuild (UnityEditor.BuildTarget target, string path)
{
StringBuilder warningStringBuilder = new StringBuilder();
PluginImporter[] pluginImporters = PluginImporter.GetImporters (target);
foreach (PluginImporter pluginImporter in pluginImporters) {
NativePlugin plugin = GetPluginByName(pluginImporter.GetEditorData ("PLUGIN_NAME"));
if (plugin != null) {
string version = pluginImporter.GetEditorData ("PLUGIN_VERSION");
if (plugin.Version != version) {
warningStringBuilder.AppendFormat (@"Plugin version number mismatch: ""{0}"" is set to ""{1}"", while ""{2}"" was built with ""{3}""",
plugin.Name, plugin.Version, target.ToString(), version);
}
string buildNumberStr = pluginImporter.GetEditorData ("PLUGIN_BUILD_NUMBER");
int buildNumber;
if(int.TryParse(buildNumberStr, out buildNumber)){
if (plugin.BuildNumber != buildNumber) {
warningStringBuilder.AppendFormat (@"Plugin build number mismatch: ""{0}"" is set to ""{1}"", while ""{2}"" was built with ""{3}""",
plugin.Name, plugin.BuildNumber, target.ToString(), buildNumber);
}
}
string buildTypeStr = pluginImporter.GetEditorData ("BUILD_TYPE");
BuildType buildType = (BuildType) Enum.Parse(typeof(BuildType), buildTypeStr, true);
if ((EditorUserBuildSettings.development && buildType == BuildType.Release) ||
(!EditorUserBuildSettings.development && buildType == BuildType.Debug)) {
warningStringBuilder.AppendFormat (@"Plugin build type mismatch: current build is set to development=""{0}"", while plugin ""{0}"" for ""{0}"" is ""{0}"".\n",
EditorUserBuildSettings.development, plugin.Name, target, buildType);
}
}
}
string warnings = warningStringBuilder.ToString ();
if (!string.IsNullOrEmpty(warnings)) {
Debug.LogWarning (warnings);
}
}
public int callbackOrder {
get {
return 0;
}
}
private NativePlugin GetPluginByName(string name) {
if (string.IsNullOrEmpty (name)) {
return null;
}
for (int i = 0; i < NativePluginSettings.plugins.Count; i++) {
if (NativePluginSettings.plugins [i].Name == name) {
return NativePluginSettings.plugins [i];
}
}
return null;
}
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.Build;
using UnityEditor;
using System.Text;
using System;
namespace iBicha
{
public class NativeVersionChecker : IPreprocessBuild {
public void OnPreprocessBuild (UnityEditor.BuildTarget target, string path)
{
StringBuilder warningStringBuilder = new StringBuilder();
PluginImporter[] pluginImporters = PluginImporter.GetImporters (target);
foreach (PluginImporter pluginImporter in pluginImporters) {
NativePlugin plugin = GetPluginByName(pluginImporter.GetEditorData ("PLUGIN_NAME"));
if (plugin != null) {
string version = pluginImporter.GetEditorData ("PLUGIN_VERSION");
if (plugin.Version != version) {
warningStringBuilder.AppendFormat (@"Plugin version number mismatch: ""{0}"" is set to ""{1}"",
while ""{2}"" was built with ""{3}""",
plugin.Name, plugin.Version, target.ToString(), version);
}
string buildNumberStr = pluginImporter.GetEditorData ("PLUGIN_BUILD_NUMBER");
int buildNumber;
if(int.TryParse(buildNumberStr, out buildNumber)){
if (plugin.BuildNumber != buildNumber) {
warningStringBuilder.AppendFormat (@"Plugin build number mismatch: ""{0}"" is set to ""{1}"",
while ""{2}"" was built with ""{3}""",
plugin.Name, plugin.BuildNumber, target.ToString(), buildNumber);
}
}
string buildTypeStr = pluginImporter.GetEditorData ("BUILD_TYPE");
BuildType buildType = (BuildType) Enum.Parse(typeof(BuildType), buildTypeStr, true);
if ((EditorUserBuildSettings.development && buildType == BuildType.Release) ||
(!EditorUserBuildSettings.development && buildType == BuildType.Debug)) {
warningStringBuilder.AppendFormat (@"Plugin build type mismatch: current build is set to development=""{0}"",
while plugin ""{0}"" for ""{0}"" is ""{0}"".\n",
EditorUserBuildSettings.development, plugin.Name, target, buildType);
}
}
}
string warnings = warningStringBuilder.ToString ();
if (!string.IsNullOrEmpty(warnings)) {
Debug.LogWarning (warnings);
}
}
public int callbackOrder {
get {
return 0;
}
}
private NativePlugin GetPluginByName(string name) {
if (string.IsNullOrEmpty (name)) {
return null;
}
for (int i = 0; i < NativePluginSettings.plugins.Count; i++) {
if (NativePluginSettings.plugins [i].Name == name) {
return NativePluginSettings.plugins [i];
}
}
return null;
}
}
}
| mit | C# |
cd61e65bce9b9bd0da6f90bcada010df4c8ca9cd | set version to v0.2 | mastersign/MapMap | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("MapMap")]
[assembly: AssemblyDescription("A tool to capture large pictures from maps in the browser.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("www.mastersign.de")]
[assembly: AssemblyProduct("MapMap")]
[assembly: AssemblyCopyright("Copyright © 2013 Tobias Kiertscher")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("ab8dae14-a292-4cad-880f-af30449be302")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("MapMap")]
[assembly: AssemblyDescription("A tool to capture large pictures from maps in the browser.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("www.mastersign.de")]
[assembly: AssemblyProduct("MapMap")]
[assembly: AssemblyCopyright("Copyright © 2013 Tobias Kiertscher")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("ab8dae14-a292-4cad-880f-af30449be302")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
| mit | C# |
88962b852d6c3a74f7dd27b1548e7185a3bbc61a | Bump to 2.6.0 | dreadnought-friends/support-tool,iltar/support-tool | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Dreadnought Community Support Tool")]
[assembly: AssemblyDescription("This community made tool gathers information which the Dreadnought Customer Support might ask of you to assist with issues or bug reports.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("support-tool")]
[assembly: AssemblyCopyright("Copyright Anyone © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.6.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Dreadnought Community Support Tool")]
[assembly: AssemblyDescription("This community made tool gathers information which the Dreadnought Customer Support might ask of you to assist with issues or bug reports.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("support-tool")]
[assembly: AssemblyCopyright("Copyright Anyone © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
3835ec4c8f6159a055e3a10004f19be94786e921 | Bump version to hotfix 1.2.4.1 | EliotVU/Unreal-Library | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "UELib" )]
[assembly: AssemblyDescription( "UELib makes it possible to deserialize and decompile almost any Unreal package files." )]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany( "EliotVU" )]
[assembly: AssemblyProduct( "UELib" )]
[assembly: AssemblyCopyright( "© 2009-2013 Eliot van Uytfanghe. All rights reserved." )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "0eb1c54e-8955-4c8d-98d3-16285f114f16" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.2.4.1" )]
[assembly: AssemblyFileVersion( "1.2.4.1" )]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "UELib" )]
[assembly: AssemblyDescription( "UELib makes it possible to deserialize and decompile almost any Unreal package files." )]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany( "EliotVU" )]
[assembly: AssemblyProduct( "UELib" )]
[assembly: AssemblyCopyright( "© 2009-2013 Eliot van Uytfanghe. All rights reserved." )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "0eb1c54e-8955-4c8d-98d3-16285f114f16" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.2.4.0" )]
[assembly: AssemblyFileVersion( "1.2.4.0" )]
| mit | C# |
9184cf0cdc83e52310110bd82208c958628b5a89 | Bump version | nixxquality/WebMConverter,o11c/WebMConverter,Yuisbean/WebMConverter | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.9.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.8.0")]
| mit | C# |
bc65f17a8fab449cd1f986325234ddeb7be1df5c | Bump version to 0.6 | FatturaElettronicaPA/FatturaElettronicaPA | Properties/AssemblyInfo.cs | Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FatturaElettronica.NET")]
[assembly: AssemblyDescription("Fattura Elettronica per le aziende e la Pubblica Amministrazione Italiana")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronica.NET")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.0.0")]
[assembly: AssemblyFileVersion("0.6.0.0")]
| using System.Reflection;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FatturaElettronica.NET")]
[assembly: AssemblyDescription("Fattura Elettronica per le aziende e la Pubblica Amministrazione Italiana")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nicola Iarocci, CIR2000")]
[assembly: AssemblyProduct("FatturaElettronica.NET")]
[assembly: AssemblyCopyright("Copyright © CIR2000 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
| bsd-3-clause | C# |
4ee20bd8cc696718b55b60ff0d72bef0674f5974 | Fix the API | cwensley/maccore,beni55/maccore,jorik041/maccore,mono/maccore | src/ImageIO/CGImageSource.cs | src/ImageIO/CGImageSource.cs | //
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using MonoMac.ObjCRuntime;
using MonoMac.Foundation;
using MonoMac.CoreFoundation;
using MonoMac.CoreGraphics;
namespace MonoMac.ImageIO {
public class CGImageSource : INativeObject, IDisposable
{
internal IntPtr handle;
// invoked by marshallers
internal CGImageSource (IntPtr handle) : this (handle, false)
{
this.handle = handle;
}
[Preserve (Conditional=true)]
internal CGImageSource (IntPtr handle, bool owns)
{
this.handle = handle;
if (!owns)
CFObject.CFRetain (handle);
}
~CGImageSource ()
{
Dispose (false);
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
public IntPtr Handle {
get { return handle; }
}
protected virtual void Dispose (bool disposing)
{
if (handle != IntPtr.Zero){
CFObject.CFRelease (handle);
handle = IntPtr.Zero;
}
}
[DllImport (Constants.ImageIOLibrary)]
extern static IntPtr CGImageSourceCreateWithURL(IntPtr url, IntPtr options);
public static CGImageSource CreateWithURL (NSUrl url, NSDictionary options)
{
if (url == null)
throw new ArgumentNullException ("url");
return new CGImageSource (CGImageSourceCreateWithURL (url.Handle, options == null ? IntPtr.Zero : options.Handle));
}
[DllImport (Constants.ImageIOLibrary)]
extern static IntPtr CGImageSourceCreateImageAtIndex(IntPtr isrc, int index, IntPtr options);
public static CGImage CreateImageAtIndex (CGImageSource isrc, int index, NSDictionary options)
{
if (isrc == null)
throw new ArgumentNullException ("isrc");
return new CGImage(CGImageSourceCreateImageAtIndex(isrc.Handle, index, options == null ? IntPtr.Zero : options.Handle));
}
}
}
| //
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using MonoMac.ObjCRuntime;
using MonoMac.Foundation;
using MonoMac.CoreFoundation;
using MonoMac.CoreGraphics;
namespace MonoMac.ImageIO {
public class CGImageSource : INativeObject, IDisposable
{
internal IntPtr handle;
// invoked by marshallers
internal CGImageSource (IntPtr handle)
: this (handle, false)
{
this.handle = handle;
}
[Preserve (Conditional=true)]
internal CGImageSource (IntPtr handle, bool owns)
{
this.handle = handle;
if (!owns)
CFObject.CFRetain (handle);
}
~CGImageSource ()
{
Dispose (false);
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
public IntPtr Handle {
get { return handle; }
}
protected virtual void Dispose (bool disposing)
{
if (handle != IntPtr.Zero){
CFObject.CFRelease (handle);
handle = IntPtr.Zero;
}
}
[DllImport (Constants.IOImageLibrary)]
extern static IntPtr CGImageSourceCreateWithURL(IntPtr url, IntPtr options);
public static CGImageSource CreateWithURL (CFUrl url, IntPtr options)
{
return new CGImageSource(CGImageSourceCreateWithURL(url.Handle, options));
}
[DllImport (Constants.IOImageLibrary)]
extern static IntPtr CGImageSourceCreateImageAtIndex(IntPtr isrc, int index, IntPtr options);
public static CGImage CreateImageAtIndex (CGImageSource isrc, int index, IntPtr options)
{
return new CGImage(CGImageSourceCreateImageAtIndex(isrc.Handle, index, options));
}
}
}
| apache-2.0 | C# |
b211a87ae3961ed470621883c54ce157f8a32884 | Rename variable in Automapper config to match its type (Job instead of JobDTO) | paulbatum/FieldEngineerLite | FieldEngineerLite.Service/App_Start/AutomapperConfiguration.cs | FieldEngineerLite.Service/App_Start/AutomapperConfiguration.cs | // ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
// This file reused from: https://code.msdn.microsoft.com/Field-Engineer-501df99d
using AutoMapper;
using FieldEngineerLite.Service.DataObjects;
using FieldEngineerLite.Service.Models;
namespace FieldEngineerLite.Service
{
public class AutomapperConfiguration
{
public static void CreateMapping(IConfiguration cfg)
{
// Apply some name changes from the entity to the DTO
cfg.CreateMap<Job, JobDTO>()
.ForMember(jobDTO => jobDTO.Equipments, map => map.MapFrom(job => job.Equipments));
// For incoming requests, ignore the relationships
cfg.CreateMap<JobDTO, Job>()
.ForMember(job => job.Customer, map => map.Ignore())
.ForMember(job => job.Equipments, map => map.Ignore());
cfg.CreateMap<Customer, CustomerDTO>();
cfg.CreateMap<Equipment, EquipmentDTO>();
}
}
}
| // ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
// This file reused from: https://code.msdn.microsoft.com/Field-Engineer-501df99d
using AutoMapper;
using FieldEngineerLite.Service.DataObjects;
using FieldEngineerLite.Service.Models;
namespace FieldEngineerLite.Service
{
public class AutomapperConfiguration
{
public static void CreateMapping(IConfiguration cfg)
{
// Apply some name changes from the entity to the DTO
cfg.CreateMap<Job, JobDTO>()
.ForMember(jobDTO => jobDTO.Equipments, map => map.MapFrom(job => job.Equipments));
// For incoming requests, ignore the relationships
cfg.CreateMap<JobDTO, Job>()
.ForMember(jobDTO => jobDTO.Customer, map => map.Ignore())
.ForMember(jobDTO => jobDTO.Equipments, map => map.Ignore());
cfg.CreateMap<Customer, CustomerDTO>();
cfg.CreateMap<Equipment, EquipmentDTO>();
}
}
}
| apache-2.0 | C# |
700cab8ee999798d48d4e5ad1dce5e0b8320df5b | fix a typo | rpmoore/ds3_net_sdk,shabtaisharon/ds3_net_sdk,SpectraLogic/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,rpmoore/ds3_net_sdk,rpmoore/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,RachelTucker/ds3_net_sdk,RachelTucker/ds3_net_sdk | Ds3/Helpers/Strategies/WriteRandomAccessHelperStrategy.cs | Ds3/Helpers/Strategies/WriteRandomAccessHelperStrategy.cs | /*
* ******************************************************************************
* Copyright 2014 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file 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 Ds3.Helpers.Strategies.ChunkStrategies;
using Ds3.Helpers.Strategies.StreamFactory;
namespace Ds3.Helpers.Strategies
{
/// <summary>
/// The WriteRandomAccessHelperStrategy bundle WriteRandomAccessChunkStrategy with WriteRandomAccessStreamFactory
/// </summary>
public class WriteRandomAccessHelperStrategy : IHelperStrategy<string>
{
private readonly IChunkStrategy _writeRandomAccessChunkStrategy;
private readonly IStreamFactory<string> _writeRandomAccessStreamFactory;
public WriteRandomAccessHelperStrategy(int retryAfter = -1, bool withAggregation = false)
{
this._writeRandomAccessChunkStrategy = new WriteRandomAccessChunkStrategy(retryAfter, withAggregation);
this._writeRandomAccessStreamFactory = new WriteRandomAccessStreamFactory();
}
public IChunkStrategy GetChunkStrategy()
{
return this._writeRandomAccessChunkStrategy;
}
public IStreamFactory<string> GetStreamFactory()
{
return this._writeRandomAccessStreamFactory;
}
}
} | /*
* ******************************************************************************
* Copyright 2014 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file 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 Ds3.Helpers.Strategies.ChunkStrategies;
using Ds3.Helpers.Strategies.StreamFactory;
namespace Ds3.Helpers.Strategies
{
/// <summary>
/// The WriteRandomAccessHelperStrategy bundle WriteRandomAccessChunkStrategy with WriteRandomAccessStreamFactory
/// </summary>
public class WriteRandomAccessHelperStrategy : IHelperStrategy<string>
{
private readonly IChunkStrategy _writeRandomAccessChunkStrategy;
private readonly IStreamFactory<string> _writeRandomAccesStreamFactory;
public WriteRandomAccessHelperStrategy(int retryAfter = -1, bool withAggregation = false)
{
this._writeRandomAccessChunkStrategy = new WriteRandomAccessChunkStrategy(retryAfter, withAggregation);
this._writeRandomAccesStreamFactory = new WriteRandomAccessStreamFactory();
}
public IChunkStrategy GetChunkStrategy()
{
return this._writeRandomAccessChunkStrategy;
}
public IStreamFactory<string> GetStreamFactory()
{
return this._writeRandomAccesStreamFactory;
}
}
} | apache-2.0 | C# |
e807489d0c8496d2a59c7a1443b4cb42fbb7c590 | Remove unintended effect | unlimitedbacon/MatterControl,mmoening/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,larsbrubaker/MatterControl,mmoening/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl | MatterControlLib/ApplicationView/Themes/DirectoryTheme.cs | MatterControlLib/ApplicationView/Themes/DirectoryTheme.cs | /*
Copyright (c) 2018, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg;
namespace MatterHackers.MatterControl
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MatterHackers.Agg.Platform;
using Newtonsoft.Json;
public class DirectoryTheme : IColorTheme
{
private string path;
public DirectoryTheme()
{
}
public DirectoryTheme(string directory)
{
path = directory;
this.Name = Path.GetFileName(directory);
this.ThemeNames = AggContext.StaticData.GetFiles(directory).Where(p => Path.GetFileName(p) != "theme.json").Select(p => Path.GetFileNameWithoutExtension(p)).ToArray();
}
public string Name { get; }
public IEnumerable<string> ThemeNames { get; }
public ThemeSet GetTheme(string themeName, Color accentColor)
{
var themeset = this.LoadTheme(themeName);
themeset.SetAccentColor(accentColor);
return themeset;
}
public ThemeSet GetTheme(string themeName)
{
var themeset = this.LoadTheme(themeName);
themeset.SetAccentColor(themeset.AccentColors.First());
return themeset;
}
private ThemeSet LoadTheme(string themeName)
{
ThemeSet themeset;
try
{
themeset = JsonConvert.DeserializeObject<ThemeSet>(
AggContext.StaticData.ReadAllText(Path.Combine(path, themeName + ".json")));
}
catch
{
themeset = JsonConvert.DeserializeObject<ThemeSet>(
AggContext.StaticData.ReadAllText(Path.Combine(path, this.ThemeNames.First() + ".json")));
}
// Set SchemaVersion at construction time
themeset.SchemeVersion = ThemeSet.LatestSchemeVersion;
themeset.ThemeID = themeName;
return themeset;
}
}
} | /*
Copyright (c) 2018, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg;
namespace MatterHackers.MatterControl
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MatterHackers.Agg.Platform;
using Newtonsoft.Json;
public class DirectoryTheme : IColorTheme
{
private string path;
public DirectoryTheme()
{
}
public DirectoryTheme(string directory)
{
path = directory;
this.Name = Path.GetFileName(directory);
this.ThemeNames = AggContext.StaticData.GetFiles(directory).Where(p => Path.GetFileName(p) != "theme.json").Select(p => Path.GetFileNameWithoutExtension(p)).ToArray();
}
public string Name { get; }
public IEnumerable<string> ThemeNames { get; }
public ThemeSet GetTheme(string themeName, Color accentColor)
{
var themeset = this.LoadTheme(themeName);
themeset.SetAccentColor(accentColor);
return themeset;
}
public ThemeSet GetTheme(string themeName)
{
var themeset = this.LoadTheme(themeName);
themeset.SetAccentColor(themeset.AccentColors[2]);
return themeset;
}
private ThemeSet LoadTheme(string themeName)
{
ThemeSet themeset;
try
{
themeset = JsonConvert.DeserializeObject<ThemeSet>(
AggContext.StaticData.ReadAllText(Path.Combine(path, themeName + ".json")));
}
catch
{
themeset = JsonConvert.DeserializeObject<ThemeSet>(
AggContext.StaticData.ReadAllText(Path.Combine(path, this.ThemeNames.First() + ".json")));
}
// Set SchemaVersion at construction time
themeset.SchemeVersion = ThemeSet.LatestSchemeVersion;
themeset.ThemeID = themeName;
return themeset;
}
}
} | bsd-2-clause | C# |
3351594cb7070755e5ce3e2cc2cde65c51b560c4 | Update todo message to explain what is the issue | Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype | src/Glimpse.Host.Web.AspNet/GlimpseMiddleware.cs | src/Glimpse.Host.Web.AspNet/GlimpseMiddleware.cs | using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Glimpse.Web;
using System;
namespace Glimpse.Host.Web.AspNet
{
public class GlimpseMiddleware
{
private readonly RequestDelegate _innerNext;
private readonly MasterRequestRuntime _runtime;
private readonly ISettings _settings;
private readonly IContextData<MessageContext> _contextData;
public GlimpseMiddleware(RequestDelegate innerNext, IServiceProvider serviceProvider)
{
_innerNext = innerNext;
_runtime = new MasterRequestRuntime(serviceProvider);
_contextData = new ContextData<MessageContext>();
}
public async Task Invoke(Microsoft.AspNet.Http.HttpContext context)
{
var newContext = new HttpContext(context, _settings);
// TODO: This is the wrong place for this, AgentRuntime isn't garenteed to execute first
_contextData.Value = new MessageContext { Id = Guid.NewGuid(), Type = "Request" };
await _runtime.Begin(newContext);
var handler = (IRequestHandler)null;
if (_runtime.TryGetHandle(newContext, out handler))
{
await handler.Handle(newContext);
}
else
{
await _innerNext(context);
}
// TODO: This doesn't work correctly :( (headers)
await _runtime.End(newContext);
}
}
} | using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Glimpse.Web;
using System;
namespace Glimpse.Host.Web.AspNet
{
public class GlimpseMiddleware
{
private readonly RequestDelegate _innerNext;
private readonly MasterRequestRuntime _runtime;
private readonly ISettings _settings;
private readonly IContextData<MessageContext> _contextData;
public GlimpseMiddleware(RequestDelegate innerNext, IServiceProvider serviceProvider)
{
_innerNext = innerNext;
_runtime = new MasterRequestRuntime(serviceProvider);
_contextData = new ContextData<MessageContext>();
}
public async Task Invoke(Microsoft.AspNet.Http.HttpContext context)
{
var newContext = new HttpContext(context, _settings);
// TODO: This is the wrong place for this, AgentRuntime isn't garenteed to execute first
_contextData.Value = new MessageContext { Id = Guid.NewGuid(), Type = "Request" };
await _runtime.Begin(newContext);
var handler = (IRequestHandler)null;
if (_runtime.TryGetHandle(newContext, out handler))
{
await handler.Handle(newContext);
}
else
{
await _innerNext(context);
}
// TODO: This doesn't work correctly :(
await _runtime.End(newContext);
}
}
} | mit | C# |
a63e3b2d9b3020f0dd3caaa3c4c65b885c13c786 | increase version number / just a test if update works | PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer | StandUpTimer/Properties/AssemblyInfo.cs | StandUpTimer/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("0.8.3")]
[assembly: AssemblyFileVersion("0.8.3")]
[assembly: InternalsVisibleTo("StandUpTimer.UnitTests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] | using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("0.8.2")]
[assembly: AssemblyFileVersion("0.8.2")]
[assembly: InternalsVisibleTo("StandUpTimer.UnitTests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] | mit | C# |
14892be31517c955f52dadbb9c7966ad6c972d56 | update ad place | dncuug/dot-net.in.ua,dncuug/dot-net.in.ua,dncuug/dot-net.in.ua | src/WebSite/Views/Home/Index.cshtml | src/WebSite/Views/Home/Index.cshtml | @using X.PagedList;
@using X.PagedList.Mvc.Core;
@model IPagedList<Core.ViewModels.PublicationViewModel>
@{
ViewData["Title"] = "Welcome!";
}
@section head {
<meta property="og:title" content="@Core.Settings.Current.WebSiteTitle" />
<meta property="og:type" content="website" />
<meta property="og:url" content="@Core.Settings.Current.WebSiteUrl" />
<meta property="og:image" content="@Core.Settings.Current.FacebookImage" />
<meta property="og:description" content="@Core.Settings.Current.DefaultDescription" />
<meta name="keywords" content="@Core.Settings.Current.DefaultKeywords" />
<meta name="description" content="@Core.Settings.Current.DefaultDescription" />
}
@section top {
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>Welcome to the daily developers digest!</h1>
<h3 style="color: #FFF">All news and events will be here!</h3>
<span style="color: #FFF">
Project supported by .NET Core Ukrainian User Group, Microsoft Azure Ukraine User Group and Xamarin Ukraine User Group!
</span>
</div>
</div>
}
@for (var i=0; i<Model.Count(); i++)
{
@Html.Partial("_Publication", Model[i])
if (i == 2) { @Html.Partial("_InFeedAd") }
if (i == 0) { @Html.Partial("_SmartContent") }
}
@Html.PagedListPager(Model, page => $"/page/{page}")
| @using X.PagedList;
@using X.PagedList.Mvc.Core;
@model IPagedList<Core.ViewModels.PublicationViewModel>
@{
ViewData["Title"] = "Welcome!";
}
@section head {
<meta property="og:title" content="@Core.Settings.Current.WebSiteTitle" />
<meta property="og:type" content="website" />
<meta property="og:url" content="@Core.Settings.Current.WebSiteUrl" />
<meta property="og:image" content="@Core.Settings.Current.FacebookImage" />
<meta property="og:description" content="@Core.Settings.Current.DefaultDescription" />
<meta name="keywords" content="@Core.Settings.Current.DefaultKeywords" />
<meta name="description" content="@Core.Settings.Current.DefaultDescription" />
}
@section top {
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>Welcome to the daily developers digest!</h1>
<h3 style="color: #FFF">All news and events will be here!</h3>
<span style="color: #FFF">
Project supported by .NET Core Ukrainian User Group, Microsoft Azure Ukraine User Group and Xamarin Ukraine User Group!
</span>
</div>
</div>
}
@for (var i=0; i<Model.Count(); i++)
{
@Html.Partial("_Publication", Model[i])
if (i == 0) { @Html.Partial("_InFeedAd") }
if (i == 2) { @Html.Partial("_SmartContent") }
}
@Html.PagedListPager(Model, page => $"/page/{page}")
| mit | C# |
dd100bbdf227b4f4552353303f386c3028811eb0 | use untyped ODataOptions for IncidentController | Azure/mobile-services-dynamics-connector,Azure/mobile-services-dynamics-connector,Azure/mobile-services-dynamics-connector | MobileServicesCrm/server/ActivityLoggerBackend/Controllers/IncidentController.cs | MobileServicesCrm/server/ActivityLoggerBackend/Controllers/IncidentController.cs | using System;
using System.Linq;
using ActivityLoggerBackend.Models;
using Microsoft.WindowsAzure.Mobile.Service.Security;
using Microsoft.Xrm.Client.Services;
using Microsoft.Xrm.Sdk.Client;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.OData.Query;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.WebServiceClient;
using Microsoft.Xrm.Client;
using System.Net;
using Microsoft.Xrm.Sdk.Query;
namespace ActivityLoggerBackend.Controllers
{
[AuthorizeLevel(AuthorizationLevel.User)]
public class IncidentController : BaseController<IncidentDto, Incident>
{
public IncidentController()
: base(true)
{
}
[HttpGet]
public async Task<IEnumerable<IncidentDto>> Get(ODataQueryOptions query)
{
this.Services.Log.Info("inside the query\n");
this.Services.Log.Info("Query is: " + this.Request.RequestUri.ToString());
IEnumerable<IncidentDto> incidents = await this.QueryAsync(query);
foreach (var incident in incidents)
{
this.Services.Log.Info("Incident " + incident.Id + ", '" + incident.Text + "', completed: " + incident.Complete.ToString());
}
return incidents;
}
}
} | using System;
using System.Linq;
using ActivityLoggerBackend.Models;
using Microsoft.WindowsAzure.Mobile.Service.Security;
using Microsoft.Xrm.Client.Services;
using Microsoft.Xrm.Sdk.Client;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.OData.Query;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.WebServiceClient;
using Microsoft.Xrm.Client;
using System.Net;
using Microsoft.Xrm.Sdk.Query;
namespace ActivityLoggerBackend.Controllers
{
[AuthorizeLevel(AuthorizationLevel.User)]
public class IncidentController : BaseController<IncidentDto, Incident>
{
public IncidentController()
: base(true)
{
}
[HttpGet]
public async Task<IEnumerable<IncidentDto>> Get(ODataQueryOptions<IncidentDto> query)
{
this.Services.Log.Info("inside the query\n");
this.Services.Log.Info("Query is: " + this.Request.RequestUri.ToString());
IEnumerable<IncidentDto> incidents = await this.QueryAsync(query);
foreach (var incident in incidents)
{
this.Services.Log.Info("Incident " + incident.Id + ", '" + incident.Text + "', completed: " + incident.Complete.ToString());
}
return incidents;
}
}
} | apache-2.0 | C# |
5cad1d5512caf54b0f03daa452bff2482992d203 | Update ICustomDeserializer.cs | tiksn/TIKSN-Framework | TIKSN.Core/Serialization/ICustomDeserializer.cs | TIKSN.Core/Serialization/ICustomDeserializer.cs | namespace TIKSN.Serialization
{
/// <summary>
/// Custom (specialized or typed) deserializer interface
/// </summary>
/// <typeparam name="TSerial">Type to deserialize from, usually string or byte array</typeparam>
public interface ICustomDeserializer<TSerial, TModel>
{
/// <summary>
/// Deserialize from <typeparamref name="TSerial"/> type to <typeparamref name="TModel"/>
/// </summary>
/// <param name="serial"></param>
/// <returns></returns>
TModel Deserialize(TSerial serial);
}
} | namespace TIKSN.Serialization
{
/// <summary>
/// Custom (specialized or typed) deserializer interface
/// </summary>
/// <typeparam name="TSerial">Type to deserialize from, usually string or byte array</typeparam>
public interface ICustomDeserializer<TSerial, TModel>
{
/// <summary>
/// Deserialize from <typeparamref name="TSerial"/> type to <typeparamref name="TModel"/>
/// </summary>
/// <param name="serial"></param>
/// <returns></returns>
TModel Deserialize(TSerial serial);
}
}
| mit | C# |
4e8cb44ae912d8e99827ba36e5fda81b65bc4de1 | Fix merge | vnbaaij/QuicksilverB2B,episerver/QuicksilverB2B,episerver/QuicksilverB2B,vnbaaij/QuicksilverB2B,vnbaaij/QuicksilverB2B,episerver/QuicksilverB2B | Sources/EPiServer.Reference.Commerce.Site.B2B/ServiceContracts/IBudgetService.cs | Sources/EPiServer.Reference.Commerce.Site.B2B/ServiceContracts/IBudgetService.cs | using System;
using System.Collections.Generic;
using EPiServer.Reference.Commerce.Site.B2B.Models.Entities;
using EPiServer.Reference.Commerce.Site.B2B.Models.ViewModels;
namespace EPiServer.Reference.Commerce.Site.B2B.ServiceContracts
{
public interface IBudgetService
{
List<BudgetViewModel> GetAllBudgets();
void CreateNewBudget(BudgetViewModel budgetModel);
List<Budget> GetOrganizationBudgets(Guid organizationId);
void UpdateBudget(BudgetViewModel budgetModel);
Budget GetBudgetById(int budgetId);
bool IsTimeOverlapped(DateTime startDate, DateTime dueDateTime, Guid organizationGuid);
Budget GetCurrentOrganizationBudget(Guid organizationId);
bool HasEnoughAmount(Guid organizationGuid, decimal amount);
List<Budget> GetOrganizationPurchasersBudgets(Guid organizationId);
List<Budget> GetOrganizationBudgetsWithoutPurchasers(Guid organizationId);
Budget GetCustomerCurrentBudget(Guid organizationId, string purchaserName);
Budget GetUserActiveBudget(Guid customerId);
}
}
| using System;
using System.Collections.Generic;
using EPiServer.Reference.Commerce.Site.B2B.Models.Entities;
using EPiServer.Reference.Commerce.Site.B2B.Models.ViewModels;
namespace EPiServer.Reference.Commerce.Site.B2B.ServiceContracts
{
public interface IBudgetService
{
List<BudgetViewModel> GetAllBudgets();
void CreateNewBudget(BudgetViewModel budgetModel);
List<Budget> GetOrganizationBudgets(Guid organizationId);
void UpdateBudget(BudgetViewModel budgetModel);
Budget GetBudgetById(int budgetId);
bool IsTimeOverlapped(DateTime startDate, DateTime dueDateTime, Guid organizationGuid);
Budget GetCurrentOrganizationBudget(Guid organizationId);
bool HasEnoughAmount(Guid organizationGuid, decimal amount);
List<Budget> GetOrganizationPurchasersBudgets(Guid organizationId);
List<Budget> GetOrganizationBudgetsWithoutPurchasers(Guid organizationId);
Budget GetCustomerCurrentBudget(Guid organizationId, string purchaserName);
bool IsValidBudgetAmount(Guid organizationGuid, decimal amount);
Budget GetUserActiveBudget(Guid customerId);
}
}
| apache-2.0 | C# |
58e5a71d31e0f06d544b0b2bccf20a675d2ea8bc | Fix showing username when logged in. | Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW | MitternachtWeb/Views/Shared/_NavbarLogin.cshtml | MitternachtWeb/Views/Shared/_NavbarLogin.cshtml | @{
var DiscordUser = UserHelper.GetDiscordUser(User);
}
@if(DiscordUser == null) {
<a class="nav-link text-dark" asp-area="" asp-controller="Login" asp-action="Index">Login</a>
} else {
@DiscordUser.User
}
| @{
var DiscordUser = UserHelper.GetDiscordUser(User);
}
@if(DiscordUser == null) {
<a class="nav-link text-dark" asp-area="" asp-controller="Login" asp-action="Index">Login</a>
} else {
@DiscordUser
}
| mit | C# |
8f910dfb380473f9e242d258f3a8dea5b9c14cb7 | implement IFileSystem.FolderFor on UnityEditorFileSystem | Unity-Technologies/CodeEditor,Unity-Technologies/CodeEditor | src/CodeEditor.Text.UI.Unity.Editor/Implementation/UnityEditorFileSystem.cs | src/CodeEditor.Text.UI.Unity.Editor/Implementation/UnityEditorFileSystem.cs | using CodeEditor.IO;
using CodeEditor.IO.Implementation;
namespace CodeEditor.Text.UI.Unity.Editor.Implementation
{
class UnityEditorFileSystem : IFileSystem
{
public IFile FileFor(string file)
{
return new UnityEditorFile(file);
}
public IFolder FolderFor(string folder)
{
return new Folder(folder, this);
}
}
}
| using CodeEditor.IO;
namespace CodeEditor.Text.UI.Unity.Editor.Implementation
{
class UnityEditorFileSystem : IFileSystem
{
public IFile FileFor(string file)
{
return new UnityEditorFile(file);
}
}
}
| mit | C# |
58406445bc700a06c9da7f513341ce1af6a6ef92 | Add proto comment | tmat/roslyn,jmarolf/roslyn,brettfo/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,jmarolf/roslyn,tannergooding/roslyn,reaction1989/roslyn,AmadeusW/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,stephentoub/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,diryboy/roslyn,wvdd007/roslyn,dotnet/roslyn,brettfo/roslyn,mavasani/roslyn,eriawan/roslyn,eriawan/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,tmat/roslyn,brettfo/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,gafter/roslyn,tannergooding/roslyn,AmadeusW/roslyn,eriawan/roslyn,wvdd007/roslyn,AmadeusW/roslyn,heejaechang/roslyn,KevinRansom/roslyn,stephentoub/roslyn,genlu/roslyn,panopticoncentral/roslyn,tmat/roslyn,aelij/roslyn,davkean/roslyn,weltkante/roslyn,mavasani/roslyn,sharwell/roslyn,davkean/roslyn,physhi/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,gafter/roslyn,sharwell/roslyn,weltkante/roslyn,dotnet/roslyn,physhi/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,genlu/roslyn,KirillOsenkov/roslyn,genlu/roslyn,gafter/roslyn,panopticoncentral/roslyn,jasonmalinowski/roslyn,mgoertz-msft/roslyn,aelij/roslyn,jasonmalinowski/roslyn,AlekseyTs/roslyn,ErikSchierboom/roslyn,AlekseyTs/roslyn,heejaechang/roslyn,physhi/roslyn,wvdd007/roslyn,dotnet/roslyn,aelij/roslyn,KirillOsenkov/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,jmarolf/roslyn,reaction1989/roslyn,panopticoncentral/roslyn,mavasani/roslyn,diryboy/roslyn,mgoertz-msft/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,davkean/roslyn | src/Compilers/Core/Portable/SourceGeneration/AdditionalSourcesCollection.cs | src/Compilers/Core/Portable/SourceGeneration/AdditionalSourcesCollection.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;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
#nullable enable
namespace Microsoft.CodeAnalysis
{
// PROTOTYPE: should this implement ICollection?
[System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0016:Add public types and members to the declared API", Justification = "In Progress")]
public sealed class AdditionalSourcesCollection
{
private readonly PooledDictionary<string, SourceText> _sourcesAdded;
internal AdditionalSourcesCollection()
{
_sourcesAdded = PooledDictionary<string, SourceText>.GetInstance();
}
internal AdditionalSourcesCollection(ImmutableArray<GeneratedSourceText> sources)
: this()
{
foreach (var source in sources)
{
_sourcesAdded.Add(source.HintName, source.Text);
}
}
public void Add(string hintName, SourceText source)
{
_sourcesAdded.Add(hintName, source);
}
public void RemoveSource(string hintName)
{
_sourcesAdded.Remove(hintName);
}
public bool Contains(string hintName) => _sourcesAdded.ContainsKey(hintName);
internal ImmutableArray<GeneratedSourceText> ToImmutableAndFree()
{
// PROTOTYPE: This needs to be consistently ordered
ArrayBuilder<GeneratedSourceText> builder = ArrayBuilder<GeneratedSourceText>.GetInstance();
foreach (var (hintName, sourceText) in _sourcesAdded)
{
builder.Add(new GeneratedSourceText(hintName, sourceText));
}
_sourcesAdded.Free();
return builder.ToImmutableAndFree();
}
}
}
| // 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;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
#nullable enable
namespace Microsoft.CodeAnalysis
{
// PROTOTYPE: should this implement ICollection?
[System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0016:Add public types and members to the declared API", Justification = "In Progress")]
public sealed class AdditionalSourcesCollection
{
private readonly PooledDictionary<string, SourceText> _sourcesAdded;
internal AdditionalSourcesCollection()
{
_sourcesAdded = PooledDictionary<string, SourceText>.GetInstance();
}
internal AdditionalSourcesCollection(ImmutableArray<GeneratedSourceText> sources)
: this()
{
foreach (var source in sources)
{
_sourcesAdded.Add(source.HintName, source.Text);
}
}
public void Add(string hintName, SourceText source)
{
_sourcesAdded.Add(hintName, source);
}
public void RemoveSource(string hintName)
{
_sourcesAdded.Remove(hintName);
}
public bool Contains(string hintName) => _sourcesAdded.ContainsKey(hintName);
internal ImmutableArray<GeneratedSourceText> ToImmutableAndFree()
{
ArrayBuilder<GeneratedSourceText> builder = ArrayBuilder<GeneratedSourceText>.GetInstance();
foreach (var (hintName, sourceText) in _sourcesAdded)
{
builder.Add(new GeneratedSourceText(hintName, sourceText));
}
_sourcesAdded.Free();
return builder.ToImmutableAndFree();
}
}
}
| mit | C# |
f819ffce2bbb64e2fdba83d130042d084304625c | Make the legacy decoder more resilient against leading linebreaks | ZLima12/osu,2yangk23/osu,Drezi126/osu,DrabWeb/osu,EVAST9919/osu,smoogipooo/osu,smoogipoo/osu,Damnae/osu,UselessToucan/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,DrabWeb/osu,ZLima12/osu,johnneijzen/osu,peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,johnneijzen/osu,Frontear/osuKyzer,ppy/osu,smoogipoo/osu,2yangk23/osu,UselessToucan/osu,DrabWeb/osu,UselessToucan/osu,EVAST9919/osu,naoey/osu,naoey/osu,naoey/osu,Nabile-Rahmani/osu,smoogipoo/osu,peppy/osu | osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | osu.Game/Beatmaps/Formats/BeatmapDecoder.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 System;
using System.Collections.Generic;
using System.IO;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Beatmaps.Formats
{
public abstract class BeatmapDecoder
{
private static readonly Dictionary<string, Type> decoders = new Dictionary<string, Type>();
static BeatmapDecoder()
{
OsuLegacyDecoder.Register();
}
public static BeatmapDecoder GetDecoder(StreamReader stream)
{
string line;
do { line = stream.ReadLine()?.Trim(); }
while (line != null && line.Length == 0);
if (line == null || !decoders.ContainsKey(line))
throw new IOException(@"Unknown file format");
return (BeatmapDecoder)Activator.CreateInstance(decoders[line], line);
}
protected static void AddDecoder<T>(string magic) where T : BeatmapDecoder
{
decoders[magic] = typeof(T);
}
public virtual Beatmap Decode(StreamReader stream)
{
return ParseFile(stream);
}
public virtual void Decode(StreamReader stream, Beatmap beatmap)
{
ParseFile(stream, beatmap);
}
protected virtual Beatmap ParseFile(StreamReader stream)
{
var beatmap = new Beatmap
{
HitObjects = new List<HitObject>(),
BeatmapInfo = new BeatmapInfo
{
Metadata = new BeatmapMetadata(),
Difficulty = new BeatmapDifficulty(),
},
};
ParseFile(stream, beatmap);
return beatmap;
}
protected abstract void ParseFile(StreamReader stream, Beatmap beatmap);
}
}
| // Copyright (c) 2007-2017 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.IO;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Beatmaps.Formats
{
public abstract class BeatmapDecoder
{
private static readonly Dictionary<string, Type> decoders = new Dictionary<string, Type>();
static BeatmapDecoder()
{
OsuLegacyDecoder.Register();
}
public static BeatmapDecoder GetDecoder(StreamReader stream)
{
string line = stream.ReadLine()?.Trim();
if (line == null || !decoders.ContainsKey(line))
throw new IOException(@"Unknown file format");
return (BeatmapDecoder)Activator.CreateInstance(decoders[line], line);
}
protected static void AddDecoder<T>(string magic) where T : BeatmapDecoder
{
decoders[magic] = typeof(T);
}
public virtual Beatmap Decode(StreamReader stream)
{
return ParseFile(stream);
}
public virtual void Decode(StreamReader stream, Beatmap beatmap)
{
ParseFile(stream, beatmap);
}
protected virtual Beatmap ParseFile(StreamReader stream)
{
var beatmap = new Beatmap
{
HitObjects = new List<HitObject>(),
BeatmapInfo = new BeatmapInfo
{
Metadata = new BeatmapMetadata(),
Difficulty = new BeatmapDifficulty(),
},
};
ParseFile(stream, beatmap);
return beatmap;
}
protected abstract void ParseFile(StreamReader stream, Beatmap beatmap);
}
}
| mit | C# |
6348d1f0973ecb4bf77b40c5525534fbc6fc8153 | Change redirecturi to tryfunctionspage | fashaikh/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/SimpleWAWS,fashaikh/SimpleWAWS,projectkudu/TryAppService,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/TryAppService,fashaikh/SimpleWAWS,projectkudu/TryAppService,fashaikh/SimpleWAWS,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS,projectkudu/TryAppService,projectkudu/SimpleWAWS,davidebbo/SimpleWAWS | SimpleWAWS/Authentication/GoogleAuthProvider.cs | SimpleWAWS/Authentication/GoogleAuthProvider.cs | using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
namespace SimpleWAWS.Authentication
{
public class GoogleAuthProvider : BaseOpenIdConnectAuthProvider
{
public override string GetLoginUrl(HttpContextBase context)
{
var culture = CultureInfo.CurrentCulture.Name.ToLowerInvariant();
var builder = new StringBuilder();
builder.Append("https://accounts.google.com/o/oauth2/auth");
builder.Append("?response_type=id_token");
//TODO:Add a whitelisted location list
if (context.IsFunctionsPortalRequest())
{
builder.AppendFormat("&redirect_uri={0}", WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "{0}/?Login=true", context.Request.Headers["Origin"])));
}
else
{
builder.AppendFormat("&redirect_uri={0}", WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "https://{0}/Login", context.Request.Headers["HOST"])));
}
builder.AppendFormat("&client_id={0}", AuthSettings.GoogleAppId);
builder.AppendFormat("&scope={0}", "email");
builder.AppendFormat("&state={0}", WebUtility.UrlEncode(context.IsAjaxRequest()|| context.IsFunctionsPortalRequest() ? string.Format(CultureInfo.InvariantCulture, "/{0}{1}", culture, context.Request.Url.Query) : context.Request.Url.PathAndQuery));
return builder.ToString();
}
protected override string GetValidAudiance()
{
return AuthSettings.GoogleAppId;
}
public override string GetIssuerName(string altSecId)
{
return "Google";
}
}
} | using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
namespace SimpleWAWS.Authentication
{
public class GoogleAuthProvider : BaseOpenIdConnectAuthProvider
{
public override string GetLoginUrl(HttpContextBase context)
{
var culture = CultureInfo.CurrentCulture.Name.ToLowerInvariant();
var builder = new StringBuilder();
builder.Append("https://accounts.google.com/o/oauth2/auth");
builder.Append("?response_type=id_token");
builder.AppendFormat("&redirect_uri={0}", WebUtility.UrlEncode(string.Format(CultureInfo.InvariantCulture, "https://{0}/Login", context.Request.Headers["HOST"])));
builder.AppendFormat("&client_id={0}", AuthSettings.GoogleAppId);
builder.AppendFormat("&scope={0}", "email");
builder.AppendFormat("&state={0}", WebUtility.UrlEncode(context.IsAjaxRequest()|| context.IsFunctionsPortalRequest() ? string.Format(CultureInfo.InvariantCulture, "/{0}{1}", culture, context.Request.Url.Query) : context.Request.Url.PathAndQuery));
return builder.ToString();
}
protected override string GetValidAudiance()
{
return AuthSettings.GoogleAppId;
}
public override string GetIssuerName(string altSecId)
{
return "Google";
}
}
} | apache-2.0 | C# |
af01ebd2528e694209aadf7d9991c305899c2a40 | Add missing docs. Ref: #34 | tusdotnet/tusdotnet,smatsson/tusdotnet,tusdotnet/tusdotnet,tusdotnet/tusdotnet,smatsson/tusdotnet,tusdotnet/tusdotnet | Source/tusdotnet/Models/Configuration/Events.cs | Source/tusdotnet/Models/Configuration/Events.cs | using System;
using System.Threading.Tasks;
namespace tusdotnet.Models.Configuration
{
/// <summary>
/// Events supported by tusdotnet
/// </summary>
public class Events
{
/// <summary>
/// Callback ran when a file is completely uploaded.
/// This callback is called only once after the last bytes have been written to the store or
/// after a "final" file has been created using the concatenation extension.
/// It will not be called for any subsequent requests for already completed files.
/// </summary>
public Func<FileCompleteContext, Task> OnFileCompleteAsync { get; set; }
/// <summary>
/// Callback ran right before a file is created. This callback can be used to validate
/// files before they are created. Calling the <code>FailRequest</code> method on the context
/// will return a 400 Bad Request to the client.
/// </summary>
public Func<BeforeCreateContext, Task> OnBeforeCreateAsync { get; set; }
/// <summary>
/// Callback ran right before a file is deleted. This callback can be used to validate
/// that a file can be deleted. Calling the <code>FailRequest</code> method on the context
/// will return a 400 Bad Request to the client.
/// </summary>
public Func<BeforeDeleteContext, Task> OnBeforeDeleteAsync { get; set; }
}
}
| using System;
using System.Threading.Tasks;
namespace tusdotnet.Models.Configuration
{
/// <summary>
/// Events supported by tusdotnet
/// </summary>
public class Events
{
/// <summary>
/// Callback ran when a file is completely uploaded.
/// This callback is called only once after the last bytes have been written to the store or
/// after a "final" file has been created using the concatenation extension.
/// It will not be called for any subsequent requests for already completed files.
/// </summary>
public Func<FileCompleteContext, Task> OnFileCompleteAsync { get; set; }
/// <summary>
/// Callback ran right before a file is created. This callback can be used to validate
/// files before they are created. Calling the <code>FailRequest</code> method on the context
/// will return a 400 Bad Request to the client.
/// </summary>
public Func<BeforeCreateContext, Task> OnBeforeCreateAsync { get; set; }
public Func<BeforeDeleteContext, Task> OnBeforeDeleteAsync { get; set; }
}
}
| mit | C# |
f33c4cf64eb4d3bece93e3dc2e801d26e7520367 | Update MicrosoftAdUnitBundle.cs | tiksn/TIKSN-Framework | TIKSN.Core/Advertising/MicrosoftAdUnitBundle.cs | TIKSN.Core/Advertising/MicrosoftAdUnitBundle.cs | namespace TIKSN.Advertising
{
public abstract class MicrosoftAdUnitBundle : AdUnitBundle
{
protected MicrosoftAdUnitBundle(AdUnit designTime, string applicationId, string adUnitId)
: base(designTime, new AdUnit(AdProviders.Microsoft, applicationId, adUnitId))
{
}
}
}
| namespace TIKSN.Advertising
{
public abstract class MicrosoftAdUnitBundle : AdUnitBundle
{
protected MicrosoftAdUnitBundle(AdUnit designTime, string applicationId, string adUnitId)
: base(designTime, new AdUnit(AdProviders.Microsoft, applicationId, adUnitId))
{
}
}
} | mit | C# |
b25b8cef7bd06b1e86000d853b009a324a28af36 | add content to connect method | SexyFishHorse/IrcClient4Net | IrcClient4Net/TwitchIrcClient.cs | IrcClient4Net/TwitchIrcClient.cs | namespace SexyFishHorse.Irc.Client
{
using System.IO;
using System.Net.Sockets;
using SexyFishHorse.Irc.Client.Configuration;
public class TwitchIrcClient : ITwitchIrcClient
{
private readonly IConfiguration configuration;
private TcpClient client;
private StreamReader inputStream;
private StreamWriter outputStream;
public TwitchIrcClient(IConfiguration configuration)
{
this.configuration = configuration;
}
public void Connect()
{
client = new TcpClient(configuration.TwitchIrcServerName, configuration.TwitchIrcPortNumber);
inputStream = new StreamReader(client.GetStream());
outputStream = new StreamWriter(client.GetStream());
outputStream.WriteLine("PASS " + configuration.TwitchIrcPassword);
outputStream.WriteLine("NICK " + configuration.TwitchIrcNickname);
outputStream.WriteLine("USER " + configuration.TwitchIrcNickname + " 8 * : " + configuration.TwitchIrcNickname);
outputStream.Flush();
}
}
}
| namespace SexyFishHorse.Irc.Client
{
using System;
using SexyFishHorse.Irc.Client.Configuration;
public class TwitchIrcClient : ITwitchIrcClient
{
private readonly IConfiguration configuration;
public TwitchIrcClient(IConfiguration configuration)
{
this.configuration = configuration;
}
public void Connect()
{
throw new NotImplementedException();
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.