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 |
---|---|---|---|---|---|---|---|---|
bbf9825a567b7b544a1b54a5ccd418c0d37d1912
|
update version
|
prodot/ReCommended-Extension
|
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
|
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
|
using System.Reflection;
using ReCommendedExtension;
// 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(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2019 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("3.5.0.0")]
[assembly: AssemblyFileVersion("3.5.0")]
|
using System.Reflection;
using ReCommendedExtension;
// 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(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2019 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("3.4.4.0")]
[assembly: AssemblyFileVersion("3.4.4")]
|
apache-2.0
|
C#
|
d898a7d8df92acb856a153820ab88c211eb8a059
|
Support full interface
|
CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,mavasani/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,mavasani/roslyn,dotnet/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,diryboy/roslyn,bartdesmet/roslyn,mavasani/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,weltkante/roslyn,weltkante/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,diryboy/roslyn
|
src/Workspaces/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonEmbeddedLanguage.cs
|
src/Workspaces/Core/Portable/EmbeddedLanguages/Json/LanguageServices/JsonEmbeddedLanguage.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.EmbeddedLanguages.LanguageServices;
using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars;
using Microsoft.CodeAnalysis.LanguageServices;
namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json.LanguageServices
{
internal class JsonEmbeddedLanguage : IEmbeddedLanguage
{
public int StringLiteralKind { get; }
public ISyntaxFactsService SyntaxFacts { get; }
public ISemanticFactsService SemanticFacts { get; }
public IVirtualCharService VirtualCharService { get; }
public JsonEmbeddedLanguage(
AbstractEmbeddedLanguageProvider languageProvider,
int stringLiteralKind,
ISyntaxFactsService syntaxFacts,
ISemanticFactsService semanticFacts,
IVirtualCharService virtualCharService)
{
StringLiteralKind = stringLiteralKind;
SyntaxFacts = syntaxFacts;
SemanticFacts = semanticFacts;
VirtualCharService = virtualCharService;
BraceMatcher = new JsonEmbeddedBraceMatcher(this);
Classifier = new JsonEmbeddedClassifier(this);
DiagnosticAnalyzer = new AggregateEmbeddedDiagnosticAnalyzer(
new JsonDiagnosticAnalyzer(this),
new JsonDetectionAnalyzer(this));
CodeFixProvider = new JsonEmbeddedCodeFixProvider(languageProvider, this);
}
public IEmbeddedBraceMatcher BraceMatcher { get; }
public IEmbeddedClassifier Classifier { get; }
public IEmbeddedDiagnosticAnalyzer DiagnosticAnalyzer { get; }
public IEmbeddedCodeFixProvider CodeFixProvider { get; }
// No document-highlights for embedded json currently.
public IEmbeddedHighlighter Highlighter => null;
}
}
|
// 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.EmbeddedLanguages.LanguageServices;
using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars;
using Microsoft.CodeAnalysis.LanguageServices;
namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Json.LanguageServices
{
internal class JsonEmbeddedLanguage : IEmbeddedLanguage
{
public int StringLiteralKind { get; }
public ISyntaxFactsService SyntaxFacts { get; }
public ISemanticFactsService SemanticFacts { get; }
public IVirtualCharService VirtualCharService { get; }
public JsonEmbeddedLanguage(
AbstractEmbeddedLanguageProvider languageProvider,
int stringLiteralKind,
ISyntaxFactsService syntaxFacts,
ISemanticFactsService semanticFacts,
IVirtualCharService virtualCharService)
{
StringLiteralKind = stringLiteralKind;
SyntaxFacts = syntaxFacts;
SemanticFacts = semanticFacts;
VirtualCharService = virtualCharService;
BraceMatcher = new JsonEmbeddedBraceMatcher(this);
Classifier = new JsonEmbeddedClassifier(this);
DiagnosticAnalyzer = new AggregateEmbeddedDiagnosticAnalyzer(
new JsonDiagnosticAnalyzer(this),
new JsonDetectionAnalyzer(this));
CodeFixProvider = new JsonEmbeddedCodeFixProvider(languageProvider, this);
}
public IEmbeddedBraceMatcher BraceMatcher { get; }
public IEmbeddedClassifier Classifier { get; }
public IEmbeddedDiagnosticAnalyzer DiagnosticAnalyzer { get; }
public IEmbeddedCodeFixProvider CodeFixProvider { get; }
}
}
|
mit
|
C#
|
d3af3ff05dad12e8c9b7d894b011f623b1f3851a
|
Add a display property for cadet rank
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
BatteryCommander.Common/Models/Rank.cs
|
BatteryCommander.Common/Models/Rank.cs
|
using System.ComponentModel.DataAnnotations;
namespace BatteryCommander.Common.Models
{
public enum Rank
{
[Display(Name = "PVT")]
E1 = 1,
[Display(Name = "PV2")]
E2 = 2,
[Display(Name = "PFC")]
E3 = 3,
[Display(Name = "SPC")]
E4 = 4,
[Display(Name = "SGT")]
E5 = 5,
[Display(Name = "SSG")]
E6 = 6,
[Display(Name = "SFC")]
E7 = 7,
[Display(Name = "1SG")]
E8 = 8,
[Display(Name = "CDT")]
Cadet = 9,
[Display(Name = "2LT")]
O1 = 10,
[Display(Name = "1LT")]
O2 = 11,
[Display(Name = "CPT")]
O3 = 12,
[Display(Name = "MAJ")]
O4 = 13,
[Display(Name = "LTC")]
O5 = 14,
[Display(Name = "COL")]
O6 = 15
}
}
|
using System.ComponentModel.DataAnnotations;
namespace BatteryCommander.Common.Models
{
public enum Rank
{
[Display(Name = "PVT")]
E1 = 1,
[Display(Name = "PV2")]
E2 = 2,
[Display(Name = "PFC")]
E3 = 3,
[Display(Name = "SPC")]
E4 = 4,
[Display(Name = "SGT")]
E5 = 5,
[Display(Name = "SSG")]
E6 = 6,
[Display(Name = "SFC")]
E7 = 7,
[Display(Name = "1SG")]
E8 = 8,
Cadet = 9,
[Display(Name = "2LT")]
O1 = 10,
[Display(Name = "1LT")]
O2 = 11,
[Display(Name = "CPT")]
O3 = 12,
[Display(Name = "MAJ")]
O4 = 13,
[Display(Name = "LTC")]
O5 = 14,
[Display(Name = "COL")]
O6 = 15
}
}
|
mit
|
C#
|
3721eb049835074dea0792774aaff3fce2a5979d
|
increase version no.
|
gigya/microdot
|
SolutionVersion.cs
|
SolutionVersion.cs
|
#region Copyright
// Copyright 2017 Gigya Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER 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 HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Gigya Inc.")]
[assembly: AssemblyCopyright("© 2017 Gigya Inc.")]
[assembly: AssemblyDescription("Microdot Framework")]
[assembly: AssemblyVersion("1.1.2.0")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2.0")]
// 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)]
[assembly: CLSCompliant(false)]
|
#region Copyright
// Copyright 2017 Gigya Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER 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 HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Gigya Inc.")]
[assembly: AssemblyCopyright("© 2017 Gigya Inc.")]
[assembly: AssemblyDescription("Microdot Framework")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1.0")]
// 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)]
[assembly: CLSCompliant(false)]
|
apache-2.0
|
C#
|
e27868b658d3cdf8048f4b9d03c8fd9b753a9822
|
make sure TodoMVC sample works.
|
JSONAPIdotNET/JSONAPI.NET,SathishN/JSONAPI.NET,SphtKr/JSONAPI.NET,danshapir/JSONAPI.NET
|
JSONAPI.TodoMVC.API/Startup.cs
|
JSONAPI.TodoMVC.API/Startup.cs
|
using System.Data.Entity;
using System.Reflection;
using System.Web.Http;
using Autofac;
using Autofac.Integration.WebApi;
using JSONAPI.Autofac;
using JSONAPI.Autofac.EntityFramework;
using JSONAPI.Core;
using JSONAPI.EntityFramework.Http;
using JSONAPI.TodoMVC.API.Models;
using Owin;
namespace JSONAPI.TodoMVC.API
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
var httpConfig = GetWebApiConfiguration();
app.UseWebApi(httpConfig);
}
private static HttpConfiguration GetWebApiConfiguration()
{
var httpConfig = new HttpConfiguration();
var pluralizationService = new PluralizationService();
pluralizationService.AddMapping("todo", "todos");
var namingConventions = new DefaultNamingConventions(pluralizationService);
var configuration = new JsonApiAutofacConfiguration(namingConventions);
configuration.RegisterResourceType(typeof(Todo));
var module = configuration.GetAutofacModule();
var efModule = configuration.GetEntityFrameworkAutofacModule();
var containerBuilder = new ContainerBuilder();
containerBuilder.RegisterModule(module);
containerBuilder.RegisterModule(efModule);
containerBuilder.RegisterGeneric(typeof(EntityFrameworkDocumentMaterializer<>))
.AsImplementedInterfaces();
containerBuilder.RegisterApiControllers(Assembly.GetExecutingAssembly());
containerBuilder.RegisterType<TodoMvcContext>().As<DbContext>();
var container = containerBuilder.Build();
httpConfig.UseJsonApiWithAutofac(container);
// Web API routes
httpConfig.Routes.MapHttpRoute("DefaultApi", "{controller}/{id}", new { id = RouteParameter.Optional });
return httpConfig;
}
}
}
|
using System.Web.Http;
using Autofac;
using JSONAPI.Autofac;
using JSONAPI.Autofac.EntityFramework;
using JSONAPI.Core;
using JSONAPI.EntityFramework.Http;
using JSONAPI.TodoMVC.API.Models;
using Owin;
namespace JSONAPI.TodoMVC.API
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
var httpConfig = GetWebApiConfiguration();
app.UseWebApi(httpConfig);
}
private static HttpConfiguration GetWebApiConfiguration()
{
var httpConfig = new HttpConfiguration();
var pluralizationService = new PluralizationService();
pluralizationService.AddMapping("todo", "todos");
var namingConventions = new DefaultNamingConventions(pluralizationService);
var configuration = new JsonApiAutofacConfiguration(namingConventions);
configuration.RegisterResourceType(typeof(Todo));
var module = configuration.GetAutofacModule();
var efModule = configuration.GetEntityFrameworkAutofacModule();
var containerBuilder = new ContainerBuilder();
containerBuilder.RegisterModule(module);
containerBuilder.RegisterModule(efModule);
containerBuilder.RegisterGeneric(typeof(EntityFrameworkDocumentMaterializer<>))
.AsImplementedInterfaces();
var container = containerBuilder.Build();
httpConfig.UseJsonApiWithAutofac(container);
// Web API routes
httpConfig.Routes.MapHttpRoute("DefaultApi", "{controller}/{id}", new { id = RouteParameter.Optional });
return httpConfig;
}
}
}
|
mit
|
C#
|
ecb4afb055bc3e99d8a424a881140f92de2ee277
|
Fix incorrect 4 object equal check syntax
|
HilHi-Technology/Vision
|
Assets/Scripts/FullVisionScript.cs
|
Assets/Scripts/FullVisionScript.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FullVisionScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Vector3 camForward = transform.forward;
Camera cam = GetComponent<Camera>();
float vFOV = cam.fieldOfView;
float radAngle = cam.fieldOfView * Mathf.Deg2Rad;
float radHFOV = 2 * (float) Math.Atan(Mathf.Tan(radAngle / 2) * cam.aspect);
float hFOV = Mathf.Rad2Deg * radHFOV;
Vector3 upperLeft = Quaternion.AngleAxis(-hFOV / 2, transform.up) * Quaternion.AngleAxis(vFOV / 4, transform.right) * camForward;
Vector3 upperRight = Quaternion.AngleAxis(hFOV / 2, transform.up) * Quaternion.AngleAxis(vFOV / 4, transform.right) * camForward;
Vector3 lowerLeft = Quaternion.AngleAxis(-hFOV / 2, transform.up) * Quaternion.AngleAxis(-vFOV / 4, transform.right) * camForward;
Vector3 lowerRight = Quaternion.AngleAxis(hFOV / 2, transform.up) * Quaternion.AngleAxis(-vFOV / 4, transform.right) * camForward;
Debug.DrawRay(transform.position, upperLeft, Color.red);
Debug.DrawRay(transform.position, upperRight, Color.blue);
Debug.DrawRay(transform.position, lowerLeft, Color.green);
Debug.DrawRay(transform.position, lowerRight, Color.yellow);
Debug.DrawRay(transform.position, transform.forward, Color.white);
RaycastHit upperLeftHit;
RaycastHit upperRightHit;
RaycastHit lowerLeftHit;
RaycastHit lowerRightHit;
if (Physics.Raycast(transform.position, upperLeft, out upperLeftHit)) {
if (Physics.Raycast(transform.position, upperRight, out upperRightHit)) {
if (Physics.Raycast(transform.position, lowerLeft, out lowerLeftHit)) {
if (Physics.Raycast(transform.position, lowerRight, out lowerRightHit)) {
if (upperLeftHit.transform == upperRightHit.transform && lowerLeftHit.transform == lowerRightHit.transform && upperLeftHit.transform == lowerLeftHit.transform) {
upperLeftHit.transform.BroadcastMessage("FullVision");
}
}
}
}
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FullVisionScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Vector3 camForward = transform.forward;
Camera cam = GetComponent<Camera>();
float vFOV = cam.fieldOfView;
float radAngle = cam.fieldOfView * Mathf.Deg2Rad;
float radHFOV = 2 * (float) Math.Atan(Mathf.Tan(radAngle / 2) * cam.aspect);
float hFOV = Mathf.Rad2Deg * radHFOV;
//print(vFOV);
//print(hFOV);
Vector3 upperLeft = Quaternion.AngleAxis(-hFOV / 2, transform.up) * Quaternion.AngleAxis(vFOV / 4, transform.right) * camForward;
Vector3 upperRight = Quaternion.AngleAxis(hFOV / 2, transform.up) * Quaternion.AngleAxis(vFOV / 4, transform.right) * camForward;
Vector3 lowerLeft = Quaternion.AngleAxis(-hFOV / 2, transform.up) * Quaternion.AngleAxis(-vFOV / 4, transform.right) * camForward;
Vector3 lowerRight = Quaternion.AngleAxis(hFOV / 2, transform.up) * Quaternion.AngleAxis(-vFOV / 4, transform.right) * camForward;
Debug.DrawRay(transform.position, upperLeft, Color.red);
Debug.DrawRay(transform.position, upperRight, Color.blue);
Debug.DrawRay(transform.position, lowerLeft, Color.green);
Debug.DrawRay(transform.position, lowerRight, Color.yellow);
Debug.DrawRay(transform.position, transform.forward, Color.white);
RaycastHit upperLeftHit;
RaycastHit upperRightHit;
RaycastHit lowerLeftHit;
RaycastHit lowerRightHit;
if (Physics.Raycast(transform.position, upperLeft, out upperLeftHit)) {
if (Physics.Raycast(transform.position, upperRight, out upperRightHit)) {
if (Physics.Raycast(transform.position, lowerLeft, out lowerLeftHit)) {
if (Physics.Raycast(transform.position, lowerRight, out lowerRightHit)) {
if (upperLeftHit.transform == upperRightHit.transform == lowerLeftHit.transform == lowerRightHit.transform) {
upperLeftHit.transform.BroadcastMessage("FullVision");
}
}
}
}
}
}
}
|
mit
|
C#
|
da16f4c47b2faa4aee65baef824ddb138a16212a
|
Enable Server GC for FormatterBenchmarks
|
diryboy/roslyn,AlekseyTs/roslyn,eriawan/roslyn,dotnet/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,gafter/roslyn,brettfo/roslyn,jmarolf/roslyn,jmarolf/roslyn,AmadeusW/roslyn,physhi/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,brettfo/roslyn,davkean/roslyn,physhi/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,sharwell/roslyn,aelij/roslyn,mgoertz-msft/roslyn,sharwell/roslyn,tmat/roslyn,weltkante/roslyn,gafter/roslyn,dotnet/roslyn,heejaechang/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,diryboy/roslyn,physhi/roslyn,aelij/roslyn,stephentoub/roslyn,tmat/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,dotnet/roslyn,AlekseyTs/roslyn,wvdd007/roslyn,genlu/roslyn,panopticoncentral/roslyn,brettfo/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,panopticoncentral/roslyn,heejaechang/roslyn,wvdd007/roslyn,jasonmalinowski/roslyn,stephentoub/roslyn,bartdesmet/roslyn,KirillOsenkov/roslyn,tannergooding/roslyn,tannergooding/roslyn,mavasani/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,davkean/roslyn,genlu/roslyn,davkean/roslyn,genlu/roslyn,KirillOsenkov/roslyn,mgoertz-msft/roslyn,aelij/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,panopticoncentral/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,ErikSchierboom/roslyn,gafter/roslyn,ErikSchierboom/roslyn,mavasani/roslyn,mavasani/roslyn,tannergooding/roslyn,tmat/roslyn,jmarolf/roslyn,weltkante/roslyn
|
src/Tools/IdeBenchmarks/FormatterBenchmarks.cs
|
src/Tools/IdeBenchmarks/FormatterBenchmarks.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.IO;
using System.Linq;
using System.Threading;
using BenchmarkDotNet.Attributes;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Test.Utilities;
namespace IdeBenchmarks
{
[GcServer(true)]
public class FormatterBenchmarks
{
private readonly UseExportProviderAttribute _useExportProviderAttribute = new UseExportProviderAttribute();
[Params(
"BoundNodes.xml.Generated",
"ErrorFacts.Generated",
"Syntax.xml.Internal.Generated",
"Syntax.xml.Main.Generated",
"Syntax.xml.Syntax.Generated")]
public string Document { get; set; }
[IterationSetup]
public void IterationSetup()
=> _useExportProviderAttribute.Before(null);
[IterationCleanup]
public void IterationCleanup()
=> _useExportProviderAttribute.After(null);
[Benchmark]
public object FormatCSharp()
{
var path = Path.Combine(Path.GetFullPath(@"..\..\..\..\..\src\Compilers\CSharp\Portable\Generated"), Document + ".cs");
var text = File.ReadAllText(path);
using var workspace = TestWorkspace.CreateCSharp(text);
var document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id);
return Formatter.GetFormattedTextChanges(document.GetSyntaxRootSynchronously(CancellationToken.None), workspace);
}
[Benchmark]
public object FormatVisualBasic()
{
var path = Path.Combine(Path.GetFullPath(@"..\..\..\..\..\src\Compilers\VisualBasic\Portable\Generated"), Document + ".vb");
var text = File.ReadAllText(path);
using var workspace = TestWorkspace.CreateVisualBasic(text);
var document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id);
return Formatter.GetFormattedTextChanges(document.GetSyntaxRootSynchronously(CancellationToken.None), workspace);
}
}
}
|
// 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.IO;
using System.Linq;
using System.Threading;
using BenchmarkDotNet.Attributes;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Test.Utilities;
namespace IdeBenchmarks
{
public class FormatterBenchmarks
{
private readonly UseExportProviderAttribute _useExportProviderAttribute = new UseExportProviderAttribute();
[Params(
"BoundNodes.xml.Generated",
"ErrorFacts.Generated",
"Syntax.xml.Internal.Generated",
"Syntax.xml.Main.Generated",
"Syntax.xml.Syntax.Generated")]
public string Document { get; set; }
[IterationSetup]
public void IterationSetup()
=> _useExportProviderAttribute.Before(null);
[IterationCleanup]
public void IterationCleanup()
=> _useExportProviderAttribute.After(null);
[Benchmark]
public object FormatCSharp()
{
var path = Path.Combine(Path.GetFullPath(@"..\..\..\..\..\src\Compilers\CSharp\Portable\Generated"), Document + ".cs");
var text = File.ReadAllText(path);
using var workspace = TestWorkspace.CreateCSharp(text);
var document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id);
return Formatter.GetFormattedTextChanges(document.GetSyntaxRootSynchronously(CancellationToken.None), workspace);
}
[Benchmark]
public object FormatVisualBasic()
{
var path = Path.Combine(Path.GetFullPath(@"..\..\..\..\..\src\Compilers\VisualBasic\Portable\Generated"), Document + ".vb");
var text = File.ReadAllText(path);
using var workspace = TestWorkspace.CreateVisualBasic(text);
var document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id);
return Formatter.GetFormattedTextChanges(document.GetSyntaxRootSynchronously(CancellationToken.None), workspace);
}
}
}
|
mit
|
C#
|
3bc9533ae839a0fafcb2f81d9ceecfbb526f2fbe
|
Update install checker. Don't forget to add the "System" assembly reference, sigh.
|
henrybauer/AutoAsparagus
|
AutoAsparagus/ASPInstallChecker.cs
|
AutoAsparagus/ASPInstallChecker.cs
|
/*
* Originally based on the InstallChecker from the Kethane mod for Kerbal Space Program.
* This version is based off taraniselsu's version from https://github.com/Majiir/Kethane/blob/b93b1171ec42b4be6c44b257ad31c7efd7ea1702/Plugin/InstallChecker.cs
*
* Original is (C) Copyright Majiir.
* CC0 Public Domain (http://creativecommons.org/publicdomain/zero/1.0/)
* http://forum.kerbalspaceprogram.com/threads/65395-CompatibilityChecker-Discussion-Thread?p=899895&viewfull=1#post899895
*
* This file has been modified extensively and is released under the same license.
*/
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace AutoAsparagus
{
[KSPAddon(KSPAddon.Startup.MainMenu, true)]
internal class ASPInstallChecker : MonoBehaviour
{
protected void Start()
{
const string modName = "AutoAsparagus";
const string expectedPath = "AutoAsparagus";
// Search for this mod's DLL existing in the wrong location. This will also detect duplicate copies because only one can be in the right place.
var assemblies = AssemblyLoader.loadedAssemblies.Where (a => a.assembly.GetName ().Name == Assembly.GetExecutingAssembly ().GetName ().Name).Where (a => a.url != expectedPath);
if (assemblies.Any()) {
var badPaths = assemblies.Select(a => a.path).Select(
p => Uri.UnescapeDataString(new Uri(Path.GetFullPath(KSPUtil.ApplicationRootPath)).MakeRelativeUri(new Uri(p)).ToString().Replace('/', Path.DirectorySeparatorChar))
);
PopupDialog.SpawnPopupDialog("Incorrect " + modName + " Installation",
modName + " has been installed incorrectly and will not function properly. All files should be located in KSP/GameData/" +
expectedPath + ". Do not move any files from inside that folder.\n\nIncorrect path(s):\n" +
String.Join("\n", badPaths.ToArray()),
"OK", false, HighLogic.Skin);
}
}
}
}
|
/**
* Originally based on the InstallChecker from the Kethane mod for Kerbal Space Program.
* This version is based off taraniselsu's version from https://github.com/Majiir/Kethane/blob/b93b1171ec42b4be6c44b257ad31c7efd7ea1702/Plugin/InstallChecker.cs
*
* Original is (C) Copyright Majiir.
* CC0 Public Domain (http://creativecommons.org/publicdomain/zero/1.0/)
* http://forum.kerbalspaceprogram.com/threads/65395-CompatibilityChecker-Discussion-Thread?p=899895&viewfull=1#post899895
*
* This file has been modified extensively and is released under the same license.
*/
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace AutoAsparagus
{
[KSPAddon(KSPAddon.Startup.MainMenu, true)]
internal class ASPInstallChecker : MonoBehaviour
{
protected void Start()
{
const string modName = "AutoAsparagus";
const string expectedPath = "AutoAsparagus";
// Search for this mod's DLL existing in the wrong location. This will also detect duplicate copies because only one can be in the right place.
var assemblies = AssemblyLoader.loadedAssemblies.Where(a => a.assembly.GetName().Name == Assembly.GetExecutingAssembly().GetName().Name).Where(a => a.url != expectedPath);
if (assemblies.Any()) {
var badPaths = assemblies.Select(a => a.path).Select(p => Uri.UnescapeDataString(new Uri(Path.GetFullPath(KSPUtil.ApplicationRootPath)).MakeRelativeUri(new Uri(p)).ToString().Replace('/', Path.DirectorySeparatorChar)));
PopupDialog.SpawnPopupDialog("Incorrect " + modName + " Installation",
modName + " has been installed incorrectly and will not function properly. All files should be located in KSP/GameData/" + expectedPath + ". Do not move any files from inside that folder.\n\nIncorrect path(s):\n" + String.Join("\n", badPaths.ToArray()),
"OK", false, HighLogic.Skin);
}
}
}
}
|
apache-2.0
|
C#
|
9716dd3b5de43d1455c49851ae1bb5299199b12d
|
Update MatrixObjectTypeConverter.cs
|
wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
src/Core2D/Serializer/Xaml/Converters/MatrixObjectTypeConverter.cs
|
src/Core2D/Serializer/Xaml/Converters/MatrixObjectTypeConverter.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.ComponentModel;
using System.Globalization;
using Core2D.Renderer;
namespace Core2D.Serializer.Xaml.Converters
{
/// <summary>
/// Defines <see cref="MatrixObject"/> type converter.
/// </summary>
internal class MatrixObjectTypeConverter : TypeConverter
{
/// <inheritdoc/>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string);
}
/// <inheritdoc/>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(string);
}
/// <inheritdoc/>
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
return MatrixObject.Parse((string)value);
}
/// <inheritdoc/>
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
return value is MatrixObject matrix ? matrix.ToString() : throw new NotSupportedException();
}
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Globalization;
using System.ComponentModel;
using Core2D.Renderer;
namespace Core2D.Serializer.Xaml.Converters
{
/// <summary>
/// Defines <see cref="MatrixObject"/> type converter.
/// </summary>
internal class MatrixObjectTypeConverter : TypeConverter
{
/// <inheritdoc/>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string);
}
/// <inheritdoc/>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(string);
}
/// <inheritdoc/>
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
return MatrixObject.Parse((string)value);
}
/// <inheritdoc/>
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
return value is MatrixObject matrix ? matrix.ToString() : throw new NotSupportedException();
}
}
}
|
mit
|
C#
|
1094d192ab4e6dfbdb50868174b0c7f2ab3f3116
|
Change extraction of NamespaceDeclarations to have ID based on the location
|
github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql
|
csharp/extractor/Semmle.Extraction.CSharp/Entities/NamespaceDeclaration.cs
|
csharp/extractor/Semmle.Extraction.CSharp/Entities/NamespaceDeclaration.cs
|
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Semmle.Extraction.Entities;
using System.IO;
using System.Linq;
namespace Semmle.Extraction.CSharp.Entities
{
class NamespaceDeclaration : CachedEntity<NamespaceDeclarationSyntax>
{
private readonly NamespaceDeclaration parent;
private readonly NamespaceDeclarationSyntax node;
public NamespaceDeclaration(Context cx, NamespaceDeclarationSyntax node, NamespaceDeclaration parent)
: base(cx, node)
{
this.node = node;
this.parent = parent;
}
public override void WriteId(TextWriter trapFile)
{
trapFile.WriteSubId(Context.Create(ReportingLocation));
trapFile.Write(";namespacedeclaration");
}
public override void Populate(TextWriter trapFile)
{
var @namespace = (INamespaceSymbol)Context.GetModel(node).GetSymbolInfo(node.Name).Symbol;
var ns = Namespace.Create(Context, @namespace);
trapFile.namespace_declarations(this, ns);
trapFile.namespace_declaration_location(this, Context.Create(node.Name.GetLocation()));
var visitor = new Populators.TypeOrNamespaceVisitor(Context, trapFile, this);
foreach (var member in node.Members.Cast<CSharpSyntaxNode>().Concat(node.Usings))
{
member.Accept(visitor);
}
if (parent != null)
{
trapFile.parent_namespace_declaration(this, parent);
}
}
public static NamespaceDeclaration Create(Context cx, NamespaceDeclarationSyntax decl, NamespaceDeclaration parent)
{
var init = (decl, parent);
return NamespaceDeclarationFactory.Instance.CreateEntity(cx, init, init);
}
class NamespaceDeclarationFactory : ICachedEntityFactory<(NamespaceDeclarationSyntax decl, NamespaceDeclaration parent), NamespaceDeclaration>
{
public static readonly NamespaceDeclarationFactory Instance = new NamespaceDeclarationFactory();
public NamespaceDeclaration Create(Context cx, (NamespaceDeclarationSyntax decl, NamespaceDeclaration parent) init) =>
new NamespaceDeclaration(cx, init.decl, init.parent);
}
public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel;
public override Microsoft.CodeAnalysis.Location ReportingLocation => node.Name.GetLocation();
public override bool NeedsPopulation => true;
}
}
|
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Semmle.Extraction.Entities;
using System.IO;
using System.Linq;
namespace Semmle.Extraction.CSharp.Entities
{
internal class NamespaceDeclaration : FreshEntity
{
private readonly NamespaceDeclaration parent;
private readonly NamespaceDeclarationSyntax node;
public NamespaceDeclaration(Context cx, NamespaceDeclarationSyntax node, NamespaceDeclaration parent)
: base(cx)
{
this.node = node;
this.parent = parent;
TryPopulate();
}
protected override void Populate(TextWriter trapFile)
{
var @namespace = (INamespaceSymbol)cx.GetModel(node).GetSymbolInfo(node.Name).Symbol;
var ns = Namespace.Create(cx, @namespace);
trapFile.namespace_declarations(this, ns);
trapFile.namespace_declaration_location(this, cx.Create(node.Name.GetLocation()));
var visitor = new Populators.TypeOrNamespaceVisitor(cx, trapFile, this);
foreach (var member in node.Members.Cast<CSharpSyntaxNode>().Concat(node.Usings))
{
member.Accept(visitor);
}
if (parent != null)
{
trapFile.parent_namespace_declaration(this, parent);
}
}
public static NamespaceDeclaration Create(Context cx, NamespaceDeclarationSyntax decl, NamespaceDeclaration parent) => new NamespaceDeclaration(cx, decl, parent);
public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel;
}
}
|
mit
|
C#
|
1f618669fbe2ef7eb0d244e27dfbb508dc3dfe65
|
Fix typo paramaters -> parameters
|
mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype
|
src/Glimpse.Server.Web/Framework/ResourceManager.cs
|
src/Glimpse.Server.Web/Framework/ResourceManager.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Glimpse.Web;
namespace Glimpse.Server.Web
{
public class ResourceManager : IResourceManager
{
private IDictionary<string, ResourceManagerItem> _resourceTable = new Dictionary<string, ResourceManagerItem>(StringComparer.OrdinalIgnoreCase);
public void Register(string name, string uriTemplate, ResourceType type, Func<HttpContext, IDictionary<string, string>, Task> resource)
{
// todo: blow up on bad name??
_resourceTable.Add(name, new ResourceManagerItem(type, uriTemplate, resource));
}
public ResourceManagerResult Match(HttpContext context)
{
var path = context.Request.Path;
var remainingPath = (PathString)null;
var startingSegment = path.StartingSegment(out remainingPath);
var parameters = (IDictionary<string, string>)null;
var managerItem = (ResourceManagerItem)null;
if (!string.IsNullOrEmpty(startingSegment)
&& _resourceTable.TryGetValue(startingSegment, out managerItem)
&& MatchUriTemplate(managerItem.UriTemplate, remainingPath, out parameters))
{
return new ResourceManagerResult(parameters, managerItem.Resource, managerItem.Type);
}
return null;
}
public IReadOnlyDictionary<string, string> RegisteredUris
{
get { return _resourceTable.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.UriTemplate); }
}
private bool MatchUriTemplate(string uriTemplate, PathString remainingPath, out IDictionary<string, string> paramaters)
{
paramaters = new Dictionary<string, string>();
return true;
}
private class ResourceManagerItem
{
public ResourceManagerItem(ResourceType type, string uriTemplate, Func<HttpContext, IDictionary<string, string>, Task> resource)
{
Type = type;
UriTemplate = uriTemplate;
Resource = resource;
}
public ResourceType Type { get; set; }
public string UriTemplate { get; }
public Func<HttpContext, IDictionary<string, string>, Task> Resource { get; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Glimpse.Web;
namespace Glimpse.Server.Web
{
public class ResourceManager : IResourceManager
{
private IDictionary<string, ResourceManagerItem> _resourceTable = new Dictionary<string, ResourceManagerItem>(StringComparer.OrdinalIgnoreCase);
public void Register(string name, string uriTemplate, ResourceType type, Func<HttpContext, IDictionary<string, string>, Task> resource)
{
// todo: blow up on bad name??
_resourceTable.Add(name, new ResourceManagerItem(type, uriTemplate, resource));
}
public ResourceManagerResult Match(HttpContext context)
{
var path = context.Request.Path;
var remainingPath = (PathString)null;
var startingSegment = path.StartingSegment(out remainingPath);
var paramaters = (IDictionary<string, string>)null;
var managerItem = (ResourceManagerItem)null;
if (!string.IsNullOrEmpty(startingSegment)
&& _resourceTable.TryGetValue(startingSegment, out managerItem)
&& MatchUriTemplate(managerItem.UriTemplate, remainingPath, out paramaters))
{
return new ResourceManagerResult(paramaters, managerItem.Resource, managerItem.Type);
}
return null;
}
public IReadOnlyDictionary<string, string> RegisteredUris
{
get { return _resourceTable.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.UriTemplate); }
}
private bool MatchUriTemplate(string uriTemplate, PathString remainingPath, out IDictionary<string, string> paramaters)
{
paramaters = new Dictionary<string, string>();
return true;
}
private class ResourceManagerItem
{
public ResourceManagerItem(ResourceType type, string uriTemplate, Func<HttpContext, IDictionary<string, string>, Task> resource)
{
Type = type;
UriTemplate = uriTemplate;
Resource = resource;
}
public ResourceType Type { get; set; }
public string UriTemplate { get; }
public Func<HttpContext, IDictionary<string, string>, Task> Resource { get; }
}
}
}
|
mit
|
C#
|
248d200da8eb817e40b52b8075fb6de46f51fead
|
Add mention of how to use IPC in the xmldoc
|
peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework
|
osu.Framework/HostOptions.cs
|
osu.Framework/HostOptions.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Platform;
#nullable enable
namespace osu.Framework
{
/// <summary>
/// Various configuration properties for a <see cref="Host"/>.
/// </summary>
public class HostOptions
{
/// <summary>
/// Name of the game or application.
/// </summary>
/// <remarks>
/// This property may be null. Host types like <see cref="Platform.HeadlessGameHost"/> fallback to a custom GUID string when it occurs.
/// </remarks>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Whether to bind the IPC port. See <see cref="IIpcHost"/> for more details on usage.
/// </summary>
public bool BindIPC { get; set; }
/// <summary>
/// Whether this is a portable installation.
/// </summary>
public bool PortableInstallation { get; set; }
/// <summary>
/// Whether to bypass the compositor. Defaults to <c>true</c>.
/// </summary>
/// <remarks>
/// On Linux, the compositor re-buffers the application to apply various window effects,
/// increasing latency in the process. Thus it is a good idea for games to bypass it,
/// though normal applications would generally benefit from letting the window effects untouched. <br/>
/// If the SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR environment variable is set, this property will have no effect.
/// </remarks>
public bool BypassCompositor { get; set; } = true;
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
namespace osu.Framework
{
/// <summary>
/// Various configuration properties for a <see cref="Host"/>.
/// </summary>
public class HostOptions
{
/// <summary>
/// Name of the game or application.
/// </summary>
/// <remarks>
/// This property may be null. Host types like <see cref="Platform.HeadlessGameHost"/> fallback to a custom GUID string when it occurs.
/// </remarks>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Whether to bind the IPC port.
/// </summary>
public bool BindIPC { get; set; }
/// <summary>
/// Whether this is a portable installation.
/// </summary>
public bool PortableInstallation { get; set; }
/// <summary>
/// Whether to bypass the compositor. Defaults to <c>true</c>.
/// </summary>
/// <remarks>
/// On Linux, the compositor re-buffers the application to apply various window effects,
/// increasing latency in the process. Thus it is a good idea for games to bypass it,
/// though normal applications would generally benefit from letting the window effects untouched. <br/>
/// If the SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR environment variable is set, this property will have no effect.
/// </remarks>
public bool BypassCompositor { get; set; } = true;
}
}
|
mit
|
C#
|
f04e9d26e1c3eaa39bab0b2bbab40e9476683cb2
|
Test of commits 2
|
Ebisu77/RoRAssist
|
RoRAssist/Pages/PersuasionPage.xaml.cs
|
RoRAssist/Pages/PersuasionPage.xaml.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace RoRAssist.Pages
{
/// <summary>
/// Interaction logic for PersuasionPage.xaml
/// </summary>
public partial class PersuasionPage : Page
{
public PersuasionPage()
{
InitializeComponent();
//toto je len pokusny coment na zmazanie
//druhy pokus pre testovanie
//treti pokus
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace RoRAssist.Pages
{
/// <summary>
/// Interaction logic for PersuasionPage.xaml
/// </summary>
public partial class PersuasionPage : Page
{
public PersuasionPage()
{
InitializeComponent();
//toto je len pokusny coment na zmazanie
//druhy pokus pre testovanie
}
}
}
|
mit
|
C#
|
41cf2b9575075b07d8aa55607ddfdf8c78766f22
|
Update project and license URLs
|
PedroLamas/nuproj,faustoscardovi/nuproj,kovalikp/nuproj,DavidAnson/nuproj,DavidAnson/nuproj,AArnott/nuproj,nuproj/nuproj,NN---/nuproj,ericstj/nuproj,oliver-feng/nuproj,zbrad/nuproj
|
src/Common/CommonAssemblyInfo.cs
|
src/Common/CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("Immo Landwerth")]
[assembly: AssemblyProduct("NuProj")]
[assembly: AssemblyCopyright("Copyright © Immo Landwerth")]
[assembly: AssemblyTrademark("")]
[assembly : AssemblyMetadata("PreRelease", "Beta")]
[assembly : AssemblyMetadata("ProjectUrl", "http://github.com/terrajobst/nuproj")]
[assembly : AssemblyMetadata("LicenseUrl", "https://raw.githubusercontent.com/terrajobst/nuproj/master/LICENSE")]
[assembly: AssemblyVersion("0.9.2.0")]
[assembly: AssemblyFileVersion("0.9.2.0")]
|
using System.Reflection;
[assembly: AssemblyCompany("Immo Landwerth")]
[assembly: AssemblyProduct("NuProj")]
[assembly: AssemblyCopyright("Copyright © Immo Landwerth")]
[assembly: AssemblyTrademark("")]
[assembly : AssemblyMetadata("PreRelease", "Beta")]
[assembly : AssemblyMetadata("ProjectUrl", "http://nuproj.codeplex.com")]
[assembly : AssemblyMetadata("LicenseUrl", "http://nuproj.codeplex.com/license")]
[assembly: AssemblyVersion("0.9.2.0")]
[assembly: AssemblyFileVersion("0.9.2.0")]
|
mit
|
C#
|
8b4c177a2d6cfee3dc5c88d34549c887007c772d
|
Update SharedSecret.cs
|
ektrah/nsec
|
src/Cryptography/SharedSecret.cs
|
src/Cryptography/SharedSecret.cs
|
using System;
using System.ComponentModel;
using System.Diagnostics;
using static Interop.Libsodium;
namespace NSec.Cryptography
{
[DebuggerDisplay("Size = {Size}")]
public sealed class SharedSecret : IDisposable
{
private readonly SecureMemoryHandle _handle;
internal SharedSecret(
SecureMemoryHandle sharedSecretHandle)
{
_handle = sharedSecretHandle;
}
public int Size => _handle.Size;
internal SecureMemoryHandle Handle => _handle;
[Obsolete("The 'Import' method is obsolete. Use the method overloads in the 'KeyDerivationAlgorithm' class that accept a 'ReadOnlySpan<byte>' directly instead.")]
public static SharedSecret Import(
ReadOnlySpan<byte> sharedSecret,
in SharedSecretCreationParameters creationParameters = default)
{
if (sharedSecret.Length > 128)
{
throw Error.Argument_SharedSecretLength(nameof(sharedSecret), 128);
}
Sodium.Initialize();
SecureMemoryHandle? sharedSecretHandle = default;
bool success = false;
try
{
ImportCore(sharedSecret, out sharedSecretHandle);
success = true;
}
finally
{
if (!success && sharedSecretHandle != null)
{
sharedSecretHandle.Dispose();
}
}
if (!success || sharedSecretHandle == null)
{
throw Error.Format_InvalidBlob();
}
return new SharedSecret(sharedSecretHandle);
}
public void Dispose()
{
_handle.Dispose();
}
[EditorBrowsable(EditorBrowsableState.Never)]
public override string? ToString()
{
return typeof(SharedSecret).ToString();
}
private static void ImportCore(
ReadOnlySpan<byte> sharedSecret,
out SecureMemoryHandle? sharedSecretHandle)
{
sharedSecretHandle = SecureMemoryHandle.CreateFrom(sharedSecret);
}
}
}
|
using System;
using System.ComponentModel;
using System.Diagnostics;
using static Interop.Libsodium;
namespace NSec.Cryptography
{
[DebuggerDisplay("Size = {Size}")]
public sealed class SharedSecret : IDisposable
{
private readonly SecureMemoryHandle _handle;
internal SharedSecret(
SecureMemoryHandle sharedSecretHandle)
{
_handle = sharedSecretHandle;
}
public int Size => _handle.Size;
internal SecureMemoryHandle Handle => _handle;
[Obsolete("The 'Import' method is obsolete. Pass the shared secret directly as 'ReadOnlySpan<byte>' to a 'KeyDerivationAlgorithm' instance instead.")]
public static SharedSecret Import(
ReadOnlySpan<byte> sharedSecret,
in SharedSecretCreationParameters creationParameters = default)
{
if (sharedSecret.Length > 128)
{
throw Error.Argument_SharedSecretLength(nameof(sharedSecret), 128);
}
Sodium.Initialize();
SecureMemoryHandle? sharedSecretHandle = default;
bool success = false;
try
{
ImportCore(sharedSecret, out sharedSecretHandle);
success = true;
}
finally
{
if (!success && sharedSecretHandle != null)
{
sharedSecretHandle.Dispose();
}
}
if (!success || sharedSecretHandle == null)
{
throw Error.Format_InvalidBlob();
}
return new SharedSecret(sharedSecretHandle);
}
public void Dispose()
{
_handle.Dispose();
}
[EditorBrowsable(EditorBrowsableState.Never)]
public override string? ToString()
{
return typeof(SharedSecret).ToString();
}
private static void ImportCore(
ReadOnlySpan<byte> sharedSecret,
out SecureMemoryHandle? sharedSecretHandle)
{
sharedSecretHandle = SecureMemoryHandle.CreateFrom(sharedSecret);
}
}
}
|
mit
|
C#
|
1538c38bc02ec8e59c9b3f0e0eae0b08fc8ed6fb
|
Remove unnecessary timekey enumeration complexity.
|
huin/kerbcam2
|
kerbcam2/Timeline.cs
|
kerbcam2/Timeline.cs
|
using System;
using System.Collections.Generic;
namespace kerbcam2 {
class Timeline {
private List<TimeKey> keys = new List<TimeKey>();
/// <summary>
/// Returns number of TimeKeys.
/// </summary>
public int Count {
get { return keys.Count; }
}
public TimeKey this[int index] {
get { return keys[index]; }
}
/// <summary>
/// Iterates over the TimeKeys in order.
/// </summary>
/// <returns></returns>
public IEnumerator<TimeKey> GetEnumerator() {
return keys.GetEnumerator();
}
/// <summary>
/// Adds a copy of a TimeKey to the timeline.
/// </summary>
/// <param name="key">The key to add.</param>
public TimeKey NewTimeKey(string name, float seconds) {
TimeKey key = new TimeKey(this, name, seconds);
keys.Add(key);
ResortKeyOrder();
return key;
}
/// <summary>
/// Removes a TimeKey from the timeline.
/// </summary>
/// <param name="key">The key to remove.</param>
/// <returns>true if key found and removed, false otherwise.</returns>
public bool RemoveTimeKey(TimeKey key) {
return keys.Remove(key);
}
public void ShiftAll(float offset) {
foreach (TimeKey key in keys) {
key.RawSetSeconds(key.Seconds + offset);
}
}
internal void ResortKeyOrder() {
// Right now we just lazily reorder the whole list even if only one
// item changed. If this turns out to be too slow, we'll optimize.
keys.Sort();
}
}
}
|
using System;
using System.Collections.Generic;
namespace kerbcam2 {
class Timeline {
private List<TimeKey> keys = new List<TimeKey>();
/// <summary>
/// Returns number of TimeKeys.
/// </summary>
public int Count {
get { return keys.Count; }
}
public TimeKey this[int index] {
get { return keys[index]; }
}
/// <summary>
/// Iterates over the TimeKeys in order.
/// </summary>
/// <returns></returns>
public TimeKeyEnumerator GetEnumerator() {
return new TimeKeyEnumerator(this);
}
public struct TimeKeyEnumerator : IEnumerator<TimeKey> {
private readonly IEnumerator<TimeKey> e;
internal TimeKeyEnumerator(Timeline timeline) {
e = timeline.keys.GetEnumerator();
}
object System.Collections.IEnumerator.Current {
get { return e.Current; }
}
public TimeKey Current {
get { return e.Current; }
}
public void Dispose() { new NotImplementedException(); }
public bool MoveNext() { return e.MoveNext(); }
public void Reset() { e.Reset(); }
}
/// <summary>
/// Adds a copy of a TimeKey to the timeline.
/// </summary>
/// <param name="key">The key to add.</param>
public TimeKey NewTimeKey(string name, float seconds) {
TimeKey key = new TimeKey(this, name, seconds);
keys.Add(key);
ResortKeyOrder();
return key;
}
/// <summary>
/// Removes a TimeKey from the timeline.
/// </summary>
/// <param name="key">The key to remove.</param>
/// <returns>true if key found and removed, false otherwise.</returns>
public bool RemoveTimeKey(TimeKey key) {
return keys.Remove(key);
}
public void ShiftAll(float offset) {
foreach (TimeKey key in keys) {
key.RawSetSeconds(key.Seconds + offset);
}
}
internal void ResortKeyOrder() {
// Right now we just lazily reorder the whole list even if only one
// item changed. If this turns out to be too slow, we'll optimize.
keys.Sort();
}
}
}
|
bsd-3-clause
|
C#
|
ebed366a9b4c5c64398e3aee5196b21a9a7b8d72
|
fix CI test-run
|
ronnyek/linq2db,MaceWindu/linq2db,MaceWindu/linq2db,linq2db/linq2db,LinqToDB4iSeries/linq2db,LinqToDB4iSeries/linq2db,linq2db/linq2db
|
Tests/Linq/UserTests/Issue1363Tests.cs
|
Tests/Linq/UserTests/Issue1363Tests.cs
|
using LinqToDB;
using LinqToDB.Mapping;
using NUnit.Framework;
using System;
using System.Linq;
namespace Tests.UserTests
{
/// <summary>
/// Test fixes to Issue #1305.
/// Before fix fields in derived tables were added first in the column order by <see cref="DataExtensions.CreateTable{T}(IDataContext, string, string, string, string, string, LinqToDB.SqlQuery.DefaultNullable)"/>.
/// </summary>
[TestFixture]
public class Issue1363Tests : TestBase
{
[Table("Issue1363")]
public sealed class Issue1363Record
{
[Column("required_field")]
public Guid Required { get; set; }
[Column("optional_field")]
public Guid? Optional { get; set; }
}
// TODO: mysql - need to add default db type for create table for Guid
[Test, Combinatorial]
public void TestInsert([DataSources(ProviderName.Access, ProviderName.MySql)] string context)
{
using (var db = GetDataContext(context))
using (var tbl = db.CreateLocalTable<Issue1363Record>())
{
var id1 = Guid.NewGuid();
var id2 = Guid.NewGuid();
insert(id1, null);
insert(id2, id1);
var record = tbl.Where(_ => _.Required == id2).Single();
Assert.AreEqual(id1, record.Optional);
void insert(Guid id, Guid? testId)
{
tbl.Insert(() => new Issue1363Record()
{
Required = id,
Optional = tbl.Where(_ => _.Required == testId).Select(_ => (Guid?)_.Required).SingleOrDefault()
});
}
}
}
}
}
|
using LinqToDB;
using LinqToDB.Mapping;
using NUnit.Framework;
using System;
using System.Linq;
namespace Tests.UserTests
{
/// <summary>
/// Test fixes to Issue #1305.
/// Before fix fields in derived tables were added first in the column order by <see cref="DataExtensions.CreateTable{T}(IDataContext, string, string, string, string, string, LinqToDB.SqlQuery.DefaultNullable)"/>.
/// </summary>
[TestFixture]
public class Issue1363Tests : TestBase
{
[Table("Issue1363")]
public sealed class Issue1363Record
{
[Column("required_field")]
public Guid Required { get; set; }
[Column("optional_field")]
public Guid? Optional { get; set; }
}
[Test, Combinatorial]
public void TestInsert([DataSources(ProviderName.Access)] string context)
{
using (var db = GetDataContext(context))
using (var tbl = db.CreateLocalTable<Issue1363Record>())
{
var id1 = Guid.NewGuid();
var id2 = Guid.NewGuid();
insert(id1, null);
insert(id2, id1);
var record = tbl.Where(_ => _.Required == id2).Single();
Assert.AreEqual(id1, record.Optional);
void insert(Guid id, Guid? testId)
{
tbl.Insert(() => new Issue1363Record()
{
Required = id,
Optional = tbl.Where(_ => _.Required == testId).Select(_ => (Guid?)_.Required).SingleOrDefault()
});
}
}
}
}
}
|
mit
|
C#
|
5ad0828e5bd42be64f90b9eda461b32d6040ef89
|
Remove MIT license header
|
fredatgithub/WinFormTemplate
|
WinFormTemplate/Punctuation.cs
|
WinFormTemplate/Punctuation.cs
|
using System;
namespace WinFormTemplate
{
public static class Punctuation
{
public const string Comma = ",";
public const string Colon = ":";
public const string OneSpace = " ";
public const string Dash = "-";
public const string UnderScore = "_";
public const string SignAt = "@";
public const string Ampersand = "&";
public const string SignSharp = "#";
public const string Period = ".";
public const string Backslash = "\\";
public const string Slash = "/";
public const string OpenParenthesis = "(";
public const string CloseParenthesis = ")";
public const string OpenCurlyBrace = "{";
public const string CloseCurlyBrace = "}";
public const string OpenSquareBracket = "[";
public const string CloseSquareBracket = "]";
public const string LessThan = "<";
public const string GreaterThan = ">";
public const string DoubleQuote = "\"";
public const string SimpleQuote = "'";
public const string Tilde = "~";
public const string Pipe = "|";
public const string Plus = "+";
public const string Minus = "-";
public const string Multiply = "*";
public const string Divide = "/";
public const string Dollar = "$";
public const string Pound = "£";
public const string Percent = "%";
public const string QuestionMark = "?";
public const string ExclamationPoint = "!";
public const string Chapter = "§";
public const string Micro = "µ";
public static string CrLf = Environment.NewLine;
public static string Tabulate(ushort numberOfTabulation = 1)
{
string result = string.Empty;
for (int number = 0; number < numberOfTabulation; number++)
{
result += " ";
}
return result;
}
}
}
|
/*
The MIT License(MIT)
Copyright(c) 2015 Freddy Juhel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using System;
namespace WinFormTemplate
{
public static class Punctuation
{
public const string Comma = ",";
public const string Colon = ":";
public const string OneSpace = " ";
public const string Dash = "-";
public const string UnderScore = "_";
public const string SignAt = "@";
public const string Ampersand = "&";
public const string SignSharp = "#";
public const string Period = ".";
public const string Backslash = "\\";
public const string Slash = "/";
public const string OpenParenthesis = "(";
public const string CloseParenthesis = ")";
public const string OpenCurlyBrace = "{";
public const string CloseCurlyBrace = "}";
public const string OpenSquareBracket = "[";
public const string CloseSquareBracket = "]";
public const string LessThan = "<";
public const string GreaterThan = ">";
public const string DoubleQuote = "\"";
public const string SimpleQuote = "'";
public const string Tilde = "~";
public const string Pipe = "|";
public const string Plus = "+";
public const string Minus = "-";
public const string Multiply = "*";
public const string Divide = "/";
public const string Dollar = "$";
public const string Pound = "£";
public const string Percent = "%";
public const string QuestionMark = "?";
public const string ExclamationPoint = "!";
public const string Chapter = "§";
public const string Micro = "µ";
public static string CrLf = Environment.NewLine;
public static string Tabulate(ushort numberOfTabulation = 1)
{
string result = string.Empty;
for (int number = 0; number < numberOfTabulation; number++)
{
result += " ";
}
return result;
}
}
}
|
mit
|
C#
|
c85fbbd6f0f20218c65ffb255290aff19322d083
|
Add an extra test for ranges.
|
pyaria/edulinq,zhangz/edulinq,iainholder/edulinq,zhangz/edulinq,jskeet/edulinq,jskeet/edulinq,jskeet/edulinq,iainholder/edulinq,pyaria/edulinq
|
src/Edulinq.Tests/RangeTest.cs
|
src/Edulinq.Tests/RangeTest.cs
|
#region Copyright and license information
// Copyright 2010-2011 Jon Skeet
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
// This time we can't just use Enumerable, as that will always use Edulinq.Enumerable
#if NORMAL_LINQ
using RangeClass = System.Linq.Enumerable;
#else
using RangeClass = Edulinq.Enumerable;
#endif
using NUnit.Framework;
namespace Edulinq.Tests
{
[TestFixture]
public class RangeTest
{
[Test]
public void NegativeCount()
{
Assert.Throws<ArgumentOutOfRangeException>(() => RangeClass.Range(10, -1));
}
[Test]
public void CountTooLarge()
{
Assert.Throws<ArgumentOutOfRangeException>(() => RangeClass.Range(int.MaxValue, 2));
Assert.Throws<ArgumentOutOfRangeException>(() => RangeClass.Range(2, int.MaxValue));
// int.MaxValue is odd, hence the +3 instead of +2
Assert.Throws<ArgumentOutOfRangeException>(() => RangeClass.Range(int.MaxValue / 2, (int.MaxValue / 2) + 3));
}
[Test]
public void LargeButValidCount()
{
// Essentially the edge conditions for CountTooLarge, but just below the boundary
RangeClass.Range(int.MaxValue, 1);
RangeClass.Range(1, int.MaxValue);
RangeClass.Range(int.MaxValue / 2, (int.MaxValue / 2) + 2);
}
[Test]
public void ValidRange()
{
RangeClass.Range(5, 3).AssertSequenceEqual(5, 6, 7);
}
[Test]
public void NegativeStart()
{
RangeClass.Range(-2, 5).AssertSequenceEqual(-2, -1, 0, 1, 2);
}
}
}
|
#region Copyright and license information
// Copyright 2010-2011 Jon Skeet
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
// This time we can't just use Enumerable, as that will always use Edulinq.Enumerable
#if NORMAL_LINQ
using RangeClass = System.Linq.Enumerable;
#else
using RangeClass = Edulinq.Enumerable;
#endif
using NUnit.Framework;
namespace Edulinq.Tests
{
[TestFixture]
public class RangeTest
{
[Test]
public void NegativeCount()
{
Assert.Throws<ArgumentOutOfRangeException>(() => RangeClass.Range(10, -1));
}
[Test]
public void CountTooLarge()
{
Assert.Throws<ArgumentOutOfRangeException>(() => RangeClass.Range(int.MaxValue, 2));
Assert.Throws<ArgumentOutOfRangeException>(() => RangeClass.Range(2, int.MaxValue));
// int.MaxValue is odd, hence the +3 instead of +2
Assert.Throws<ArgumentOutOfRangeException>(() => RangeClass.Range(int.MaxValue / 2, (int.MaxValue / 2) + 3));
}
[Test]
public void LargeButValidCount()
{
// Essentially the edge conditions for CountTooLarge, but just below the boundary
RangeClass.Range(int.MaxValue, 1);
RangeClass.Range(1, int.MaxValue);
RangeClass.Range(int.MaxValue / 2, (int.MaxValue / 2) + 2);
}
[Test]
public void ValidRange()
{
RangeClass.Range(5, 3).AssertSequenceEqual(5, 6, 7);
}
}
}
|
apache-2.0
|
C#
|
ff5cf7297d7a06b6266ad45ef1e787647cabe01f
|
Add unit tests for implicit unsigned construction
|
OlsonDev/YeamulNet
|
Yeamul.Test/Test_Node_Implicit_Ctor.cs
|
Yeamul.Test/Test_Node_Implicit_Ctor.cs
|
using System;
using NUnit.Framework;
namespace Yeamul {
[TestFixture]
public class Test_Node_Implicit_Ctor {
[Test]
public void CanConstructImplicitlyFromInt16() {
Node node = Int16.MaxValue;
AssertNodeIsDefinedScalarNumber(node);
AssertNodeHasTypes(node, NodeType.Scalar, ScalarType.Number, NumberType.Int16, MapType.NotApplicable);
}
[Test]
public void CanConstructImplicitlyFromInt32() {
Node node = Int32.MaxValue;
AssertNodeIsDefinedScalarNumber(node);
AssertNodeHasTypes(node, NodeType.Scalar, ScalarType.Number, NumberType.Int32, MapType.NotApplicable);
}
[Test]
public void CanConstructImplicitlyFromInt64() {
Node node = Int64.MaxValue;
AssertNodeIsDefinedScalarNumber(node);
AssertNodeHasTypes(node, NodeType.Scalar, ScalarType.Number, NumberType.Int64, MapType.NotApplicable);
}
[Test]
public void CanConstructImplicitlyFromUInt16() {
Node node = UInt16.MaxValue;
AssertNodeIsDefinedScalarNumber(node);
AssertNodeHasTypes(node, NodeType.Scalar, ScalarType.Number, NumberType.UInt16, MapType.NotApplicable);
}
[Test]
public void CanConstructImplicitlyFromUInt32() {
Node node = UInt32.MaxValue;
AssertNodeIsDefinedScalarNumber(node);
AssertNodeHasTypes(node, NodeType.Scalar, ScalarType.Number, NumberType.UInt32, MapType.NotApplicable);
}
[Test]
public void CanConstructImplicitlyFromUInt64() {
Node node = UInt64.MaxValue;
AssertNodeIsDefinedScalarNumber(node);
AssertNodeHasTypes(node, NodeType.Scalar, ScalarType.Number, NumberType.UInt64, MapType.NotApplicable);
}
private static void AssertNodeIsDefinedScalarNumber(Node node) {
Assert.That(node.IsDefined);
Assert.That(node.IsScalar);
Assert.That(node.IsNumber);
}
private void AssertNodeHasTypes(Node node, NodeType nodeType, ScalarType scalarType, NumberType numberType, MapType mapType) {
Assert.AreEqual(node.NodeType, nodeType);
Assert.AreEqual(node.ScalarType, scalarType);
Assert.AreEqual(node.NumberType, numberType);
Assert.AreEqual(node.MapType, mapType);
}
}
}
|
using System;
using NUnit.Framework;
namespace Yeamul {
[TestFixture]
public class Test_Node_Implicit_Ctor {
[Test]
public void CanConstructImplicitlyFromInt16() {
Node node = Int16.MaxValue;
AssertNodeIsDefinedScalarNumber(node);
AssertNodeHasTypes(node, NodeType.Scalar, ScalarType.Number, NumberType.Int16, MapType.NotApplicable);
}
[Test]
public void CanConstructImplicitlyFromInt32() {
Node node = Int32.MaxValue;
AssertNodeIsDefinedScalarNumber(node);
AssertNodeHasTypes(node, NodeType.Scalar, ScalarType.Number, NumberType.Int32, MapType.NotApplicable);
}
[Test]
public void CanConstructImplicitlyFromInt64() {
Node node = Int64.MaxValue;
AssertNodeIsDefinedScalarNumber(node);
AssertNodeHasTypes(node, NodeType.Scalar, ScalarType.Number, NumberType.Int64, MapType.NotApplicable);
}
private static void AssertNodeIsDefinedScalarNumber(Node node) {
Assert.That(node.IsDefined);
Assert.That(node.IsScalar);
Assert.That(node.IsNumber);
}
private void AssertNodeHasTypes(Node node, NodeType nodeType, ScalarType scalarType, NumberType numberType, MapType mapType) {
Assert.AreEqual(node.NodeType, nodeType);
Assert.AreEqual(node.ScalarType, scalarType);
Assert.AreEqual(node.NumberType, numberType);
Assert.AreEqual(node.MapType, mapType);
}
}
}
|
mit
|
C#
|
d11d2c47663404a2cc1c62962ae88fbb43853f7e
|
set eol-style for AssemblyInfo.cs
|
vancegroup-mirrors/open-dynamics-engine-svnmirror,vancegroup-mirrors/open-dynamics-engine-svnmirror,vancegroup-mirrors/open-dynamics-engine-svnmirror,vancegroup-mirrors/open-dynamics-engine-svnmirror,vancegroup-mirrors/open-dynamics-engine-svnmirror
|
contrib/Ode.NET/Ode/AssemblyInfo.cs
|
contrib/Ode.NET/Ode/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Ode.NET")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ode.NET")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("1347a35e-c32b-4ff6-8064-7d10b2cc113b")]
[assembly: AssemblyVersion("0.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
[assembly: CLSCompliantAttribute(true)]
|
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Ode.NET")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ode.NET")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("1347a35e-c32b-4ff6-8064-7d10b2cc113b")]
[assembly: AssemblyVersion("0.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
[assembly: CLSCompliantAttribute(true)]
|
lgpl-2.1
|
C#
|
b6d8f9bc9801aa9b2f91ab40d6b66e9eddc7f788
|
Update Version Information. Merged Latest JustArchi/Master 2.5.6.8 release.
|
blackpanther989/ArchiSteamFarm,blackpanther989/ArchiSteamFarm
|
ArchiSteamFarm/SharedInfo.cs
|
ArchiSteamFarm/SharedInfo.cs
|
/*
_ _ _ ____ _ _____
/ \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
/ _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
/ ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
Copyright 2015-2016 Łukasz "JustArchi" Domeradzki
Contact: JustArchi@JustArchi.net
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 System.Reflection;
namespace ArchiSteamFarm {
internal static class SharedInfo {
internal const string VersionNumber = "2.1.6.8";
internal const string MyVersionNumber = "2.1.6.1";
internal const string Copyright = "Copyright © ArchiSteamFarm 2015-2016";
internal const string GithubRepo = "Blackpanther989/ArchiSteamFarm";
internal const string ServiceName = "ArchiSteamFarm";
internal const string ServiceDescription = "ASF is an application that allows you to farm steam cards using multiple steam accounts simultaneously.";
internal const string EventLog = ServiceName;
internal const string EventLogSource = EventLog + "Logger";
internal const string ASF = "ASF";
internal const string ASFDirectory = "ArchiSteamFarm";
internal const string ConfigDirectory = "config";
internal const string DebugDirectory = "debug";
internal const string LogFile = "log.txt";
internal const ulong ArchiSteamID = 76561198006963719;
internal const ulong ASFGroupSteamID = 103582791440160998;
internal const string GithubReleaseURL = "https://api.github.com/repos/" + GithubRepo + "/releases"; // GitHub API is HTTPS only
internal const string GlobalConfigFileName = ASF + ".json";
internal const string GlobalDatabaseFileName = ASF + ".db";
internal static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version;
}
}
|
/*
_ _ _ ____ _ _____
/ \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
/ _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
/ ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
Copyright 2015-2016 Łukasz "JustArchi" Domeradzki
Contact: JustArchi@JustArchi.net
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 System.Reflection;
namespace ArchiSteamFarm {
internal static class SharedInfo {
internal const string VersionNumber = "2.1.6.9";
internal const string MyVersionNumber = "2.1.6.0";
internal const string Copyright = "Copyright © ArchiSteamFarm 2015-2016";
internal const string GithubRepo = "Blackpanther989/ArchiSteamFarm";
internal const string ServiceName = "ArchiSteamFarm";
internal const string ServiceDescription = "ASF is an application that allows you to farm steam cards using multiple steam accounts simultaneously.";
internal const string EventLog = ServiceName;
internal const string EventLogSource = EventLog + "Logger";
internal const string ASF = "ASF";
internal const string ASFDirectory = "ArchiSteamFarm";
internal const string ConfigDirectory = "config";
internal const string DebugDirectory = "debug";
internal const string LogFile = "log.txt";
internal const ulong ArchiSteamID = 76561198006963719;
internal const ulong ASFGroupSteamID = 103582791440160998;
internal const string GithubReleaseURL = "https://api.github.com/repos/" + GithubRepo + "/releases"; // GitHub API is HTTPS only
internal const string GlobalConfigFileName = ASF + ".json";
internal const string GlobalDatabaseFileName = ASF + ".db";
internal static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version;
}
}
|
apache-2.0
|
C#
|
dde2b8109040a7348597257234229bc4630a6ad0
|
Remove debug log
|
aarya123/IshanGame
|
Assets/Scripts/Trampoline.cs
|
Assets/Scripts/Trampoline.cs
|
using UnityEngine;
using System.Collections;
public class Trampoline : MonoBehaviour {
public float velocityX;
public float velocityY;
void OnTriggerStay2D(Collider2D other) {
if (other.gameObject.tag == "Player") {
other.rigidbody2D.AddForce(new Vector2(velocityX,velocityY));
//other.rigidbody2D.velocity+=new Vector2(velocityX,velocityY);
}
}
}
|
using UnityEngine;
using System.Collections;
public class Trampoline : MonoBehaviour {
public float velocityX;
public float velocityY;
void OnTriggerStay2D(Collider2D other) {
if (other.gameObject.tag == "Player") {
Debug.Log ("Hit!");
other.rigidbody2D.AddForce(new Vector2(velocityX,velocityY));
//other.rigidbody2D.velocity+=new Vector2(velocityX,velocityY);
}
}
}
|
apache-2.0
|
C#
|
882d7f788b6488eb6b8ff558f8eb16b69cb37e38
|
fix target
|
tomvantilburg/cow,tomvantilburg/cow,Geodan/cow,Geodan/cow,tomvantilburg/cow,Geodan/cow
|
server/signalr/CowSignalR/CowHub.cs
|
server/signalr/CowSignalR/CowHub.cs
|
using System;
using System.Threading.Tasks;
using CowSignalR.Models;
using Microsoft.AspNet.SignalR;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace CowSignalR
{
public class CowHub : Hub
{
public override Task OnConnected()
{
Clients.Others.userConnected(Context.ConnectionId);
return base.OnConnected();
}
public override Task OnDisconnected()
{
Clients.Others.userDisconnected(Context.ConnectionId);
return base.OnDisconnected();
}
public override Task OnReconnected()
{
Clients.Others.userReconnected(Context.ConnectionId);
return base.OnDisconnected();
}
public void Send(string message)
{
dynamic d = JObject.Parse(message);
string target = d.target;
if(String.IsNullOrEmpty(target)){
Clients.All.broadcastMessage(message);
}
else
{
Clients.Client(target).broadcastMessage(message);
}
}
}
}
|
using System.Threading.Tasks;
using CowSignalR.Models;
using Microsoft.AspNet.SignalR;
using Newtonsoft.Json;
namespace CowSignalR
{
public class CowHub : Hub
{
public override Task OnConnected()
{
Clients.Others.userConnected(Context.ConnectionId);
return base.OnConnected();
}
public override Task OnDisconnected()
{
Clients.Others.userDisconnected(Context.ConnectionId);
return base.OnDisconnected();
}
public override Task OnReconnected()
{
Clients.Others.userReconnected(Context.ConnectionId);
return base.OnDisconnected();
}
public void Send(string message)
{
if (!message.Contains("target"))
{
Clients.All.broadcastMessage(message);
}
else
{
var cowMessage=JsonConvert.DeserializeObject<CowMessage>(message);
Clients.Client(cowMessage.target).broadcastMessage(message);
}
}
}
}
|
mit
|
C#
|
5bd44c801a9cfb5999e475ad8e0c56582488e348
|
Update SharedAssemblyInfo.cs
|
wieslawsoltes/SimpleWavSplitter,wieslawsoltes/SimpleWavSplitter,wieslawsoltes/SimpleWavSplitter,wieslawsoltes/SimpleWavSplitter
|
src/Shared/SharedAssemblyInfo.cs
|
src/Shared/SharedAssemblyInfo.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Reflection;
[assembly: AssemblyCompany("Wiesław Šoltés")]
[assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2010-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("0.3.3")]
[assembly: AssemblyFileVersion("0.3.3")]
[assembly: AssemblyInformationalVersion("0.3.3")]
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Reflection;
[assembly: AssemblyCompany("Wiesław Šoltés")]
[assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2010-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("0.3.2")]
[assembly: AssemblyFileVersion("0.3.2")]
[assembly: AssemblyInformationalVersion("0.3.2")]
|
mit
|
C#
|
e3bbc9dc8970977a1a4ae56fcda400a7a32eaa4e
|
remove unused namespaces
|
olebg/car-mods-heaven,olebg/car-mods-heaven
|
CarModsHeaven/CarModsHeaven/CarModsHeaven.Web/Controllers/HomeController.cs
|
CarModsHeaven/CarModsHeaven/CarModsHeaven.Web/Controllers/HomeController.cs
|
using Bytes2you.Validation;
using CarModsHeaven.Data;
using CarModsHeaven.Services.Contracts;
using CarModsHeaven.Web.Models.Home;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using System;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace CarModsHeaven.Web.Controllers
{
[RequireHttps]
public class HomeController : Controller
{
//[OutputCache(Duration = 60)]
public ActionResult Index()
{
return this.View();
}
}
}
|
using System.Web.Mvc;
namespace CarModsHeaven.Web.Controllers
{
[RequireHttps]
public class HomeController : Controller
{
//[OutputCache(Duration = 60)]
public ActionResult Index()
{
return this.View();
}
}
}
|
mit
|
C#
|
7bd7907acb35072b88e9418beddea0d36bb03a2a
|
fix sequence
|
rustamserg/mogate
|
mogate/Actions/Sequence.cs
|
mogate/Actions/Sequence.cs
|
using System;
using System.Collections.Generic;
namespace mogate
{
public class Sequence : IAction
{
private Queue<IAction> m_queue = new Queue<IAction>();
public void Add(IAction action)
{
m_queue.Enqueue (action);
}
public bool Execute()
{
if (m_queue.Count == 0)
return true;
if (m_queue.Peek ().Execute ())
m_queue.Dequeue ();
return (m_queue.Count == 0);
}
}
}
|
using System;
using System.Collections.Generic;
namespace mogate
{
public class Sequence : IAction
{
private Queue<IAction> m_queue = new Queue<IAction>();
public void Add(IAction action)
{
m_queue.Enqueue (action);
}
public bool Execute()
{
if (m_queue.Count == 0)
return true;
if (m_queue.Peek().Execute ())
m_queue.Dequeue ();
return false;
}
}
}
|
mit
|
C#
|
d0300bcffef5031686a8c24adcdd0383665221c9
|
Use IMPP as default for iCloud profile.
|
aluxnimm/outlookcaldavsynchronizer
|
CalDavSynchronizer/Ui/Options/ProfileTypes/ContactsiCloudProfile.cs
|
CalDavSynchronizer/Ui/Options/ProfileTypes/ContactsiCloudProfile.cs
|
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/)
// Copyright (c) 2015 Gerhard Zehetbauer
// Copyright (c) 2015 Alexander Nimmervoll
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Collections.Generic;
using CalDavSynchronizer.Contracts;
using CalDavSynchronizer.Ui.Options.ViewModels;
namespace CalDavSynchronizer.Ui.Options.ProfileTypes
{
class ContactsiCloudProfile : ProfileBase
{
public ContactsiCloudProfile(IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList<string> availableCategories, IOptionTasks optionTasks, ISettingsFaultFinder settingsFaultFinder, GeneralOptions generalOptions, IViewOptions viewOptions) : base(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)
{
}
public override string Name => "iCloud Contacts";
public override string ImageUrl { get; } = "pack://application:,,,/CalDavSynchronizer;component/Resources/ProfileLogos/logo_iCloud.png";
protected override void InitializeData(Contracts.Options data)
{
data.CalenderUrl = "https://contacts.icloud.com/";
data.MappingConfiguration = new ContactMappingConfiguration()
{
MapDistributionLists = true,
DistributionListType = DistributionListType.VCardGroupWithUid,
WriteImAsImpp = true
};
}
protected override void InitializePrototypeData(Contracts.Options data)
{
InitializeData(data);
}
}
}
|
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/)
// Copyright (c) 2015 Gerhard Zehetbauer
// Copyright (c) 2015 Alexander Nimmervoll
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Collections.Generic;
using CalDavSynchronizer.Contracts;
using CalDavSynchronizer.Ui.Options.ViewModels;
namespace CalDavSynchronizer.Ui.Options.ProfileTypes
{
class ContactsiCloudProfile : ProfileBase
{
public ContactsiCloudProfile(IOptionsViewModelParent optionsViewModelParent, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList<string> availableCategories, IOptionTasks optionTasks, ISettingsFaultFinder settingsFaultFinder, GeneralOptions generalOptions, IViewOptions viewOptions) : base(optionsViewModelParent, outlookAccountPasswordProvider, availableCategories, optionTasks, settingsFaultFinder, generalOptions, viewOptions)
{
}
public override string Name => "iCloud Contacts";
public override string ImageUrl { get; } = "pack://application:,,,/CalDavSynchronizer;component/Resources/ProfileLogos/logo_iCloud.png";
protected override void InitializeData(Contracts.Options data)
{
data.CalenderUrl = "https://contacts.icloud.com/";
data.MappingConfiguration = new ContactMappingConfiguration()
{
MapDistributionLists = true,
DistributionListType = DistributionListType.VCardGroupWithUid
};
}
protected override void InitializePrototypeData(Contracts.Options data)
{
InitializeData(data);
}
}
}
|
agpl-3.0
|
C#
|
b88c441d8be6cbd2c2707938369539ef61dccf08
|
Make sure to register interface rather than implementation
|
appharbor/appharbor-cli
|
src/AppHarbor/AppHarborInstaller.cs
|
src/AppHarbor/AppHarborInstaller.cs
|
using System.Reflection;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.Resolvers.SpecializedResolvers;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
namespace AppHarbor
{
public class AppHarborInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel));
container.Register(AllTypes.FromThisAssembly()
.BasedOn<ICommand>());
container.Register(Component
.For<IAccessTokenConfiguration>()
.ImplementedBy<AccessTokenConfiguration>());
container.Register(Component
.For<IAppHarborClient>()
.UsingFactoryMethod(x =>
{
return new AppHarborClient(accessTokenConfiguration.GetAccessToken());
}));
container.Register(Component
.For<CommandDispatcher>()
.UsingFactoryMethod(x =>
{
return new CommandDispatcher(Assembly.GetExecutingAssembly().GetExportedTypes(), container.Kernel);
}));
container.Register(Component
.For<IFileSystem>()
.ImplementedBy<PhysicalFileSystem>()
.LifeStyle.Transient);
}
}
}
|
using System.Reflection;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.Resolvers.SpecializedResolvers;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
namespace AppHarbor
{
public class AppHarborInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel));
container.Register(AllTypes.FromThisAssembly()
.BasedOn<ICommand>());
container.Register(Component
.For<IAccessTokenConfiguration>()
.ImplementedBy<AccessTokenConfiguration>());
container.Register(Component
.For<AppHarborClient>()
.UsingFactoryMethod(x =>
{
var accessTokenConfiguration = container.Resolve<AccessTokenConfiguration>();
return new AppHarborClient(accessTokenConfiguration.GetAccessToken());
}));
container.Register(Component
.For<CommandDispatcher>()
.UsingFactoryMethod(x =>
{
return new CommandDispatcher(Assembly.GetExecutingAssembly().GetExportedTypes(), container.Kernel);
}));
container.Register(Component
.For<IFileSystem>()
.ImplementedBy<PhysicalFileSystem>()
.LifeStyle.Transient);
}
}
}
|
mit
|
C#
|
ea017fa6cdb6baa8650cacfdb4eb89f4c97979b8
|
Make tests pass
|
kipusoep/Archetype,kgiszewski/Archetype,kipusoep/Archetype,imulus/Archetype,Nicholas-Westby/Archetype,Nicholas-Westby/Archetype,Nicholas-Westby/Archetype,kgiszewski/Archetype,tomfulton/Archetype,tomfulton/Archetype,kjac/Archetype,kjac/Archetype,kipusoep/Archetype,imulus/Archetype,tomfulton/Archetype,imulus/Archetype,kgiszewski/Archetype,kjac/Archetype
|
app/Umbraco/Umbraco.Archetype/PropertyConverters/ArchetypeValueConverter.cs
|
app/Umbraco/Umbraco.Archetype/PropertyConverters/ArchetypeValueConverter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Archetype.Umbraco.Extensions;
using Archetype.Umbraco.Models;
using Newtonsoft.Json;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
namespace Archetype.Umbraco.PropertyConverters
{
[PropertyValueType(typeof(Models.Archetype))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class ArchetypeValueConverter : PropertyValueConverterBase
{
public ServiceContext Services
{
get { return ApplicationContext.Current.Services; }
}
public override bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.PropertyEditorAlias.Equals(Constants.PropertyEditorAlias);
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
var defaultValue = new Models.Archetype();
if (source == null)
return defaultValue;
var sourceString = source.ToString();
if (!sourceString.DetectIsJson())
return defaultValue;
var archetype = new ArchetypeHelper().DeserializeJsonToArchetype(source.ToString(),
(propertyType != null ? propertyType.DataTypeId : -1));
return archetype;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Archetype.Umbraco.Extensions;
using Archetype.Umbraco.Models;
using Newtonsoft.Json;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
namespace Archetype.Umbraco.PropertyConverters
{
[PropertyValueType(typeof(Models.Archetype))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class ArchetypeValueConverter : PropertyValueConverterBase
{
public ServiceContext Services
{
get { return ApplicationContext.Current.Services; }
}
public override bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.PropertyEditorAlias.Equals(Constants.PropertyEditorAlias);
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
var defaultValue = new Models.Archetype();
if (source == null)
return defaultValue;
var sourceString = source.ToString();
if (!sourceString.DetectIsJson())
return defaultValue;
var archetype = new ArchetypeHelper().DeserializeJsonToArchetype(source.ToString(), propertyType.DataTypeId);
return archetype;
}
}
}
|
mit
|
C#
|
3c0bd46059f32600f6b44b702893fc094d9540ae
|
comment not yet used ext. method
|
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
|
src/FilterLists.DataLoad/Startup.cs
|
src/FilterLists.DataLoad/Startup.cs
|
using System.IO;
using FilterLists.Data.DependencyInjection.Extensions;
using FilterLists.Services.DependencyInjection.Extensions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace FilterLists.DataLoad
{
public class Startup
{
public Startup()
{
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", false, true);
Configuration = builder.Build();
}
private IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
var loggerFactory = new LoggerFactory().AddConsole().AddDebug();
services.AddSingleton(loggerFactory);
services.AddLogging();
services.AddFilterListsRepositories(Configuration);
services.AddFilterListsServices();
//services.AddFilterListsDataLoad();
}
}
}
|
using System.IO;
using FilterLists.Data.DependencyInjection.Extensions;
using FilterLists.DataLoad.DependencyInjection.Extensions;
using FilterLists.Services.DependencyInjection.Extensions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace FilterLists.DataLoad
{
public class Startup
{
public Startup()
{
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", false, true);
Configuration = builder.Build();
}
private IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
var loggerFactory = new LoggerFactory().AddConsole().AddDebug();
services.AddSingleton(loggerFactory);
services.AddLogging();
services.AddFilterListsRepositories(Configuration);
services.AddFilterListsServices();
services.AddFilterListsDataLoad();
}
}
}
|
mit
|
C#
|
18e0d8372e9c97be37b41b2bbafe03834b608e09
|
fix to NavigationClassBuilder
|
GiveCampUK/GiveCRM,GiveCampUK/GiveCRM
|
src/GiveCRM.Web/Views/MenuHelper.cs
|
src/GiveCRM.Web/Views/MenuHelper.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace GiveCRM.Web.Views
{
public static class MenuHelper
{
public static bool IsCurrentPage(
this HtmlHelper htmlHelper,
string controllerName,
string actionName = "")
{
var routeData = htmlHelper.ViewContext.RouteData;
string currentAction = routeData.GetRequiredString("action");
string currentController = routeData.GetRequiredString("controller");
if (string.IsNullOrEmpty(actionName))
{
actionName = currentAction;
}
return (controllerName == currentController && actionName == currentAction);
}
public static MvcHtmlString NavigationClassBuilder(
this HtmlHelper htmlHelper,
string controllerName,
string actionName = "",
string additionalClasses = "")
{
List<string> classList = SplitString(additionalClasses);
if (IsCurrentPage(htmlHelper, controllerName, actionName))
{
classList.Add("active");
}
if (classList.Count == 0)
{
return new MvcHtmlString("");
}
return new MvcHtmlString("class=\"" + JoinString(classList) + "\"");
}
private static List<string> SplitString(string list)
{
if (string.IsNullOrEmpty(list))
{
return new List<string>();
}
return list.Split(' ').ToList();
}
private static string JoinString(List<string> classList)
{
return string.Join(" ", classList.ToArray());
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace GiveCRM.Web.Views
{
public static class MenuHelper
{
public static bool IsCurrentPage(
this HtmlHelper htmlHelper,
string controllerName,
string actionName = "")
{
var routeData = htmlHelper.ViewContext.RouteData;
string currentAction = routeData.GetRequiredString("action");
string currentController = routeData.GetRequiredString("controller");
if (string.IsNullOrEmpty(actionName))
{
actionName = currentAction;
}
return (controllerName == currentController && actionName == currentAction);
}
public static MvcHtmlString NavigationClassBuilder(
this HtmlHelper htmlHelper,
string controllerName,
string actionName = "",
string additionalClasses = "")
{
List<string> classList = additionalClasses.Split(' ').ToList();
if (IsCurrentPage(htmlHelper, controllerName, actionName))
{
classList.Add("active");
}
if (classList.Count == 0)
{
return new MvcHtmlString("");
}
return new MvcHtmlString("class=\"" + string.Join(" ", classList.ToArray()) + "\"");
}
}
}
|
mit
|
C#
|
7e6bf26b821b9565c8a36e0449154b986197d766
|
Order files by name.
|
peschuster/LogImporter
|
source/LogImporter/FileRepository.cs
|
source/LogImporter/FileRepository.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace LogImporter
{
public class FileRepository : IFileRepository
{
private readonly FileInfo[] files;
public FileRepository(DirectoryInfo directory, string pattern)
{
if (directory == null)
throw new ArgumentNullException("directory");
if (!directory.Exists)
throw new ArgumentException("Directory does not exist.", "directory");
this.files = string.IsNullOrWhiteSpace(pattern)
? directory.GetFiles()
: directory.GetFiles(pattern);
}
public IEnumerable<FileInfo> GetFiles()
{
return this.files
.OrderBy(f => f.Name);
}
public IEnumerable<FileInfo> GetFiles(IEnumerable<string> importedFileNames, LogEntry lastEntry)
{
if (importedFileNames == null)
throw new ArgumentNullException("importedFileNames");
if (lastEntry == null)
throw new ArgumentNullException("lastEntry");
return (from f in this.files
where f.Name == lastEntry.LogFilename || !importedFileNames.Contains(f.Name)
orderby f.Name
select f);
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace LogImporter
{
public class FileRepository : IFileRepository
{
private readonly FileInfo[] files;
public FileRepository(DirectoryInfo directory, string pattern)
{
if (directory == null)
throw new ArgumentNullException("directory");
if (!directory.Exists)
throw new ArgumentException("Directory does not exist.", "directory");
this.files = string.IsNullOrWhiteSpace(pattern)
? directory.GetFiles()
: directory.GetFiles(pattern);
}
public IEnumerable<FileInfo> GetFiles()
{
return this.files
.OrderBy(f => f.Name);
}
public IEnumerable<FileInfo> GetFiles(IEnumerable<string> importedFileNames, LogEntry lastEntry)
{
if (importedFileNames == null)
throw new ArgumentNullException("importedFileNames");
if (lastEntry == null)
throw new ArgumentNullException("lastEntry");
return (from f in this.files
where f.Name == lastEntry.LogFilename || !importedFileNames.Contains(f.Name)
select f);
}
}
}
|
mit
|
C#
|
9e47c62c9223e4e458b35c3de09e84c8dac4a1c7
|
Fix 563
|
Sitecore/Sitecore-Instance-Manager
|
src/SIM.Pipelines/Delete/CleanUp.cs
|
src/SIM.Pipelines/Delete/CleanUp.cs
|
using JetBrains.Annotations;
using SIM.Pipelines.Install;
using SIM.Pipelines.Processors;
using Sitecore.Diagnostics.Base;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SIM.Sitecore9Installer;
using System.Threading;
using Sitecore.Diagnostics.Logging;
namespace SIM.Pipelines.Delete
{
public class CleanUp : Processor
{
protected override void Process([NotNull] ProcessorArgs args)
{
Install9Args arguments = args as Install9Args;
Assert.ArgumentNotNull(arguments, nameof(arguments));
if (arguments.ScriptsOnly)
{
this.Skip();
return;
}
InstallParam param = arguments.Tasker.GlobalParams.FirstOrDefault(p => p.Name == "DeployRoot");
if (param!=null)
{
int retriesNumber = 3;
for (int i=0;i<= retriesNumber; i++)
{
if (Directory.Exists(param.Value))
{
try
{
Directory.Delete(param.Value, true);
}
catch(System.IO.IOException ex)
{
Log.Warn($"Can't remove directory: {param.Value}. {ex.Message}");
}
if (Directory.Exists(param.Value))
{
if (retriesNumber == i)
{
throw new Exception($"Can't remove directory: {param.Value}");
}
Thread.Sleep(10000);
}
else
{
break;
}
}
}
}
Directory.Delete(arguments.Tasker.UnInstallParamsPath, true);
}
}
}
|
using JetBrains.Annotations;
using SIM.Pipelines.Install;
using SIM.Pipelines.Processors;
using Sitecore.Diagnostics.Base;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SIM.Sitecore9Installer;
using System.Threading;
using Sitecore.Diagnostics.Logging;
namespace SIM.Pipelines.Delete
{
public class CleanUp : Processor
{
protected override void Process([NotNull] ProcessorArgs args)
{
Install9Args arguments = args as Install9Args;
Assert.ArgumentNotNull(arguments, nameof(arguments));
if (arguments.ScriptsOnly)
{
this.Skip();
return;
}
Directory.Delete(arguments.Tasker.UnInstallParamsPath, true);
InstallParam param = arguments.Tasker.GlobalParams.FirstOrDefault(p => p.Name == "DeployRoot");
if (param!=null)
{
int retrisNumber = 3;
for (int i=0;i<= retrisNumber; i++)
{
if (Directory.Exists(param.Value))
{
try
{
Directory.Delete(param.Value, true);
}
catch(System.IO.IOException ex)
{
Log.Warn($"Can't remove directory: {param.Value}. {ex.Message}");
}
if (Directory.Exists(param.Value))
{
if (retrisNumber==i)
{
throw new Exception($"Can't remove directory: {param.Value}");
}
Thread.Sleep(10000);
}
else
{
break;
}
}
}
}
}
}
}
|
mit
|
C#
|
cfc7aa10cf707a77b7af962848511affec053383
|
Update CoreXamlType.cs
|
wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
|
src/Serializer.Xaml/CoreXamlType.cs
|
src/Serializer.Xaml/CoreXamlType.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Portable.Xaml;
using Portable.Xaml.ComponentModel;
using Portable.Xaml.Schema;
using System;
using System.ComponentModel;
namespace Serializer.Xaml
{
internal class CoreXamlType : XamlType
{
public CoreXamlType(Type underlyingType, XamlSchemaContext schemaContext)
: base(underlyingType, schemaContext)
{
}
protected override ICustomAttributeProvider LookupCustomAttributeProvider()
{
return new CoreAttributeProvider(this.UnderlyingType);
}
protected override XamlValueConverter<TypeConverter> LookupTypeConverter()
{
var result = CoreTypeConverterProvider.Find(this.UnderlyingType);
if (result != null)
{
return new XamlValueConverter<TypeConverter>(result, this);
}
else
{
return base.LookupTypeConverter();
}
}
}
}
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Portable.Xaml;
using Portable.Xaml.ComponentModel;
using Portable.Xaml.Schema;
using System;
namespace Serializer.Xaml
{
internal class CoreXamlType : XamlType
{
public CoreXamlType(Type underlyingType, XamlSchemaContext schemaContext)
: base(underlyingType, schemaContext)
{
}
protected override ICustomAttributeProvider LookupCustomAttributeProvider()
{
return new CoreAttributeProvider(this.UnderlyingType);
}
protected override XamlValueConverter<TypeConverter> LookupTypeConverter()
{
var result = CoreTypeConverterProvider.Find(this.UnderlyingType);
if (result != null)
{
return new XamlValueConverter<TypeConverter>(result, this);
}
else
{
return base.LookupTypeConverter();
}
}
}
}
|
mit
|
C#
|
2b33c5cfd75fc979f259a2eceab3f5ff5a8ae191
|
Fix for chekcing the children belonging to MemberType tree.
|
WebCentrum/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,leekelleher/Umbraco-CMS,leekelleher/Umbraco-CMS,robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,madsoulswe/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS,rasmuseeg/Umbraco-CMS,bjarnef/Umbraco-CMS,lars-erik/Umbraco-CMS,tcmorris/Umbraco-CMS,lars-erik/Umbraco-CMS,mattbrailsford/Umbraco-CMS,mattbrailsford/Umbraco-CMS,hfloyd/Umbraco-CMS,rasmuseeg/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,bjarnef/Umbraco-CMS,umbraco/Umbraco-CMS,WebCentrum/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,lars-erik/Umbraco-CMS,NikRimington/Umbraco-CMS,rasmuseeg/Umbraco-CMS,marcemarc/Umbraco-CMS,tompipe/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,bjarnef/Umbraco-CMS,madsoulswe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,WebCentrum/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,marcemarc/Umbraco-CMS,madsoulswe/Umbraco-CMS,tompipe/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,umbraco/Umbraco-CMS,lars-erik/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,NikRimington/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,leekelleher/Umbraco-CMS,NikRimington/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,lars-erik/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,bjarnef/Umbraco-CMS,abryukhov/Umbraco-CMS,leekelleher/Umbraco-CMS
|
src/Umbraco.Web/Trees/MemberTypeTreeController.cs
|
src/Umbraco.Web/Trees/MemberTypeTreeController.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Formatting;
using Umbraco.Core;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.WebApi.Filters;
namespace Umbraco.Web.Trees
{
[CoreTree(TreeGroup = Constants.Trees.Groups.Settings)]
[UmbracoTreeAuthorize(Constants.Trees.MemberTypes)]
[Tree(Constants.Applications.Settings, Constants.Trees.MemberTypes, null, sortOrder: 2)]
public class MemberTypeTreeController : MemberTypeAndGroupTreeControllerBase
{
protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
{
var root = base.CreateRootNode(queryStrings);
//check if there are any member types
root.HasChildren = Services.MemberTypeService.GetAll().Any();
return root;
}
protected override IEnumerable<TreeNode> GetTreeNodesFromService(string id, FormDataCollection queryStrings)
{
return Services.MemberTypeService.GetAll()
.OrderBy(x => x.Name)
.Select(dt => CreateTreeNode(dt, Constants.ObjectTypes.MemberType, id, queryStrings, "icon-item-arrangement", false));
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Formatting;
using Umbraco.Core;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.WebApi.Filters;
namespace Umbraco.Web.Trees
{
[CoreTree(TreeGroup =Constants.Trees.Groups.Settings)]
[UmbracoTreeAuthorize(Constants.Trees.MemberTypes)]
[Tree(Constants.Applications.Settings, Constants.Trees.MemberTypes, null, sortOrder: 2)]
public class MemberTypeTreeController : MemberTypeAndGroupTreeControllerBase
{
protected override IEnumerable<TreeNode> GetTreeNodesFromService(string id, FormDataCollection queryStrings)
{
return Services.MemberTypeService.GetAll()
.OrderBy(x => x.Name)
.Select(dt => CreateTreeNode(dt, Constants.ObjectTypes.MemberType, id, queryStrings, "icon-item-arrangement", false));
}
}
}
|
mit
|
C#
|
1934fe6558fe42d1587bb6f2b52da5e48212a53b
|
remove template from DelegateQuery::DelegateMethod because it cause build errors in VS.Net Express 2008
|
marksvc/libpalaso,gtryus/libpalaso,andrew-polk/libpalaso,ermshiperete/libpalaso,ermshiperete/libpalaso,mccarthyrb/libpalaso,sillsdev/libpalaso,JohnThomson/libpalaso,gtryus/libpalaso,ddaspit/libpalaso,tombogle/libpalaso,andrew-polk/libpalaso,gmartin7/libpalaso,JohnThomson/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,ddaspit/libpalaso,marksvc/libpalaso,JohnThomson/libpalaso,chrisvire/libpalaso,mccarthyrb/libpalaso,hatton/libpalaso,gtryus/libpalaso,JohnThomson/libpalaso,gmartin7/libpalaso,ermshiperete/libpalaso,andrew-polk/libpalaso,ddaspit/libpalaso,hatton/libpalaso,darcywong00/libpalaso,gmartin7/libpalaso,sillsdev/libpalaso,darcywong00/libpalaso,ddaspit/libpalaso,andrew-polk/libpalaso,sillsdev/libpalaso,hatton/libpalaso,ermshiperete/libpalaso,mccarthyrb/libpalaso,gtryus/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso,gmartin7/libpalaso,mccarthyrb/libpalaso,chrisvire/libpalaso,chrisvire/libpalaso,hatton/libpalaso,tombogle/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,marksvc/libpalaso,darcywong00/libpalaso,chrisvire/libpalaso
|
Palaso/Data/DelegateQuery.cs
|
Palaso/Data/DelegateQuery.cs
|
using System.Collections.Generic;
using Palaso.Data;
namespace Palaso.Data
{
public class DelegateQuery<T> : IQuery<T> where T: class, new()
{
public delegate IEnumerable<IDictionary<string, object>> DelegateMethod(T item);
DelegateMethod _method;
public DelegateQuery(DelegateMethod method)
{
_method = method;
}
#region IQuery<T> Members
public IEnumerable<IDictionary<string, object>> GetResults(T item)
{
return _method(item);
}
#endregion
}
}
|
using System.Collections.Generic;
using Palaso.Data;
namespace Palaso.Data
{
public class DelegateQuery<T> : IQuery<T> where T: class, new()
{
public delegate IEnumerable<IDictionary<string, object>> DelegateMethod<T>(T item) where T : class, new();
DelegateMethod<T> _method;
public DelegateQuery(DelegateMethod<T> method)
{
_method = method;
}
#region IQuery<T> Members
public IEnumerable<IDictionary<string, object>> GetResults(T item)
{
return _method(item);
}
#endregion
}
}
|
mit
|
C#
|
d04509a82e51a08b9b2c1d5c3a2ce2a2611e4166
|
Introduce a SmartLink value to the LinkWith attribute.
|
mono/maccore
|
src/ObjCRuntime/LinkWithAttribute.cs
|
src/ObjCRuntime/LinkWithAttribute.cs
|
//
// Authors: Jeffrey Stedfast
//
// Copyright 2011 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
namespace MonoMac.ObjCRuntime {
[Flags]
public enum LinkTarget {
Simulator = 1,
ArmV6 = 2,
ArmV7 = 4,
Thumb = 8,
ArmV7s = 16,
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true)]
public class LinkWithAttribute : Attribute {
public LinkWithAttribute (string libraryName, LinkTarget target, string linkerFlags)
{
LibraryName = libraryName;
LinkerFlags = linkerFlags;
LinkTarget = target;
}
public LinkWithAttribute (string libraryName, LinkTarget target)
{
LibraryName = libraryName;
LinkTarget = target;
}
public LinkWithAttribute (string libraryName)
{
LibraryName = libraryName;
}
public bool ForceLoad {
get; set;
}
public string Frameworks {
get; set;
}
public string WeakFrameworks {
get; set;
}
public string LibraryName {
get; private set;
}
public string LinkerFlags {
get; set;
}
public LinkTarget LinkTarget {
get; set;
}
public bool NeedsGccExceptionHandling {
get; set;
}
public bool IsCxx {
get; set;
}
public bool SmartLink {
get; set;
}
}
}
|
//
// Authors: Jeffrey Stedfast
//
// Copyright 2011 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
namespace MonoMac.ObjCRuntime {
[Flags]
public enum LinkTarget {
Simulator = 1,
ArmV6 = 2,
ArmV7 = 4,
Thumb = 8,
ArmV7s = 16,
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true)]
public class LinkWithAttribute : Attribute {
public LinkWithAttribute (string libraryName, LinkTarget target, string linkerFlags)
{
LibraryName = libraryName;
LinkerFlags = linkerFlags;
LinkTarget = target;
}
public LinkWithAttribute (string libraryName, LinkTarget target)
{
LibraryName = libraryName;
LinkTarget = target;
}
public LinkWithAttribute (string libraryName)
{
LibraryName = libraryName;
}
public bool ForceLoad {
get; set;
}
public string Frameworks {
get; set;
}
public string WeakFrameworks {
get; set;
}
public string LibraryName {
get; private set;
}
public string LinkerFlags {
get; set;
}
public LinkTarget LinkTarget {
get; set;
}
public bool NeedsGccExceptionHandling {
get; set;
}
public bool IsCxx {
get; set;
}
}
}
|
apache-2.0
|
C#
|
cf6500c2a0949b1fc0a207b81c2771801af41bf9
|
Increment version
|
roberthardy/Synthesis,kamsar/Synthesis
|
Source/SharedAssemblyInfo.cs
|
Source/SharedAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System;
[assembly: AssemblyCompany("ISITE Design")]
[assembly: AssemblyProduct("Synthesis")]
[assembly: AssemblyCopyright("Copyright © Kam Figy, ISITE Design")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("8.0.0.0")]
[assembly: AssemblyFileVersion("8.0.0.0")]
[assembly: AssemblyInformationalVersion("8.0.0-beta02")]
[assembly: CLSCompliant(false)]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System;
[assembly: AssemblyCompany("ISITE Design")]
[assembly: AssemblyProduct("Synthesis")]
[assembly: AssemblyCopyright("Copyright © Kam Figy, ISITE Design")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("8.0.0.0")]
[assembly: AssemblyFileVersion("8.0.0.0")]
[assembly: AssemblyInformationalVersion("8.0.0-beta01")]
[assembly: CLSCompliant(false)]
|
mit
|
C#
|
23d5fa5c9b8ae34f8805f2b9e003d0df1a67818e
|
Add comment.
|
jmarolf/roslyn,aelij/roslyn,KirillOsenkov/roslyn,jasonmalinowski/roslyn,bkoelman/roslyn,VSadov/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,KirillOsenkov/roslyn,tmeschter/roslyn,stephentoub/roslyn,jcouv/roslyn,dpoeschl/roslyn,abock/roslyn,paulvanbrenk/roslyn,aelij/roslyn,DustinCampbell/roslyn,jcouv/roslyn,gafter/roslyn,physhi/roslyn,bkoelman/roslyn,eriawan/roslyn,tannergooding/roslyn,KevinRansom/roslyn,sharwell/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,jamesqo/roslyn,tmeschter/roslyn,swaroop-sridhar/roslyn,agocke/roslyn,wvdd007/roslyn,brettfo/roslyn,diryboy/roslyn,swaroop-sridhar/roslyn,genlu/roslyn,swaroop-sridhar/roslyn,xasx/roslyn,OmarTawfik/roslyn,panopticoncentral/roslyn,ErikSchierboom/roslyn,eriawan/roslyn,gafter/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,tannergooding/roslyn,aelij/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,paulvanbrenk/roslyn,sharwell/roslyn,genlu/roslyn,brettfo/roslyn,davkean/roslyn,ErikSchierboom/roslyn,mavasani/roslyn,cston/roslyn,nguerrera/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,genlu/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,KirillOsenkov/roslyn,nguerrera/roslyn,diryboy/roslyn,xasx/roslyn,heejaechang/roslyn,jamesqo/roslyn,xasx/roslyn,tmat/roslyn,eriawan/roslyn,MichalStrehovsky/roslyn,CyrusNajmabadi/roslyn,agocke/roslyn,mgoertz-msft/roslyn,AmadeusW/roslyn,gafter/roslyn,jmarolf/roslyn,dotnet/roslyn,jamesqo/roslyn,AlekseyTs/roslyn,abock/roslyn,reaction1989/roslyn,davkean/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,heejaechang/roslyn,wvdd007/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,AlekseyTs/roslyn,wvdd007/roslyn,OmarTawfik/roslyn,brettfo/roslyn,dpoeschl/roslyn,mavasani/roslyn,sharwell/roslyn,mavasani/roslyn,tmat/roslyn,panopticoncentral/roslyn,tannergooding/roslyn,OmarTawfik/roslyn,jcouv/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,reaction1989/roslyn,VSadov/roslyn,cston/roslyn,davkean/roslyn,dpoeschl/roslyn,mgoertz-msft/roslyn,dotnet/roslyn,MichalStrehovsky/roslyn,DustinCampbell/roslyn,paulvanbrenk/roslyn,nguerrera/roslyn,physhi/roslyn,heejaechang/roslyn,weltkante/roslyn,tmeschter/roslyn,DustinCampbell/roslyn,agocke/roslyn,weltkante/roslyn,diryboy/roslyn,bartdesmet/roslyn,cston/roslyn,bkoelman/roslyn,jasonmalinowski/roslyn,physhi/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,VSadov/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,tmat/roslyn,MichalStrehovsky/roslyn,dotnet/roslyn,abock/roslyn,reaction1989/roslyn,bartdesmet/roslyn
|
src/Workspaces/Core/Portable/EmbeddedLanguages/LanguageServices/AbstractEmbeddedLanguageProvider.cs
|
src/Workspaces/Core/Portable/EmbeddedLanguages/LanguageServices/AbstractEmbeddedLanguageProvider.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars;
using Microsoft.CodeAnalysis.LanguageServices;
namespace Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices
{
/// <summary>
/// Abstract implementation of the C# and VB embedded language providers.
/// </summary>
internal abstract class AbstractEmbeddedLanguageProvider : IEmbeddedLanguageProvider
{
private readonly ImmutableArray<IEmbeddedLanguage> _embeddedLanguages;
protected AbstractEmbeddedLanguageProvider(
int stringLiteralKind,
ISyntaxFactsService syntaxFacts,
ISemanticFactsService semanticFacts,
IVirtualCharService virtualCharService)
{
// This is where we'll add the Regex and Json providers when their respective
// branches get merged in.
_embeddedLanguages = ImmutableArray.Create<IEmbeddedLanguage>();
}
public ImmutableArray<IEmbeddedLanguage> GetEmbeddedLanguages()
=> _embeddedLanguages;
/// <summary>
/// Helper method used by the VB and C# <see cref="IEmbeddedCodeFixProvider"/>s so they can
/// add special comments to string literals to convey that language services should light up
/// for them.
/// </summary>
internal abstract void AddComment(
SyntaxEditor editor, SyntaxToken stringLiteral, string commentContents);
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars;
using Microsoft.CodeAnalysis.LanguageServices;
namespace Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices
{
/// <summary>
/// Abstract implementation of the C# and VB embedded language providers.
/// </summary>
internal abstract class AbstractEmbeddedLanguageProvider : IEmbeddedLanguageProvider
{
private readonly ImmutableArray<IEmbeddedLanguage> _embeddedLanguages;
protected AbstractEmbeddedLanguageProvider(
int stringLiteralKind,
ISyntaxFactsService syntaxFacts,
ISemanticFactsService semanticFacts,
IVirtualCharService virtualCharService)
{
_embeddedLanguages = ImmutableArray.Create<IEmbeddedLanguage>();
}
public ImmutableArray<IEmbeddedLanguage> GetEmbeddedLanguages()
=> _embeddedLanguages;
/// <summary>
/// Helper method used by the VB and C# <see cref="IEmbeddedCodeFixProvider"/>s so they can
/// add special comments to string literals to convey that language services should light up
/// for them.
/// </summary>
internal abstract void AddComment(
SyntaxEditor editor, SyntaxToken stringLiteral, string commentContents);
}
}
|
mit
|
C#
|
345d02e1890190713f2128ef1fdef33ee29778c3
|
add accessors for "headers" field
|
iron-io/iron_dotnet
|
src/IronSharp.IronMQ/Subscriber.cs
|
src/IronSharp.IronMQ/Subscriber.cs
|
using System;
using System.Collections.Generic;
using System.Net;
using Newtonsoft.Json;
namespace IronSharp.IronMQ
{
public class Subscriber
{
public Subscriber() : this(null,null,null)
{
}
public Subscriber(string name, string url) : this(name, url, null)
{
}
public Subscriber(string name, string url, Dictionary<string,string> headers )
{
Name = name;
Url = url;
Headers = headers;
}
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Name { get; set; }
[JsonProperty("retries_delay", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? RetriesDelay { get; set; }
[JsonProperty("retries_remaining", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? RetriesRemaining { get; set; }
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Status { get; set; }
[JsonProperty("status_code", DefaultValueHandling = DefaultValueHandling.Ignore)]
protected int? Code { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("error_queue", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ErrorQueue { get; set; }
[JsonProperty("headers", DefaultValueHandling = DefaultValueHandling.Ignore)]
public Dictionary<string, string> Headers { get; set; }
[JsonIgnore]
public HttpStatusCode StatusCode
{
get { return (HttpStatusCode) Code.GetValueOrDefault(200); }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Net;
using Newtonsoft.Json;
namespace IronSharp.IronMQ
{
public class Subscriber
{
public Subscriber() : this(null,null,null)
{
}
public Subscriber(string name, string url) : this(name, url, null)
{
}
public Subscriber(string name, string url, Dictionary<string,string> headers )
{
Name = name;
Url = url;
Headers = headers;
}
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Name { get; set; }
[JsonProperty("retries_delay", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? RetriesDelay { get; set; }
[JsonProperty("retries_remaining", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? RetriesRemaining { get; set; }
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Status { get; set; }
[JsonProperty("status_code", DefaultValueHandling = DefaultValueHandling.Ignore)]
protected int? Code { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("error_queue", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ErrorQueue { get; set; }
[JsonProperty("headers", DefaultValueHandling = DefaultValueHandling.Ignore)]
public Dictionary<string, string> Headers;
[JsonIgnore]
public HttpStatusCode StatusCode
{
get { return (HttpStatusCode) Code.GetValueOrDefault(200); }
}
}
}
|
mit
|
C#
|
d455ab9ffe38b35765aa84b0d6bb08e65ec99dd5
|
Add default kick message, inform who the kicker was
|
Yonom/CupCake
|
CupCake.DefaultCommands/Commands/User/KickCommand.cs
|
CupCake.DefaultCommands/Commands/User/KickCommand.cs
|
using System.Runtime.InteropServices;
using CupCake.Command;
using CupCake.Command.Source;
using CupCake.Permissions;
using CupCake.Players;
namespace CupCake.DefaultCommands.Commands.User
{
public sealed class KickCommand : UserCommandBase
{
[MinGroup(Group.Trusted)]
[Label("kick", "kickplayer")]
[CorrectUsage("[player] [reason]")]
protected override void Run(IInvokeSource source, ParsedCommand message)
{
this.RequireOwner();
Player player = this.GetPlayerOrSelf(source, message);
this.RequireSameRank(source, player);
this.Chatter.ChatService.Kick(source.Name, player.Username, (message.Count > 1 ? message.GetTrail(1) : "Tsk tsk tsk"));
}
}
}
|
using CupCake.Command;
using CupCake.Command.Source;
using CupCake.Permissions;
using CupCake.Players;
namespace CupCake.DefaultCommands.Commands.User
{
public sealed class KickCommand : UserCommandBase
{
[MinGroup(Group.Trusted)]
[Label("kick", "kickplayer")]
[CorrectUsage("[player] [reason]")]
protected override void Run(IInvokeSource source, ParsedCommand message)
{
this.RequireOwner();
Player player = this.GetPlayerOrSelf(source, message);
this.RequireSameRank(source, player);
this.Chatter.Kick(player.Username, message.GetTrail(1));
}
}
}
|
mit
|
C#
|
e7d28fc965cb70540db9a26c61947e1ce7172bd5
|
Fix CS
|
Lc5/CurrencyRates,Lc5/CurrencyRates,Lc5/CurrencyRates
|
CurrencyRates.WebService/CurrencyRatesService.svc.cs
|
CurrencyRates.WebService/CurrencyRatesService.svc.cs
|
namespace CurrencyRates.WebService
{
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using CurrencyRates.Model;
using CurrencyRates.Model.Entities;
using CurrencyRates.Model.Queries;
public class CurrencyRatesService : ICurrencyRatesService
{
private readonly Context context;
public CurrencyRatesService(Context context)
{
this.context = context;
this.context.Configuration.ProxyCreationEnabled = false;
}
public Rate Find(int id)
{
return this.context
.Rates
.Include(r => r.File)
.SingleOrDefault(r => r.Id == id);
}
public IEnumerable<Rate> FindLatest()
{
return this.context
.Rates
.FindLatest()
.Include(r => r.Currency);
}
}
}
|
namespace CurrencyRates.WebService
{
using System.Collections.Generic;
using System.Data.Entity;
using CurrencyRates.Model;
using CurrencyRates.Model.Entities;
using CurrencyRates.Model.Queries;
public class CurrencyRatesService : ICurrencyRatesService
{
private readonly Context context;
public CurrencyRatesService(Context context)
{
this.context = context;
this.context.Configuration.ProxyCreationEnabled = false;
}
public Rate Find(int id)
{
return this.context.Rates.Find(id);
}
public IEnumerable<Rate> FindLatest()
{
return this.context.Rates.FindLatest().Include(r => r.Currency);
}
}
}
|
mit
|
C#
|
6aebc144e4b5fe2769fc24e9017f914ff6becb4d
|
add a key to FormItemModel to allow saving to database
|
bluemner/FormsGenerator,bluemner/FormsGenerator,bluemner/FormsGenerator
|
FormsGeneratorWebApplication/Models/FormItemModel.cs
|
FormsGeneratorWebApplication/Models/FormItemModel.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace FormsGeneratorWebApplication.Models
{
public class FormItemModel
{
[Key]
public int id { get; set; }
[Display(Name="Position")]
[Required(ErrorMessage="No postion set")]
public int postion { get; set; }
[Display(Name = "Question")]
[Required(ErrorMessage = "Question is required")]
public string question { get; set; }
[Display(Name = "Type")]
[Required(ErrorMessage = "Type is required")]
public int type { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace FormsGeneratorWebApplication.Models
{
public class FormItemModel
{
[Display(Name="Position")]
[Required(ErrorMessage="No postion set")]
public int postion { get; set; }
[Display(Name = "Question")]
[Required(ErrorMessage = "Question is required")]
public string question { get; set; }
[Display(Name = "Type")]
[Required(ErrorMessage = "Type is required")]
public int type { get; set; }
}
}
|
mit
|
C#
|
895e517809b21089cf6182c39476b6169f40d3fc
|
Fix tests - apparently CoreEventId.NavigationBaseIncludeIgnored now defaults to Error in EF Core 6.
|
IntelliTect/Coalesce,IntelliTect/Coalesce,IntelliTect/Coalesce,IntelliTect/Coalesce
|
src/IntelliTect.Coalesce.Tests/TargetClasses/TestDbContext/TestDbContext.cs
|
src/IntelliTect.Coalesce.Tests/TargetClasses/TestDbContext/TestDbContext.cs
|
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using System;
using System.Collections.Generic;
using System.Text;
namespace IntelliTect.Coalesce.Tests.TargetClasses.TestDbContext
{
[Coalesce]
public class TestDbContext : DbContext
{
public DbSet<Person> People { get; set; }
public DbSet<Case> Cases { get; set; }
public DbSet<Company> Companies { get; set; }
public DbSet<Product> Products { get; set; }
public DbSet<CaseProduct> CaseProducts { get; set; }
public DbSet<ComplexModel> ComplexModels { get; set; }
public DbSet<Test> Tests { get; set; }
public TestDbContext() : this(Guid.NewGuid().ToString()) { }
public TestDbContext(string memoryDatabaseName)
: base(new DbContextOptionsBuilder<TestDbContext>().UseInMemoryDatabase(memoryDatabaseName).ConfigureWarnings(w =>
{
#if NET5_0_OR_GREATER
w.Ignore(CoreEventId.NavigationBaseIncludeIgnored);
#endif
}).Options)
{ }
public TestDbContext(DbContextOptions<TestDbContext> options)
: base(options)
{ }
}
}
|
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
namespace IntelliTect.Coalesce.Tests.TargetClasses.TestDbContext
{
[Coalesce]
public class TestDbContext : DbContext
{
public DbSet<Person> People { get; set; }
public DbSet<Case> Cases { get; set; }
public DbSet<Company> Companies { get; set; }
public DbSet<Product> Products { get; set; }
public DbSet<CaseProduct> CaseProducts { get; set; }
public DbSet<ComplexModel> ComplexModels { get; set; }
public DbSet<Test> Tests { get; set; }
public TestDbContext() : this(Guid.NewGuid().ToString()) { }
public TestDbContext(string memoryDatabaseName)
: base(new DbContextOptionsBuilder<TestDbContext>().UseInMemoryDatabase(memoryDatabaseName).Options)
{ }
public TestDbContext(DbContextOptions<TestDbContext> options)
: base(options)
{ }
}
}
|
apache-2.0
|
C#
|
a882c88b9f788633b44778bef92cd7723da80dfb
|
Update StaticOffsets.cs
|
aevitas/orion
|
src/Orion.GlobalOffensive/Orion.GlobalOffensive/Patchables/StaticOffsets.cs
|
src/Orion.GlobalOffensive/Orion.GlobalOffensive/Patchables/StaticOffsets.cs
|
// Copyright (C) 2015 aevitas
// See the file LICENSE for copying permission.
namespace Orion.GlobalOffensive.Patchables
{
// Contains offsets that hardly ever, if ever at all, change.
public enum StaticOffsets
{
// Entity
Position = 0x134,
Team = 0xF0,
Armor = 0xA8A4,
Health = 0xFC,
Dormant = 0xE9,
Index = 0x64,
Flags = 0x100,
LifeState = 0x25B,
CrosshairId = 0xA904,
// GameClient
LocalPlayerIndex = 0x160,
GameState = 0xE8,
// EntityList/ObjectManager
EntitySize = 0x10
}
}
|
// Copyright (C) 2015 aevitas
// See the file LICENSE for copying permission.
namespace Orion.GlobalOffensive.Patchables
{
// Contains offsets that hardly ever, if ever at all, change.
public enum StaticOffsets
{
// Entity
Position = 0x134,
Team = 0xF0,
Armor = 0x8C84,
Health = 0xFC,
Dormant = 0xE9,
Index = 0x64,
Flags = 0x100,
LifeState = 0x25B,
CrosshairId = 0xA904,
// GameClient
LocalPlayerIndex = 0x160,
GameState = 0xE8,
// EntityList/ObjectManager
EntitySize = 0x10
}
}
|
apache-2.0
|
C#
|
53667269a5952b4c32dfef49165fcf4af51406fd
|
add message
|
nmklotas/GitLabCLI
|
src/GitlabCmd.Console/Output/OutputPresenter.cs
|
src/GitlabCmd.Console/Output/OutputPresenter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace GitLabCLI.Console.Output
{
public sealed class OutputPresenter
{
private readonly GridResultFormatter _gridResultFormatter;
public OutputPresenter(GridResultFormatter gridResultFormatter) => _gridResultFormatter = gridResultFormatter;
public void Info(string text)
=> WriteLine(text);
public void Error(string text)
=> WriteLine($"Error: {text}");
public void SuccessResult(string header)
{
WriteLine("-------------------------");
WriteLine(header);
}
public void FailureResult(string header, string error)
{
WriteLine("-------------------------");
WriteLine(header);
WriteLine($"Error: {error}");
}
public void GridResult(
string header,
string[] columnHeaders,
IEnumerable<object[]> rows)
{
var inputRows = rows.ToArray();
if (inputRows.Select(r => r.Length).Any(l => l != columnHeaders.Length))
throw new ArgumentOutOfRangeException(nameof(columnHeaders), "columnHeaders length must match all rows length");
WriteLine(_gridResultFormatter.Format(header, columnHeaders, inputRows));
}
private void WriteLine(string text)
=> System.Console.WriteLine(text);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace GitLabCLI.Console.Output
{
public sealed class OutputPresenter
{
private readonly GridResultFormatter _gridResultFormatter;
public OutputPresenter(GridResultFormatter gridResultFormatter) => _gridResultFormatter = gridResultFormatter;
public void Info(string text)
=> WriteLine(text);
public void Error(string text)
=> WriteLine($"Error: {text}");
public void SuccessResult(string header)
{
WriteLine("-------------------------");
WriteLine(header);
}
public void FailureResult(string header, string error)
{
WriteLine("-------------------------");
WriteLine(header);
WriteLine($"Error: {error}");
}
public void GridResult(
string header,
string[] columnHeaders,
IEnumerable<object[]> rows)
{
var inputRows = rows.ToArray();
if (inputRows.Select(r => r.Length).Any(l => l != columnHeaders.Length))
throw new ArgumentOutOfRangeException();
WriteLine(_gridResultFormatter.Format(header, columnHeaders, inputRows));
}
private void WriteLine(string text)
=> System.Console.WriteLine(text);
}
}
|
mit
|
C#
|
d0c87453f0cfc0b7c340ffea41fcb191289d0ab9
|
Update image mapping code on server
|
lindydonna/ContosoMoments,azure-appservice-samples/ContosoMoments,azure-appservice-samples/ContosoMoments,lindydonna/ContosoMoments,lindydonna/ContosoMoments,azure-appservice-samples/ContosoMoments,azure-appservice-samples/ContosoMoments,azure-appservice-samples/ContosoMoments,lindydonna/ContosoMoments,lindydonna/ContosoMoments
|
src/Cloud/ContosoMoments.API/Helpers/ImageNameResolver.cs
|
src/Cloud/ContosoMoments.API/Helpers/ImageNameResolver.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using ContosoMoments.Common.Models;
using ContosoMoments.MobileServer.Models;
using Microsoft.Azure.Mobile.Server.Files;
namespace ContosoMoments.API.Controllers.TableControllers
{
public class ImageNameResolver : IContainerNameResolver
{
private MobileServiceContext dbContext;
private string storeUri;
public const string DefaultSizeKey = "lg";
public const string ContainerPrefix = "images";
public ImageNameResolver(string storeUri = null)
{
this.dbContext = new MobileServiceContext();
this.storeUri = storeUri;
}
public Task<string> GetFileContainerNameAsync(string tableName, string recordId, string fileName)
{
string result;
if (storeUri != null) {
// use the storeUri parameter to get the file container
var split = storeUri.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
result = split[0];
}
else {
// use the default container
result = string.Format("{0}-{1}", ContainerPrefix, DefaultSizeKey);
}
return Task.FromResult(result);
}
public Task<IEnumerable<string>> GetRecordContainerNames(string tableName, string recordId)
{
var sizes = new string[] { "lg", "md", "sm", "xs" };
var result = sizes.Select(x => GetContainerAndImageName(recordId: recordId, sizeKey: x));
return Task.FromResult(result);
}
public static string GetContainerAndImageName(string recordId, string sizeKey)
{
// image container is in the format images-xs
// There is a custom storage provider that will filter to only that file within the container
return string.Format("{0}-{1}/{2}", ContainerPrefix, sizeKey, recordId);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using ContosoMoments.Common.Models;
using ContosoMoments.MobileServer.Models;
using Microsoft.Azure.Mobile.Server.Files;
namespace ContosoMoments.API.Controllers.TableControllers
{
public class ImageNameResolver : IContainerNameResolver
{
private MobileServiceContext dbContext;
private string storeUri;
public ImageNameResolver(string storeUri = "")
{
this.dbContext = new MobileServiceContext();
this.storeUri = storeUri;
}
public Task<string> GetFileContainerNameAsync(string tableName, string recordId, string fileName)
{
// use the storeUri parameter to get the file container
var result = storeUri.Split( new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
return Task.FromResult(result[0]);
}
public async Task<IEnumerable<string>> GetRecordContainerNames(string tableName, string recordId)
{
var imageRecord = await dbContext.Images.FindAsync(recordId);
var sizes = new string[] { "lg", "md", "sm", "xs" };
return sizes.Select(x => GetContainerAndImageName(imageRecord, x));
}
private string GetContainerAndImageName(Image image, string sizeKey)
{
// image container is in the format images-xs
// There is a custom storage provider that will filter to only that file within the container
return string.Format("images-{0}/{1}", sizeKey, image.FileName);
}
}
}
|
mit
|
C#
|
a6421ec4829d5f78507f1500bddf3a3b1f9fa044
|
check AbpAllowAnonymousAttribute
|
aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template
|
aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/Startup/SecurityRequirementsOperationFilter.cs
|
aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/Startup/SecurityRequirementsOperationFilter.cs
|
using System.Collections.Generic;
using System.Linq;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using Abp.Authorization;
namespace AbpCompanyName.AbpProjectName.Web.Host.Startup
{
public class SecurityRequirementsOperationFilter : IOperationFilter
{
public void Apply(Operation operation, OperationFilterContext context)
{
var actionAttrs = context.ApiDescription.ActionAttributes();
if (actionAttrs.OfType<AbpAllowAnonymousAttribute>().Any())
{
return;
}
var actionAbpAuthorizeAttrs = actionAttrs.OfType<AbpAuthorizeAttribute>();
var controllerAbpAuthorizeAttrs = context.ApiDescription.ControllerAttributes()
.OfType<AbpAuthorizeAttribute>();
if (controllerAbpAuthorizeAttrs.Any() || actionAbpAuthorizeAttrs.Any())
{
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
operation.Responses.Add("403", new Response { Description = "Forbidden" });
var permissions = controllerAbpAuthorizeAttrs.Union(actionAbpAuthorizeAttrs)
.SelectMany(p => p.Permissions)
.Distinct();
operation.Security = new List<IDictionary<string, IEnumerable<string>>>
{
new Dictionary<string, IEnumerable<string>>
{
{ "bearerAuth", permissions }
}
};
}
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using Abp.Authorization;
namespace AbpCompanyName.AbpProjectName.Web.Host.Startup
{
public class SecurityRequirementsOperationFilter : IOperationFilter
{
public void Apply(Operation operation, OperationFilterContext context)
{
var controllerAbpAuthorizeAttrs = context.ApiDescription.ControllerAttributes()
.OfType<AbpAuthorizeAttribute>();
var actionAbpAuthorizeAtrrs = context.ApiDescription.ActionAttributes()
.OfType<AbpAuthorizeAttribute>();
if (controllerAbpAuthorizeAttrs.Any() || actionAbpAuthorizeAtrrs.Any())
{
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
operation.Responses.Add("403", new Response { Description = "Forbidden" });
var permissions = controllerAbpAuthorizeAttrs.Union(actionAbpAuthorizeAtrrs)
.SelectMany(p => p.Permissions)
.Distinct();
operation.Security = new List<IDictionary<string, IEnumerable<string>>>
{
new Dictionary<string, IEnumerable<string>>
{
{ "bearerAuth", permissions }
}
};
}
}
}
}
|
mit
|
C#
|
41204f5f43ac10f0159778a87491d6d71bae37b2
|
Add ToDictionarySafe
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Common/Utilities/Collections/Enumerable.ToDictionary.cs
|
source/Nuke.Common/Utilities/Collections/Enumerable.ToDictionary.cs
|
// Copyright 2019 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
namespace Nuke.Common.Utilities.Collections
{
public static partial class EnumerableExtensions
{
public static Dictionary<TKey, TValue> ToDictionary<T, TKey, TValue>(
this IEnumerable<T> enumerable,
[InstantHandle] Func<T, TKey> keySelector,
[InstantHandle] Func<T, TValue> valueSelector,
IEqualityComparer<TKey> comparer = null,
Func<ArgumentException, TKey, Exception> exceptionFactory = null)
{
var list = enumerable.ToList();
var dictionary = new Dictionary<TKey, TValue>(list.Count, comparer);
foreach (var item in list)
{
var key = keySelector.Invoke(item);
try
{
dictionary.Add(key, valueSelector.Invoke(item));
}
catch (ArgumentException exception) when (exceptionFactory != null)
{
throw exceptionFactory.Invoke(exception, key);
}
}
return dictionary;
}
public static Dictionary<TKey, TValue> ToDictionarySafe<T, TKey, TValue>(
this IEnumerable<T> enumerable,
[InstantHandle] Func<T, TKey> keySelector,
[InstantHandle] Func<T, TValue> valueSelector,
string duplicationMessage)
{
var groups = enumerable.ToLookup(keySelector.Invoke, valueSelector.Invoke);
ControlFlow.Assert(
groups.All(x => x.Count() == 1),
new[] { $"{duplicationMessage.TrimEnd(":")}:" }
.Concat(groups.Where(x => x.Count() > 1).Select(x => $" - {x.Key}"))
.JoinNewLine());
return groups.ToDictionary(x => x.Key, x => x.Single());
}
}
}
|
// Copyright 2019 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
namespace Nuke.Common.Utilities.Collections
{
public static partial class EnumerableExtensions
{
public static IDictionary<TKey, TValue> ToDictionary<T, TKey, TValue>(
this IEnumerable<T> enumerable,
[InstantHandle] Func<T, TKey> keySelector,
[InstantHandle] Func<T, TValue> valueSelector,
IEqualityComparer<TKey> comparer = null,
Func<ArgumentException, TKey, Exception> exceptionFactory = null)
{
var list = enumerable.ToList();
var dictionary = new Dictionary<TKey, TValue>(list.Count, comparer);
foreach (var item in list)
{
var key = keySelector(item);
try
{
dictionary.Add(key, valueSelector(item));
}
catch (ArgumentException exception)
{
exceptionFactory ??= (ex, _) => ex;
throw exceptionFactory(exception, key);
}
}
return dictionary;
}
}
}
|
mit
|
C#
|
19f47c054ee8a3e7a258848a359be4b116df851e
|
Update 01-CreateTable.cs
|
awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples
|
.dotnet/example_code/DynamoDB/TryDax/01-CreateTable.cs
|
.dotnet/example_code/DynamoDB/TryDax/01-CreateTable.cs
|
// snippet-sourcedescription:[ ]
// snippet-service:[dynamodb]
// snippet-keyword:[dotNET]
// snippet-keyword:[Amazon DynamoDB]
// snippet-keyword:[Code Sample]
// snippet-keyword:[ ]
// snippet-sourcetype:[full-example]
// snippet-sourcedate:[ ]
// snippet-sourceauthor:[AWS]
// snippet-start:[dynamodb.dotNET.trydax.01-CreateTable]
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.Model;
namespace ClientTest
{
class Program
{
public static async Task Main(string[] args)
{
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
var tableName = "TryDaxTable";
var request = new CreateTableRequest()
{
TableName = tableName,
KeySchema = new List<KeySchemaElement>()
{
new KeySchemaElement{ AttributeName = "pk",KeyType = "HASH"},
new KeySchemaElement{ AttributeName = "sk",KeyType = "RANGE"}
},
AttributeDefinitions = new List<AttributeDefinition>() {
new AttributeDefinition{ AttributeName = "pk",AttributeType = "N"},
new AttributeDefinition{ AttributeName = "sk",AttributeType = "N"}
},
ProvisionedThroughput = new ProvisionedThroughput()
{
ReadCapacityUnits = 10,
WriteCapacityUnits = 10
}
};
var response = await client.CreateTableAsync(request);
Console.WriteLine("Hit <enter> to continue...");
Console.ReadLine();
}
}
}
// snippet-end:[dynamodb.dotNET.trydax.01-CreateTable]
|
// snippet-sourcedescription:[ ]
// snippet-service:[dynamodb]
// snippet-keyword:[dotNET]
// snippet-keyword:[Amazon DynamoDB]
// snippet-keyword:[Code Sample]
// snippet-keyword:[ ]
// snippet-sourcetype:[full-example]
// snippet-sourcedate:[ ]
// snippet-sourceauthor:[AWS]
// snippet-start:[dynamodb.dotNET.trydax.01-CreateTable]
/**
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* This file is 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://aws.amazon.com/apache2.0/
*
* 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 Amazon.DynamoDBv2.Model;
using Amazon.DynamoDBv2;
namespace ClientTest
{
class Program
{
static void Main(string[] args)
{
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
var tableName = "TryDaxTable";
var request = new CreateTableRequest()
{
TableName = tableName,
KeySchema = new List<KeySchemaElement>()
{
new KeySchemaElement{ AttributeName = "pk",KeyType = "HASH"},
new KeySchemaElement{ AttributeName = "sk",KeyType = "RANGE"}
},
AttributeDefinitions = new List<AttributeDefinition>() {
new AttributeDefinition{ AttributeName = "pk",AttributeType = "N"},
new AttributeDefinition{ AttributeName = "sk",AttributeType = "N"}
},
ProvisionedThroughput = new ProvisionedThroughput()
{
ReadCapacityUnits = 10,
WriteCapacityUnits = 10
}
};
var response = client.CreateTableAsync(request).Result;
Console.WriteLine("Hit <enter> to continue...");
Console.ReadLine();
}
}
}
// snippet-end:[dynamodb.dotNET.trydax.01-CreateTable]
|
apache-2.0
|
C#
|
22e1824d95a3188c5b741b0f321c419a4b866601
|
Add Alias attribute to NLogLoggerProvider
|
NLog/NLog.Extensions.Logging,NLog/NLog.Framework.Logging,NLog/NLog.Framework.Logging
|
src/NLog.Extensions.Logging/Logging/NLogLoggerProvider.cs
|
src/NLog.Extensions.Logging/Logging/NLogLoggerProvider.cs
|
#if !NETCORE1_0
using Microsoft.Extensions.Logging;
#endif
namespace NLog.Extensions.Logging
{
/// <summary>
/// Provider logger for NLog + Microsoft.Extensions.Logging
/// </summary>
#if !NETCORE1_0
[ProviderAlias("NLog")]
#endif
public class NLogLoggerProvider : Microsoft.Extensions.Logging.ILoggerProvider
{
/// <summary>
/// NLog options
/// </summary>
public NLogProviderOptions Options { get; set; }
/// <summary>
/// New provider with default options, see <see cref="Options"/>
/// </summary>
public NLogLoggerProvider()
{
}
/// <summary>
/// New provider with options
/// </summary>
/// <param name="options"></param>
public NLogLoggerProvider(NLogProviderOptions options)
{
Options = options;
}
/// <summary>
/// Create a logger with the name <paramref name="name"/>.
/// </summary>
/// <param name="name">Name of the logger to be created.</param>
/// <returns>New Logger</returns>
public Microsoft.Extensions.Logging.ILogger CreateLogger(string name)
{
return new NLogLogger(LogManager.GetLogger(name), Options);
}
/// <summary>
/// Cleanup
/// </summary>
public void Dispose()
{
}
}
}
|
namespace NLog.Extensions.Logging
{
/// <summary>
/// Provider logger for NLog + Microsoft.Extensions.Logging
/// </summary>
public class NLogLoggerProvider : Microsoft.Extensions.Logging.ILoggerProvider
{
/// <summary>
/// NLog options
/// </summary>
public NLogProviderOptions Options { get; set; }
/// <summary>
/// New provider with default options, see <see cref="Options"/>
/// </summary>
public NLogLoggerProvider()
{
}
/// <summary>
/// New provider with options
/// </summary>
/// <param name="options"></param>
public NLogLoggerProvider(NLogProviderOptions options)
{
Options = options;
}
/// <summary>
/// Create a logger with the name <paramref name="name"/>.
/// </summary>
/// <param name="name">Name of the logger to be created.</param>
/// <returns>New Logger</returns>
public Microsoft.Extensions.Logging.ILogger CreateLogger(string name)
{
return new NLogLogger(LogManager.GetLogger(name), Options);
}
/// <summary>
/// Cleanup
/// </summary>
public void Dispose()
{
}
}
}
|
bsd-2-clause
|
C#
|
885f548a34c2d6ab01e33be5a92f841efe40ef6c
|
Fix link to remote R setup
|
MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS
|
src/Package/Impl/Options/R/Commands/SetupRemoteCommand.cs
|
src/Package/Impl/Options/R/Commands/SetupRemoteCommand.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.ComponentModel.Design;
using System.Diagnostics;
using Microsoft.VisualStudio.R.Package.Commands;
using Microsoft.VisualStudio.R.Packages.R;
namespace Microsoft.VisualStudio.R.Package.Options.R.Tools {
public sealed class SetupRemoteCommand : MenuCommand {
private const string _remoteSetupPage = "https://aka.ms/rtvs-remote-setup-instructions";
public SetupRemoteCommand() :
base(OnCommand, new CommandID(RGuidList.RCmdSetGuid, RPackageCommandId.icmdSetupRemote)) {
}
public static void OnCommand(object sender, EventArgs args) {
Process.Start(_remoteSetupPage);
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.ComponentModel.Design;
using System.Diagnostics;
using Microsoft.VisualStudio.R.Package.Commands;
using Microsoft.VisualStudio.R.Packages.R;
namespace Microsoft.VisualStudio.R.Package.Options.R.Tools {
public sealed class SetupRemoteCommand : MenuCommand {
private const string _remoteSetupPage = "http://aka.ms/rtvs-remote";
public SetupRemoteCommand() :
base(OnCommand, new CommandID(RGuidList.RCmdSetGuid, RPackageCommandId.icmdSetupRemote)) {
}
public static void OnCommand(object sender, EventArgs args) {
Process.Start(_remoteSetupPage);
}
}
}
|
mit
|
C#
|
1d59a4490ebc1753e3ccb9d30112deff3626b8bb
|
Update UI for Create view.
|
iamdavidfrancis/AFO2015,iamdavidfrancis/AFO2015
|
Orlandia2015/Views/MissionAchievements/Create.cshtml
|
Orlandia2015/Views/MissionAchievements/Create.cshtml
|
@model Orlandia2015.Models.MissionAchievement
@{
ViewBag.Title = "Add Mission Achievement";
}
<h2>Add Mission Achievement</h2>
<hr />
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.uAchievementID, "Achievement Name:", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownList("uAchievementID", null, htmlAttributes: new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.uAchievementID, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.iMissionCount, "Missions to earn:", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.iMissionCount, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.iMissionCount, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Add Mission Achievement" class="btn btn-primary" />
@Html.ActionLink("Cancel", "Index", null, new { @class = "btn btn-warning" })
</div>
</div>
</div>
}
|
@model Orlandia2015.Models.MissionAchievement
@{
ViewBag.Title = "Create";
}
<h2>Create</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>MissionAchievement</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.uAchievementID, "uAchievementID", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.DropDownList("uAchievementID", null, htmlAttributes: new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.uAchievementID, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.iMissionCount, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.iMissionCount, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.iMissionCount, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
|
apache-2.0
|
C#
|
803897b254377b9218d6b3809d8b34eaef63b404
|
Throw on invalid argument passed to DiagnosticReporter.Report(...)
|
genlu/roslyn,paulvanbrenk/roslyn,KirillOsenkov/roslyn,physhi/roslyn,heejaechang/roslyn,tmeschter/roslyn,jasonmalinowski/roslyn,OmarTawfik/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,gafter/roslyn,swaroop-sridhar/roslyn,aelij/roslyn,DustinCampbell/roslyn,tmeschter/roslyn,brettfo/roslyn,VSadov/roslyn,dpoeschl/roslyn,KevinRansom/roslyn,mavasani/roslyn,xasx/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,tannergooding/roslyn,bkoelman/roslyn,abock/roslyn,stephentoub/roslyn,DustinCampbell/roslyn,panopticoncentral/roslyn,AmadeusW/roslyn,KirillOsenkov/roslyn,diryboy/roslyn,DustinCampbell/roslyn,eriawan/roslyn,tannergooding/roslyn,gafter/roslyn,mgoertz-msft/roslyn,davkean/roslyn,sharwell/roslyn,dpoeschl/roslyn,eriawan/roslyn,genlu/roslyn,jcouv/roslyn,gafter/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,MichalStrehovsky/roslyn,agocke/roslyn,tmat/roslyn,dpoeschl/roslyn,CyrusNajmabadi/roslyn,nguerrera/roslyn,genlu/roslyn,bartdesmet/roslyn,jcouv/roslyn,brettfo/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,cston/roslyn,shyamnamboodiripad/roslyn,aelij/roslyn,OmarTawfik/roslyn,jmarolf/roslyn,tannergooding/roslyn,abock/roslyn,reaction1989/roslyn,wvdd007/roslyn,nguerrera/roslyn,davkean/roslyn,nguerrera/roslyn,jamesqo/roslyn,physhi/roslyn,tmeschter/roslyn,diryboy/roslyn,paulvanbrenk/roslyn,wvdd007/roslyn,dotnet/roslyn,agocke/roslyn,jasonmalinowski/roslyn,abock/roslyn,KirillOsenkov/roslyn,KevinRansom/roslyn,reaction1989/roslyn,cston/roslyn,AlekseyTs/roslyn,mavasani/roslyn,MichalStrehovsky/roslyn,MichalStrehovsky/roslyn,weltkante/roslyn,jamesqo/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,jamesqo/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,paulvanbrenk/roslyn,agocke/roslyn,swaroop-sridhar/roslyn,stephentoub/roslyn,AmadeusW/roslyn,heejaechang/roslyn,jmarolf/roslyn,VSadov/roslyn,bartdesmet/roslyn,OmarTawfik/roslyn,ErikSchierboom/roslyn,xasx/roslyn,cston/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,sharwell/roslyn,mavasani/roslyn,brettfo/roslyn,AmadeusW/roslyn,VSadov/roslyn,panopticoncentral/roslyn,davkean/roslyn,wvdd007/roslyn,swaroop-sridhar/roslyn,mgoertz-msft/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,bkoelman/roslyn,reaction1989/roslyn,jmarolf/roslyn,AlekseyTs/roslyn,heejaechang/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,bkoelman/roslyn,tmat/roslyn,physhi/roslyn,eriawan/roslyn,weltkante/roslyn,jcouv/roslyn,xasx/roslyn,ErikSchierboom/roslyn,diryboy/roslyn,aelij/roslyn,panopticoncentral/roslyn,jasonmalinowski/roslyn,stephentoub/roslyn,tmat/roslyn
|
src/Workspaces/Core/MSBuild/MSBuild/DiagnosticReporter.cs
|
src/Workspaces/Core/MSBuild/MSBuild/DiagnosticReporter.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.MSBuild.Logging;
namespace Microsoft.CodeAnalysis.MSBuild
{
internal class DiagnosticReporter
{
private readonly Workspace _workspace;
public DiagnosticReporter(Workspace workspace)
{
_workspace = workspace;
}
public void Report(DiagnosticReportingMode mode, string message, Func<string, Exception> createException = null)
{
switch (mode)
{
case DiagnosticReportingMode.Throw:
if (createException != null)
{
throw createException(message);
}
throw new InvalidOperationException(message);
case DiagnosticReportingMode.Log:
Report(new WorkspaceDiagnostic(WorkspaceDiagnosticKind.Failure, message));
break;
case DiagnosticReportingMode.Ignore:
break;
default:
throw new ArgumentException($"Invalid {nameof(DiagnosticReportingMode)} specified: {mode}", nameof(mode));
}
}
public void Report(WorkspaceDiagnostic diagnostic)
{
_workspace.OnWorkspaceFailed(diagnostic);
}
public void Report(DiagnosticLog log)
{
foreach (var logItem in log)
{
Report(DiagnosticReportingMode.Log, GetMsbuildFailedMessage(logItem.ProjectFilePath, logItem.ToString()));
}
}
private static string GetMsbuildFailedMessage(string projectFilePath, string message)
=> string.IsNullOrWhiteSpace(message)
? string.Format(WorkspaceMSBuildResources.Msbuild_failed_when_processing_the_file_0, projectFilePath)
: string.Format(WorkspaceMSBuildResources.Msbuild_failed_when_processing_the_file_0_with_message_1, projectFilePath, message);
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.MSBuild.Logging;
namespace Microsoft.CodeAnalysis.MSBuild
{
internal class DiagnosticReporter
{
private readonly Workspace _workspace;
public DiagnosticReporter(Workspace workspace)
{
_workspace = workspace;
}
public void Report(DiagnosticReportingMode mode, string message, Func<string, Exception> createException = null)
{
switch (mode)
{
case DiagnosticReportingMode.Throw:
if (createException != null)
{
throw createException(message);
}
throw new InvalidOperationException(message);
case DiagnosticReportingMode.Log:
Report(new WorkspaceDiagnostic(WorkspaceDiagnosticKind.Failure, message));
break;
case DiagnosticReportingMode.Ignore:
default:
break;
}
}
public void Report(WorkspaceDiagnostic diagnostic)
{
_workspace.OnWorkspaceFailed(diagnostic);
}
public void Report(DiagnosticLog log)
{
foreach (var logItem in log)
{
Report(DiagnosticReportingMode.Log, GetMsbuildFailedMessage(logItem.ProjectFilePath, logItem.ToString()));
}
}
private static string GetMsbuildFailedMessage(string projectFilePath, string message)
=> string.IsNullOrWhiteSpace(message)
? string.Format(WorkspaceMSBuildResources.Msbuild_failed_when_processing_the_file_0, projectFilePath)
: string.Format(WorkspaceMSBuildResources.Msbuild_failed_when_processing_the_file_0_with_message_1, projectFilePath, message);
}
}
|
mit
|
C#
|
308d337bf5289b2dd705c97fe32ed4aff5e11d93
|
add ref
|
mattgwagner/CertiPay.Common
|
CertiPay.Common.Notifications/Extensions/SmtpExtensions.cs
|
CertiPay.Common.Notifications/Extensions/SmtpExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace CertiPay.Common.Notifications.Extensions
{
public static class SmtpExtensions
{
/// <summary>
/// Extension method to have SmtpClient's SendMailAsync respond to a CancellationToken
/// https://gist.github.com/mattbenic/400e3c039ab8ea3e33aa
/// </summary>
public static async Task SendMailAsync(
this SmtpClient client,
MailMessage message,
CancellationToken token)
{
Action cancelSend = () =>
{
client.SendAsyncCancel();
};
using (var reg = token.Register(cancelSend))
{
await client.SendMailAsync(message);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace CertiPay.Common.Notifications.Extensions
{
public static class SmtpExtensions
{
/// <summary>
/// Extension method to have SmtpClient's SendMailAsync respond to a CancellationToken
/// </summary>
public static async Task SendMailAsync(
this SmtpClient client,
MailMessage message,
CancellationToken token)
{
Action cancelSend = () =>
{
client.SendAsyncCancel();
};
using (var reg = token.Register(cancelSend))
{
await client.SendMailAsync(message);
}
}
}
}
|
mit
|
C#
|
05554f38413e694166685bdd600aa835712667d8
|
update Copyright (c) 2017 - 2020 NDark
|
NDark/ndinfrastructure,NDark/ndinfrastructure
|
Unity/UnityTestToolsUtility/UnityTestToolsUtility.cs
|
Unity/UnityTestToolsUtility/UnityTestToolsUtility.cs
|
/**
MIT License
Copyright (c) 2017 - 2020 NDark
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.
*/
/*
@file UnityTestToolsUtility.cs
@author NDark
@date 20170426 file started.
*/
using UnityEngine;
using UnityTest;
public static partial class UnityTestToolsUtility
{
public static void GetAndEnableAssertComponents( GameObject _Obj )
{
AssertionComponent[] asserts = null ;
GetAndEnableAssertComponents( _Obj , out asserts ) ;
}
public static void GetAndEnableAssertComponents( GameObject _Obj
, out AssertionComponent[] _Asserts )
{
GetAssertComponents( _Obj , out _Asserts ) ;
EnableAssertComponents( _Asserts ) ;
}
public static void GetAssertComponents( GameObject _Obj
, out AssertionComponent[] _Asserts )
{
_Asserts = _Obj.GetComponents<UnityTest.AssertionComponent>() ;
}
public static void EnableAssertComponents( AssertionComponent[] _Asserts )
{
foreach( UnityTest.AssertionComponent assert in _Asserts )
{
assert.enabled = true ;
}
}
}
|
/**
MIT License
Copyright (c) 2017 NDark
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.
*/
/*
@file UnityTestToolsUtility.cs
@author NDark
@date 20170426 file started.
*/
using UnityEngine;
using UnityTest;
public static partial class UnityTestToolsUtility
{
public static void GetAndEnableAssertComponents( GameObject _Obj )
{
AssertionComponent[] asserts = null ;
GetAndEnableAssertComponents( _Obj , out asserts ) ;
}
public static void GetAndEnableAssertComponents( GameObject _Obj
, out AssertionComponent[] _Asserts )
{
GetAssertComponents( _Obj , out _Asserts ) ;
EnableAssertComponents( _Asserts ) ;
}
public static void GetAssertComponents( GameObject _Obj
, out AssertionComponent[] _Asserts )
{
_Asserts = _Obj.GetComponents<UnityTest.AssertionComponent>() ;
}
public static void EnableAssertComponents( AssertionComponent[] _Asserts )
{
foreach( UnityTest.AssertionComponent assert in _Asserts )
{
assert.enabled = true ;
}
}
}
|
mit
|
C#
|
7381da87075b16d79065920d02e33159a9ee2686
|
Update EnumerableExtensions.cs
|
keith-hall/Extensions,keith-hall/Extensions
|
src/EnumerableExtensions.cs
|
src/EnumerableExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace HallLibrary.Extensions
{
public static class EnumerableExtensions
{
/// <summary>
/// Randomise the order of the elements in the <paramref name="source"/> enumerable.
/// </summary>
/// <typeparam name="T">The type of the elements in the <paramref name="source"/> enumerable.</typeparam>
/// <param name="source">The enumerable containing the elements to shuffle.</param>
/// <returns>An enumerable containing the same elements but in a random order.</returns>
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source)
{
return Shuffle(source, new Random());
}
/// <summary>
/// Randomise the order of the elements in the <paramref name="source"/> enumerable, using the specified <paramref name="random"/> seed.
/// </summary>
/// <typeparam name="T">The type of the elements in the <paramref name="source"/> enumerable.</typeparam>
/// <param name="source">The enumerable containing the elements to shuffle.</param>
/// <param name="random">The random seed to use.</param>
/// <returns>An enumerable containing the same elements but in a random order.</returns>
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random random)
{ // http://stackoverflow.com/questions/1287567/is-using-random-and-orderby-a-good-shuffle-algorithm
var elements = source.ToArray();
for (var i = elements.Length - 1; i >= 0; i--)
{
// Swap element "i" with a random earlier element it (or itself)
// ... except we don't really need to swap it fully, as we can
// return it immediately, and afterwards it's irrelevant.
var swapIndex = random.Next(i + 1); // Random.Next maxValue is an exclusive upper-bound, which is why we add 1
yield return elements[swapIndex];
elements[swapIndex] = elements[i];
}
}
/// <summary>
/// Returns <c>true</c> if the number of elements in the <paramref name="enumerable"/> exceeds the specified <paramref name="count"/>, without enumerating through every element.
/// </summary>
/// <typeparam name="T">The type of elements in the enumerable.</typeparam>
/// <param name="enumerable">The enumerable sequence to check.</param>
/// <param name="count">The count to exceed.</param>
/// <returns>Returns <c>true</c> if the number of elements in the <paramref name="enumerable"/> exceeds the specified <paramref name="count"/>.</returns>
public static bool CountExceeds<T>(this IEnumerable<T> enumerable, int count)
{
return enumerable.Take(count + 1).Count() > count;
}
/// <summary>
/// Converts the current <see cref="T" /> <paramref name="value"/> to an enumerable, containing the <paramref name="value"/> as it's sole element.
/// </summary>
/// <typeparam name="T">The type of the element.</typeparam>
/// <param name="value">The value that the new enumerable will contain.</param>
/// <returns>Returns an enumerable containing a single element.</returns>
public static IEnumerable<T> AsSingleEnumerable<T>(this T value)
{
//x return Enumerable.Repeat(value, 1);
return new[] { value };
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace HallLibrary.Extensions
{
public static class EnumerableExtensions
{
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng)
{ // http://stackoverflow.com/questions/1287567/is-using-random-and-orderby-a-good-shuffle-algorithm
T[] elements = source.ToArray();
for (int i = elements.Length - 1; i >= 0; i--)
{
// Swap element "i" with a random earlier element it (or itself)
// ... except we don't really need to swap it fully, as we can
// return it immediately, and afterwards it's irrelevant.
int swapIndex = rng.Next(i + 1);
yield return elements[swapIndex];
elements[swapIndex] = elements[i];
}
}
public static bool CountExceeds<T>(this IEnumerable<T> enumerable, int count)
{
return enumerable.Take(count + 1).Count() > count;
}
public static IEnumerable<T> AsSingleEnumerable<T> (this T value)
{
//x return Enumerable.Repeat(value, 1);
return new [] { value };
}
}
}
|
apache-2.0
|
C#
|
bfdb3270174b2a2c02d07cf994ab736d9e6d7dc5
|
Add copyright banner for NamedPipeUtil.cs
|
mono/msbuild,rainersigwald/msbuild,cdmihai/msbuild,sean-gilliam/msbuild,AndyGerlicher/msbuild,AndyGerlicher/msbuild,rainersigwald/msbuild,mono/msbuild,mono/msbuild,sean-gilliam/msbuild,sean-gilliam/msbuild,AndyGerlicher/msbuild,AndyGerlicher/msbuild,sean-gilliam/msbuild,rainersigwald/msbuild,cdmihai/msbuild,mono/msbuild,cdmihai/msbuild,rainersigwald/msbuild,cdmihai/msbuild
|
src/Shared/NamedPipeUtil.cs
|
src/Shared/NamedPipeUtil.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
namespace Microsoft.Build.Shared
{
internal static class NamedPipeUtil
{
internal static string GetPipeNameOrPath(string pipeName)
{
if (NativeMethodsShared.IsUnixLike)
{
// If we're on a Unix machine then named pipes are implemented using Unix Domain Sockets.
// Most Unix systems have a maximum path length limit for Unix Domain Sockets, with
// Mac having a particularly short one. Mac also has a generated temp directory that
// can be quite long, leaving very little room for the actual pipe name. Fortunately,
// '/tmp' is mandated by POSIX to always be a valid temp directory, so we can use that
// instead.
return Path.Combine("/tmp", pipeName);
}
else
{
return pipeName;
}
}
}
}
|
using System;
using System.IO;
namespace Microsoft.Build.Shared
{
internal static class NamedPipeUtil
{
internal static string GetPipeNameOrPath(string pipeName)
{
if (NativeMethodsShared.IsUnixLike)
{
// If we're on a Unix machine then named pipes are implemented using Unix Domain Sockets.
// Most Unix systems have a maximum path length limit for Unix Domain Sockets, with
// Mac having a particularly short one. Mac also has a generated temp directory that
// can be quite long, leaving very little room for the actual pipe name. Fortunately,
// '/tmp' is mandated by POSIX to always be a valid temp directory, so we can use that
// instead.
return Path.Combine("/tmp", pipeName);
}
else
{
return pipeName;
}
}
}
}
|
mit
|
C#
|
12177326d86e86cd62419b718f9f734bef800c3b
|
Mark Main with [STAThread].
|
KevM/fixie,bardoloi/fixie,Duohong/fixie,JakeGinnivan/fixie,bardoloi/fixie,EliotJones/fixie,fixie/fixie
|
src/Fixie.Console/Program.cs
|
src/Fixie.Console/Program.cs
|
using System;
using System.Linq;
namespace Fixie.Console
{
using Console = System.Console;
class Program
{
const int FatalError = -1;
[STAThread]
static int Main(string[] args)
{
try
{
if (args.Length != 1)
{
Console.WriteLine("Usage: Fixie.Console [assembly_file]");
return FatalError;
}
var assemblyPath = args.Single();
var result = Execute(assemblyPath);
return result.Failed;
}
catch (Exception ex)
{
using (Foreground.Red)
Console.WriteLine("Fatal Error: {0}", ex);
return FatalError;
}
}
static Result Execute(string assemblyPath)
{
using (var environment = new ExecutionEnvironment(assemblyPath))
{
var runner = environment.Create<ConsoleRunner>();
return runner.RunAssembly(assemblyPath);
}
}
}
}
|
using System;
using System.Linq;
namespace Fixie.Console
{
using Console = System.Console;
class Program
{
const int FatalError = -1;
static int Main(string[] args)
{
try
{
if (args.Length != 1)
{
Console.WriteLine("Usage: Fixie.Console [assembly_file]");
return FatalError;
}
var assemblyPath = args.Single();
var result = Execute(assemblyPath);
return result.Failed;
}
catch (Exception ex)
{
using (Foreground.Red)
Console.WriteLine("Fatal Error: {0}", ex);
return FatalError;
}
}
static Result Execute(string assemblyPath)
{
using (var environment = new ExecutionEnvironment(assemblyPath))
{
var runner = environment.Create<ConsoleRunner>();
return runner.RunAssembly(assemblyPath);
}
}
}
}
|
mit
|
C#
|
7cab48f045c7f071b8dd4486f41e7888ba70e3d1
|
Fix version bug
|
ErikEJ/EntityFramework.SqlServerCompact,ErikEJ/EntityFramework7.SqlServerCompact
|
src/Provider40/Properties/AssemblyInfo.cs
|
src/Provider40/Properties/AssemblyInfo.cs
|
using System.Reflection;
using Microsoft.EntityFrameworkCore.Infrastructure;
#if SQLCE35
[assembly: AssemblyTitle("EntityFrameworkCore.SqlServerCompact35")]
[assembly: AssemblyProduct("EntityFrameworkCore.SqlServerCompact35")]
[assembly: DesignTimeProviderServices(
typeName: "Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlCeDesignTimeServices",
assemblyName: "EntityFrameworkCore.SqlServerCompact35.Design, Version=1.2.0.0, Culture=neutral, PublicKeyToken=9af395b34ac99006",
packageName: "EntityFrameworkCore.SqlServerCompact35.Design")]
#else
[assembly: AssemblyTitle("EntityFrameworkCore.SqlServerCompact40")]
[assembly: AssemblyProduct("EntityFrameworkCore.SqlServerCompact40")]
[assembly: DesignTimeProviderServices(
typeName: "Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlCeDesignTimeServices",
assemblyName: "EntityFrameworkCore.SqlServerCompact40.Design, Version=1.2.0.0, Culture=neutral, PublicKeyToken=9af395b34ac99006",
packageName: "EntityFrameworkCore.SqlServerCompact40.Design")]
#endif
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0-rtm")]
|
using System.Reflection;
using Microsoft.EntityFrameworkCore.Infrastructure;
#if SQLCE35
[assembly: AssemblyTitle("EntityFrameworkCore.SqlServerCompact35")]
[assembly: AssemblyProduct("EntityFrameworkCore.SqlServerCompact35")]
[assembly: DesignTimeProviderServices(
typeName: "Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlCeDesignTimeServices",
assemblyName: "EntityFrameworkCore.SqlServerCompact35.Design, Version=1.1.0.0, Culture=neutral, PublicKeyToken=9af395b34ac99006",
packageName: "EntityFrameworkCore.SqlServerCompact35.Design")]
#else
[assembly: AssemblyTitle("EntityFrameworkCore.SqlServerCompact40")]
[assembly: AssemblyProduct("EntityFrameworkCore.SqlServerCompact40")]
[assembly: DesignTimeProviderServices(
typeName: "Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlCeDesignTimeServices",
assemblyName: "EntityFrameworkCore.SqlServerCompact40.Design, Version=1.1.0.0, Culture=neutral, PublicKeyToken=9af395b34ac99006",
packageName: "EntityFrameworkCore.SqlServerCompact40.Design")]
#endif
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0-rtm")]
|
apache-2.0
|
C#
|
057acb6129d291333329ad305ae7e6c752c345ee
|
add version of Deserialize with Type parameter instead of generic
|
sw17ch/Z-ARCHIVED-legacy-cauterize,sw17ch/Z-ARCHIVED-legacy-cauterize,sw17ch/Z-ARCHIVED-legacy-cauterize,sw17ch/Z-ARCHIVED-legacy-cauterize,sw17ch/Z-ARCHIVED-legacy-cauterize
|
support/cs/src/CauterizeFormatter.cs
|
support/cs/src/CauterizeFormatter.cs
|
using System;
using System.IO;
using System.Runtime.Serialization;
namespace Cauterize
{
public class CauterizeFormatter
{
public SerializationBinder Binder { get; set; }
public StreamingContext Context { get; set; }
public ISurrogateSelector SurrogateSelector { get; set; }
private readonly CauterizeTypeFormatterFactory _formatterFactory;
public CauterizeFormatter() // only needed for deserialization
{
_formatterFactory = new CauterizeTypeFormatterFactory();
}
public CauterizeFormatter(CauterizeTypeFormatterFactory factory)
{
_formatterFactory = factory;
}
public virtual T Deserialize<T>(Stream serializationStream)
{
return (T)Deserialize(serializationStream, typeof (T));
}
public virtual object Deserialize(Stream serializationStream, Type t)
{
var formatter = _formatterFactory.GetFormatter(t);
return formatter.Deserialize(serializationStream, t);
}
public virtual void Serialize(Stream serializationStream, object obj)
{
var formatter = _formatterFactory.GetFormatter(obj.GetType());
formatter.Serialize(serializationStream, obj);
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
namespace Cauterize
{
public class CauterizeFormatter
{
public SerializationBinder Binder { get; set; }
public StreamingContext Context { get; set; }
public ISurrogateSelector SurrogateSelector { get; set; }
private readonly CauterizeTypeFormatterFactory _formatterFactory;
public CauterizeFormatter() // only needed for deserialization
{
_formatterFactory = new CauterizeTypeFormatterFactory();
}
public CauterizeFormatter(CauterizeTypeFormatterFactory factory)
{
_formatterFactory = factory;
}
public virtual T Deserialize<T>(Stream serializationStream)
{
var formatter = _formatterFactory.GetFormatter(typeof(T));
return (T)formatter.Deserialize(serializationStream, typeof(T));
}
public virtual void Serialize(Stream serializationStream, object obj)
{
var formatter = _formatterFactory.GetFormatter(obj.GetType());
formatter.Serialize(serializationStream, obj);
}
}
}
|
mit
|
C#
|
cf6141bc5fa32ccae902f7653f5ca08a2b7dd744
|
Add DiscountRate to LineItem model
|
MatthewSteeples/XeroAPI.Net,jcvandan/XeroAPI.Net,TDaphneB/XeroAPI.Net,XeroAPI/XeroAPI.Net
|
source/XeroApi/Model/LineItem.cs
|
source/XeroApi/Model/LineItem.cs
|
namespace XeroApi.Model
{
public class LineItem : ModelBase
{
private readonly TrackingCategories _tracking = new TrackingCategories();
public string Description { get; set; }
public decimal? UnitAmount { get; set; }
public string TaxType { get; set; }
public decimal? TaxAmount { get; set; }
public decimal? LineAmount { get; set; }
public string AccountCode { get; set; }
public TrackingCategories Tracking { get { return _tracking; } }
public string ItemCode { get; set; }
public decimal? Quantity { get; set; }
public decimal? DiscountRate { get; set; }
public override string ToString()
{
return string.Format("LineItem:{0}", Description ?? ItemCode);
}
}
public class LineItems : ModelList<LineItem>
{
}
}
|
namespace XeroApi.Model
{
public class LineItem : ModelBase
{
private readonly TrackingCategories _tracking = new TrackingCategories();
public string Description { get; set; }
public decimal? UnitAmount { get; set; }
public string TaxType { get; set; }
public decimal? TaxAmount { get; set; }
public decimal? LineAmount { get; set; }
public string AccountCode { get; set; }
public TrackingCategories Tracking { get { return _tracking; } }
public string ItemCode { get; set; }
public decimal? Quantity { get; set; }
public override string ToString()
{
return string.Format("LineItem:{0}", Description ?? ItemCode);
}
}
public class LineItems : ModelList<LineItem>
{
}
}
|
mit
|
C#
|
2c6f9b1aa2821ba3b6cb72b488e2cc04487b67b1
|
Add BtcJpyNextWeek
|
kiyoaki/bitflyer-api-dotnet-client
|
src/BitFlyer.Apis/ProductCode.cs
|
src/BitFlyer.Apis/ProductCode.cs
|
using System.Linq;
using System.Threading.Tasks;
namespace BitFlyer.Apis
{
public static class ProductCode
{
public const string BtcJpy = "BTC_JPY";
public const string FxBtcJpy = "FX_BTC_JPY";
public const string EthBtc = "ETH_BTC";
public const string BchBtc = "BCH_BTC";
public const string BtcUsd = "BTC_USD";
public static async Task<string> GetBtcJpyThisWeek()
{
var markets = await PublicApi.GetMarkets();
var btcJpyThisWeekMarket = markets.FirstOrDefault(x => x.ProductAlias == ProductAlias.BtcJpyThisWeek);
return btcJpyThisWeekMarket?.ProductCode;
}
public static async Task<string> GetBtcJpyNextWeek()
{
var markets = await PublicApi.GetMarkets();
var btcJpyNextWeekMarket = markets.FirstOrDefault(x => x.ProductAlias == ProductAlias.BtcJpyNextWeek);
return btcJpyNextWeekMarket?.ProductCode;
}
}
}
|
using System.Linq;
using System.Threading.Tasks;
namespace BitFlyer.Apis
{
public static class ProductCode
{
public const string BtcJpy = "BTC_JPY";
public const string FxBtcJpy = "FX_BTC_JPY";
public const string EthBtc = "ETH_BTC";
public const string BchBtc = "BCH_BTC";
public const string BtcUsd = "BTC_USD";
public static async Task<string> GetBtcJpyThisWeek()
{
var markets = await PublicApi.GetMarkets();
var btcJpyThisWeekMarket = markets.FirstOrDefault(x => x.ProductAlias == ProductAlias.BtcJpyThisWeek);
return btcJpyThisWeekMarket?.ProductCode;
}
}
}
|
mit
|
C#
|
1e4513b5c9768fab619f8412155cfbd3bcbcbf01
|
Fix unit test.
|
andrelmp/eShopOnContainers,BillWagner/eShopOnContainers,BillWagner/eShopOnContainers,dotnet-architecture/eShopOnContainers,andrelmp/eShopOnContainers,skynode/eShopOnContainers,albertodall/eShopOnContainers,oferns/eShopOnContainers,andrelmp/eShopOnContainers,productinfo/eShopOnContainers,productinfo/eShopOnContainers,skynode/eShopOnContainers,albertodall/eShopOnContainers,productinfo/eShopOnContainers,dotnet-architecture/eShopOnContainers,andrelmp/eShopOnContainers,BillWagner/eShopOnContainers,dotnet-architecture/eShopOnContainers,oferns/eShopOnContainers,dotnet-architecture/eShopOnContainers,andrelmp/eShopOnContainers,skynode/eShopOnContainers,productinfo/eShopOnContainers,albertodall/eShopOnContainers,skynode/eShopOnContainers,TypeW/eShopOnContainers,productinfo/eShopOnContainers,oferns/eShopOnContainers,oferns/eShopOnContainers,TypeW/eShopOnContainers,TypeW/eShopOnContainers,albertodall/eShopOnContainers,oferns/eShopOnContainers,TypeW/eShopOnContainers,BillWagner/eShopOnContainers,andrelmp/eShopOnContainers,productinfo/eShopOnContainers,albertodall/eShopOnContainers,skynode/eShopOnContainers,TypeW/eShopOnContainers,BillWagner/eShopOnContainers,dotnet-architecture/eShopOnContainers
|
test/Services/UnitTest/Account/AccountControllerTest.cs
|
test/Services/UnitTest/Account/AccountControllerTest.cs
|
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.WebMVC.Controllers;
using Microsoft.eShopOnContainers.WebMVC.Services;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Moq;
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace UnitTest.Account
{
public class AccountControllerTest
{
private readonly Mock<IIdentityParser<ApplicationUser>> _identityParserMock;
private readonly Mock<HttpContext> _httpContextMock;
public AccountControllerTest()
{
_identityParserMock = new Mock<IIdentityParser<ApplicationUser>>();
_httpContextMock = new Mock<HttpContext>();
}
[Fact]
public void Signin_with_token_success()
{
//Arrange
var fakeCP = GenerateFakeClaimsIdentity();
_httpContextMock.Setup(x => x.User)
.Returns(new ClaimsPrincipal(fakeCP));
//Act
var accountController = new AccountController(_identityParserMock.Object);
accountController.ControllerContext.HttpContext = _httpContextMock.Object;
var actionResult = accountController.SignIn("");
//Assert
var redirectResult = Assert.IsType<RedirectToActionResult>(actionResult);
Assert.Equal(redirectResult.ActionName, "Index");
Assert.Equal(redirectResult.ControllerName, "Catalog");
Assert.Equal(accountController.ViewData["access_token"], "fakeToken");
}
private ClaimsIdentity GenerateFakeClaimsIdentity()
{
var ci = new ClaimsIdentity();
ci.AddClaim(new Claim("access_token", "fakeToken"));
return ci;
}
}
}
|
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.WebMVC.Controllers;
using Microsoft.eShopOnContainers.WebMVC.Services;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Moq;
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace UnitTest.Account
{
public class AccountControllerTest
{
private readonly Mock<IIdentityParser<ApplicationUser>> _identityParserMock;
private readonly Mock<HttpContext> _httpContextMock;
public AccountControllerTest()
{
_identityParserMock = new Mock<IIdentityParser<ApplicationUser>>();
_httpContextMock = new Mock<HttpContext>();
}
[Fact]
public void Signin_with_token_success()
{
//Arrange
var fakeCP = GenerateFakeClaimsIdentity();
_httpContextMock.Setup(x => x.User)
.Returns(new ClaimsPrincipal(fakeCP));
//Act
var accountController = new AccountController(_identityParserMock.Object);
accountController.ControllerContext.HttpContext = _httpContextMock.Object;
var actionResult = accountController.SignIn("");
//Assert
var redirectResult = Assert.IsType<RedirectResult>(actionResult);
Assert.Equal(redirectResult.Url, "/");
Assert.Equal(accountController.ViewData["access_token"], "fakeToken");
}
private ClaimsIdentity GenerateFakeClaimsIdentity()
{
var ci = new ClaimsIdentity();
ci.AddClaim(new Claim("access_token", "fakeToken"));
return ci;
}
}
}
|
mit
|
C#
|
d97fc065d8d9e2762255b81bf7fc447847a80847
|
Revert "Revert "Formatting comments.""
|
zzzprojects/Z.ExtensionMethods,huoxudong125/Z.ExtensionMethods,mario-loza/Z.ExtensionMethods
|
test/Z.Core.Test/String.IsAnagram.cs
|
test/Z.Core.Test/String.IsAnagram.cs
|
// Copyright (c) 2015 ZZZ Projects. All rights reserved
// Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
// Website: http://www.zzzprojects.com/
// Feedback / Feature Requests / Issues : http://zzzprojects.uservoice.com/forums/283927
// All ZZZ Projects products: Entity Framework Extensions / Bulk Operations / Extension Methods /Icon Library
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Z.Core.Test
{
[TestClass]
public class System_String_IsAnagram
{
[TestMethod]
public void IsAnagram()
{
// Type
string @this = "abba";
// Examples
bool value1 = @this.IsAnagram("abba"); // return true;
bool value2 = @this.IsAnagram("abab"); // return false;
bool value3 = @this.IsAnagram("aba"); // return false;
bool value4 = @this.IsAnagram(""); // return false;
bool value5 = @this.IsAnagram("aba b"); // return false;
// Unit Test
Assert.IsTrue(value1);
Assert.IsFalse(value2);
Assert.IsFalse(value3);
Assert.IsFalse(value4);
Assert.IsFalse(value5);
}
}
}
|
// Copyright (c) 2015 ZZZ Projects. All rights reserved
// Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
// Website: http://www.zzzprojects.com/
// Feedback / Feature Requests / Issues : http://zzzprojects.uservoice.com/forums/283927
// All ZZZ Projects products: Entity Framework Extensions / Bulk Operations / Extension Methods /Icon Library
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Z.Core.Test
{
[TestClass]
public class System_String_IsAnagram
{
[TestMethod]
public void IsAnagram()
{
// Type
string @this = "abba";
// Examples
bool value1 = @this.IsAnagram("abba"); // return true;
bool value2 = @this.IsAnagram("abab"); // return false;
bool value3 = @this.IsAnagram("aba"); // return false;
bool value4 = @this.IsAnagram(""); // return false;
bool value5 = @this.IsAnagram("aba b"); // return false;
// Unit Test
Assert.IsTrue(value1);
Assert.IsFalse(value2);
Assert.IsFalse(value3);
Assert.IsFalse(value4);
Assert.IsFalse(value5);
}
}
}
|
mit
|
C#
|
5395348783c0b838e4c44aa8bf313c0bb979d646
|
Revert "Cleaned up state abbreviations."
|
jeffreypalermo/humanityroad-emergencyresponsedatatransformer,jeffreypalermo/humanityroad-emergencyresponsedatatransformer
|
HRERDataTransformer/HRERDataTransformer/Models/StateAbbreviations.cs
|
HRERDataTransformer/HRERDataTransformer/Models/StateAbbreviations.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace HRERDataTransformer.Models
{
public static class StateAbbreviations
{
public static Dictionary<string, string> Abbreviations = new Dictionary<string, string>
{
{ "AL", "Alabama" },
{ "AK", "Alaska" },
{ "AZ", "Arizona" },
{ "AR", "Arkansas" },
{ "CA", "California" },
{ "CO", "Colorado" },
{ "CT", "Connecticut" },
{ "DE", "Delaware" },
{ "FL", "Florida" },
{ "GA", "Georgia" },
{ "HI", "Hawaii" },
{ "ID", "Idaho" },
{ "IL", "Illinois" },
{ "IN", "Indiana" },
{ "IA", "Iowa" },
{ "KS", "Kansas" },
{ "KY", "Kentucky" },
{ "LA", "Louisiana" },
{ "ME", "Maine" },
{ "MD", "Maryland" },
{ "MA", "Massachusetts" },
{ "MI", "Michigan" },
{ "MN", "Minnesota" },
{ "MS", "Mississippi" },
{ "MO", "Missouri" },
{ "MT", "Montana" },
{ "NE", "Nebraska" },
{ "NV", "Nevada" },
{ "NH", "New Hampshire" },
{ "NJ", "New Jersey" },
{ "NM", "New Mexico" },
{ "NY", "New York" },
{ "NC", "North Carolina" },
{ "ND", "North Dakota" },
{ "OH", "Ohio" },
{ "OK", "Oklahoma" },
{ "OR", "Oregon" },
{ "PA", "Pennsylvania" },
{ "RI", "Rhode Island" },
{ "SC", "South Carolina" },
{ "SD", "South Dakota" },
{ "TN", "Tennessee" },
{ "TX", "Texas" },
{ "UT", "Utah" },
{ "VT", "Vermont" },
{ "VA", "Virginia" },
{ "WA", "Washington" },
{ "WV", "West Virginia" },
{ "WI", "Wisconsin" },
{ "WY", "Wyoming" },
{ "AS", "American Samoa" },
{ "DC", "District of Columbia" },
{ "FM", "Federated States of Micronesia" },
{ "GU", "Guam" },
{ "MH", "Marshall Islands" },
{ "MP", "Northern Mariana Islands" },
{ "PW", "Palau" },
{ "PR", "Puerto Rico" },
{ "VI", "Virgin Islands" }
};
}
}
|
using System.Collections.Generic;
namespace HRERDataTransformer.Models
{
public static class StateAbbreviations
{
public static Dictionary<string, string> Abbreviations = new Dictionary<string, string>
{
{ "AL", "Alabama" },
{ "AK", "Alaska" },
{ "AZ", "Arizona" },
{ "AR", "Arkansas" },
{ "CA", "California" },
{ "CO", "Colorado" },
{ "CT", "Connecticut" },
{ "DE", "Delaware" },
{ "FL", "Florida" },
{ "GA", "Georgia" },
{ "HI", "Hawaii" },
{ "ID", "Idaho" },
{ "IL", "Illinois" },
{ "IN", "Indiana" },
{ "IA", "Iowa" },
{ "KS", "Kansas" },
{ "KY", "Kentucky" },
{ "LA", "Louisiana" },
{ "ME", "Maine" },
{ "MD", "Maryland" },
{ "MA", "Massachusetts" },
{ "MI", "Michigan" },
{ "MN", "Minnesota" },
{ "MS", "Mississippi" },
{ "MO", "Missouri" },
{ "MT", "Montana" },
{ "NE", "Nebraska" },
{ "NV", "Nevada" },
{ "NH", "New Hampshire" },
{ "NJ", "New Jersey" },
{ "NM", "New Mexico" },
{ "NY", "New York" },
{ "NC", "North Carolina" },
{ "ND", "North Dakota" },
{ "OH", "Ohio" },
{ "OK", "Oklahoma" },
{ "OR", "Oregon" },
{ "PA", "Pennsylvania" },
{ "RI", "Rhode Island" },
{ "SC", "South Carolina" },
{ "SD", "South Dakota" },
{ "TN", "Tennessee" },
{ "TX", "Texas" },
{ "UT", "Utah" },
{ "VT", "Vermont" },
{ "VA", "Virginia" },
{ "WA", "Washington" },
{ "WV", "West Virginia" },
{ "WI", "Wisconsin" },
{ "WY", "Wyoming" },
{ "AS", "American Samoa" },
{ "DC", "District of Columbia" },
{ "FM", "Federated States of Micronesia" },
{ "GU", "Guam" },
{ "MH", "Marshall Islands" },
{ "MP", "Northern Mariana Islands" },
{ "PW", "Palau" },
{ "PR", "Puerto Rico" },
{ "VI", "Virgin Islands" }
};
}
}
|
apache-2.0
|
C#
|
328aa5a68b87a47b3f26fc9cd438cce71d9c4994
|
Use PublicMonitoringConfiguration in AgentDiagnosticSettings
|
cwickham3/azure-sdk-for-net,jamestao/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,shuagarw/azure-sdk-for-net,olydis/azure-sdk-for-net,AuxMon/azure-sdk-for-net,pilor/azure-sdk-for-net,stankovski/azure-sdk-for-net,oburlacu/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,pattipaka/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,AzCiS/azure-sdk-for-net,rohmano/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,dominiqa/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,begoldsm/azure-sdk-for-net,olydis/azure-sdk-for-net,robertla/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,r22016/azure-sdk-for-net,oaastest/azure-sdk-for-net,ogail/azure-sdk-for-net,AuxMon/azure-sdk-for-net,namratab/azure-sdk-for-net,scottrille/azure-sdk-for-net,rohmano/azure-sdk-for-net,relmer/azure-sdk-for-net,marcoippel/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,oburlacu/azure-sdk-for-net,shipram/azure-sdk-for-net,samtoubia/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,peshen/azure-sdk-for-net,btasdoven/azure-sdk-for-net,lygasch/azure-sdk-for-net,robertla/azure-sdk-for-net,jamestao/azure-sdk-for-net,samtoubia/azure-sdk-for-net,dasha91/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,kagamsft/azure-sdk-for-net,stankovski/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,enavro/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,oaastest/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,yoreddy/azure-sdk-for-net,nemanja88/azure-sdk-for-net,tpeplow/azure-sdk-for-net,pankajsn/azure-sdk-for-net,pankajsn/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,pinwang81/azure-sdk-for-net,shipram/azure-sdk-for-net,pinwang81/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,juvchan/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,mihymel/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,naveedaz/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,smithab/azure-sdk-for-net,Nilambari/azure-sdk-for-net,Nilambari/azure-sdk-for-net,tpeplow/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,bgold09/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,shutchings/azure-sdk-for-net,r22016/azure-sdk-for-net,vladca/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,abhing/azure-sdk-for-net,vladca/azure-sdk-for-net,tpeplow/azure-sdk-for-net,mihymel/azure-sdk-for-net,xindzhan/azure-sdk-for-net,marcoippel/azure-sdk-for-net,zaevans/azure-sdk-for-net,dasha91/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,namratab/azure-sdk-for-net,robertla/azure-sdk-for-net,yoreddy/azure-sdk-for-net,nathannfan/azure-sdk-for-net,cwickham3/azure-sdk-for-net,hovsepm/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,lygasch/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,AuxMon/azure-sdk-for-net,peshen/azure-sdk-for-net,atpham256/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,makhdumi/azure-sdk-for-net,gubookgu/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,akromm/azure-sdk-for-net,djyou/azure-sdk-for-net,samtoubia/azure-sdk-for-net,juvchan/azure-sdk-for-net,alextolp/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,nathannfan/azure-sdk-for-net,r22016/azure-sdk-for-net,hovsepm/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,guiling/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,marcoippel/azure-sdk-for-net,xindzhan/azure-sdk-for-net,bgold09/azure-sdk-for-net,jtlibing/azure-sdk-for-net,smithab/azure-sdk-for-net,makhdumi/azure-sdk-for-net,herveyw/azure-sdk-for-net,djyou/azure-sdk-for-net,djyou/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,naveedaz/azure-sdk-for-net,akromm/azure-sdk-for-net,makhdumi/azure-sdk-for-net,AzCiS/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,alextolp/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,nemanja88/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,jamestao/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,hyonholee/azure-sdk-for-net,nacaspi/azure-sdk-for-net,guiling/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,kagamsft/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,hyonholee/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,alextolp/azure-sdk-for-net,pankajsn/azure-sdk-for-net,hyonholee/azure-sdk-for-net,markcowl/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,begoldsm/azure-sdk-for-net,bgold09/azure-sdk-for-net,begoldsm/azure-sdk-for-net,pomortaz/azure-sdk-for-net,pinwang81/azure-sdk-for-net,lygasch/azure-sdk-for-net,ailn/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,abhing/azure-sdk-for-net,peshen/azure-sdk-for-net,dominiqa/azure-sdk-for-net,jtlibing/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,pomortaz/azure-sdk-for-net,amarzavery/azure-sdk-for-net,shutchings/azure-sdk-for-net,pilor/azure-sdk-for-net,ailn/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,ogail/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,mihymel/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,enavro/azure-sdk-for-net,mabsimms/azure-sdk-for-net,juvchan/azure-sdk-for-net,Nilambari/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,mabsimms/azure-sdk-for-net,btasdoven/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,shuagarw/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,enavro/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,rohmano/azure-sdk-for-net,dasha91/azure-sdk-for-net,yoreddy/azure-sdk-for-net,vladca/azure-sdk-for-net,AzCiS/azure-sdk-for-net,relmer/azure-sdk-for-net,hovsepm/azure-sdk-for-net,btasdoven/azure-sdk-for-net,zaevans/azure-sdk-for-net,zaevans/azure-sdk-for-net,naveedaz/azure-sdk-for-net,smithab/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,pilor/azure-sdk-for-net,olydis/azure-sdk-for-net,pomortaz/azure-sdk-for-net,samtoubia/azure-sdk-for-net,oburlacu/azure-sdk-for-net,herveyw/azure-sdk-for-net,jtlibing/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,mabsimms/azure-sdk-for-net,pattipaka/azure-sdk-for-net,oaastest/azure-sdk-for-net,relmer/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,scottrille/azure-sdk-for-net,cwickham3/azure-sdk-for-net,shutchings/azure-sdk-for-net,namratab/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,herveyw/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,gubookgu/azure-sdk-for-net,xindzhan/azure-sdk-for-net,dominiqa/azure-sdk-for-net,kagamsft/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,amarzavery/azure-sdk-for-net,nemanja88/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,akromm/azure-sdk-for-net,amarzavery/azure-sdk-for-net,jamestao/azure-sdk-for-net,shuagarw/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,atpham256/azure-sdk-for-net,hyonholee/azure-sdk-for-net,nacaspi/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,ogail/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,pattipaka/azure-sdk-for-net,scottrille/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,gubookgu/azure-sdk-for-net,abhing/azure-sdk-for-net,ailn/azure-sdk-for-net,atpham256/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,guiling/azure-sdk-for-net,hyonholee/azure-sdk-for-net,shipram/azure-sdk-for-net,nathannfan/azure-sdk-for-net
|
src/Insights/Generated/Management/Insights/Models/AgentDiagnosticSettings.cs
|
src/Insights/Generated/Management/Insights/Models/AgentDiagnosticSettings.cs
|
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.
using System;
using System.Linq;
using Microsoft.Azure.Management.Insights.Models;
namespace Microsoft.Azure.Management.Insights.Models
{
/// <summary>
/// Represents the diagnosticSettings.
/// </summary>
public partial class AgentDiagnosticSettings
{
private string _description;
/// <summary>
/// Optional. The setting description.
/// </summary>
public string Description
{
get { return this._description; }
set { this._description = value; }
}
private string _name;
/// <summary>
/// Optional. The setting name.
/// </summary>
public string Name
{
get { return this._name; }
set { this._name = value; }
}
private PublicMonitoringConfiguration _publicConfiguration;
/// <summary>
/// Optional. The public diagnostic configuration.
/// </summary>
public PublicMonitoringConfiguration PublicConfiguration
{
get { return this._publicConfiguration; }
set { this._publicConfiguration = value; }
}
/// <summary>
/// Initializes a new instance of the AgentDiagnosticSettings class.
/// </summary>
public AgentDiagnosticSettings()
{
}
}
}
|
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.
using System;
using System.Linq;
using Microsoft.Azure.Management.Insights.Models;
namespace Microsoft.Azure.Management.Insights.Models
{
/// <summary>
/// Represents the diagnosticSettings.
/// </summary>
public partial class AgentDiagnosticSettings
{
private string _description;
/// <summary>
/// Optional. The setting description.
/// </summary>
public string Description
{
get { return this._description; }
set { this._description = value; }
}
private string _name;
/// <summary>
/// Optional. The setting name.
/// </summary>
public string Name
{
get { return this._name; }
set { this._name = value; }
}
private PublicConfiguration _publicConfiguration;
/// <summary>
/// Optional. The public diagnostic configuration.
/// </summary>
public PublicConfiguration PublicConfiguration
{
get { return this._publicConfiguration; }
set { this._publicConfiguration = value; }
}
/// <summary>
/// Initializes a new instance of the AgentDiagnosticSettings class.
/// </summary>
public AgentDiagnosticSettings()
{
}
}
}
|
apache-2.0
|
C#
|
0f9ac5601d57d121a6ed1495c38137bf5450390c
|
Fix params on activator.
|
darvell/Coremero
|
Coremero/Coremero.Client.Discord/DiscordObjectFactory.cs
|
Coremero/Coremero.Client.Discord/DiscordObjectFactory.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using Discord;
namespace Coremero.Client.Discord
{
public class DiscordObjectFactory<TSource, TTarget> where TSource : ISnowflakeEntity
{
private Dictionary<ulong, TTarget> _cache = new Dictionary<ulong, TTarget>();
public TTarget Get(TSource source)
{
TTarget result;
_cache.TryGetValue(source.Id, out result);
if (result == null)
{
// Resort to reflection. :(
_cache[source.Id] = (TTarget) Activator.CreateInstance(typeof(TTarget), source);
}
return result;
}
}
public static class DiscordFactory
{
public static readonly DiscordObjectFactory<IGuild, DiscordServer> ServerFactory = new DiscordObjectFactory<IGuild, DiscordServer>();
public static readonly DiscordObjectFactory<IMessageChannel, DiscordChannel> ChannelFactory = new DiscordObjectFactory<IMessageChannel, DiscordChannel>();
public static readonly DiscordObjectFactory<global::Discord.IUser, DiscordUser> UserFactory = new DiscordObjectFactory<global::Discord.IUser, DiscordUser>();
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using Discord;
namespace Coremero.Client.Discord
{
public class DiscordObjectFactory<TSource, TTarget> where TSource : ISnowflakeEntity
{
private Dictionary<ulong, TTarget> _cache = new Dictionary<ulong, TTarget>();
public TTarget Get(TSource source)
{
TTarget result;
_cache.TryGetValue(source.Id, out result);
if (result == null)
{
// Resort to reflection. :(
_cache[source.Id] = (TTarget) Activator.CreateInstance(typeof(TTarget), new[] {source});
}
return result;
}
}
public static class DiscordFactory
{
public static readonly DiscordObjectFactory<IGuild, DiscordServer> ServerFactory = new DiscordObjectFactory<IGuild, DiscordServer>();
public static readonly DiscordObjectFactory<IMessageChannel, DiscordChannel> ChannelFactory = new DiscordObjectFactory<IMessageChannel, DiscordChannel>();
public static readonly DiscordObjectFactory<global::Discord.IUser, DiscordUser> UserFactory = new DiscordObjectFactory<global::Discord.IUser, DiscordUser>();
}
}
|
mit
|
C#
|
6e83b84f782e08915c9a901c3dada9f089485a2a
|
Update cake script with new paths
|
Mikescher/AlephNote
|
build.cake
|
build.cake
|
#tool "GitVersion.Commandline"
#addin "Cake.Compression"
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var solution = File("Source/AlephNote.sln");
Task("Clean")
.Does(() =>
{
CleanDirectories("Bin/*");
CleanDirectories("Lib/*");
CleanDirectories("./**/bin");
CleanDirectories("./**/obj");
});
Task("Restore")
.IsDependentOn("Clean")
.Does(() => NuGetRestore(solution));
Task("UpdateAssemblyInfo")
.Does(() =>
{
var version1 = GitVersion(new GitVersionSettings
{
UpdateAssemblyInfo = true,
UpdateAssemblyInfoFilePath = "Source/AlephNote.App/Properties/AssemblyInfo.cs"
});
var version2 = GitVersion(new GitVersionSettings
{
UpdateAssemblyInfo = true,
UpdateAssemblyInfoFilePath = "Source/AlephNote.Eto/Properties/AssemblyInfo.cs"
});
if (AppVeyor.IsRunningOnAppVeyor) AppVeyor.UpdateBuildVersion(version1.NuGetVersionV2);
if (AppVeyor.IsRunningOnAppVeyor) AppVeyor.UpdateBuildVersion(version2.NuGetVersionV2);
});
Task("Build")
.IsDependentOn("Restore")
.IsDependentOn("UpdateAssemblyInfo")
.Does(() =>
{
MSBuild(solution, configurator =>
configurator
.SetConfiguration(configuration)
.SetVerbosity(Verbosity.Minimal));
});
Task("Pack")
.IsDependentOn("Build")
.Does(() =>
{
var rootWin = "Bin/" + configuration + "/net46";
var rootCore = "Bin/" + configuration + "/netstandard1.6";
var filesToDelete =
GetFiles("Bin/**/*.pdb") +
GetFiles("Bin/**/*.xml") +
GetFiles("Bin/**/*.vshost.exe") +
GetFiles("Bin/**/*.manifest");
DeleteFiles(filesToDelete);
if (DirectoryExists(rootWin + "/.notes")) DeleteDirectory(rootWin + "/.notes", true);
Zip(rootWin, "Bin/AlephNote.zip");
if (DirectoryExists(rootCore + "/.notes")) DeleteDirectory(rootCore + "/.notes", true);
Zip(rootCore, "Bin/AlephNote.zip");
if (AppVeyor.IsRunningOnAppVeyor) AppVeyor.UploadArtifact("Bin/AlephNote.zip");
});
Task("Default")
.IsDependentOn("Pack");
RunTarget(target);
|
#tool "GitVersion.Commandline"
#addin "Cake.Compression"
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var solution = File("Source/AlephNote.sln");
Task("Clean")
.Does(() =>
{
CleanDirectories("Bin/*");
CleanDirectories("Lib/*");
CleanDirectories("./**/bin");
CleanDirectories("./**/obj");
});
Task("Restore")
.IsDependentOn("Clean")
.Does(() => NuGetRestore(solution));
Task("UpdateAssemblyInfo")
.Does(() =>
{
var version = GitVersion(new GitVersionSettings
{
UpdateAssemblyInfo = true,
UpdateAssemblyInfoFilePath = "Source/AlephNote.App/Properties/AssemblyInfo.cs"
});
if (AppVeyor.IsRunningOnAppVeyor) AppVeyor.UpdateBuildVersion(version.NuGetVersionV2);
});
Task("Build")
.IsDependentOn("Restore")
.IsDependentOn("UpdateAssemblyInfo")
.Does(() =>
{
MSBuild(solution, configurator =>
configurator
.SetConfiguration(configuration)
.SetVerbosity(Verbosity.Minimal));
});
Task("Pack")
.IsDependentOn("Build")
.Does(() =>
{
var root = "Bin/" + configuration;
var filesToDelete =
GetFiles("Bin/**/*.pdb") +
GetFiles("Bin/**/*.xml") +
GetFiles("Bin/**/*.vshost.exe") +
GetFiles("Bin/**/*.manifest");
DeleteFiles(filesToDelete);
if (DirectoryExists(root + "/.notes"))
DeleteDirectory(root + "/.notes", true);
Zip(root, "Bin/AlephNote.zip");
if (AppVeyor.IsRunningOnAppVeyor) AppVeyor.UploadArtifact("Bin/AlephNote.zip");
});
Task("Default")
.IsDependentOn("Pack");
RunTarget(target);
|
mit
|
C#
|
55208822e4bd598700d27ae49d7ddbb699924885
|
Rename `format` argument to `fallback` in `TranslatableString`
|
peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework
|
osu.Framework/Localisation/TranslatableString.cs
|
osu.Framework/Localisation/TranslatableString.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using System;
namespace osu.Framework.Localisation
{
/// <summary>
/// A string which can be translated using a key lookup.
/// </summary>
public class TranslatableString : LocalisableFormattableString, IEquatable<TranslatableString>
{
public readonly string Key;
/// <summary>
/// Creates a <see cref="TranslatableString"/> using texts.
/// </summary>
/// <param name="key">The key for <see cref="LocalisationManager"/> to look up with.</param>
/// <param name="fallback">The fallback string to use when no translation can be found.</param>
/// <param name="args">Optional formattable arguments.</param>
public TranslatableString(string key, string fallback, params object?[] args)
: base(fallback, args)
{
Key = key;
}
/// <summary>
/// Creates a <see cref="TranslatableString"/> using interpolated string.
/// Example usage:
/// <code>
/// new TranslatableString("played_count_self", $"You have played {count:N0} times!");
/// </code>
/// </summary>
/// <param name="key">The key for <see cref="LocalisationManager"/> to look up with.</param>
/// <param name="interpolation">The interpolated string containing fallback and formattable arguments.</param>
public TranslatableString(string key, FormattableString interpolation)
: base(interpolation)
{
Key = key;
}
protected override string FormatString(string fallback, object?[] args, LocalisationParameters parameters)
=> base.FormatString(parameters.Store?.Get(Key) ?? fallback, args, parameters);
public bool Equals(TranslatableString? other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return base.Equals(other) && Key == other.Key;
}
public override bool Equals(ILocalisableStringData? other) => other is TranslatableString translatable && Equals(translatable);
public override bool Equals(object? obj) => obj is TranslatableString translatable && Equals(translatable);
public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), Key);
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable enable
using System;
namespace osu.Framework.Localisation
{
/// <summary>
/// A string which can be translated using a key lookup.
/// </summary>
public class TranslatableString : LocalisableFormattableString, IEquatable<TranslatableString>
{
public readonly string Key;
/// <summary>
/// Creates a <see cref="TranslatableString"/> using texts.
/// </summary>
/// <param name="key">The key for <see cref="LocalisationManager"/> to look up with.</param>
/// <param name="fallback">The fallback string to use when no translation can be found.</param>
/// <param name="args">Optional formattable arguments.</param>
public TranslatableString(string key, string fallback, params object?[] args)
: base(fallback, args)
{
Key = key;
}
/// <summary>
/// Creates a <see cref="TranslatableString"/> using interpolated string.
/// Example usage:
/// <code>
/// new TranslatableString("played_count_self", $"You have played {count:N0} times!");
/// </code>
/// </summary>
/// <param name="key">The key for <see cref="LocalisationManager"/> to look up with.</param>
/// <param name="interpolation">The interpolated string containing fallback and formattable arguments.</param>
public TranslatableString(string key, FormattableString interpolation)
: base(interpolation)
{
Key = key;
}
protected override string FormatString(string format, object?[] args, LocalisationParameters parameters)
=> base.FormatString(parameters.Store?.Get(Key) ?? format, args, parameters);
public bool Equals(TranslatableString? other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return base.Equals(other) && Key == other.Key;
}
public override bool Equals(ILocalisableStringData? other) => other is TranslatableString translatable && Equals(translatable);
public override bool Equals(object? obj) => obj is TranslatableString translatable && Equals(translatable);
public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), Key);
}
}
|
mit
|
C#
|
0a34ce2509d1df942034704a9baa057010b1af47
|
Increase font weight for runtime clock
|
peppy/osu,ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,peppy/osu
|
osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs
|
osu.Game/Overlays/Toolbar/DigitalClockDisplay.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Toolbar
{
public class DigitalClockDisplay : ClockDisplay
{
private OsuSpriteText realTime;
private OsuSpriteText gameTime;
private bool showRuntime = true;
public bool ShowRuntime
{
get => showRuntime;
set
{
if (showRuntime == value)
return;
showRuntime = value;
updateMetrics();
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[]
{
realTime = new OsuSpriteText(),
gameTime = new OsuSpriteText
{
Y = 14,
Colour = colours.PinkLight,
Font = OsuFont.Default.With(size: 10, weight: FontWeight.SemiBold),
}
};
updateMetrics();
}
protected override void UpdateDisplay(DateTimeOffset now)
{
realTime.Text = $"{now:HH:mm:ss}";
gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}";
}
private void updateMetrics()
{
Width = showRuntime ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare).
gameTime.FadeTo(showRuntime ? 1 : 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.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
namespace osu.Game.Overlays.Toolbar
{
public class DigitalClockDisplay : ClockDisplay
{
private OsuSpriteText realTime;
private OsuSpriteText gameTime;
private bool showRuntime = true;
public bool ShowRuntime
{
get => showRuntime;
set
{
if (showRuntime == value)
return;
showRuntime = value;
updateMetrics();
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[]
{
realTime = new OsuSpriteText(),
gameTime = new OsuSpriteText
{
Y = 14,
Colour = colours.PinkLight,
Scale = new Vector2(0.6f)
}
};
updateMetrics();
}
protected override void UpdateDisplay(DateTimeOffset now)
{
realTime.Text = $"{now:HH:mm:ss}";
gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}";
}
private void updateMetrics()
{
Width = showRuntime ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare).
gameTime.FadeTo(showRuntime ? 1 : 0);
}
}
}
|
mit
|
C#
|
f715bd8c19534ad13d53def4bb84eb58afee379b
|
Add xml comment for new StreamDeckXL property.
|
OpenStreamDeck/StreamDeckSharp
|
src/StreamDeckSharp/Hardware.cs
|
src/StreamDeckSharp/Hardware.cs
|
using StreamDeckSharp.Internals;
namespace StreamDeckSharp
{
/// <summary>
/// Details about different StreamDeck Hardware
/// </summary>
public static class Hardware
{
/// <summary>
/// Details about the classic Stream Deck
/// </summary>
public static IUsbHidHardware StreamDeck { get; }
/// <summary>
/// Details about the Stream Deck Mini
/// </summary>
public static IUsbHidHardware StreamDeckMini { get; }
/// <summary>
/// Details about the Stream Deck XL
/// </summary>
public static IUsbHidHardware StreamDeckXL { get; }
internal static IHardwareInternalInfos Internal_StreamDeck { get; }
internal static IHardwareInternalInfos Internal_StreamDeckMini { get; }
internal static IHardwareInternalInfos Internal_StreamDeckXL { get; }
static Hardware()
{
var hwStreamDeck = new StreamDeckHardwareInfo();
var hwStreamDeckMini = new StreamDeckMiniHardwareInfo();
var hwStreamDeckXL = new StreamDeckXlHardwareInfo();
StreamDeck = hwStreamDeck;
StreamDeckMini = hwStreamDeckMini;
StreamDeckXL = hwStreamDeckXL;
Internal_StreamDeck = hwStreamDeck;
Internal_StreamDeckMini = hwStreamDeckMini;
Internal_StreamDeckXL = hwStreamDeckXL;
}
internal static class VendorIds
{
public const int ElgatoSystemsGmbH = 0x0fd9;
}
internal static class ProductIds
{
public const int StreamDeck = 0x0060;
public const int StreamDeckMini = 0x0063;
public const int StreamDeckXL = 0x006c;
}
internal static bool IsKnownDevice(int vendorId, int productId)
{
if (vendorId != VendorIds.ElgatoSystemsGmbH)
return false;
switch (productId)
{
case ProductIds.StreamDeck:
case ProductIds.StreamDeckMini:
case ProductIds.StreamDeckXL:
return true;
default:
return false;
}
}
}
}
|
using StreamDeckSharp.Internals;
namespace StreamDeckSharp
{
/// <summary>
/// Details about different StreamDeck Hardware
/// </summary>
public static class Hardware
{
/// <summary>
/// Details about the classic Stream Deck
/// </summary>
public static IUsbHidHardware StreamDeck { get; }
/// <summary>
/// Details about the Stream Deck Mini
/// </summary>
public static IUsbHidHardware StreamDeckMini { get; }
public static IUsbHidHardware StreamDeckXL { get; }
internal static IHardwareInternalInfos Internal_StreamDeck { get; }
internal static IHardwareInternalInfos Internal_StreamDeckMini { get; }
internal static IHardwareInternalInfos Internal_StreamDeckXL { get; }
static Hardware()
{
var hwStreamDeck = new StreamDeckHardwareInfo();
var hwStreamDeckMini = new StreamDeckMiniHardwareInfo();
var hwStreamDeckXL = new StreamDeckXlHardwareInfo();
StreamDeck = hwStreamDeck;
StreamDeckMini = hwStreamDeckMini;
StreamDeckXL = hwStreamDeckXL;
Internal_StreamDeck = hwStreamDeck;
Internal_StreamDeckMini = hwStreamDeckMini;
Internal_StreamDeckXL = hwStreamDeckXL;
}
internal static class VendorIds
{
public const int ElgatoSystemsGmbH = 0x0fd9;
}
internal static class ProductIds
{
public const int StreamDeck = 0x0060;
public const int StreamDeckMini = 0x0063;
public const int StreamDeckXL = 0x006c;
}
internal static bool IsKnownDevice(int vendorId, int productId)
{
if (vendorId != VendorIds.ElgatoSystemsGmbH)
return false;
switch (productId)
{
case ProductIds.StreamDeck:
case ProductIds.StreamDeckMini:
case ProductIds.StreamDeckXL:
return true;
default:
return false;
}
}
}
}
|
mit
|
C#
|
21bb51244f6f722a6959ebdb56fe4c872e97ad95
|
Fix for test case. [release]
|
dapplo/Dapplo.Jira
|
Dapplo.Jira.Tests/WorkTests.cs
|
Dapplo.Jira.Tests/WorkTests.cs
|
#region Dapplo 2017 - GNU Lesser General Public License
// Dapplo - building blocks for .NET applications
// Copyright (C) 2017 Dapplo
//
// For more information see: http://dapplo.net/
// Dapplo repositories are hosted on GitHub: https://github.com/dapplo
//
// This file is part of Dapplo.Jira
//
// Dapplo.Jira is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Dapplo.Jira is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have a copy of the GNU Lesser General Public License
// along with Dapplo.Jira. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
#endregion
#region Usings
using System;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Dapplo.Jira.Entities;
using Xunit;
using Xunit.Abstractions;
#endregion
namespace Dapplo.Jira.Tests
{
public class WorkTests : TestBase
{
public WorkTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
{
}
[Fact]
public async Task TestLogWork()
{
var created = DateTimeOffset.ParseExact(@"30/10/2007", "dd/MM/yyyy", CultureInfo.GetCultureInfo("en-US"));
var worklog = await Client.Work.CreateAsync(TestIssueKey, new Worklog {
TimeSpentSeconds = (long)TimeSpan.FromHours(16).TotalSeconds,
Comment = "Testing the logging of work",
Created = created
});
Assert.NotNull(worklog);
Assert.Equal("2d", worklog.TimeSpent);
Assert.Equal(created, worklog.Created);
worklog.TimeSpent = "3d";
await Client.Work.UpdateAsync(TestIssueKey, worklog);
var worklogs = await Client.Work.GetAsync(TestIssueKey);
var retrievedWorklog = worklogs.FirstOrDefault(worklogItem => string.Equals(worklog.Id, worklogItem.Id));
Assert.NotNull(retrievedWorklog);
Assert.Equal("3d", retrievedWorklog.TimeSpent);
// Delete again
await Client.Work.DeleteAsync(TestIssueKey, worklog);
}
[Fact]
public async Task TestWorklogs()
{
var worklogs = await Client.Work.GetAsync(TestIssueKey);
Assert.NotNull(worklogs);
Assert.True(worklogs.Elements.Count > 0);
}
}
}
|
#region Dapplo 2017 - GNU Lesser General Public License
// Dapplo - building blocks for .NET applications
// Copyright (C) 2017 Dapplo
//
// For more information see: http://dapplo.net/
// Dapplo repositories are hosted on GitHub: https://github.com/dapplo
//
// This file is part of Dapplo.Jira
//
// Dapplo.Jira is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Dapplo.Jira is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have a copy of the GNU Lesser General Public License
// along with Dapplo.Jira. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
#endregion
#region Usings
using System;
using System.Linq;
using System.Threading.Tasks;
using Dapplo.Jira.Entities;
using Xunit;
using Xunit.Abstractions;
#endregion
namespace Dapplo.Jira.Tests
{
public class WorkTests : TestBase
{
public WorkTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
{
}
[Fact]
public async Task TestLogWork()
{
var created = DateTimeOffset.Parse("30/10/2007");
var worklog = await Client.Work.CreateAsync(TestIssueKey, new Worklog {
TimeSpentSeconds = (long)TimeSpan.FromHours(16).TotalSeconds,
Comment = "Testing the logging of work",
Created = created
});
Assert.NotNull(worklog);
Assert.Equal("2d", worklog.TimeSpent);
Assert.Equal(created, worklog.Created);
worklog.TimeSpent = "3d";
await Client.Work.UpdateAsync(TestIssueKey, worklog);
var worklogs = await Client.Work.GetAsync(TestIssueKey);
var retrievedWorklog = worklogs.FirstOrDefault(worklogItem => string.Equals(worklog.Id, worklogItem.Id));
Assert.NotNull(retrievedWorklog);
Assert.Equal("3d", retrievedWorklog.TimeSpent);
// Delete again
await Client.Work.DeleteAsync(TestIssueKey, worklog);
}
[Fact]
public async Task TestWorklogs()
{
var worklogs = await Client.Work.GetAsync(TestIssueKey);
Assert.NotNull(worklogs);
Assert.True(worklogs.Elements.Count > 0);
}
}
}
|
mit
|
C#
|
9071cce8bcdafdc7190b6c50cd42ad9822dc2f03
|
Bump version for release
|
jwvdiermen/TransIP-API
|
src/shared/SharedAssemblyInfo.cs
|
src/shared/SharedAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyProduct("TransIP API")]
[assembly: AssemblyCompany("Crealuz")]
[assembly: AssemblyCopyright("Copyright © 2011-2014 Crealuz - All rights reserved")]
[assembly: AssemblyVersion("0.1.6")]
[assembly: AssemblyFileVersion("0.1.6")]
|
using System.Reflection;
[assembly: AssemblyProduct("TransIP API")]
[assembly: AssemblyCompany("Crealuz")]
[assembly: AssemblyCopyright("Copyright © 2011-2014 Crealuz - All rights reserved")]
[assembly: AssemblyVersion("0.1.5")]
[assembly: AssemblyFileVersion("0.1.5")]
|
mit
|
C#
|
2c0600becf0aeab17f996138e4f6df6451bf281d
|
add project url
|
abhinavwaviz/im-only-resting,SwensenSoftware/im-only-resting,MrZANE42/im-only-resting,jordanbtucker/im-only-resting,stephen-swensen/im-only-resting,codemonkey493/im-only-resting,nathanwblair/im-only-resting,stephen-swensen/im-only-resting,ItsAGeekThing/im-only-resting,jordanbtucker/im-only-resting,SwensenSoftware/im-only-resting,codemonkey493/im-only-resting,ItsAGeekThing/im-only-resting,MrZANE42/im-only-resting,abhinavwaviz/im-only-resting,nathanwblair/im-only-resting
|
Ior/Properties/AssemblyInfo.cs
|
Ior/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("I'm Only Resting")]
[assembly: AssemblyDescription("http://code.google.com/p/im-only-resting/")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("I'm Only Resting")]
[assembly: AssemblyCopyright("Copyright © Stephen Swensen 2012")]
[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("42d77ebc-de54-4916-b931-de852d2bacff")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.*")]
[assembly: AssemblyFileVersion("1.0.0.*")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("I'm Only Resting")]
[assembly: AssemblyDescription("http://stackoverflow.com/users/236255/stephen-swensen")] //put project url here to tshow in about page.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("I'm Only Resting")]
[assembly: AssemblyCopyright("Copyright © Stephen Swensen 2012")]
[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("42d77ebc-de54-4916-b931-de852d2bacff")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.*")]
[assembly: AssemblyFileVersion("1.0.0.*")]
|
apache-2.0
|
C#
|
3fbf3f683075b41ab5285aeb747d224151208471
|
Fix typo
|
elastic/elasticsearch-net,elastic/elasticsearch-net
|
src/Utf8Json/src/Utf8Json/Internal/Emit/DynamicAssembly.cs
|
src/Utf8Json/src/Utf8Json/Internal/Emit/DynamicAssembly.cs
|
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace Utf8Json.Internal.Emit
{
public class DynamicAssembly
{
#if NET45 || NET47
readonly string moduleName;
#endif
readonly AssemblyBuilder assemblyBuilder;
readonly ModuleBuilder moduleBuilder;
// don't expose ModuleBuilder
// public ModuleBuilder ModuleBuilder { get { return moduleBuilder; } }
readonly object gate = new object();
// requires lock on mono environment. see: https://github.com/neuecc/MessagePack-CSharp/issues/161
public TypeBuilder DefineType(string name, TypeAttributes attr)
{
lock (gate)
{
return moduleBuilder.DefineType(name, attr);
}
}
public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent)
{
lock (gate)
{
return moduleBuilder.DefineType(name, attr, parent);
}
}
public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, Type[] interfaces)
{
lock (gate)
{
return moduleBuilder.DefineType(name, attr, parent, interfaces);
}
}
public DynamicAssembly(string moduleName)
{
#if NET45 || NET47
this.moduleName = moduleName;
this.assemblyBuilder = System.AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(moduleName), AssemblyBuilderAccess.RunAndSave);
this.moduleBuilder = assemblyBuilder.DefineDynamicModule(moduleName, moduleName + ".dll");
#else
#if NETSTANDARD
this.assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName(moduleName), AssemblyBuilderAccess.Run);
#else
this.assemblyBuilder = System.AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(moduleName), AssemblyBuilderAccess.Run);
#endif
this.moduleBuilder = assemblyBuilder.DefineDynamicModule(moduleName);
#endif
}
#if NET45 || NET47
public AssemblyBuilder Save()
{
assemblyBuilder.Save(moduleName + ".dll");
return assemblyBuilder;
}
#endif
}
}
|
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace Utf8Json.Internal.Emit
{
public class DynamicAssembly
{
#if NET45 || NET47
readonly string moduleName;
#endif
readonly AssemblyBuilder assemblyBuilder;
readonly ModuleBuilder moduleBuilder;
// don't expose ModuleBuilder
// public ModuleBuilder ModuleBuilder { get { return moduleBuilder; } }
readonly object gate = new object();
// requires lock on mono environment. see: https://github.com/neuecc/MessagePack-CSharp/issues/161
public TypeBuilder DefineType(string name, TypeAttributes attr)
{
lock (gate)
{
return moduleBuilder.DefineType(name, attr);
}
}
public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent)
{
lock (gate)
{
return moduleBuilder.DefineType(name, attr, parent);
}
}
public TypeBuilder DefineType(string name, TypeAttributes attr, Type parent, Type[] interfaces)
{
lock (gate)
{
return moduleBuilder.DefineType(name, attr, parent, interfaces);
}
}
public DynamicAssembly(string moduleName)
{
#if NET45 || NET47
this.moduleName = moduleName;
this.assemblyBuilder = System.AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(moduleName), AssemblyBuilderAccess.RunAndSave,);
this.moduleBuilder = assemblyBuilder.DefineDynamicModule(moduleName, moduleName + ".dll");
#else
#if NETSTANDARD
this.assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName(moduleName), AssemblyBuilderAccess.Run);
#else
this.assemblyBuilder = System.AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(moduleName), AssemblyBuilderAccess.Run);
#endif
this.moduleBuilder = assemblyBuilder.DefineDynamicModule(moduleName);
#endif
}
#if NET45 || NET47
public AssemblyBuilder Save()
{
assemblyBuilder.Save(moduleName + ".dll");
return assemblyBuilder;
}
#endif
}
}
|
apache-2.0
|
C#
|
f4e0602740863547ceb59664d9dc2986cf207e8d
|
Update SolidColorBrushImpl.cs
|
DavidKarlas/Perspex,punker76/Perspex,MrDaedra/Avalonia,tshcherban/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,wieslawsoltes/Perspex,Perspex/Perspex,SuperJMN/Avalonia,jazzay/Perspex,bbqchickenrobot/Perspex,danwalmsley/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,OronDF343/Avalonia,OronDF343/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,MrDaedra/Avalonia,susloparovdenis/Perspex,kekekeks/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,susloparovdenis/Avalonia,susloparovdenis/Avalonia,akrisiun/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,susloparovdenis/Perspex,ncarrillo/Perspex,AvaloniaUI/Avalonia,kekekeks/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex
|
src/Windows/Perspex.Direct2D1/Media/SolidColorBrushImpl.cs
|
src/Windows/Perspex.Direct2D1/Media/SolidColorBrushImpl.cs
|
// -----------------------------------------------------------------------
// <copyright file="SolidColorBrushImpl.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Direct2D1.Media
{
public class SolidColorBrushImpl : BrushImpl
{
public SolidColorBrushImpl(Perspex.Media.SolidColorBrush brush, SharpDX.Direct2D1.RenderTarget target)
{
this.PlatformBrush = new SharpDX.Direct2D1.SolidColorBrush(
target,
brush?.Color.ToDirect2D() ?? new SharpDX.Color4(),
new SharpDX.Direct2D1.BrushProperties
{
Opacity = brush != null ? (float)brush.Opacity : 1.0f,
Transform = target.Transform
}
);
}
}
}
|
// -----------------------------------------------------------------------
// <copyright file="SolidColorBrushImpl.cs" company="Steven Kirk">
// Copyright 2015 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Direct2D1.Media
{
public class SolidColorBrushImpl : BrushImpl
{
public SolidColorBrushImpl(Perspex.Media.SolidColorBrush brush, SharpDX.Direct2D1.RenderTarget target)
{
this.PlatformBrush = new SharpDX.Direct2D1.SolidColorBrush(
target,
brush?.Color.ToDirect2D() ?? new SharpDX.Color4(),
new SharpDX.Direct2D1.BrushProperties
{
Opacity = brush != null ? (float)brush.Opacity : 1.0f,
Transform = target.Transform
}
);
}
}
}
|
mit
|
C#
|
5a215828e756f498c1cabf8d9c9904f170e391bf
|
Add BoweTime missing implementations
|
rc1/BowieCode
|
BowieTime.cs
|
BowieTime.cs
|
using System;
namespace BowieCode {
/// <summary>
/// Simple time and helpers
/// </summary>
public class BowieTime {
///<summary>
///An imitation of JavaScript's Date.Now function.
///</summary>
public static long Now () {
return (long) System.Math.Floor( DateTime.UtcNow.Subtract( new DateTime( 1970, 1, 1, 0, 0, 0, DateTimeKind.Utc ) ).TotalMilliseconds );
}
///<summary>
///Returns Now as a string. As unity uses floats as doubles, a string can be useful
///for sending over OSC for example.
///</summary>
public static string NowStr () {
var time = Now();
return string.Format( "{0:0}", time );
}
///<summary>
///Returns the time of day where 0.5f is noon for now.
///</summary>
public static float PercentOfDay () {
return PercentOfDay( DateTime.Now );
}
///<summary>
///Returns the time of day where 0.5f is noon.
///</summary>
public static float PercentOfDay ( DateTime dateTime ) {
DateTime currentDay = new DateTime( dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0 );
DateTime nextDay = new DateTime( dateTime.Year, dateTime.Month, dateTime.Day, 23, 59, 59 );
TimeSpan aDay = nextDay - currentDay;
TimeSpan soFar = dateTime - currentDay;
return (float) ( soFar.TotalMilliseconds / aDay.TotalMilliseconds );
}
///<summary>
///Returns the time of day where 0.5f is noon.
///</summary>
public static float PercentOfDay ( float hours, float mins ) {
float value = hours * ( 1.0f / 24.0f );
value += mins * ( 1.0f / 24.0f / 60.0f );
return value;
}
///<summary>
///Returns the percent of year for now where 0.0f is right after the new year bells and people kiss. 0.999999f is when people drunkenly gather.
///</summary>
public static float PercentOfYear () {
return PercentOfYear( DateTime.Now );
}
///<summary>
///Returns the percent of year where 0.0f is right after the new year bells and people kiss. 0.999999f is when people drunkenly gather.
///</summary>
public static float PercentOfYear ( DateTime dateTime ) {
DateTime currentYear = new DateTime ( dateTime.Year, 1, 1, 0, 0, 0 );
DateTime nextYear = new DateTime ( dateTime.Year + 1, 1, 1, 0, 0, 0 );
TimeSpan aYear = nextYear - currentYear;
TimeSpan soFar = dateTime - currentYear;
return (float)(soFar.TotalMinutes / aYear.TotalMinutes);
}
}
}
|
using System;
namespace BowieCode {
/// <summary>
/// Simple time and helpers
/// </summary>
public class BowieTime {
///<summary>
///An imitation of JavaScript's Date.Now function.
///</summary>
public static long Now () {
return (long)System.Math.Floor( DateTime.UtcNow.Subtract( new DateTime( 1970, 1, 1, 0, 0, 0, DateTimeKind.Utc ) ).TotalMilliseconds );
}
///<summary>
///Returns Now as a string. As unity uses floats as doubles, a string can be useful
///for sending over OSC for example.
///</summary>
public static string NowStr () {
var time = Now();
return string.Format( "{0:0}", time );
}
///<summary>
///Returns the time of day where 0.5f is noon.
///</summary>
public static float TimeOfDay () {
// Debug.Log( "To do from hopsital project" );
return -1000.0f;
}
///<summary>
///Returns the time of year where 0.0f is right after the new year bells and people kiss. 0.999999f is when people drunkenly gather.
///</summary>
public static float TimeOfYear () {
// Debug.Log( "To do from hopsital project" );
return -1000.0f;
}
}
}
|
mit
|
C#
|
ad301dfb7f6d2bf80ff75252eeec0c903a43661a
|
Make saved settings more readable
|
NJAldwin/Pequot
|
Pequot/SerializableSettings.cs
|
Pequot/SerializableSettings.cs
|
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
namespace Pequot
{
[XmlRoot("settings")]
public class SerializableSettings
: Dictionary<string, string>, IXmlSerializable
{
#region IXmlSerializable Members
public System.Xml.Schema.XmlSchema GetSchema()
{
return null;
}
public void ReadXml(XmlReader reader)
{
bool wasEmpty = reader.IsEmptyElement;
reader.Read();
if (wasEmpty)
return;
while (reader.NodeType != XmlNodeType.EndElement)
{
// Convert from human-readable element names (see below)
string key = XmlConvert.DecodeName(reader.Name.Replace("___", "_x0020_").Replace("__x005F__", "___"));
string value = reader.ReadString();
if(key!=null)
{
if(ContainsKey(key))
// update if already exists
this[key] = value;
else
Add(key, value);
}
reader.Read();
}
reader.ReadEndElement();
}
public void WriteXml(XmlWriter writer)
{
foreach (String key in Keys)
{
// Convert to human-readable element names by substituting three underscores for an encoded space (2nd Replace)
// and making sure existing triple-underscores will not cause confusion by substituting with partial encoding
string encoded = XmlConvert.EncodeName(key);
if (encoded == null) continue;
writer.WriteStartElement(encoded.Replace("___", "__x005F__").Replace("_x0020_", "___"));
writer.WriteString(this[key]);
writer.WriteEndElement();
}
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
namespace Pequot
{
[XmlRoot("settings")]
public class SerializableSettings
: Dictionary<string, string>, IXmlSerializable
{
#region IXmlSerializable Members
public System.Xml.Schema.XmlSchema GetSchema()
{
return null;
}
public void ReadXml(System.Xml.XmlReader reader)
{
bool wasEmpty = reader.IsEmptyElement;
reader.Read();
if (wasEmpty)
return;
while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
{
string key = XmlConvert.DecodeName(reader.Name);
string value = reader.ReadString();
this.Add(key, value);
reader.Read();
}
reader.ReadEndElement();
}
public void WriteXml(System.Xml.XmlWriter writer)
{
foreach (String key in this.Keys)
{
writer.WriteStartElement(XmlConvert.EncodeName(key));
writer.WriteString(this[key]);
writer.WriteEndElement();
}
}
#endregion
}
}
|
mit
|
C#
|
09b56a663a4a4568d64dd38cca36e9ff9b30499c
|
Comment out complex result
|
DigDes/SoapCore
|
samples/Client461/Program.cs
|
samples/Client461/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
public static void Main(string[] args)
{
var binding = new BasicHttpBinding();
var endpoint = new EndpointAddress(new Uri(string.Format("http://{0}:5050/Service.asmx", Environment.MachineName)));
var serviceClient = new SampleService.SampleServiceClient(binding, endpoint);
var result = serviceClient.Ping("hey");
Console.WriteLine("Ping method result: {0}", result);
// TODO: DateTimeOffsetProperty not working
//var complexModel = new SampleService.ComplexModelInput
//{
// StringProperty = Guid.NewGuid().ToString(),
// IntProperty = int.MaxValue / 2,
// ListProperty = new List<string> { "test", "list", "of", "strings" },
// DateTimeOffsetProperty = new DateTimeOffset(2018, 12, 31, 13, 59, 59, TimeSpan.FromHours(1))
//};
//var complexResult = serviceClient.PingComplexModel(complexModel);
//Console.WriteLine("PingComplexModel result. FloatProperty: {0}, StringProperty: {1}, ListProperty: {2}, DateTimeOffsetProperty: {3}",
// complexResult.FloatProperty, complexResult.StringProperty, string.Join(", ", complexResult.ListProperty), complexResult.DateTimeOffsetProperty);
// see https://github.com/DigDes/SoapCore/issues/38
//serviceClient.VoidMethod(out var stringValue);
//Console.WriteLine("Void method result: {0}", stringValue);
var asyncMethodResult = serviceClient.AsyncMethodAsync().Result;
Console.WriteLine("Async method result: {0}", asyncMethodResult);
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
public static void Main(string[] args)
{
var binding = new BasicHttpBinding();
var endpoint = new EndpointAddress(new Uri(string.Format("http://{0}:5050/Service.asmx", Environment.MachineName)));
var serviceClient = new SampleService.SampleServiceClient(binding, endpoint);
var result = serviceClient.Ping("hey");
Console.WriteLine("Ping method result: {0}", result);
var complexModel = new SampleService.ComplexModelInput
{
StringProperty = Guid.NewGuid().ToString(),
IntProperty = int.MaxValue / 2,
ListProperty = new List<string> { "test", "list", "of", "strings" },
DateTimeOffsetProperty = new DateTimeOffset(2018, 12, 31, 13, 59, 59, TimeSpan.FromHours(1)),
ComplexListProperty = new List<SampleService.ComplexObject>()
};
var complexResult = serviceClient.PingComplexModel(complexModel);
Console.WriteLine("PingComplexModel result. FloatProperty: {0}, StringProperty: {1}", complexResult.FloatProperty, complexResult.StringProperty);
// see https://github.com/DigDes/SoapCore/issues/38
//serviceClient.VoidMethod(out var stringValue);
//Console.WriteLine("Void method result: {0}", stringValue);
var asyncMethodResult = serviceClient.AsyncMethodAsync().Result;
Console.WriteLine("Async method result: {0}", asyncMethodResult);
Console.ReadKey();
}
}
}
|
mit
|
C#
|
8ca5572299c8eaf21581e861f5fb302d3f27357f
|
Rename local variable in test
|
charlenni/Mapsui,charlenni/Mapsui,pauldendulk/Mapsui
|
Tests/Mapsui.Tests/Rendering/RenderFetchStrategyTests.cs
|
Tests/Mapsui.Tests/Rendering/RenderFetchStrategyTests.cs
|
using BruTile;
using BruTile.Cache;
using BruTile.Predefined;
using Mapsui.Providers;
using Mapsui.Rendering;
using NUnit.Framework;
using System.Globalization;
using Mapsui.Geometries;
namespace Mapsui.Tests.Rendering
{
[TestFixture]
public class RenderFetchStrategyTests
{
[Test]
public void GetFeaturesWithPartOfOptimalResolutionTilesMissing()
{
// arrange
var schema = new GlobalSphericalMercator();
var box = schema.Extent.ToBoundingBox();
const int levelId = 3;
var resolution = schema.Resolutions[levelId.ToString(CultureInfo.InvariantCulture)];
var memoryCache = PopulateMemoryCache(schema, new MemoryCache<Feature>(), levelId);
var renderFetchStrategy = new RenderFetchStrategy();
// act
var tiles = renderFetchStrategy.Get(box, resolution.UnitsPerPixel, schema, memoryCache);
// assert
Assert.True(tiles.Count == 43);
}
private static ITileCache<Feature> PopulateMemoryCache(GlobalSphericalMercator schema, MemoryCache<Feature> cache, int levelId)
{
for (var i = levelId; i >= 0; i--)
{
var tiles = schema.GetTileInfos(schema.Extent, i.ToString(CultureInfo.InvariantCulture));
foreach (var tile in tiles)
{
if ((tile.Index.Col + tile.Index.Row) % 2 == 0) // Add only 50% of the tiles with the arbitrary rule.
{
cache.Add(tile.Index, new Feature { Geometry = new Point()});
}
}
}
return cache;
}
}
}
|
using BruTile;
using BruTile.Cache;
using BruTile.Predefined;
using Mapsui.Providers;
using Mapsui.Rendering;
using NUnit.Framework;
using System.Globalization;
using Mapsui.Geometries;
namespace Mapsui.Tests.Rendering
{
[TestFixture]
public class RenderFetchStrategyTests
{
[Test]
public void GetFeaturesWithPartOfOptimalResolutionTilesMissing()
{
// arrange
var schema = new GlobalSphericalMercator();
var box = schema.Extent.ToBoundingBox();
const int levelId = 3;
var resolution = schema.Resolutions[levelId.ToString(CultureInfo.InvariantCulture)];
var memoryCache = PopulateMemoryCache(schema, new MemoryCache<Feature>(), levelId);
var renderGetStrategy = new RenderFetchStrategy();
// act
var tiles = renderGetStrategy.Get(box, resolution.UnitsPerPixel, schema, memoryCache);
// assert
Assert.True(tiles.Count == 43);
}
private static ITileCache<Feature> PopulateMemoryCache(GlobalSphericalMercator schema, MemoryCache<Feature> cache, int levelId)
{
for (var i = levelId; i >= 0; i--)
{
var tiles = schema.GetTileInfos(schema.Extent, i.ToString(CultureInfo.InvariantCulture));
foreach (var tile in tiles)
{
if ((tile.Index.Col + tile.Index.Row) % 2 == 0) // Add only 50% of the tiles with the arbitrary rule.
{
cache.Add(tile.Index, new Feature { Geometry = new Point()});
}
}
}
return cache;
}
}
}
|
mit
|
C#
|
78298c551a5919109feb9659fc48ffe52c11e38e
|
Edit it
|
sta/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp
|
websocket-sharp/CompressionMethod.cs
|
websocket-sharp/CompressionMethod.cs
|
#region License
/*
* CompressionMethod.cs
*
* The MIT License
*
* Copyright (c) 2013-2016 sta.blockhead
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#endregion
using System;
namespace WebSocketSharp
{
/// <summary>
/// Specifies the method for compression.
/// </summary>
/// <remarks>
/// The methods are defined in
/// <see href="https://tools.ietf.org/html/rfc7692">
/// Compression Extensions for WebSocket</see>.
/// </remarks>
public enum CompressionMethod : byte
{
/// <summary>
/// Specifies no compression.
/// </summary>
None,
/// <summary>
/// Specifies DEFLATE.
/// </summary>
Deflate
}
}
|
#region License
/*
* CompressionMethod.cs
*
* The MIT License
*
* Copyright (c) 2013-2016 sta.blockhead
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#endregion
using System;
namespace WebSocketSharp
{
/// <summary>
/// Specifies the compression method used to compress a message on
/// the WebSocket connection.
/// </summary>
/// <remarks>
/// The compression methods that can be used are defined in
/// <see href="https://tools.ietf.org/html/rfc7692">
/// Compression Extensions for WebSocket</see>.
/// </remarks>
public enum CompressionMethod : byte
{
/// <summary>
/// Specifies non compression.
/// </summary>
None,
/// <summary>
/// Specifies DEFLATE.
/// </summary>
Deflate
}
}
|
mit
|
C#
|
941a43e51eef8bedf2aa16e21842347d16625c25
|
Enable capturing start-up errors
|
martincostello/api,martincostello/api,martincostello/api
|
src/API/Program.cs
|
src/API/Program.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Program.cs" company="https://martincostello.com/">
// Martin Costello (c) 2016
// </copyright>
// <summary>
// Program.cs
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace MartinCostello.Api
{
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
/// <summary>
/// A class representing the entry-point to the application. This class cannot be inherited.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry-point to the application.
/// </summary>
/// <param name="args">The arguments to the application.</param>
/// <returns>
/// The exit code from the application.
/// </returns>
public static int Main(string[] args)
{
try
{
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddCommandLine(args)
.Build();
var builder = new WebHostBuilder()
.UseKestrel()
.UseConfiguration(configuration)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.CaptureStartupErrors(true);
using (var host = builder.Build())
{
host.Run();
}
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine($"Unhandled exception: {ex}");
return -1;
}
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Program.cs" company="https://martincostello.com/">
// Martin Costello (c) 2016
// </copyright>
// <summary>
// Program.cs
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace MartinCostello.Api
{
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
/// <summary>
/// A class representing the entry-point to the application. This class cannot be inherited.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry-point to the application.
/// </summary>
/// <param name="args">The arguments to the application.</param>
/// <returns>
/// The exit code from the application.
/// </returns>
public static int Main(string[] args)
{
try
{
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddCommandLine(args)
.Build();
var builder = new WebHostBuilder()
.UseKestrel()
.UseConfiguration(configuration)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>();
using (var host = builder.Build())
{
host.Run();
}
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine($"Unhandled exception: {ex}");
return -1;
}
}
}
}
|
mit
|
C#
|
f70275aad0f232f3dda75e02d71d8d42a4daa975
|
Update IShapeRendererState.cs
|
wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
|
src/Core2D/Model/Renderer/IShapeRendererState.cs
|
src/Core2D/Model/Renderer/IShapeRendererState.cs
|
using Core2D.Shapes;
using Core2D.Style;
namespace Core2D.Renderer
{
/// <summary>
/// Defines shape renderer state contract.
/// </summary>
public interface IShapeRendererState : IObservableObject, ISelection
{
/// <summary>
/// The X coordinate of current pan position.
/// </summary>
double PanX { get; set; }
/// <summary>
/// The Y coordinate of current pan position.
/// </summary>
double PanY { get; set; }
/// <summary>
/// The X component of current zoom value.
/// </summary>
double ZoomX { get; set; }
/// <summary>
/// The Y component of current zoom value.
/// </summary>
double ZoomY { get; set; }
/// <summary>
/// Flag indicating shape state to enable its drawing.
/// </summary>
IShapeState DrawShapeState { get; set; }
/// <summary>
/// Image cache repository.
/// </summary>
IImageCache ImageCache { get; set; }
/// <summary>
/// Gets or sets value indicating whether to draw decorators.
/// </summary>
bool DrawDecorators { get; set; }
/// <summary>
/// Gets or sets value indicating whether to draw points.
/// </summary>
bool DrawPoints { get; set; }
/// <summary>
/// Gets or sets style used to draw points.
/// </summary>
IShapeStyle PointStyle { get; set; }
/// <summary>
/// Gets or sets size used to draw points.
/// </summary>
double PointSize { get; set; }
/// <summary>
/// Gets or sets selection rectangle style.
/// </summary>
IShapeStyle SelectionStyle { get; set; }
/// <summary>
/// Gets or sets editor helper shapes style.
/// </summary>
IShapeStyle HelperStyle { get; set; }
/// <summary>
/// Gets or sets shapes decorator.
/// </summary>
IDecorator Decorator { get; set; }
}
}
|
using Core2D.Shapes;
using Core2D.Style;
namespace Core2D.Renderer
{
/// <summary>
/// Defines shape renderer state contract.
/// </summary>
public interface IShapeRendererState : IObservableObject, ISelection
{
/// <summary>
/// The X coordinate of current pan position.
/// </summary>
double PanX { get; set; }
/// <summary>
/// The Y coordinate of current pan position.
/// </summary>
double PanY { get; set; }
/// <summary>
/// The X component of current zoom value.
/// </summary>
double ZoomX { get; set; }
/// <summary>
/// The Y component of current zoom value.
/// </summary>
double ZoomY { get; set; }
/// <summary>
/// Flag indicating shape state to enable its drawing.
/// </summary>
IShapeState DrawShapeState { get; set; }
/// <summary>
/// Image cache repository.
/// </summary>
IImageCache ImageCache { get; set; }
/// <summary>
/// Gets or sets value indicating whether to draw decorators.
/// </summary>
bool DrawDecorators { get; set; }
/// <summary>
/// Gets or sets value indicating whether to draw points.
/// </summary>
bool DrawPoints { get; set; }
/// <summary>
/// Gets or sets style used to draw points.
/// </summary>
IShapeStyle PointStyle { get; set; }
/// <summary>
/// Gets or sets size used to draw points.
/// </summary>
double PointSize { get; set; }
/// <summary>
/// Gets or sets selection rectangle style.
/// </summary>
IShapeStyle SelectionStyle { get; set; }
/// <summary>
/// Gets or sets editor helper shapes style.
/// </summary>
IShapeStyle HelperStyle { get; set; }
}
}
|
mit
|
C#
|
3b188bbea82e43d1ea7b421ae8bd0b0080143bf4
|
Remove windows store test runner
|
yufeih/Nine.Application,studio-nine/Nine.Application
|
test/WindowsStore/MainPage.xaml.cs
|
test/WindowsStore/MainPage.xaml.cs
|
namespace Nine.Application.WindowsStore.Test
{
using System;
using System.Reflection;
using Windows.UI.Xaml.Controls;
using Xunit;
using Xunit.Abstractions;
public sealed partial class MainPage : Page, IMessageSink
{
public MainPage()
{
InitializeComponent();
}
public bool OnMessage(IMessageSinkMessage message)
{
Output.Text = message.ToString();
return true;
}
}
}
|
namespace Nine.Application.WindowsStore.Test
{
using System;
using System.Reflection;
using Windows.UI.Xaml.Controls;
using Xunit;
using Xunit.Abstractions;
public sealed partial class MainPage : Page, IMessageSink
{
public MainPage()
{
InitializeComponent();
Loaded += async (a, b) =>
{
await new PortableTestExecutor().RunAll(this, typeof(AppUITest).GetTypeInfo().Assembly);
};
}
public bool OnMessage(IMessageSinkMessage message)
{
Output.Text = message.ToString();
return true;
}
}
}
|
mit
|
C#
|
cb36e4b1b95e20b4d626ad99da0bed124f231966
|
fix bug in error test
|
sebastus/AzureFunctionForSplunk
|
shared/sendToSplunkLAD30.csx
|
shared/sendToSplunkLAD30.csx
|
#r "Newtonsoft.Json"
using System;
using System.Dynamic;
using System.Net;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public class SingleHttpClientInstance
{
private static readonly HttpClient HttpClient;
static SingleHttpClientInstance()
{
HttpClient = new HttpClient();
}
public static async Task<HttpResponseMessage> SendToSplunk(HttpRequestMessage req)
{
HttpResponseMessage response = await HttpClient.SendAsync(req);
return response;
}
}
static async Task SendMessagesToSplunk(string[] messages, TraceWriter log)
{
var converter = new ExpandoObjectConverter();
ServicePointManager.ServerCertificateValidationCallback =
new System.Net.Security.RemoteCertificateValidationCallback(
delegate { return true; });
var client = new SingleHttpClientInstance();
string newClientContent = "";
foreach (var message in messages)
{
try
{
dynamic obj = JsonConvert.DeserializeObject<ExpandoObject>(message, converter);
string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
newClientContent += "{\"event\": " + json + "}";
}
catch (Exception e)
{
log.Info($"Error {e} caught while parsing message: {message}");
}
}
try
{
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, "https://asplunktest.westus.cloudapp.azure.com:8088/services/collector/event");
req.Headers.Accept.Clear();
req.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
req.Headers.Add("Authorization", "Splunk 73A24AB7-60DD-4235-BF71-D892AE47F49D");
req.Content = new StringContent(newClientContent, Encoding.UTF8, "application/json");
HttpResponseMessage response = await SingleHttpClientInstance.SendToSplunk(req);
}
catch (System.Net.Http.HttpRequestException e)
{
log.Info($"Error: \"{e.InnerException.Message}\" was caught while sending to Splunk. Is the Splunk service running?");
}
catch (Exception f)
{
log.Info($"Error \"{f.InnerException.Message}\" was caught while sending to Splunk. Unplanned exception.");
}
}
|
#r "Newtonsoft.Json"
using System;
using System.Dynamic;
using System.Net;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public class SingleHttpClientInstance
{
private static readonly HttpClient HttpClient;
static SingleHttpClientInstance()
{
HttpClient = new HttpClient();
}
public static async Task<HttpResponseMessage> SendToSplunk(HttpRequestMessage req)
{
HttpResponseMessage response = await HttpClient.SendAsync(req);
return response;
}
}
static async Task SendMessagesToSplunk(string[] messages, TraceWriter log)
{
var converter = new ExpandoObjectConverter();
ServicePointManager.ServerCertificateValidationCallback =
new System.Net.Security.RemoteCertificateValidationCallback(
delegate { return true; });
var client = new SingleHttpClientInstance();
string newClientContent = "";
foreach (var message in messages)
{
try {
dynamic obj = JsonConvert.DeserializeObject<ExpandoObject>(message, converter);
string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
newClientContent += "{\"event\": " + json + "}";
} catch (Exception e) {
log.Info($"Error {e} caught while parsing message: {message}");
}
}
try {
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, "https://asplunktest.westus.cloudapp.azure.com:8088/services/collector/event");
req.Headers.Accept.Clear();
req.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
req.Headers.Add("Authorization", "Splunk 73A24AB7-60DD-4235-BF71-D892AE47F49D");
req.Content = new StringContent(newClientContent, Encoding.UTF8, "application/json");
HttpResponseMessage response = await SingleHttpClientInstance.SendToSplunk(req);
} catch (System.Net.Http.HttpRequestException e) {
log.Info($"Error {e.message} caught while sending to Splunk. Is the Splunk service running?");
}
}
|
mit
|
C#
|
36e8d840e20e694caecc6e83eab8629e56733477
|
refactor for readability
|
marinoscar/MySql2MSSQL
|
Code/MySql2MSSQL/ConnectionManager.cs
|
Code/MySql2MSSQL/ConnectionManager.cs
|
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MySql2MSSQL
{
public class ConnectionManager
{
public ConnectionManager(Arguments args)
{
Args = args;
}
public Arguments Args { get; private set; }
public string GetConnectionString()
{
const string mysqlTemplate = "Server={server};Database={db};Uid={user};Pwd={password};";
const string mssqlTemplate = "Server={server};Database={db};User Id={user};Password={password};";
return IsMysql() ? DoReplace(mysqlTemplate) : DoReplace(mssqlTemplate);
}
public DbConnection GetConnection()
{
DbConnection result = null;
var conStr = GetConnectionString();
if (IsMysql())
result = new MySqlConnection(conStr);
else
result = new SqlConnection(conStr);
return result;
}
private string DoReplace(string template)
{
return template
.Replace("{server}", Args.Host)
.Replace("{db}", Args.Database)
.Replace("{user}", Args.User)
.Replace("{password}", Args.Password);
}
private bool IsMysql()
{
return Args.Target == "mysql";
}
}
}
|
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MySql2MSSQL
{
public class ConnectionManager
{
public ConnectionManager(Arguments args)
{
Args = args;
}
public Arguments Args { get; private set; }
public string GetConnectionString()
{
const string mysqlTemplate = "Server={server};Database={db};Uid={user};Pwd={password};";
const string mssqlTemplate = "Server={server};Database={db};User Id={user};Password={password};";
return IsMysql() ? DoReplace(mysqlTemplate) : DoReplace(mssqlTemplate);
}
public DbConnection GetConnection()
{
return IsMysql() ? ((DbConnection)new MySqlConnection(GetConnectionString())) : ((DbConnection)new SqlConnection(GetConnectionString()));
}
private string DoReplace(string template)
{
return template
.Replace("{server}", Args.Host)
.Replace("{db}", Args.Database)
.Replace("{user}", Args.User)
.Replace("{password}", Args.Password);
}
private bool IsMysql()
{
return Args.Target == "mysql";
}
}
}
|
mit
|
C#
|
8400e8ca7c32ce44a0b8051311bec2cc6f80f138
|
Add verbose option for tests
|
bradyholt/cron-expression-descriptor,bradyholt/cron-expression-descriptor
|
test/support/BaseTestFormats.cs
|
test/support/BaseTestFormats.cs
|
using Xunit;
using System.Globalization;
using System.Threading;
namespace CronExpressionDescriptor.Test.Support
{
public abstract class BaseTestFormats
{
protected virtual string GetLocale()
{
return "en-US";
}
protected string GetDescription(string expression, bool verbose = false)
{
return GetDescription(expression, new Options() { Verbose = verbose });
}
protected string GetDescription(string expression, Options options)
{
options.Locale = this.GetLocale();
return ExpressionDescriptor.GetDescription(expression, options);
}
}
}
|
using Xunit;
using System.Globalization;
using System.Threading;
namespace CronExpressionDescriptor.Test.Support
{
public abstract class BaseTestFormats
{
protected virtual string GetLocale()
{
return "en-US";
}
protected string GetDescription(string expression)
{
return GetDescription(expression, new Options());
}
protected string GetDescription(string expression, Options options)
{
options.Locale = this.GetLocale();
return ExpressionDescriptor.GetDescription(expression, options);
}
}
}
|
mit
|
C#
|
1fc8e51d6397055679a3e532988cb6081ba88c81
|
Update TrackCamera
|
bunashibu/kikan
|
Assets/Scripts/Player/TrackCamera.cs
|
Assets/Scripts/Player/TrackCamera.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Bunashibu.Kikan {
public class TrackCamera : MonoBehaviour {
void Start() {
transform.position = transform.position + _positionOffset;
}
void Update() {
Vector3 trackPosition = _trackObj.transform.position + _positionOffset;
if (transform.position != trackPosition)
InterpolateTo(trackPosition);
}
public void Init(GameObject trackObj) {
_trackObj = trackObj;
}
private void InterpolateTo(Vector3 destination) {
Vector3 nextPosition = transform.position * 0.98f + destination * 0.02f;
transform.position = nextPosition;
}
[SerializeField] private Vector3 _positionOffset;
private GameObject _trackObj;
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Bunashibu.Kikan {
public class TrackCamera : MonoBehaviour {
void Start() {
transform.position = transform.position + _positionOffset;
_destination = new Vector3(0, 0, 0);
}
void Update() {
Vector3 trackPosition = _trackObj.transform.position + _positionOffset;
if (transform.position != trackPosition)
InterpolateTo(trackPosition);
else
_elapsedTime = 0;
}
public void Init(GameObject trackObj) {
_trackObj = trackObj;
}
private void InterpolateTo(Vector3 destination) {
if (_destination != destination)
_elapsedTime = 0;
_destination = destination;
_elapsedTime += Time.deltaTime;
float t = _elapsedTime / 3.0f;
if (t > 1.0f)
t = 1.0f;
float ratio = t * t * (3.0f - 2.0f * t);
Vector3 nextPosition = transform.position * (1.0f - ratio) + destination * ratio;
transform.position = nextPosition;
}
[SerializeField] private Vector3 _positionOffset;
private GameObject _trackObj;
private Vector3 _destination;
private float _elapsedTime;
}
}
|
mit
|
C#
|
96d2255df347e0ac33aa4ed5d6f2ee3be22c773c
|
remove invalid test
|
mono/ServiceStack.Text,NServiceKit/NServiceKit.Text,gerryhigh/ServiceStack.Text,NServiceKit/NServiceKit.Text,gerryhigh/ServiceStack.Text,mono/ServiceStack.Text
|
tests/ServiceStack.Text.Tests/JsonObjectTests.cs
|
tests/ServiceStack.Text.Tests/JsonObjectTests.cs
|
using NUnit.Framework;
namespace ServiceStack.Text.Tests
{
[TestFixture]
public class JsonObjectTests
{
private const string JsonCentroid = @"{""place"":{ ""woeid"":12345, ""placeTypeName"":""St\\ate"" } }";
[Test]
public void Can_dynamically_parse_JSON_with_escape_chars()
{
var placeTypeName = JsonObject.Parse(JsonCentroid).Object("place").Get("placeTypeName");
Assert.That(placeTypeName, Is.EqualTo("St\\ate"));
placeTypeName = JsonObject.Parse(JsonCentroid).Object("place").Get<string>("placeTypeName");
Assert.That(placeTypeName, Is.EqualTo("St\\ate"));
}
}
}
|
using NUnit.Framework;
namespace ServiceStack.Text.Tests
{
[TestFixture]
public class JsonObjectTests
{
private const string JsonCentroid = @"{""place"":{ ""woeid"":12345, ""placeTypeName"":""St\\ate"" } }";
[Test]
public void Can_dynamically_parse_JSON_with_escape_chars()
{
var placeTypeName = JsonObject.Parse(JsonCentroid).Object("place").Get("placeTypeName");
Assert.That(placeTypeName, Is.EqualTo("St\\ate"));
placeTypeName = JsonObject.Parse(JsonCentroid).Object("place").Get<string>("placeTypeName");
Assert.That(placeTypeName, Is.EqualTo("St\\ate"));
}
[Test]
public void Then_should_parse_escaped_json()
{
var json = "\"obj\":\"{\\\"key\\\":\\\"value\\\"}";
Assert.DoesNotThrow(() => JsonObject.Parse(json));
}
}
}
|
bsd-3-clause
|
C#
|
e60eaa3b8e8d149f354aac54fdd16d8833d8e569
|
add 'public' to struct score at GameManager
|
edamiani/Aether,edamiani/Aether
|
Assets/Code/GameManager.cs
|
Assets/Code/GameManager.cs
|
using UnityEngine;
using System.Collections;
public class GameManager : MonoBehaviour {
public int test;
public static GameManager Instance;
public struct Score
{
int air;
int earth;
int fire;
int water;
}
public enum ElementalType : int
{
Air = 0,
Earth = 1,
Fire = 2,
Water = 3,
Aether = 4,
None
}
public ElementalType initialElement { get { return mInitialElement; } set { mInitialElement = value; } }
public Score score { get { return mScore; } }
private ElementalType mInitialElement;
private Score mScore;
// Use this for initialization
void Awake ()
{
if(Instance == null)
{
//If I am the first instance, make me the Singleton
Instance = this;
DontDestroyOnLoad(this);
}
else
{
//If a Singleton already exists and you find
//another reference in scene, destroy it!
if(this != Instance)
{
Destroy(this.gameObject);
}
}
}
// Update is called once per frame
void Update ()
{
}
public void LoadMiniGame(ElementalType game1, ElementalType game2 = ElementalType.None)
{
}
}
|
using UnityEngine;
using System.Collections;
public class GameManager : MonoBehaviour {
public int test;
public static GameManager Instance;
struct Score
{
int air;
int earth;
int fire;
int water;
}
public enum ElementalType : int
{
Air = 0,
Earth = 1,
Fire = 2,
Water = 3,
Aether = 4,
None
}
public ElementalType initialElement { get { return mInitialElement; } set { mInitialElement = value; } }
public Score score { get { return mScore; } }
private ElementalType mInitialElement;
private Score mScore;
// Use this for initialization
void Awake ()
{
if(Instance == null)
{
//If I am the first instance, make me the Singleton
Instance = this;
DontDestroyOnLoad(this);
}
else
{
//If a Singleton already exists and you find
//another reference in scene, destroy it!
if(this != Instance)
{
Destroy(this.gameObject);
}
}
}
// Update is called once per frame
void Update ()
{
}
public void LoadMiniGame(ElementalType game1, ElementalType game2 = ElementalType.None)
{
}
}
|
mit
|
C#
|
e56e017f55dd049cf538dcb597067944916e6b5d
|
Update Tests.cs
|
ic16b055/oom
|
tasks/Task3/Task3/Tests.cs
|
tasks/Task3/Task3/Tests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Task3;
namespace Tests
{
[TestFixture]
public class ComputerTests
{
[Test]
public void CanCreatComputer()
{
var x = new Computer("Asus", "Zenbook UX330UA", 7, 1200);
Assert.IsTrue(x.Company == "Asus");
Assert.IsTrue(x.Model == "Zenbook UX330UA");
Assert.IsTrue(x.Pieces == 7);
Assert.IsTrue(x.Price == 1200);
}
[Test]
public void CannotCreateCompanyWithEmptyTitle()
{
var x = new Computer(null, "xxx", 0, 0);
}
[Test]
public void CannotCreateModelWithEmptyTitle()
{
var x = new Computer("xxx", null, 0, 0);
}
[Test]
public void CannotCreatePiecesGreatherThan99()
{
var x = new Computer("xxx", "xxx", 100, 0);
}
[Test]
public void CannotCreatePriceNotInRange()
{
var lowestPrice = new Computer("xxx", "xxx", 0, -5);
var highestPrice = new Computer("xxx", "xxx", 0, 100000);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Task3;
namespace Tests
{
[TestFixture]
public class ComputerTests
{
[Test]
public void CanCreatComputer()
{
var x = new Computer("Asus", "Zenbook UX330UA", 7, 1200);
Assert.IsTrue(x.Company == "Asus");
Assert.IsTrue(x.Model == "Zenbook UX330UA");
Assert.IsTrue(x.Pieces == 7);
Assert.IsTrue(x.Price == 1200);
}
[Test]
public void CannotCreateCompanyWithEmptyTitle()
{
var x = new Computer(null, "xxx", 0, 0);
}
[Test]
public void CannotCreateModelWithEmptyTitle()
{
var x = new Computer("xxx", null, 0, 0);
}
[Test]
public void CannotCreatePiecesGreatherThan99()
{
var x = new Computer("xxx", "xxx", 100, 0);
}
[Test]
public void CannotCreatePriceNotInRange()
{
var lowestPrice = new Computer("xxx", "xxx", 0, -5);
var highestPrice = new Computer("xxx", "xxx", 0, 100000);
}
}
}
|
mit
|
C#
|
9cdfadd89d198b7780ca921e5b1062048f31ccc8
|
Use only ControllerEventHandler in AuditTarget.
|
OSSIndex/winaudit,OSSIndex/DevAudit,OSSIndex/DevAudit
|
DevAudit.AuditLibrary/AuditTarget.cs
|
DevAudit.AuditLibrary/AuditTarget.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DevAudit.AuditLibrary
{
public abstract class AuditTarget
{
#region Events
protected event EventHandler<EnvironmentEventArgs> HostEnvironmentMessageHandler;
protected event EventHandler<EnvironmentEventArgs> AuditEnvironmentMessageHandler;
protected event EventHandler<EnvironmentEventArgs> ControllerMessageHandler;
#endregion
#region Public properties
public string Id { get; protected set; }
public string Label { get; protected set; }
public Dictionary<string, object> AuditOptions { get; set; } = new Dictionary<string, object>();
public AuditEnvironment HostEnvironment { get; protected set; }
public AuditEnvironment AuditEnvironment { get; protected set; }
#endregion
#region Constructors
public AuditTarget(Dictionary<string, object> audit_options, EventHandler<EnvironmentEventArgs> controller_message_handler = null)
{
if (ReferenceEquals(audit_options, null)) throw new ArgumentNullException("audit_options");
this.AuditOptions = audit_options;
this.ControllerMessageHandler = controller_message_handler;
this.HostEnvironmentMessageHandler = AuditTarget_HostEnvironmentMessageHandler;
this.HostEnvironment = new LocalEnvironment(this.HostEnvironmentMessageHandler);
if (this.AuditOptions.Keys.Contains("RemoteHost"))
{
if (this.AuditOptions.Keys.Contains("RemoteUser") && this.AuditOptions.Keys.Contains("RemotePass"))
{
this.AuditEnvironment = new SshEnvironment(this.HostEnvironmentMessageHandler, (string)this.AuditOptions["RemoteHost"],
(string)this.AuditOptions["RemoteUser"], this.AuditOptions["RemotePass"]);
}
}
}
private void AuditTarget_HostEnvironmentMessageHandler(object sender, EnvironmentEventArgs e)
{
e.Message = string.Format("Host environment message: ", e.Message);
this.ControllerMessageHandler.Invoke(sender, e);
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DevAudit.AuditLibrary
{
public abstract class AuditTarget
{
#region Events
public event EventHandler<EnvironmentEventArgs> HostEnvironmentMessageHandler;
public event EventHandler<EnvironmentEventArgs> AuditEnvironmentMessageHandler;
#endregion
#region Public properties
public string Id { get; protected set; }
public string Label { get; protected set; }
public Dictionary<string, object> AuditOptions { get; set; } = new Dictionary<string, object>();
public AuditEnvironment HostEnvironment { get; protected set; }
public AuditEnvironment AuditEnvironment { get; protected set; }
#endregion
#region Constructors
public AuditTarget(Dictionary<string, object> audit_options, EventHandler<EnvironmentEventArgs> message_handler = null)
{
this.HostEnvironmentMessageHandler = message_handler;
if (ReferenceEquals(audit_options, null)) throw new ArgumentNullException("audit_options");
this.AuditOptions = audit_options;
this.HostEnvironment = new LocalEnvironment(this.HostEnvironmentMessageHandler);
if (this.AuditOptions.Keys.Contains("RemoteHost"))
{
if (this.AuditOptions.Keys.Contains("RemoteUser") && this.AuditOptions.Keys.Contains("RemotePass"))
{
this.AuditEnvironment = new SshEnvironment(this.HostEnvironmentMessageHandler, (string)this.AuditOptions["RemoteHost"],
(string)this.AuditOptions["RemoteUser"], this.AuditOptions["RemotePass"]);
}
}
}
#endregion
}
}
|
bsd-3-clause
|
C#
|
dfe43a2dfabde15a8c7226fb8abc1dd08d0144ab
|
Fix issue with headers
|
DotNetRu/App,DotNetRu/App
|
DotNetRu.Azure/GitHubHookFunction.cs
|
DotNetRu.Azure/GitHubHookFunction.cs
|
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System.Net.Http;
namespace DotNetRu.Azure
{
public static class GitHubHookFunction
{
[FunctionName("update")]
public static IActionResult Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
ILogger logger)
{
var httpClient = new HttpClient();
var realmNameHeaderValue = req.Headers["RealmName"].ToString();
if (!string.IsNullOrEmpty(realmNameHeaderValue))
{
httpClient.DefaultRequestHeaders.Add("RealmName", realmNameHeaderValue);
}
httpClient.PostAsync("https://dotnetruapp.azurewebsites.net/api/realmUpdate", new StringContent(""));
return new OkResult();
}
}
}
|
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System.Net.Http;
namespace DotNetRu.Azure
{
public static class GitHubHookFunction
{
[FunctionName("update")]
public static IActionResult Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
ILogger logger)
{
var httpClient = new HttpClient();
foreach (var header in req.Headers)
{
httpClient.DefaultRequestHeaders.Add(header.Key, header.Value.ToArray());
}
httpClient.PostAsync("https://dotnetruapp.azurewebsites.net/api/realmUpdate", new StringContent(""));
return new OkResult();
}
}
}
|
mit
|
C#
|
0d8039367018444eb925d046ddd81e8d57e8ff19
|
enable webapi cors.
|
liyuan-rey/identity,liyuan-rey/identity,liyuan-rey/identity
|
src/server-core/Startup.cs
|
src/server-core/Startup.cs
|
using System;
using System.Web.Http;
using IdentityNS.Server.Core.OAuth;
using Microsoft.Owin;
using Microsoft.Owin.Diagnostics;
using Microsoft.Owin.Security.OAuth;
using Owin;
[assembly: OwinStartup(typeof (IdentityNS.Server.Core.Startup))]
namespace IdentityNS.Server.Core
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
#if DEBUG
app.UseErrorPage(new ErrorPageOptions
{
//Shows the OWIN environment dictionary keys and values.
//This detail is enabled by default if you are running your app from VS unless disabled in code.
ShowEnvironment = true,
//Hides cookie details
ShowCookies = true,
//Shows the lines of code throwing this exception.
//This detail is enabled by default if you are running your app from VS unless disabled in code.
ShowSourceCode = true
});
//for test ErrorPage
//app.Run(async context =>
//{
// throw new Exception("UseErrorPage() demo");
// await context.Response.WriteAsync("Error page demo");
//});
app.UseWelcomePage("/"); // for test purpose only
#endif
ConfigureOAuth(app);
var config = new HttpConfiguration();
WebApiConfig.Register(config);
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
app.UseWebApi(config);
}
public void ConfigureOAuth(IAppBuilder app)
{
OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
Provider = new SimpleAuthorizationServerProvider()
};
// Token Generation
app.UseOAuthAuthorizationServer(OAuthServerOptions);
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
}
}
}
|
using System;
using System.Web.Http;
using IdentityNS.Server.Core.OAuth;
using Microsoft.Owin;
using Microsoft.Owin.Diagnostics;
using Microsoft.Owin.Security.OAuth;
using Owin;
[assembly: OwinStartup(typeof (IdentityNS.Server.Core.Startup))]
namespace IdentityNS.Server.Core
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
#if DEBUG
app.UseErrorPage(new ErrorPageOptions
{
//Shows the OWIN environment dictionary keys and values.
//This detail is enabled by default if you are running your app from VS unless disabled in code.
ShowEnvironment = true,
//Hides cookie details
ShowCookies = true,
//Shows the lines of code throwing this exception.
//This detail is enabled by default if you are running your app from VS unless disabled in code.
ShowSourceCode = true
});
//for test ErrorPage
//app.Run(async context =>
//{
// throw new Exception("UseErrorPage() demo");
// await context.Response.WriteAsync("Error page demo");
//});
app.UseWelcomePage("/"); // for test purpose only
#endif
ConfigureOAuth(app);
var config = new HttpConfiguration();
WebApiConfig.Register(config);
app.UseWebApi(config);
}
public void ConfigureOAuth(IAppBuilder app)
{
OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
Provider = new SimpleAuthorizationServerProvider()
};
// Token Generation
app.UseOAuthAuthorizationServer(OAuthServerOptions);
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
}
}
}
|
mit
|
C#
|
1699daaf7f4fe38ac0395cc0a94d3a3c2de1c597
|
Make DrawableRank safer.
|
UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,nyaamara/osu,peppy/osu,johnneijzen/osu,naoey/osu,Damnae/osu,osu-RP/osu-RP,DrabWeb/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,naoey/osu,Drezi126/osu,johnneijzen/osu,peppy/osu-new,Nabile-Rahmani/osu,peppy/osu,2yangk23/osu,Frontear/osuKyzer,ppy/osu,ppy/osu,smoogipoo/osu,naoey/osu,2yangk23/osu,EVAST9919/osu,DrabWeb/osu,DrabWeb/osu,ZLima12/osu,NeoAdonis/osu,ppy/osu,EVAST9919/osu,ZLima12/osu,RedNesto/osu,UselessToucan/osu,tacchinotacchi/osu
|
osu.Game/Screens/Select/Leaderboards/DrawableRank.cs
|
osu.Game/Screens/Select/Leaderboards/DrawableRank.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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Modes;
using osu.Framework.Extensions;
namespace osu.Game.Screens.Select.Leaderboards
{
public class DrawableRank : Container
{
private Sprite sprite;
public ScoreRank Rank { get; private set; }
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
sprite.Texture = textures.Get($@"Badges/ScoreRanks/{Rank.GetDescription()}");
}
public DrawableRank(ScoreRank rank)
{
Rank = rank;
Children = new Drawable[]
{
sprite = new Sprite
{
RelativeSizeAxes = Axes.Both,
},
};
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Modes;
using osu.Framework.Extensions;
namespace osu.Game.Screens.Select.Leaderboards
{
public class DrawableRank : Container
{
private Sprite sprite;
private TextureStore textures;
private ScoreRank rank;
public ScoreRank Rank
{
get { return rank; }
set
{
if (value == rank) return;
rank = value;
sprite.Texture = textures.Get($@"Badges/ScoreRanks/{rank.GetDescription()}");
}
}
[BackgroundDependencyLoader]
private void load(TextureStore ts)
{
textures = ts;
sprite.Texture = textures.Get($@"Badges/ScoreRanks/{rank.GetDescription()}");
}
public DrawableRank(ScoreRank rank)
{
this.rank = rank;
Children = new Drawable[]
{
sprite = new Sprite
{
RelativeSizeAxes = Axes.Both,
},
};
}
}
}
|
mit
|
C#
|
247c87a0827b3ff99346f3b72a4986554a5ff110
|
Update coordinator invite page
|
CS297Sp16/LCC_Co-op_Site,CS297Sp16/LCC_Co-op_Site,CS297Sp16/LCC_Co-op_Site
|
Coop_Listing_Site/Coop_Listing_Site/Views/ControlPanel/InviteCoordinator.cshtml
|
Coop_Listing_Site/Coop_Listing_Site/Views/ControlPanel/InviteCoordinator.cshtml
|
@model Coop_Listing_Site.Models.RegisterInvite
@{
ViewBag.Title = "Invite Coordinator";
Layout = "~/Views/Shared/_CP_Layout.cshtml";
}
<h2>Invite Coordinator</h2>
<p>
This page is for inviting coordinators to the website. Please enter their email in the field below, and click Invite.
</p>
@if (ViewBag.SMTPReady != null && ViewBag.SMTPReady)
{
if (ViewBag.ReturnMessage != null)
{
<p>@ViewBag.ReturnMessage</p>
}
using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Invite" class="btn btn-default" />
</div>
</div>
</div>
}
}
else
{
<p>The SMTP information is not properly set. You may want to go set it before attempting to send out invitiation emails.</p>
}
|
@model Coop_Listing_Site.Models.RegisterInvite
@{
ViewBag.Title = "Invite Coordinator";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Invite Student</h2>
<p>
This page is for inviting coordinators to the website. Please enter their email in the field below, and click Invite.
</p>
@if (ViewBag.SMTPReady != null && ViewBag.SMTPReady)
{
if (ViewBag.ReturnMessage != null)
{
<p>@ViewBag.ReturnMessage</p>
}
using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Invite" class="btn btn-default" />
</div>
</div>
</div>
}
}
else
{
<p>The SMTP information is not properly set. You may want to go set it before attempting to send out invitiation emails.</p>
}
|
mit
|
C#
|
7907b2bde9cc7056d0fd1e47128f9b13dfc18f5b
|
Revert "Tried to Figure Out Button: Failed"
|
aarya123/IshanGame
|
Assets/Scripts/Trampoline.cs
|
Assets/Scripts/Trampoline.cs
|
using UnityEngine;
using System.Collections;
public class Trampoline : MonoBehaviour {
public float velocityX;
public float velocityY;
void OnTriggerStay2D(Collider2D other) {
if (other.gameObject.tag == "Player") {
other.rigidbody2D.AddForce(new Vector2(velocityX,velocityY));
//other.rigidbody2D.velocity+=new Vector2(velocityX,velocityY);
}
}
}
|
using UnityEngine;
using System.Collections;
public class Trampoline : MonoBehaviour {
public float velocityX;
public float velocityY;
public Input button;
void OnTriggerStay2D(Collider2D other) {
if (other.gameObject.tag == "Player") {
if(button){
other.rigidbody2D.AddForce(new Vector2(velocityX,velocityY));
//other.rigidbody2D.velocity+=new Vector2(velocityX,velocityY);
}
}
}
}
|
apache-2.0
|
C#
|
d20ff48abf36b1e1f3f500f93d24fec05a1393d4
|
Annotate correctly
|
mavasani/roslyn,bartdesmet/roslyn,weltkante/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,dotnet/roslyn,mavasani/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn
|
src/Compilers/CSharp/Portable/Syntax/InterpolationSyntax.cs
|
src/Compilers/CSharp/Portable/Syntax/InterpolationSyntax.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Microsoft.CodeAnalysis.CSharp
{
public partial class SyntaxFactory
{
public static InterpolationSyntax Interpolation(ExpressionSyntax expression)
=> Interpolation(Token(SyntaxKind.OpenBraceToken), expression, Token(SyntaxKind.CloseBraceToken));
public static InterpolationSyntax Interpolation(ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause)
=> Interpolation(Token(SyntaxKind.OpenBraceToken), expression, alignmentClause, formatClause, Token(SyntaxKind.CloseBraceToken));
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Microsoft.CodeAnalysis.CSharp
{
public partial class SyntaxFactory
{
public static InterpolationSyntax Interpolation(ExpressionSyntax expression)
=> Interpolation(Token(SyntaxKind.OpenBraceToken), expression, Token(SyntaxKind.CloseBraceToken));
public static InterpolationSyntax Interpolation(ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause)
=> Interpolation(Token(SyntaxKind.OpenBraceToken), expression, alignmentClause, formatClause, Token(SyntaxKind.CloseBraceToken));
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.