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 |
|---|---|---|---|---|---|---|---|---|
b6da9856896f76d13f470a6b42522e6dbca54793
|
Add dependency of CryptSvc to guest agent
|
xenserver/win-xenguestagent,xenserver/win-xenguestagent,kostaslamda/win-xenguestagent,kostaslamda/win-xenguestagent
|
src/xenguestagent/XenServiceInstaller.cs
|
src/xenguestagent/XenServiceInstaller.cs
|
/* Copyright (c) Citrix Systems Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;
namespace xenwinsvc
{
[RunInstaller(true)]
public class XenServiceInstaller : Installer
{
private ServiceProcessInstaller processInstaller;
private ServiceInstaller serviceInstaller;
public XenServiceInstaller()
{
processInstaller = new ServiceProcessInstaller();
serviceInstaller = new ServiceInstaller();
processInstaller.Account = ServiceAccount.LocalSystem;
serviceInstaller.StartType = ServiceStartMode.Automatic;
serviceInstaller.ServiceName = "Citrix Xen Guest Agent";
serviceInstaller.Description = "Monitors and provides various metrics to XenStore";
serviceInstaller.ServicesDependedOn = new string[] { "Winmgmt", "CryptSvc" };
Installers.Add(serviceInstaller);
Installers.Add(processInstaller);
}
private void InitializeComponent()
{
}
}
}
|
/* Copyright (c) Citrix Systems Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;
namespace xenwinsvc
{
[RunInstaller(true)]
public class XenServiceInstaller : Installer
{
private ServiceProcessInstaller processInstaller;
private ServiceInstaller serviceInstaller;
public XenServiceInstaller()
{
processInstaller = new ServiceProcessInstaller();
serviceInstaller = new ServiceInstaller();
processInstaller.Account = ServiceAccount.LocalSystem;
serviceInstaller.StartType = ServiceStartMode.Automatic;
serviceInstaller.ServiceName = "Citrix Xen Guest Agent";
serviceInstaller.Description = "Monitors and provides various metrics to XenStore";
serviceInstaller.ServicesDependedOn = new string[] { "Winmgmt" };
Installers.Add(serviceInstaller);
Installers.Add(processInstaller);
}
private void InitializeComponent()
{
}
}
}
|
bsd-2-clause
|
C#
|
857b3e232299f09522c83ecd6e651a557160865c
|
rewrite to use the plane for logic purposes
|
nferruzzi/xplode
|
Assets/Scripts/Spawner.cs
|
Assets/Scripts/Spawner.cs
|
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class Spawner : MonoBehaviour {
public float gameLevel = 5.0f;
public float sideSubdivision = 5.0f;
Vector3 bl, br, tl, tr;
void Start () {
CalcFrustumPlane ();
}
void CalcFrustumPlane () {
Camera ca = Camera.main;
Ray bottomLeftRay = ca.ViewportPointToRay(new Vector3(0, 0, 0));
Ray topLeftRay = ca.ViewportPointToRay(new Vector3(0, 1, 0));
Ray topRightRay = ca.ViewportPointToRay(new Vector3(1, 1, 0));
Ray bottomRightRay = ca.ViewportPointToRay(new Vector3(1, 0, 0));
Plane pl = new Plane (Vector3.up, new Vector3 (0, gameLevel, 0));
float bottomLeftDistance;
float topLeftDistance;
float bottomRightDistance;
float topRightDistance;
if (pl.Raycast (bottomLeftRay, out bottomLeftDistance)) {
bl = bottomLeftRay.GetPoint(bottomLeftDistance);
if (pl.Raycast (topLeftRay, out topLeftDistance)) {
tl = topLeftRay.GetPoint(topLeftDistance);
if (pl.Raycast (bottomRightRay, out bottomRightDistance)) {
br = bottomRightRay.GetPoint(bottomRightDistance);
if (pl.Raycast (topRightRay, out topRightDistance)) {
tr = topRightRay.GetPoint(topRightDistance);
}
}
}
}
}
void Update () {
}
void OnGUI() {
CalcFrustumPlane ();
}
void OnDrawGizmos() {
Gizmos.color = Color.green;
Gizmos.DrawLine (bl, br);
Gizmos.DrawLine (br, tr);
Gizmos.DrawLine (tr, tl);
Gizmos.DrawLine (tl, bl);
}
}
|
using UnityEngine;
using System.Collections;
public class Spawner : MonoBehaviour {
public float gameLevel = 5.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnDrawGizmos() {
Camera ca = Camera.main;
Ray bottomLeftRay = ca.ViewportPointToRay(new Vector3(0, 0, 0));
Ray topLeftRay = ca.ViewportPointToRay(new Vector3(0, 1, 0));
Ray topRightRay = ca.ViewportPointToRay(new Vector3(1, 1, 0));
Ray bottomRightRay = ca.ViewportPointToRay(new Vector3(1, 0, 0));
Plane pl = new Plane (Vector3.up, new Vector3 (0, gameLevel, 0));
float bottomLeftDistance;
float topLeftDistance;
float bottomRightDistance;
float topRightDistance;
if (pl.Raycast (bottomLeftRay, out bottomLeftDistance)) {
Vector3 bl = bottomLeftRay.GetPoint(bottomLeftDistance);
if (pl.Raycast (topLeftRay, out topLeftDistance)) {
Vector3 tl = topLeftRay.GetPoint(topLeftDistance);
if (pl.Raycast (bottomRightRay, out bottomRightDistance)) {
Vector3 br = bottomRightRay.GetPoint(bottomRightDistance);
if (pl.Raycast (topRightRay, out topRightDistance)) {
Vector3 tr = topRightRay.GetPoint(topRightDistance);
Gizmos.color = Color.green;
Gizmos.DrawLine (bl, br);
Gizmos.DrawLine (br, tr);
Gizmos.DrawLine (tr, tl);
Gizmos.DrawLine (tl, bl);
}
}
}
}
}
}
|
mit
|
C#
|
aed29a8e21da7acdfcf5d186b8678f51063dbe83
|
Fix output check.
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Core/Tooling/ProcessExtensions.cs
|
source/Nuke.Core/Tooling/ProcessExtensions.cs
|
// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Nuke.Core.Utilities;
namespace Nuke.Core.Tooling
{
[PublicAPI]
[DebuggerStepThrough]
[DebuggerNonUserCode]
public static class ProcessExtensions
{
[AssertionMethod]
public static void AssertWaitForExit ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process)
{
ControlFlow.Assert(process != null && process.WaitForExit(), "process != null && process.WaitForExit()");
}
[AssertionMethod]
public static void AssertZeroExitCode ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process)
{
process.AssertWaitForExit();
ControlFlow.Assert(process.ExitCode == 0,
$"Process '{Path.GetFileName(process.StartInfo.FileName)}' exited with code {process.ExitCode}. Please verify the invocation.");
}
public static IEnumerable<Output> EnsureOnlyStd (this IEnumerable<Output> output)
{
var outputList = output.ToList();
foreach (var o in outputList)
{
ControlFlow.Assert(o.Type == OutputType.Std, "o.Type == OutputType.Std");
}
return outputList;
}
}
}
|
// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Nuke.Core.Utilities;
namespace Nuke.Core.Tooling
{
[PublicAPI]
[DebuggerStepThrough]
[DebuggerNonUserCode]
public static class ProcessExtensions
{
[AssertionMethod]
public static void AssertWaitForExit ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process)
{
ControlFlow.Assert(process != null && process.WaitForExit(), "process != null && process.WaitForExit()");
}
[AssertionMethod]
public static void AssertZeroExitCode ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process)
{
process.AssertWaitForExit();
ControlFlow.Assert(process.ExitCode == 0,
$"Process '{Path.GetFileName(process.StartInfo.FileName)}' exited with code {process.ExitCode}. Please verify the invocation.");
}
public static IEnumerable<Output> EnsureOnlyStd (this IEnumerable<Output> output)
{
foreach (var o in output)
{
ControlFlow.Assert(o.Type == OutputType.Std, "o.Type == OutputType.Std");
yield return o;
}
}
}
}
|
mit
|
C#
|
9e552d85a3563c8e2e63028d07a03518bbfb3ae1
|
tidy up
|
CiBuildOrg/WebApi-Boilerplate,CiBuildOrg/WebApi-Boilerplate,CiBuildOrg/WebApi-Boilerplate
|
src/App/App.Api/Controllers/MeController.cs
|
src/App/App.Api/Controllers/MeController.cs
|
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
using App.Services.Contracts;
using App.Validation.Infrastructure;
namespace App.Api.Controllers
{
/// <summary>
/// Client
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
[ValidateViewModel]
[RoutePrefix("api/me")]
public class MeController : BaseApiController
{
private readonly IUserService _userService;
public MeController(IUserService userService)
{
_userService = userService;
}
[HttpGet]
public HttpResponseMessage Get()
{
return Request.CreateResponse(HttpStatusCode.OK, _userService.GetUser(CurrentUser.User.Id));
}
}
}
|
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
using App.Services.Contracts;
using App.Validation.Infrastructure;
namespace App.Api.Controllers
{
/// <summary>
/// Client
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
[ValidateViewModel]
//[Authorize(Roles = "SuperAdmin")]
[RoutePrefix("api/me")]
public class MeController : BaseApiController
{
private readonly IUserService _userService;
public MeController(IUserService userService)
{
_userService = userService;
}
[HttpGet]
public HttpResponseMessage Get()
{
var user = CurrentUser;
var id = user.User.Id;
return Request.CreateResponse(HttpStatusCode.OK, _userService.GetUser(id));
}
}
}
|
mit
|
C#
|
d7f788e17bdd120937501b72d67943fa72373560
|
Update InputDateType.cs (#34651)
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Components/Web/src/Forms/InputDateType.cs
|
src/Components/Web/src/Forms/InputDateType.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.AspNetCore.Components.Forms
{
/// <summary>
/// Represents the type of HTML input to be rendered by a <see cref="InputDate{TValue}"/> component.
/// </summary>
public enum InputDateType
{
/// <summary>
/// Lets the user enter a date.
/// </summary>
Date,
/// <summary>
/// Lets the user enter both a date and a time.
/// </summary>
DateTimeLocal,
/// <summary>
/// Lets the user enter a month and a year.
/// </summary>
Month,
/// <summary>
/// Lets the user enter a time.
/// </summary>
Time,
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Components.Forms
{
/// <summary>
/// Represents the type of HTML input to be rendered by a <see cref="InputDate{TValue}"/> component.
/// </summary>
public enum InputDateType
{
/// <summary>
/// Lets the user enter a date.
/// </summary>
Date,
/// <summary>
/// Lets the user enter both a date and a time.
/// </summary>
DateTimeLocal,
/// <summary>
/// Lets the user enter a month and a year.
/// </summary>
Month,
/// <summary>
/// Lets the user enter a time.
/// </summary>
Time,
}
}
|
apache-2.0
|
C#
|
bfb2cd30267b57d5d35371e9b200dd370c0900f0
|
Fix nullguard check
|
github/VisualStudio,github/VisualStudio,github/VisualStudio
|
src/GitHub.Extensions/EnumerableExtensions.cs
|
src/GitHub.Extensions/EnumerableExtensions.cs
|
using NullGuard;
using System;
using System.Collections.Generic;
using System.Linq;
namespace GitHub
{
public static class EnumerableExtensions
{
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
{
foreach (var item in source) action(item);
}
public static IEnumerable<TSource> Except<TSource>(
this IEnumerable<TSource> enumerable,
IEnumerable<TSource> second,
Func<TSource, TSource, int> comparer)
{
return enumerable.Except(second, new Collections.LambdaComparer<TSource>(comparer));
}
}
public static class StackExtensions
{
[return: AllowNull]
public static T TryPeek<T>(this Stack<T> stack) where T : class
{
if (stack.Count > 0)
return stack.Peek();
return default(T);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace GitHub
{
public static class EnumerableExtensions
{
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
{
foreach (var item in source) action(item);
}
public static IEnumerable<TSource> Except<TSource>(
this IEnumerable<TSource> enumerable,
IEnumerable<TSource> second,
Func<TSource, TSource, int> comparer)
{
return enumerable.Except(second, new Collections.LambdaComparer<TSource>(comparer));
}
}
public static class StackExtensions
{
public static T TryPeek<T>(this Stack<T> stack) where T : class
{
if (stack.Count > 0)
return stack.Peek();
return default(T);
}
}
}
|
mit
|
C#
|
fe5589ed16e5c229990d5c12b28d0165f4001d4b
|
Replace reflection to call API.
|
zclmoon/aspnetboilerplate,zclmoon/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ilyhacker/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,beratcarsi/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,beratcarsi/aspnetboilerplate,carldai0106/aspnetboilerplate,verdentk/aspnetboilerplate,andmattia/aspnetboilerplate,carldai0106/aspnetboilerplate,virtualcca/aspnetboilerplate,andmattia/aspnetboilerplate,Nongzhsh/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,zclmoon/aspnetboilerplate,ryancyq/aspnetboilerplate,andmattia/aspnetboilerplate,ilyhacker/aspnetboilerplate,virtualcca/aspnetboilerplate,carldai0106/aspnetboilerplate,Nongzhsh/aspnetboilerplate,virtualcca/aspnetboilerplate,Nongzhsh/aspnetboilerplate,verdentk/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,beratcarsi/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate
|
src/Abp/Reflection/ProxyHelper.cs
|
src/Abp/Reflection/ProxyHelper.cs
|
using Castle.DynamicProxy;
namespace Abp.Reflection
{
public static class ProxyHelper
{
/// <summary>
/// Returns dynamic proxy target object if this is a proxied object, otherwise returns the given object.
/// </summary>
public static object UnProxy(object obj)
{
return ProxyUtil.GetUnproxiedInstance(obj);
}
}
}
|
using System.Linq;
using System.Reflection;
namespace Abp.Reflection
{
public static class ProxyHelper
{
/// <summary>
/// Returns dynamic proxy target object if this is a proxied object, otherwise returns the given object.
/// </summary>
public static object UnProxy(object obj)
{
if (obj.GetType().Namespace != "Castle.Proxies")
{
return obj;
}
var targetField = obj.GetType()
.GetFields(BindingFlags.Instance | BindingFlags.NonPublic)
.FirstOrDefault(f => f.Name == "__target");
if (targetField == null)
{
return obj;
}
return targetField.GetValue(obj);
}
}
}
|
mit
|
C#
|
2fc3bcb9655db0c62a89baea5d627ef38e46f063
|
Throw exception if not Windows.
|
patriksvensson/Cake.Unity
|
src/Cake.Unity/UnityExtensions.cs
|
src/Cake.Unity/UnityExtensions.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Cake.Core;
using Cake.Core.Annotations;
using Cake.Core.IO;
using Cake.Unity.Platforms;
using static Cake.Core.PlatformFamily;
namespace Cake.Unity
{
[CakeAliasCategory("Unity")]
public static class UnityExtensions
{
[CakeMethodAlias]
[CakeAliasCategory("Build")]
[CakeNamespaceImport("Cake.Unity.Platforms")]
public static void UnityBuild(this ICakeContext context, DirectoryPath projectPath, UnityPlatform platform)
{
var tool = new UnityRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
tool.Run(context, projectPath, platform);
}
[CakeMethodAlias]
[CakeAliasCategory("Build")]
public static UnityEditorDescriptor FindUnityEditor(this ICakeContext context, int year) =>
Enumerable.FirstOrDefault
(
from editor in context.FindUnityEditors()
let version = editor.Version
where
version.Year == year
orderby
version.Stream descending,
version.Update descending
select editor
);
[CakeMethodAlias]
[CakeAliasCategory("Build")]
public static UnityEditorDescriptor FindUnityEditor(this ICakeContext context, int year, int stream) =>
Enumerable.FirstOrDefault
(
from editor in context.FindUnityEditors()
let version = editor.Version
where
version.Year == year &&
version.Stream == stream
orderby
version.Update descending
select editor
);
[CakeMethodAlias]
[CakeAliasCategory("Build")]
public static IReadOnlyCollection<UnityEditorDescriptor> FindUnityEditors(this ICakeContext context) =>
context.Environment.Platform.Family != Windows
? throw new NotSupportedException("Cannot locate Unity Editors. Only Windows platform is supported.")
: new SeekerOfEditors(context.Environment, context.Globber, context.Log)
.Seek();
}
}
|
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Cake.Core;
using Cake.Core.Annotations;
using Cake.Core.IO;
using Cake.Unity.Platforms;
namespace Cake.Unity
{
[CakeAliasCategory("Unity")]
public static class UnityExtensions
{
[CakeMethodAlias]
[CakeAliasCategory("Build")]
[CakeNamespaceImport("Cake.Unity.Platforms")]
public static void UnityBuild(this ICakeContext context, DirectoryPath projectPath, UnityPlatform platform)
{
var tool = new UnityRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
tool.Run(context, projectPath, platform);
}
[CakeMethodAlias]
[CakeAliasCategory("Build")]
public static UnityEditorDescriptor FindUnityEditor(this ICakeContext context, int year) =>
Enumerable.FirstOrDefault
(
from editor in context.FindUnityEditors()
let version = editor.Version
where
version.Year == year
orderby
version.Stream descending,
version.Update descending
select editor
);
[CakeMethodAlias]
[CakeAliasCategory("Build")]
public static UnityEditorDescriptor FindUnityEditor(this ICakeContext context, int year, int stream) =>
Enumerable.FirstOrDefault
(
from editor in context.FindUnityEditors()
let version = editor.Version
where
version.Year == year &&
version.Stream == stream
orderby
version.Update descending
select editor
);
[CakeMethodAlias]
[CakeAliasCategory("Build")]
public static IReadOnlyCollection<UnityEditorDescriptor> FindUnityEditors(this ICakeContext context) =>
new SeekerOfEditors(context.Environment, context.Globber, context.Log)
.Seek();
}
}
|
mit
|
C#
|
db1915cd5e36e2cc35c21aa2b34a33e95406d7d8
|
Add xmlenumattribute to indextype.cs
|
Ackara/Daterpillar
|
src/Daterpillar.Core/IndexType.cs
|
src/Daterpillar.Core/IndexType.cs
|
using System.Xml.Serialization;
namespace Gigobyte.Daterpillar
{
/// <summary>
/// Database index type
/// </summary>
public enum IndexType
{
/// <summary>
/// A primary key.
/// </summary>
[XmlEnum]
Primary = 0,
/// <summary>
/// A index
/// </summary>
[XmlEnum]
Index = 1
}
}
|
namespace Gigobyte.Daterpillar
{
/// <summary>
/// Database index type
/// </summary>
public enum IndexType
{
/// <summary>
/// A primary key.
/// </summary>
Primary = 0,
/// <summary>
/// A index
/// </summary>
Index = 1
}
}
|
mit
|
C#
|
ab30b3e8e0006ebc31b413e633de75f6e8b2b5f1
|
add separator parameter to HostingEnvironments.Postfix()
|
yisoft-dotnet/framework
|
src/Yisoft.Framework/HostingEnvironments.cs
|
src/Yisoft.Framework/HostingEnvironments.cs
|
// ) *
// ( /( * ) ( ( `
// )\()) ( ` ) /( ( )\ )\))(
// ((_)\ )\ ( )(_)))\ ((((_)( ((_)()\
// __ ((_)((_) (_(_())((_) )\ _ )\ (_()((_)
// \ \ / / (_) |_ _|| __|(_)_\(_)| \/ |
// \ V / | | _ | | | _| / _ \ | |\/| |
// |_| |_|(_)|_| |___|/_/ \_\ |_| |_|
//
// This file is subject to the terms and conditions defined in
// file 'License.txt', which is part of this source code package.
//
// Copyright © Yi.TEAM. All rights reserved.
// -------------------------------------------------------------------------------
using System;
namespace Yisoft.Framework
{
public static class HostingEnvironments
{
public const string Local = "local";
public const string Development = "development";
public const string Test = "test";
public const string Staging = "staging";
public const string Production = "production";
public const string Demonstration = "demonstration";
public static string NormalizeEnvName(string envName, string defaultValue = Local)
{
if (string.IsNullOrWhiteSpace(envName)) return defaultValue ?? string.Empty;
return envName.ToLower();
}
public static string Postfix(string input, string envName, string hiddenValue = Local, string separator = "_")
{
if (input == null) throw new ArgumentNullException(nameof(input));
var suffix = NormalizeEnvName(envName, hiddenValue);
separator = string.IsNullOrEmpty(separator) ? "_" : separator;
suffix = suffix == hiddenValue ? string.Empty : separator + suffix;
return $"{input}{suffix}";
}
}
}
|
// ) *
// ( /( * ) ( ( `
// )\()) ( ` ) /( ( )\ )\))(
// ((_)\ )\ ( )(_)))\ ((((_)( ((_)()\
// __ ((_)((_) (_(_())((_) )\ _ )\ (_()((_)
// \ \ / / (_) |_ _|| __|(_)_\(_)| \/ |
// \ V / | | _ | | | _| / _ \ | |\/| |
// |_| |_|(_)|_| |___|/_/ \_\ |_| |_|
//
// This file is subject to the terms and conditions defined in
// file 'License.txt', which is part of this source code package.
//
// Copyright © Yi.TEAM. All rights reserved.
// -------------------------------------------------------------------------------
using System;
namespace Yisoft.Framework
{
public static class HostingEnvironments
{
public const string Local = "local";
public const string Development = "development";
public const string Test = "test";
public const string Staging = "staging";
public const string Production = "production";
public const string Demonstration = "demonstration";
public static string NormalizeEnvName(string envName, string defaultValue = Local)
{
if (string.IsNullOrWhiteSpace(envName)) return defaultValue ?? string.Empty;
return envName.ToLower();
}
public static string Postfix(string input, string envName, string hiddenValue = Local)
{
if (input == null) throw new ArgumentNullException(nameof(input));
var suffix = NormalizeEnvName(envName, hiddenValue);
suffix = suffix == hiddenValue ? string.Empty : "_" + suffix;
return $"{input}{suffix}";
}
}
}
|
apache-2.0
|
C#
|
6fb941289bcd7aa4300c9496bca29cebc51fe776
|
Change the default font for the header.
|
AlexGhiondea/DrawIt
|
src/DrawIt/Helpers/FontHelpers.cs
|
src/DrawIt/Helpers/FontHelpers.cs
|
using System;
using System.Drawing;
namespace DrawIt
{
public static class FontHelpers
{
public static Font GetHeaderFont()
{
float fontSize = Configuration.GetSettingOrDefault<float>(Constants.Application.Header.FontSize, float.TryParse, Constants.Application.Defaults.HeaderTextSize);
string fontName = Configuration.GetSetting(Constants.Application.Header.FontName) ?? "Segoe Script";
FontStyle fontStyle = Configuration.GetSettingOrDefault<FontStyle>(Constants.Application.Header.FontStyle, Enum.TryParse<FontStyle>, FontStyle.Regular);
return new Font(fontName, fontSize, fontStyle);
}
}
}
|
using System;
using System.Drawing;
namespace DrawIt
{
public static class FontHelpers
{
public static Font GetHeaderFont()
{
float fontSize = Configuration.GetSettingOrDefault<float>(Constants.Application.Header.FontSize, float.TryParse, Constants.Application.Defaults.HeaderTextSize);
string fontName = Configuration.GetSetting(Constants.Application.Header.FontName) ?? "Calibri";
FontStyle fontStyle = Configuration.GetSettingOrDefault<FontStyle>(Constants.Application.Header.FontStyle, Enum.TryParse<FontStyle>, FontStyle.Regular);
return new Font(fontName, fontSize, fontStyle);
}
}
}
|
mit
|
C#
|
b0194e7c039292658cc382096f2b2ae0bba27ceb
|
Fix typo bug in SimpleProducer
|
HCanber/kafkaclient-net
|
src/KafkaClient/SimpleProducer.cs
|
src/KafkaClient/SimpleProducer.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Kafka.Client.Api;
using Kafka.Client.Exceptions;
namespace Kafka.Client
{
public class SimpleProducer : ProducerBase
{
public SimpleProducer(IKafkaClient client)
: base(client)
{
}
public ProducerResponseStatus Send(string topic, int partition, byte[] value, byte[] key = null)
{
IReadOnlyCollection<TopicAndPartitionValue<IEnumerable<IMessage>>> failedItems;
var responses = base.SendProduce(new[]{new TopicAndPartitionValue<IEnumerable<IMessage>>(new TopicAndPartition(topic,partition),new[]{new Message(key,value)} ), },out failedItems);
var produceResponse = responses.First();
if(produceResponse.HasError)
throw new ProduceFailedException(produceResponse.GetErrors());
return produceResponse.StatusesByTopic[topic][0];
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Kafka.Client.Api;
using Kafka.Client.Exceptions;
namespace Kafka.Client
{
public class SimpleProducer : ProducerBase
{
public SimpleProducer(IKafkaClient client)
: base(client)
{
}
public ProducerResponseStatus Send(string topic, int partition, byte[] value, byte[] key = null)
{
IReadOnlyCollection<TopicAndPartitionValue<IEnumerable<IMessage>>> failedItems;
var responses = base.SendProduce(new[]{new TopicAndPartitionValue<IEnumerable<IMessage>>(new TopicAndPartition(topic,partition),new[]{new Message(key,value)} ), },out failedItems);
var produceResponse = responses.First();
if(produceResponse.HasError)
throw new ProduceFailedException(produceResponse.GetErrors());
return produceResponse.StatusesByTopic["topic"][0];
}
}
}
|
mit
|
C#
|
2af0316fae76cecc805ffe4ca4b3fe0c187b4ad0
|
Fix to not use a test filter in NUnit when no filters has been declared in Giles. This was causing NUnit to not run the tests
|
michaelsync/Giles,michaelsync/Giles,michaelsync/Giles,codereflection/Giles,michaelsync/Giles,codereflection/Giles,codereflection/Giles
|
src/Runners/Giles.Runner.NUnit/NUnitRunner.cs
|
src/Runners/Giles.Runner.NUnit/NUnitRunner.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Giles.Core.Runners;
using NUnit.Core;
using NUnit.Core.Filters;
namespace Giles.Runner.NUnit
{
public class NUnitRunner : IFrameworkRunner
{
IEnumerable<string> filters;
public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters)
{
this.filters = filters;
var remoteTestRunner = new RemoteTestRunner(0);
var package = SetupTestPackager(assembly);
remoteTestRunner.Load(package);
var listener = new GilesNUnitEventListener();
if (filters.Count() == 0)
remoteTestRunner.Run(listener);
else
remoteTestRunner.Run(listener, GetFilters());
return listener.SessionResults;
}
ITestFilter GetFilters()
{
var simpleNameFilter = new SimpleNameFilter(filters.ToArray());
return simpleNameFilter;
}
public IEnumerable<string> RequiredAssemblies()
{
return new[]
{
Assembly.GetAssembly(typeof(NUnitRunner)).Location,
"nunit.core.dll", "nunit.core.interfaces.dll"
};
}
private static TestPackage SetupTestPackager(Assembly assembly)
{
return new TestPackage(assembly.FullName, new[] { assembly.Location });
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Giles.Core.Runners;
using Giles.Core.Utility;
using NUnit.Core;
using NUnit.Core.Filters;
namespace Giles.Runner.NUnit
{
public class NUnitRunner : IFrameworkRunner
{
IEnumerable<string> filters;
public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters)
{
this.filters = filters;
var remoteTestRunner = new RemoteTestRunner(0);
var package = SetupTestPackager(assembly);
remoteTestRunner.Load(package);
var listener = new GilesNUnitEventListener();
remoteTestRunner.Run(listener, GetFilters());
return listener.SessionResults;
}
ITestFilter GetFilters()
{
var simpleNameFilter = new SimpleNameFilter(filters.ToArray());
return simpleNameFilter;
}
public IEnumerable<string> RequiredAssemblies()
{
return new[]
{
Assembly.GetAssembly(typeof(NUnitRunner)).Location,
"nunit.core.dll", "nunit.core.interfaces.dll"
};
}
private static TestPackage SetupTestPackager(Assembly assembly)
{
return new TestPackage(assembly.FullName, new[] { assembly.Location });
}
}
}
|
mit
|
C#
|
939599d11da8f801f4b3f93872293fd50724f9fd
|
add redirectValue and textSubLabel to QuestionJson
|
smbc-digital/iag-contentapi
|
src/StockportContentApi/Model/QuestionJson.cs
|
src/StockportContentApi/Model/QuestionJson.cs
|
using System.Collections.Generic;
namespace StockportContentApi.Model
{
public class QuestionJson
{
public int pageId { get; set; }
public string buttonText { get; set; }
public bool ShouldCache { get; set; }
public bool IsLastPage { get; set; }
public List<Question> questions { get; set; }
public List<Behaviour> behaviours { get; set; }
public string description { get; set; }
public bool HideBackButton { get; set; }
}
public class Option
{
public string label { get; set; }
public string value { get; set; }
public string image { get; set; }
public string tertiaryInformation { get; set; }
}
public class ValidatorData
{
public string type { get; set; }
public string message { get; set; }
public string value { get; set; }
}
public class Question
{
public string questionId { get; set; }
public string secondaryInfo { get; set; }
public string textSubLabel { get; set; }
public string questionType { get; set; }
public string label { get; set; }
public List<Option> options { get; set; }
public List<ValidatorData> validatorData { get; set; }
}
public class Condition
{
public string questionId { get; set; }
public string equalTo { get; set; }
public string between { get; set; }
}
public class Behaviour
{
public EQuestionType behaviourType { get; set; }
public List<Condition> conditions { get; set; }
public object value { get; set; }
public object redirectValue { get; set; }
}
public enum EQuestionType
{
Redirect,
RedirectToAction,
RedirectToActionController,
GoToPage,
GoToSummary,
HandOffData
}
}
|
using System.Collections.Generic;
namespace StockportContentApi.Model
{
public class QuestionJson
{
public int pageId { get; set; }
public string buttonText { get; set; }
public bool ShouldCache { get; set; }
public bool IsLastPage { get; set; }
public List<Question> questions { get; set; }
public List<Behaviour> behaviours { get; set; }
public string description { get; set; }
public bool HideBackButton { get; set; }
}
public class Option
{
public string label { get; set; }
public string value { get; set; }
public string image { get; set; }
public string tertiaryInformation { get; set; }
}
public class ValidatorData
{
public string type { get; set; }
public string message { get; set; }
public string value { get; set; }
}
public class Question
{
public string questionId { get; set; }
public string secondaryInfo { get; set; }
public string questionType { get; set; }
public string label { get; set; }
public List<Option> options { get; set; }
public List<ValidatorData> validatorData { get; set; }
}
public class Condition
{
public string questionId { get; set; }
public string equalTo { get; set; }
public string between { get; set; }
}
public class Behaviour
{
public EQuestionType behaviourType { get; set; }
public List<Condition> conditions { get; set; }
public object value { get; set; }
}
public enum EQuestionType
{
Redirect,
RedirectToAction,
RedirectToActionController,
GoToPage,
GoToSummary,
HandOffData
}
}
|
mit
|
C#
|
8b6a4a6d5a79c44b2b0d1c4b3519bff114ab8c65
|
add admin namespace
|
davetimmins/ScriptCs.ArcGIS,davetimmins/ScriptCs.ArcGIS
|
src/ScriptCs.ArcGIS/ScriptPack.cs
|
src/ScriptCs.ArcGIS/ScriptPack.cs
|
using System;
using ScriptCs.Contracts;
using System.Collections.Generic;
namespace ScriptCs.ArcGIS
{
public class ArcGISScriptPack : IScriptPack
{
public IScriptPackContext GetContext()
{
//Return the ScriptPackContext to be used in your scripts
return new ArcGISPack();
}
public void Initialize(IScriptPackSession session)
{
Guard.AgainstNullArgument("session", session);
var namespaces = new List<String>
{
"ArcGIS.ServiceModel",
"ArcGIS.ServiceModel.Common",
"ArcGIS.ServiceModel.GeoJson",
"ArcGIS.ServiceModel.Operation",
"ArcGIS.ServiceModel.Operation.Admin",
"ArcGIS.ServiceModel.Serializers"
};
namespaces.ForEach(session.ImportNamespace);
}
public void Terminate()
{
}
}
}
|
using System;
using ScriptCs.Contracts;
namespace ScriptCs.ArcGIS
{
public class ArcGISScriptPack : IScriptPack
{
IScriptPackContext IScriptPack.GetContext()
{
//Return the ScriptPackContext to be used in your scripts
return new ArcGISPack();
}
void IScriptPack.Initialize(IScriptPackSession session)
{
Guard.AgainstNullArgument("session", session);
session.ImportNamespace("ArcGIS.ServiceModel");
session.ImportNamespace("ArcGIS.ServiceModel.Common");
session.ImportNamespace("ArcGIS.ServiceModel.GeoJson");
session.ImportNamespace("ArcGIS.ServiceModel.Operation");
session.ImportNamespace("ArcGIS.ServiceModel.Serializers");
}
void IScriptPack.Terminate()
{
//Cleanup any resources here
}
}
}
|
mit
|
C#
|
bbdc94ced9f2212b20411fbee00f101a37ca425d
|
Fix soldiers list view title
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
BatteryCommander.Web/Views/Soldier/List.cshtml
|
BatteryCommander.Web/Views/Soldier/List.cshtml
|
@model IEnumerable<BatteryCommander.Common.Models.Soldier>
@{
ViewBag.Title = "Soldiers";
}
<h2>@ViewBag.Title</h2>
@Html.ActionLink("Include Inactive Soldiers", "List", new { activeOnly = false })
@Html.ActionLink("Add a Soldier", "Edit")
@Html.ActionLink("Bulk Add/Edit Soldiers", "Bulk")
<table class="table table-striped">
<tr>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Group)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Rank)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().LastName)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().FirstName)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().MOS)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().IsDutyMOSQualified)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Status)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Notes)</th>
<th></th>
</tr>
@foreach (var soldier in Model)
{
<tr>
<td>@Html.DisplayFor(s => soldier.Group)</td>
<td>@Html.DisplayFor(s => soldier.Rank)</td>
<td>@Html.DisplayFor(s => soldier.LastName)</td>
<td>@Html.DisplayFor(s => soldier.FirstName)</td>
<td>@Html.DisplayFor(s => soldier.MOS)</td>
<td>@Html.DisplayFor(s => soldier.IsDutyMOSQualified)</td>
<td>@Html.DisplayFor(s => soldier.Status)</td>
<td>@Html.DisplayFor(s => soldier.Notes)</td>
<td>@Html.ActionLink("View", "View", new { soldierId = soldier.Id })</td>
</tr>
}
</table>
|
@model IEnumerable<BatteryCommander.Common.Models.Soldier>
@{
ViewBag.Title = "List";
}
<h2>@ViewBag.Title</h2>
@Html.ActionLink("Include Inactive Soldiers", "List", new { activeOnly = false })
@Html.ActionLink("Add a Soldier", "Edit")
@Html.ActionLink("Bulk Add/Edit Soldiers", "Bulk")
<table class="table table-striped">
<tr>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Group)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Rank)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().LastName)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().FirstName)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().MOS)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().IsDutyMOSQualified)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Status)</th>
<th>@Html.DisplayNameFor(s => s.FirstOrDefault().Notes)</th>
<th></th>
</tr>
@foreach (var soldier in Model)
{
<tr>
<td>@Html.DisplayFor(s => soldier.Group)</td>
<td>@Html.DisplayFor(s => soldier.Rank)</td>
<td>@Html.DisplayFor(s => soldier.LastName)</td>
<td>@Html.DisplayFor(s => soldier.FirstName)</td>
<td>@Html.DisplayFor(s => soldier.MOS)</td>
<td>@Html.DisplayFor(s => soldier.IsDutyMOSQualified)</td>
<td>@Html.DisplayFor(s => soldier.Status)</td>
<td>@Html.DisplayFor(s => soldier.Notes)</td>
<td>@Html.ActionLink("View", "View", new { soldierId = soldier.Id })</td>
</tr>
}
</table>
|
mit
|
C#
|
0f5fb6b190b5d83823d7aab44d670ec2e03de835
|
Remove unnecessary usings.
|
nozzlegear/davenport.net
|
Davenport/Infrastructure/DavenportException.cs
|
Davenport/Infrastructure/DavenportException.cs
|
using System;
namespace Davenport.Infrastructure
{
public class DavenportException : Exception
{
public DavenportException(string message) : base(message)
{
}
public int StatusCode { get; set; }
public string StatusText { get; set; }
public string Url { get; set; }
public string ResponseBody { get; set; }
}
}
|
using System;
using System.Linq;
using System.Net.Http;
namespace Davenport.Infrastructure
{
public class DavenportException : Exception
{
public DavenportException(string message) : base(message)
{
}
public int StatusCode { get; set; }
public string StatusText { get; set; }
public string Url { get; set; }
public string ResponseBody { get; set; }
}
}
|
mit
|
C#
|
6a6773f7a59900f873f81cd2c523439e4cc3211d
|
Make CAS test more stable.
|
enyim/EnyimMemcached
|
Enyim.Caching.Tests/TextMemcachedClientTest.cs
|
Enyim.Caching.Tests/TextMemcachedClientTest.cs
|
using Enyim.Caching;
using NUnit.Framework;
using Enyim.Caching.Memcached;
namespace MemcachedTest
{
[TestFixture]
public class TextMemcachedClientTest : MemcachedClientTest
{
protected override MemcachedClient GetClient()
{
MemcachedClient client = new MemcachedClient("test/textConfig");
client.FlushAll();
return client;
}
[TestCase]
public void IncrementTest()
{
using (MemcachedClient client = GetClient())
{
Assert.IsTrue(client.Store(StoreMode.Set, "VALUE", "100"), "Initialization failed");
Assert.AreEqual(102L, client.Increment("VALUE", 0, 2));
Assert.AreEqual(112L, client.Increment("VALUE", 0, 10));
}
}
[TestCase]
public void DecrementTest()
{
using (MemcachedClient client = GetClient())
{
client.Store(StoreMode.Set, "VALUE", "100");
Assert.AreEqual(98L, client.Decrement("VALUE", 0, 2));
Assert.AreEqual(88L, client.Decrement("VALUE", 0, 10));
}
}
[TestCase]
public void CASTest()
{
using (MemcachedClient client = GetClient())
{
// store the item
var r1 = client.Store(StoreMode.Set, "CasItem1", "foo");
Assert.IsTrue(r1, "Initial set failed.");
// get back the item and check the cas value (it should match the cas from the set)
var r2 = client.GetWithCas<string>("CasItem1");
Assert.AreEqual(r2.Result, "foo", "Invalid data returned; expected 'foo'.");
Assert.AreNotEqual(0, r2.Cas, "No cas value was returned.");
var r3 = client.Cas(StoreMode.Set, "CasItem1", "bar", r2.Cas + 1001);
Assert.IsFalse(r3.Result, "Overwriting with 'bar' should have failed.");
var r4 = client.Cas(StoreMode.Set, "CasItem1", "baz", r2.Cas);
Assert.IsTrue(r4.Result, "Overwriting with 'baz' should have succeeded.");
var r5 = client.GetWithCas<string>("CasItem1");
Assert.AreEqual(r5.Result, "baz", "Invalid data returned; excpected 'baz'.");
}
}
}
}
#region [ License information ]
/* ************************************************************
*
* Copyright (c) 2010 Attila Kisk, enyim.com
*
* 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 Enyim.Caching;
using NUnit.Framework;
using Enyim.Caching.Memcached;
namespace MemcachedTest
{
[TestFixture]
public class TextMemcachedClientTest : MemcachedClientTest
{
protected override MemcachedClient GetClient()
{
MemcachedClient client = new MemcachedClient("test/textConfig");
client.FlushAll();
return client;
}
[TestCase]
public void IncrementTest()
{
using (MemcachedClient client = GetClient())
{
Assert.IsTrue(client.Store(StoreMode.Set, "VALUE", "100"), "Initialization failed");
Assert.AreEqual(102L, client.Increment("VALUE", 0, 2));
Assert.AreEqual(112L, client.Increment("VALUE", 0, 10));
}
}
[TestCase]
public void DecrementTest()
{
using (MemcachedClient client = GetClient())
{
client.Store(StoreMode.Set, "VALUE", "100");
Assert.AreEqual(98L, client.Decrement("VALUE", 0, 2));
Assert.AreEqual(88L, client.Decrement("VALUE", 0, 10));
}
}
[TestCase]
public void CASTest()
{
using (MemcachedClient client = GetClient())
{
// store the item
var r1 = client.Store(StoreMode.Set, "CasItem1", "foo");
Assert.IsTrue(r1, "Initial set failed.");
// get back the item and check the cas value (it should match the cas from the set)
var r2 = client.GetWithCas<string>("CasItem1");
Assert.AreEqual(r2.Result, "foo", "Invalid data returned; expected 'foo'.");
Assert.AreNotEqual(0, r2.Cas, "No cas value was returned.");
var r3 = client.Cas(StoreMode.Set, "CasItem1", "bar", r2.Cas - 1);
Assert.IsFalse(r3.Result, "foo", "Overwriting with 'bar' should have failed.");
var r4 = client.Cas(StoreMode.Set, "CasItem1", "baz", r2.Cas);
Assert.IsTrue(r4.Result, "foo", "Overwriting with 'baz' should have succeeded.");
var r5 = client.GetWithCas<string>("CasItem1");
Assert.AreEqual(r5.Result, "baz", "Invalid data returned; excpected 'baz'.");
}
}
}
}
#region [ License information ]
/* ************************************************************
*
* Copyright (c) 2010 Attila Kisk, enyim.com
*
* 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
|
apache-2.0
|
C#
|
1480884fcb7b0e02c45e6d5c592a62b9e040d344
|
Implement Dispose pattern
|
vazgriz/CSharpGameLibrary,vazgriz/CSharpGameLibrary,rhynodegreat/CSharpGameLibrary,rhynodegreat/CSharpGameLibrary
|
CSGL.Vulkan/Vulkan/Event.cs
|
CSGL.Vulkan/Vulkan/Event.cs
|
using System;
using System.Collections.Generic;
namespace CSGL.Vulkan {
public class Event : IDisposable, INative<VkEvent> {
VkEvent _event;
bool disposed;
public VkEvent Native {
get {
return _event;
}
}
public Device Device { get; private set; }
public Event(Device device) {
if (device == null) throw new ArgumentNullException(nameof(device));
Device = device;
CreateEvent();
}
void CreateEvent() {
VkEventCreateInfo info = new VkEventCreateInfo();
info.sType = VkStructureType.EventCreateInfo;
var result = Device.Commands.createEvent(Device.Native, ref info, Device.Instance.AllocationCallbacks, out _event);
if (result != VkResult.Success) throw new EventException(string.Format("Error creating event: {0}", result));
}
public VkResult GetStatus() {
return Device.Commands.getEventStatus(Device.Native, _event);
}
public void Set() {
var result = Device.Commands.setEvent(Device.Native, _event);
if (result != VkResult.Success) throw new EventException(string.Format("Error setting event: {0}", result));
}
public void Reset() {
var result = Device.Commands.resetEvent(Device.Native, _event);
if (result != VkResult.Success) throw new EventException(string.Format("Error resetting event: {0}", result));
}
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
void Dispose(bool disposing) {
if (disposed) return;
Device.Commands.destroyEvent(Device.Native, _event, Device.Instance.AllocationCallbacks);
disposed = true;
}
~Event() {
Dispose(false);
}
}
public class EventException : Exception {
public EventException(string message) : base(message) { }
}
}
|
using System;
using System.Collections.Generic;
namespace CSGL.Vulkan {
public class Event : IDisposable, INative<VkEvent> {
VkEvent _event;
bool disposed;
public VkEvent Native {
get {
return _event;
}
}
public Device Device { get; private set; }
public Event(Device device) {
if (device == null) throw new ArgumentNullException(nameof(device));
Device = device;
CreateEvent();
}
void CreateEvent() {
VkEventCreateInfo info = new VkEventCreateInfo();
info.sType = VkStructureType.EventCreateInfo;
var result = Device.Commands.createEvent(Device.Native, ref info, Device.Instance.AllocationCallbacks, out _event);
if (result != VkResult.Success) throw new EventException(string.Format("Error creating event: {0}", result));
}
public VkResult GetStatus() {
return Device.Commands.getEventStatus(Device.Native, _event);
}
public void Set() {
var result = Device.Commands.setEvent(Device.Native, _event);
if (result != VkResult.Success) throw new EventException(string.Format("Error setting event: {0}", result));
}
public void Reset() {
var result = Device.Commands.resetEvent(Device.Native, _event);
if (result != VkResult.Success) throw new EventException(string.Format("Error resetting event: {0}", result));
}
public void Dispose() {
if (disposed) return;
Device.Commands.destroyEvent(Device.Native, _event, Device.Instance.AllocationCallbacks);
disposed = true;
}
}
public class EventException : Exception {
public EventException(string message) : base(message) { }
}
}
|
mit
|
C#
|
c923b950bd3a50865f8293fc16ba00f2cd333d8e
|
Revert "made session id record type"
|
louthy/echo-process,louthy/echo-process
|
Echo.Process/SessionId.cs
|
Echo.Process/SessionId.cs
|
using LanguageExt;
using Newtonsoft.Json;
using System;
using static LanguageExt.Prelude;
namespace Echo
{
/// <summary>
/// Session ID
/// </summary>
/// <remarks>
/// It enforces the rules for session IDs.
/// </remarks>
public struct SessionId : IEquatable<SessionId>, IComparable<SessionId>, IComparable
{
public readonly string Value;
/// <summary>
/// Ctor
/// </summary>
/// <param name="value">SessionId</param>
[JsonConstructor]
public SessionId(string value)
{
Value = value;
}
const int DefaultSessionIdSizeInBytes = 32;
/// <summary>
/// Make a cryptographically strong session ID
/// </summary>
/// <param name="sizeInBytes">Size in bytes. This is not the final string length, the final length depends
/// on the Base64 encoding of a byte-array sizeInBytes long. As a guide a 64 byte session ID turns into
/// an 88 character string.</param>
public static SessionId Generate(int sizeInBytes = DefaultSessionIdSizeInBytes) =>
new SessionId(randomBase64(sizeInBytes));
public bool IsValid =>
!String.IsNullOrEmpty(Value);
public override string ToString() =>
Value;
public override int GetHashCode() =>
Value.GetHashCode();
public static implicit operator SessionId(string value) =>
new SessionId(value);
public bool Equals(SessionId other) =>
Value.Equals(other.Value);
public int CompareTo(SessionId other) =>
String.Compare(Value, other.Value, StringComparison.Ordinal);
public int CompareTo(object obj) =>
obj == null
? -1
: obj is SessionId
? CompareTo((SessionId)obj)
: -1;
public static bool operator == (SessionId lhs, SessionId rhs) =>
lhs.Equals(rhs);
public static bool operator !=(SessionId lhs, SessionId rhs) =>
!lhs.Equals(rhs);
public override bool Equals(object obj) =>
obj is SessionId
? Equals((SessionId)obj)
: false;
}
/// <summary>
/// Supplementary session id new type
/// </summary>
public class SupplementarySessionId : NewType<SupplementarySessionId, SessionId>
{
public static string Key => $"sys-supp-session";
public SupplementarySessionId(string value) : base(value) { }
public static SupplementarySessionId Generate() => new SupplementarySessionId(SessionId.Generate().Value);
public new string Value => base.Value.Value;
}
}
|
using LanguageExt;
using Newtonsoft.Json;
using System;
using static LanguageExt.Prelude;
namespace Echo
{
/// <summary>
/// Session ID
/// </summary>
/// <remarks>
/// It enforces the rules for session IDs.
/// </remarks>
public class SessionId : Record<SessionId>
{
public readonly string Value;
/// <summary>
/// Ctor
/// </summary>
/// <param name="value">SessionId</param>
[JsonConstructor]
public SessionId(string value)
{
Value = value;
}
const int DefaultSessionIdSizeInBytes = 32;
/// <summary>
/// Make a cryptographically strong session ID
/// </summary>
/// <param name="sizeInBytes">Size in bytes. This is not the final string length, the final length depends
/// on the Base64 encoding of a byte-array sizeInBytes long. As a guide a 64 byte session ID turns into
/// an 88 character string.</param>
public static SessionId Generate(int sizeInBytes = DefaultSessionIdSizeInBytes) =>
new SessionId(randomBase64(sizeInBytes));
public bool IsValid =>
!String.IsNullOrEmpty(Value);
public override string ToString() =>
Value;
public static implicit operator SessionId(string value) =>
new SessionId(value);
}
/// <summary>
/// Supplementary session id new type
/// </summary>
public class SupplementarySessionId : SessionId
{
public static string Key => $"sys-supp-session";
public SupplementarySessionId(string value) : base(value) { }
public static SupplementarySessionId Generate() => new SupplementarySessionId(SessionId.Generate().Value);
}
}
|
mit
|
C#
|
6c79616474fc8a328bf5c474c2d6421d26803956
|
switch small job to a CPU intensive one
|
jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets
|
HangfireDemo/HangfireDemo/Global.asax.cs
|
HangfireDemo/HangfireDemo/Global.asax.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace HangfireDemo
{
using System.Threading;
using Hangfire;
using Serilog;
using StackExchange.Profiling;
public class MvcApplication : System.Web.HttpApplication
{
private BackgroundJobServer _backgroundJobServer;
protected void Application_Start()
{
MiniProfiler.Settings.Results_List_Authorize = IsUserAllowedToSeeMiniProfilerUI;
var log =
new LoggerConfiguration().ReadFrom.AppSettings()
.CreateLogger();
Log.Logger = log;
// Configure Hangfire
GlobalConfiguration.Configuration
.UseSqlServerStorage("HangfireDB")
.UseSerilogLogProvider();
//_backgroundJobServer = new BackgroundJobServer();
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
protected void Application_End(object sender, EventArgs e)
{
_backgroundJobServer.Dispose();
}
protected void Application_BeginRequest()
{
if (Request.IsLocal)
{
MiniProfiler.Start();
}
BackgroundJob.Enqueue(
() => Thread.Sleep(4000));
}
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}
private bool IsUserAllowedToSeeMiniProfilerUI(HttpRequest httpRequest)
{
return true;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace HangfireDemo
{
using Hangfire;
using Serilog;
using StackExchange.Profiling;
public class MvcApplication : System.Web.HttpApplication
{
private BackgroundJobServer _backgroundJobServer;
protected void Application_Start()
{
MiniProfiler.Settings.Results_List_Authorize = IsUserAllowedToSeeMiniProfilerUI;
var log =
new LoggerConfiguration().ReadFrom.AppSettings()
.CreateLogger();
Log.Logger = log;
// Configure Hangfire
GlobalConfiguration.Configuration
.UseSqlServerStorage("HangfireDB")
.UseSerilogLogProvider();
//_backgroundJobServer = new BackgroundJobServer();
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
protected void Application_End(object sender, EventArgs e)
{
_backgroundJobServer.Dispose();
}
protected void Application_BeginRequest()
{
if (Request.IsLocal)
{
MiniProfiler.Start();
}
BackgroundJob.Enqueue(() => Log.Information("Hello, world! {time}", DateTime.Now));
}
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}
private bool IsUserAllowedToSeeMiniProfilerUI(HttpRequest httpRequest)
{
return true;
}
}
}
|
apache-2.0
|
C#
|
8329b673e5b5279914e38868d1144106bca66396
|
Make AppHarborInstaller implement IWindsorInstaller
|
appharbor/appharbor-cli
|
src/AppHarbor/AppHarborInstaller.cs
|
src/AppHarbor/AppHarborInstaller.cs
|
using System;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
namespace AppHarbor
{
public class AppHarborInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
throw new NotImplementedException();
}
}
}
|
namespace AppHarbor
{
public class AppHarborInstaller
{
}
}
|
mit
|
C#
|
289c45c51867e8f5070b8cc37e6cf950c509164b
|
Update VSTS to Azure DevOps * add runtime & .NET CLI
|
devlead/website,cake-build/website,devlead/website,cake-build/website,devlead/website,cake-build/website
|
input/index.cshtml
|
input/index.cshtml
|
Title: Home
NoSidebar: true
NoContainer: true
NoGutter: true
---
<div class="jumbotron">
<div class="container">
<h1>What is Cake?</h1>
<p>Cake (C# Make) is a cross-platform build automation system with a C# DSL for tasks such as compiling code, copying files and folders, running unit tests, compressing files and building NuGet packages.</p>
<p>
<a class="btn btn-primary btn-lg" href="/docs/tutorials/getting-started" role="button">Get Started »</a>
</p>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6">
<h3 class="align-top">Familiar</h3>
<p>
Cake is built on top of the Roslyn compiler which enables you to write your build scripts in C#.
</p>
<h3>Cross platform</h3>
<p>
Cake is available on Windows, Linux and macOS.
</p>
<h3>Cross runtime</h3>
<p>
Cake runs on .NET, .NET Core and Mono.
</p>
<h3>Reliable</h3>
<p>
Regardless if you're building on your own machine, or building on a CI system such as AppVeyor, Azure DevOps,
TeamCity, TFS or Jenkins, Cake is built to behave in the same way.
</p>
<h3>Batteries included</h3>
<p>
Cake supports the most common tools used during builds such as MSBuild, .NET Core CLI, MSTest, xUnit, NUnit,
NuGet, ILMerge, WiX and SignTool out of the box.
</p>
<h3>Open source</h3>
<p>
We believe in open source and so should you. The source code for Cake is
<a href="https://github.com/cake-build/cake">hosted on GitHub</a> and
includes everything needed to build it yourself.
</p>
</div>
<div class="col-sm-6 hidden-xs">
<img style="width: 100%;" src="/assets/img/screenshot.png" alt=""/>
</div>
</div>
</div>
|
Title: Home
NoSidebar: true
NoContainer: true
NoGutter: true
---
<div class="jumbotron">
<div class="container">
<h1>What is Cake?</h1>
<p>Cake (C# Make) is a cross-platform build automation system with a C# DSL for tasks such as compiling code, copying files and folders, running unit tests, compressing files and building NuGet packages.</p>
<p>
<a class="btn btn-primary btn-lg" href="/docs/tutorials/getting-started" role="button">Get Started »</a>
</p>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6">
<h3 class="align-top">Familiar</h3>
<p>
Cake is built on top of the Roslyn compiler which enables you to write your build scripts in C#.
</p>
<h3>Cross platform</h3>
<p>
Cake is available on Windows, Linux and macOS.
</p>
<h3>Reliable</h3>
<p>
Regardless if you're building on your own machine, or building on a CI system such as AppVeyor,
TeamCity, TFS, VSTS or Jenkins, Cake is built to behave in the same way.
</p>
<h3>Batteries included</h3>
<p>
Cake supports the most common tools used during builds such as MSBuild, MSTest, xUnit, NUnit,
NuGet, ILMerge, WiX and SignTool out of the box.
</p>
<h3>Open source</h3>
<p>
We believe in open source and so should you. The source code for Cake is
<a href="https://github.com/cake-build/cake">hosted on GitHub</a> and
includes everything needed to build it yourself.
</p>
</div>
<div class="col-sm-6 hidden-xs">
<img style="width: 100%;" src="/assets/img/screenshot.png" alt=""/>
</div>
</div>
</div>
|
mit
|
C#
|
238f3f56e6bc9c069732d8439d4285f2350e0b9a
|
bump version to 2.11.0
|
piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker
|
Piwik.Tracker/Properties/AssemblyInfo.cs
|
Piwik.Tracker/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[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("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.11.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[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("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.10.0")]
|
bsd-3-clause
|
C#
|
74f276fe860e3556bda4211cd0a5952d08ac62fd
|
Test commit @2
|
MatthewKapteyn/SubmoduleTest
|
SubmoduleTest/Program.cs
|
SubmoduleTest/Program.cs
|
using System;
using Huawei_Unlock;
namespace SubmoduleTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Test.HW_ALGO_SELECTOR("This_is_a_15_digit_imei_jk");
Console.WriteLine("Made second change to SubmoduleTest");
}
}
}
|
using System;
using Huawei_Unlock;
namespace SubmoduleTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Test.HW_ALGO_SELECTOR("This_is_a_15_digit_imei_jk");
}
}
}
|
unlicense
|
C#
|
3c5ad090ac5214a686d047769b86a68c31dfbc39
|
Fix broken links
|
martincostello/website,martincostello/website,martincostello/website,martincostello/website
|
src/Website/Pages/Home/Index.cshtml
|
src/Website/Pages/Home/Index.cshtml
|
@page "/"
@model MartinCostello.Website.Pages.Home.IndexModel
@{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>Martin Costello</h1>
<p class="lead">.NET Software Developer & Tester</p>
</div>
<div class="row">
<div class="col-md-4">
<h2 class="h3">Projects</h2>
<p>Information about development projects I manage and/or work on.</p>
<p>
<a asp-page="/Projects/Index" class="btn btn-lg btn-primary" role="button">
Learn more »
</a>
</p>
</div>
<div class="col-md-4">
<h2 class="h3">Blog</h2>
<p>I occasionally blog about topics related to .NET development.</p>
<p>
<a asp-page="/Home/Blog" class="btn btn-lg btn-primary" rel="noopener" role="button" target="_blank">
Visit blog »
</a>
</p>
</div>
<div class="col-md-4">
<h2 class="h3">Tools</h2>
<p>A few simple tools I use regularly to develop .NET applications.</p>
<p>
<a asp-page="/Tools/Index" class="btn btn-lg btn-primary" role="button">
Visit tools »
</a>
</p>
</div>
</div>
|
@page "/"
@model MartinCostello.Website.Pages.Home.IndexModel
@{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>Martin Costello</h1>
<p class="lead">.NET Software Developer & Tester</p>
</div>
<div class="row">
<div class="col-md-4">
<h2 class="h3">Projects</h2>
<p>Information about development projects I manage and/or work on.</p>
<p>@Html.ActionLink("Learn more »", "Index", "Projects", null, new { @class = "btn btn-lg btn-primary", role = "button" })</p>
</div>
<div class="col-md-4">
<h2 class="h3">Blog</h2>
<p>I occasionally blog about topics related to .NET development.</p>
<p>@Html.ActionLink("Visit blog »", "Blog", "Home", null, new { @class = "btn btn-lg btn-primary", rel = "noopener", role = "button", target = "_blank" })</p>
</div>
<div class="col-md-4">
<h2 class="h3">Tools</h2>
<p>A few simple tools I use regularly to develop .NET applications.</p>
<p>@Html.ActionLink("View tools »", "Index", "Tools", null, new { @class = "btn btn-lg btn-primary", role = "button" })</p>
</div>
</div>
|
apache-2.0
|
C#
|
a828a9851ac22051bcf00896a240bb6784bf2d58
|
Fix windows code style.
|
GGG-KILLER/GUtils.NET
|
Tsu.Windows/FExplorer.cs
|
Tsu.Windows/FExplorer.cs
|
// Copyright 2016 GGG KILLER <gggkiller2@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the Software), to deal in the Software without
// restriction, including without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
// the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System.Diagnostics;
namespace Tsu.Windows
{
/// <summary>
/// A static class with utilities to open files (not streams)
/// in different ways
/// </summary>
public static class FExplorer
{
/// <summary>
/// Opens explorer.exe with <paramref name="Path" /> as
/// the working directory
/// </summary>
/// <param name="Path"></param>
public static void OpenFolder(string Path) => Process.Start(new ProcessStartInfo
{
FileName = "explorer.exe",
Arguments = Path
});
/// <summary>
/// Opens explorer.exe with <paramref name="Path" /> selected
/// </summary>
/// <param name="Path"></param>
public static void OpenWithFileSelected(string Path) => Process.Start(new ProcessStartInfo
{
FileName = "explorer.exe",
Arguments = $"/e, /select, \"{Path}\""
});
/// <summary>
/// Opens a file with the default program associated with it
/// </summary>
/// <param name="File"></param>
public static void OpenWithDefaultProgram(string File) => Process.Start(File);
/// <summary>
/// Opens cmd.exe with the working directory set as <paramref name="Path" />
/// </summary>
/// <param name="Path"></param>
public static void OpenFolderInCmd(string Path) => Process.Start(new ProcessStartInfo
{
WorkingDirectory = Path,
FileName = "cmd.exe"
});
}
}
|
/*
* Copyright 2019 GGG KILLER <gggkiller2@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the Software), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Diagnostics;
namespace Tsu.Windows
{
/// <summary>
/// A static class with utilities to open files (not streams)
/// in different ways
/// </summary>
public static class FExplorer
{
/// <summary>
/// Opens explorer.exe with <paramref name="Path" /> as
/// the working directory
/// </summary>
/// <param name="Path"></param>
public static void OpenFolder ( String Path ) => Process.Start ( new ProcessStartInfo
{
FileName = "explorer.exe",
Arguments = Path
} );
/// <summary>
/// Opens explorer.exe with <paramref name="Path" /> selected
/// </summary>
/// <param name="Path"></param>
public static void OpenWithFileSelected ( String Path ) => Process.Start ( new ProcessStartInfo
{
FileName = "explorer.exe",
Arguments = $"/e, /select, \"{Path}\""
} );
/// <summary>
/// Opens a file with the default program associated with it
/// </summary>
/// <param name="File"></param>
public static void OpenWithDefaultProgram ( String File ) => Process.Start ( File );
/// <summary>
/// Opens cmd.exe with the working directory set as <paramref name="Path" />
/// </summary>
/// <param name="Path"></param>
public static void OpenFolderInCmd ( String Path ) => Process.Start ( new ProcessStartInfo
{
WorkingDirectory = Path,
FileName = "cmd.exe"
} );
}
}
|
mit
|
C#
|
5e43d51abf38784213f2a41583c2cee315ede5b8
|
fix typo in test name
|
thedevopsmachine/aws-lambda-dotnet,thedevopsmachine/aws-lambda-dotnet,thedevopsmachine/aws-lambda-dotnet,thedevopsmachine/aws-lambda-dotnet
|
Tools/LambdaTestTool/Amazon.Lambda.TestTool.Tests/LoadLambdaFunctionTests.cs
|
Tools/LambdaTestTool/Amazon.Lambda.TestTool.Tests/LoadLambdaFunctionTests.cs
|
using System;
using System.IO;
using Xunit;
using Amazon.Lambda.TestTool.Runtime;
namespace Amazon.Lambda.TestTool.Tests
{
public class LoadLambdaFunctionTests
{
[Fact]
public void LoadInstanceMethodWithAssemblySerializer()
{
var configFile = Path.GetFullPath(@"../../../../LambdaFunctions/S3EventFunction/aws-lambda-tools-defaults.json");
var buildPath = Path.GetFullPath(@"../../../../LambdaFunctions/S3EventFunction/bin/debug/netcoreapp2.1");
var configInfo = LambdaDefaultsConfigFileParser.LoadFromFile(configFile);
Assert.Single(configInfo.FunctionInfos);
var runtime = LocalLambdaRuntime.Initialize(buildPath);
var functions = runtime.LoadLambdaFunctions(configInfo.FunctionInfos);
Assert.Equal(1, functions.Count);
var function = functions[0];
Assert.True(function.IsSuccess);
Assert.NotNull(function.LambdaAssembly);
Assert.NotNull(function.LambdaType);
Assert.NotNull(function.LambdaMethod);
Assert.NotNull(function.Serializer);
}
[Fact]
public void LoadStaticMethodWithMethodSerializer()
{
var configFile = Path.GetFullPath(@"../../../../LambdaFunctions/ToUpperFunc/aws-lambda-tools-defaults.json");
var buildPath = Path.GetFullPath(@"../../../../LambdaFunctions/ToUpperFunc/bin/debug/netcoreapp2.1");
var configInfo = LambdaDefaultsConfigFileParser.LoadFromFile(configFile);
Assert.Single(configInfo.FunctionInfos);
var runtime = LocalLambdaRuntime.Initialize(buildPath);
var functions = runtime.LoadLambdaFunctions(configInfo.FunctionInfos);
Assert.Equal(1, functions.Count);
var function = functions[0];
Assert.True(function.IsSuccess);
Assert.NotNull(function.LambdaAssembly);
Assert.NotNull(function.LambdaType);
Assert.NotNull(function.LambdaMethod);
Assert.NotNull(function.Serializer);
}
}
}
|
using System;
using System.IO;
using Xunit;
using Amazon.Lambda.TestTool.Runtime;
namespace Amazon.Lambda.TestTool.Tests
{
public class LoadLambdaFunctionTests
{
[Fact]
public void LoadInstaneMethodWithAssemblySerializer()
{
var configFile = Path.GetFullPath(@"../../../../LambdaFunctions/S3EventFunction/aws-lambda-tools-defaults.json");
var buildPath = Path.GetFullPath(@"../../../../LambdaFunctions/S3EventFunction/bin/debug/netcoreapp2.1");
var configInfo = LambdaDefaultsConfigFileParser.LoadFromFile(configFile);
Assert.Single(configInfo.FunctionInfos);
var runtime = LocalLambdaRuntime.Initialize(buildPath);
var functions = runtime.LoadLambdaFunctions(configInfo.FunctionInfos);
Assert.Equal(1, functions.Count);
var function = functions[0];
Assert.True(function.IsSuccess);
Assert.NotNull(function.LambdaAssembly);
Assert.NotNull(function.LambdaType);
Assert.NotNull(function.LambdaMethod);
Assert.NotNull(function.Serializer);
}
[Fact]
public void LoadStaticMethodWithMethodSerializer()
{
var configFile = Path.GetFullPath(@"../../../../LambdaFunctions/ToUpperFunc/aws-lambda-tools-defaults.json");
var buildPath = Path.GetFullPath(@"../../../../LambdaFunctions/ToUpperFunc/bin/debug/netcoreapp2.1");
var configInfo = LambdaDefaultsConfigFileParser.LoadFromFile(configFile);
Assert.Single(configInfo.FunctionInfos);
var runtime = LocalLambdaRuntime.Initialize(buildPath);
var functions = runtime.LoadLambdaFunctions(configInfo.FunctionInfos);
Assert.Equal(1, functions.Count);
var function = functions[0];
Assert.True(function.IsSuccess);
Assert.NotNull(function.LambdaAssembly);
Assert.NotNull(function.LambdaType);
Assert.NotNull(function.LambdaMethod);
Assert.NotNull(function.Serializer);
}
}
}
|
apache-2.0
|
C#
|
fbc06ed03884dfaff65654d9e45b718a6e51c3f4
|
update plugin name
|
heksesang/Emby.Plugins,lalmanzar/MediaBrowser.Plugins,SvenVandenbrande/Emby.Plugins,Pengwyns/Emby.Plugins,lalmanzar/MediaBrowser.Plugins,heksesang/Emby.Plugins,MediaBrowser/Emby.Plugins,SvenVandenbrande/Emby.Plugins,heksesang/Emby.Plugins,hamstercat/Emby.Plugins,MediaBrowser/Emby.Plugins,hamstercat/Emby.Plugins,SvenVandenbrande/Emby.Plugins,Pengwyns/Emby.Plugins
|
EmbyTV/Plugin.cs
|
EmbyTV/Plugin.cs
|
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Serialization;
using EmbyTV.Configuration;
namespace EmbyTV
{
public class Plugin : BasePlugin<PluginConfiguration>
{
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer)
{
Instance = this;
}
/// <summary>
/// Gets the name of the plugin
/// </summary>
/// <value>The name.</value>
public override string Name
{
get { return "EmbyTV"; }
}
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
public override string Description
{
get
{
return "Provides live tv.";
}
}
/// <summary>
/// Gets the instance.
/// </summary>
/// <value>The instance.</value>
public static Plugin Instance { get; private set; }
}
}
|
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Serialization;
using EmbyTV.Configuration;
namespace EmbyTV
{
public class Plugin : BasePlugin<PluginConfiguration>
{
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer)
{
Instance = this;
}
/// <summary>
/// Gets the name of the plugin
/// </summary>
/// <value>The name.</value>
public override string Name
{
get { return "Live TV"; }
}
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
public override string Description
{
get
{
return "Provides live tv.";
}
}
/// <summary>
/// Gets the instance.
/// </summary>
/// <value>The instance.</value>
public static Plugin Instance { get; private set; }
}
}
|
mit
|
C#
|
e09c3f24e8532cd75559536c91c4db7eaa465338
|
Change Unity Editor Dependent compilation #if UNITY_EDITOR to Application.isEditor to become in a library
|
Zomig/Logger-Unity,Zomig/Logger-Unity
|
Assets/Scripts/Logger.cs
|
Assets/Scripts/Logger.cs
|
namespace LoggerUnity
{
using UnityEngine;
public class Logger
{
public static void Log(string message)
{
if(Application.isEditor)
Debug.Log(message);
}
}
}
|
namespace LoggerUnity
{
using UnityEngine;
public class Logger
{
public static void Log(string message)
{
#if UNITY_EDITOR
Debug.Log(message);
#endif
}
}
}
|
mit
|
C#
|
fba29b49461290f37704801d432f62e237a05b54
|
Fix odd GET property responses
|
Goz3rr/SkypeSharp
|
SkypeSharp/SkypeObject.cs
|
SkypeSharp/SkypeObject.cs
|
using System;
namespace SkypeSharp {
public class SkypeErrorException : Exception {
public SkypeErrorException() {}
public SkypeErrorException(string message) : base(message) {}
}
/// <summary>
/// Class for representing Skype API objects, provides Get and Set methods for properties
/// </summary>
public abstract class SkypeObject {
/// <summary>
/// Skype internal ID
/// </summary>
public string ID { get; protected set; }
/// <summary>
/// Name of Skype Object (USER, CHATMESSAGE, CALL, etc)
/// </summary>
protected readonly string Name;
/// <summary>
/// Skype DBUS interface
/// </summary>
protected readonly Skype Skype;
protected SkypeObject(Skype skype, string id, string name) {
Skype = skype;
ID = id;
Name = name;
}
/// <summary>
/// Get a property from this object
/// </summary>
/// <param name="property">Arguments, joined with spaces</param>
/// <returns>Skype response</returns>
protected string GetProperty(params string[] property) {
string args = Name + " " + ID + " " + String.Join(" ", property);
string response = Skype.Send("GET " + args);
if(response.StartsWith("GET " + args)) {
try {
return response.Substring(args.Length + 1);
} catch(ArgumentOutOfRangeException) {
return "";
}
}
return response;
}
/// <summary>
/// Set a property of this object
/// </summary>
/// <param name="property">Arguments, joined with spaces</param>
protected string SetProperty(params string[] property) {
string message = Name + " " + ID + " " + String.Join(" ", property);
return Skype.Send(message);
}
/// <summary>
/// Alter a property of this object
/// </summary>
/// <param name="property">Arguments, joined with spaces</param>
protected void Alter(params string[] property) {
string message = "ALTER " + Name + " " + ID + " " + String.Join(" ", property);
if(Skype.Send(message) != message) throw new SkypeErrorException(message);
}
}
}
|
using System;
namespace SkypeSharp {
public class SkypeErrorException : Exception {
public SkypeErrorException() {}
public SkypeErrorException(string message) : base(message) {}
}
/// <summary>
/// Class for representing Skype API objects, provides Get and Set methods for properties
/// </summary>
public abstract class SkypeObject {
/// <summary>
/// Skype internal ID
/// </summary>
public string ID { get; protected set; }
/// <summary>
/// Name of Skype Object (USER, CHATMESSAGE, CALL, etc)
/// </summary>
protected readonly string Name;
/// <summary>
/// Skype DBUS interface
/// </summary>
protected readonly Skype Skype;
protected SkypeObject(Skype skype, string id, string name) {
Skype = skype;
ID = id;
Name = name;
}
/// <summary>
/// Get a property from this object
/// </summary>
/// <param name="property">Arguments, joined with spaces</param>
/// <returns>Skype response</returns>
protected string GetProperty(params string[] property) {
string args = Name + " " + ID + " " + String.Join(" ", property);
string response = Skype.Send("GET " + args);
return response.Substring(args.Length + 1);
}
/// <summary>
/// Set a property of this object
/// </summary>
/// <param name="property">Arguments, joined with spaces</param>
protected string SetProperty(params string[] property) {
string message = Name + " " + ID + " " + String.Join(" ", property);
return Skype.Send(message);
}
/// <summary>
/// Alter a property of this object
/// </summary>
/// <param name="property">Arguments, joined with spaces</param>
protected void Alter(params string[] property) {
string message = "ALTER " + Name + " " + ID + " " + String.Join(" ", property);
if(Skype.Send(message) != message) throw new SkypeErrorException(message);
}
}
}
|
mit
|
C#
|
fb46a8d1db888b216aac3ddbe306d8c334c1035b
|
Use name only for reporting missing file
|
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
|
src/Arkivverket.Arkade.Core/Base/ArchiveXmlUnit.cs
|
src/Arkivverket.Arkade.Core/Base/ArchiveXmlUnit.cs
|
using System.Collections.Generic;
using System.Linq;
namespace Arkivverket.Arkade.Core.Base
{
public class ArchiveXmlUnit
{
public ArchiveXmlFile File { get; }
public List<ArchiveXmlSchema> Schemas { get; }
public ArchiveXmlUnit(ArchiveXmlFile file, List<ArchiveXmlSchema> schemas)
{
File = file;
Schemas = schemas;
}
public ArchiveXmlUnit(ArchiveXmlFile file, ArchiveXmlSchema schema)
: this(file, new List<ArchiveXmlSchema> {schema})
{
}
public bool AllFilesExists()
{
return !GetMissingFiles().Any();
}
public IEnumerable<string> GetMissingFiles()
{
var missingFiles = new List<string>();
if (!File.Exists)
missingFiles.Add(File.Name);
missingFiles.AddRange(
from schema in
from schema in Schemas
where schema.IsUserProvided()
select (UserProvidedXmlSchema) schema
where !schema.FileExists
select schema.FullName
);
return missingFiles;
}
}
}
|
using System.Collections.Generic;
using System.Linq;
namespace Arkivverket.Arkade.Core.Base
{
public class ArchiveXmlUnit
{
public ArchiveXmlFile File { get; }
public List<ArchiveXmlSchema> Schemas { get; }
public ArchiveXmlUnit(ArchiveXmlFile file, List<ArchiveXmlSchema> schemas)
{
File = file;
Schemas = schemas;
}
public ArchiveXmlUnit(ArchiveXmlFile file, ArchiveXmlSchema schema)
: this(file, new List<ArchiveXmlSchema> {schema})
{
}
public bool AllFilesExists()
{
return !GetMissingFiles().Any();
}
public IEnumerable<string> GetMissingFiles()
{
var missingFiles = new List<string>();
if (!File.Exists)
missingFiles.Add(File.FullName);
missingFiles.AddRange(
from schema in
from schema in Schemas
where schema.IsUserProvided()
select (UserProvidedXmlSchema) schema
where !schema.FileExists
select schema.FullName
);
return missingFiles;
}
}
}
|
agpl-3.0
|
C#
|
f4129a7169ccbf82c67865c81500c902e51952fd
|
add comment about small delay.
|
ProjectBlueMonkey/BlueMonkey,ProjectBlueMonkey/BlueMonkey
|
client/BlueMonkey/BlueMonkey.LoginService.Droid/AzureLoginService.cs
|
client/BlueMonkey/BlueMonkey.LoginService.Droid/AzureLoginService.cs
|
using Microsoft.WindowsAzure.MobileServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace BlueMonkey.LoginService.Droid
{
public class AzureLoginService : ILoginService
{
private readonly IMobileServiceClient _client;
public AzureLoginService(IMobileServiceClient client)
{
_client = client;
}
public async Task<bool> LoginAsync()
{
var user = await _client.LoginAsync(Forms.Context, MobileServiceAuthenticationProvider.MicrosoftAccount);
// https://github.com/jamesmontemagno/MediaPlugin/issues/136
await Task.Delay(100); // need... small delay
return user != null;
}
}
}
|
using Microsoft.WindowsAzure.MobileServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace BlueMonkey.LoginService.Droid
{
public class AzureLoginService : ILoginService
{
private readonly IMobileServiceClient _client;
public AzureLoginService(IMobileServiceClient client)
{
_client = client;
}
public async Task<bool> LoginAsync()
{
var user = await _client.LoginAsync(Forms.Context, MobileServiceAuthenticationProvider.MicrosoftAccount);
await Task.Delay(100); // need... small delay
return user != null;
}
}
}
|
mit
|
C#
|
4cfd221c9dbf5075dd7256b66b635f247cf7e5e1
|
Create Random Number
|
anbinhtrong/StrongPassword
|
StrongPassword/Program.cs
|
StrongPassword/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace StrongPassword
{
class Program
{
static void Main(string[] args)
{
var salt = GenerateRandomSalt(CreateRandomNumber(), 16);
var sha1 = ComputeSaltedHash("admin", salt);
Console.WriteLine("Salt: " + salt);
Console.WriteLine("Password: " + sha1);
}
public static RNGCryptoServiceProvider CreateRandomNumber()
{
return new RNGCryptoServiceProvider();
}
public static string GenerateRandomSalt(RNGCryptoServiceProvider rng, int size)
{
var bytes = new Byte[size];
rng.GetBytes(bytes);
return Convert.ToBase64String(bytes);
}
public static string ComputeSaltedHash(string password, string salt)
{
// Create Byte array of password string
var encoder = new ASCIIEncoding();
var saltAndPassword = string.Concat(password, salt);
var secretBytes = encoder.GetBytes(saltAndPassword);
// Create a new salt
var saltBytes = new Byte[4];
var salts = salt.Length;
saltBytes[0] = (byte)(salts >> 24);
saltBytes[1] = (byte)(salts >> 16);
saltBytes[2] = (byte)(salts >> 8);
saltBytes[3] = (byte)(salts);
// append the two arrays
var toHash = new Byte[secretBytes.Length + saltBytes.Length];
Array.Copy(secretBytes, 0, toHash, 0, secretBytes.Length);
Array.Copy(saltBytes, 0, toHash, secretBytes.Length, saltBytes.Length);
var sha1 = SHA1.Create();
var computedHash = sha1.ComputeHash(toHash);
return Convert.ToBase64String(computedHash);
//return Convert.FromBase64String(computedHash);
//return encoder.GetString(computedHash);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace StrongPassword
{
class Program
{
static void Main(string[] args)
{
var rng = new RNGCryptoServiceProvider();
var salt = GenerateRandomSalt(rng, 16);
var sha1 = ComputeSaltedHash("admin", salt);
Console.WriteLine("Salt: " + salt);
Console.WriteLine("Password: " + sha1);
}
public static string GenerateRandomSalt(RNGCryptoServiceProvider rng, int size)
{
var bytes = new Byte[size];
rng.GetBytes(bytes);
return Convert.ToBase64String(bytes);
}
public static string ComputeSaltedHash(string password, string salt)
{
// Create Byte array of password string
var encoder = new ASCIIEncoding();
var saltAndPassword = string.Concat(password, salt);
var secretBytes = encoder.GetBytes(saltAndPassword);
// Create a new salt
var saltBytes = new Byte[4];
var salts = salt.Length;
saltBytes[0] = (byte)(salts >> 24);
saltBytes[1] = (byte)(salts >> 16);
saltBytes[2] = (byte)(salts >> 8);
saltBytes[3] = (byte)(salts);
// append the two arrays
var toHash = new Byte[secretBytes.Length + saltBytes.Length];
Array.Copy(secretBytes, 0, toHash, 0, secretBytes.Length);
Array.Copy(saltBytes, 0, toHash, secretBytes.Length, saltBytes.Length);
var sha1 = SHA1.Create();
var computedHash = sha1.ComputeHash(toHash);
return Convert.ToBase64String(computedHash);
//return Convert.FromBase64String(computedHash);
//return encoder.GetString(computedHash);
}
}
}
|
mit
|
C#
|
9523dc537b50d92eb954e55dc1db22bbbb5605ec
|
Fix to code-signing classifier. (#1176)
|
tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools
|
tools/pipeline-witness/Azure.Sdk.Tools.PipelineWitness/Services/FailureAnalysis/CodeSigningFailureClassifier.cs
|
tools/pipeline-witness/Azure.Sdk.Tools.PipelineWitness/Services/FailureAnalysis/CodeSigningFailureClassifier.cs
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.TeamFoundation.Build.WebApi;
namespace Azure.Sdk.Tools.PipelineWitness.Services.FailureAnalysis
{
public class CodeSigningFailureClassifier : IFailureClassifier
{
public async Task ClassifyAsync(FailureAnalyzerContext context)
{
var failedTasks = from r in context.Timeline.Records
where r.Result == TaskResult.Failed
where r.RecordType == "Task"
where r.Task != null
where r.Task.Name == "EsrpCodeSigning"
where r.Log != null
select r;
if (failedTasks.Count() > 0)
{
foreach (var failedTask in failedTasks)
{
context.AddFailure(failedTask, "Code Signing");
}
}
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.TeamFoundation.Build.WebApi;
namespace Azure.Sdk.Tools.PipelineWitness.Services.FailureAnalysis
{
public class CodeSigningFailureClassifier : IFailureClassifier
{
public async Task ClassifyAsync(FailureAnalyzerContext context)
{
var failedTasks = from r in context.Timeline.Records
where r.Result == TaskResult.Failed
where r.RecordType == "Task"
where r.Task != null
where r.Task.Name == "ESRP Code Signing"
where r.Log != null
select r;
if (failedTasks.Count() > 0)
{
foreach (var failedTask in failedTasks)
{
context.AddFailure(failedTask, "Code Signing");
}
}
}
}
}
|
mit
|
C#
|
ded58263bfc09687be7de911498d07dd3ba7bcbe
|
fix unity problems
|
leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net
|
JoinRpg.DI/ContainerConfig.cs
|
JoinRpg.DI/ContainerConfig.cs
|
using System.Linq;
using JoinRpg.Common.EmailSending.Impl;
using JoinRpg.Dal.Impl;
using JoinRpg.Experimental.Plugin.Interfaces;
using JoinRpg.PluginHost.Impl;
using JoinRpg.PluginHost.Interfaces;
using JoinRpg.Services.Email;
using JoinRpg.Services.Export;
using JoinRpg.Services.Interfaces;
using JoinRpg.Services.Interfaces.Email;
using JoinRpg.Services.Interfaces.Notification;
using JoinRpg.WebPortal.Managers;
using Microsoft.Practices.Unity;
namespace JoinRpg.DI
{
public class ContainerConfig
{
public static void InjectAll(IUnityContainer container)
{
container.RegisterTypes(RepositoriesRegistraton.GetTypes(),
WithMappings.FromAllInterfaces,
WithName.Default);
container.RegisterTypes(Services.Impl.Services.GetTypes(),
WithMappings.FromAllInterfaces,
WithName.Default);
container.RegisterType<IExportDataService, ExportDataServiceImpl>();
container.RegisterType<IEmailService, EmailServiceImpl>();
container.RegisterType<IPluginFactory, PluginFactoryImpl>();
container.RegisterType<IEmailSendingService, EmailSendingServiceImpl>();
//TODO Automatically load all assemblies that start with JoinRpg.Experimental.Plugin.*
container.RegisterTypes(
AllClasses.FromLoadedAssemblies()
.Where(type => typeof(IPlugin).IsAssignableFrom(type)),
WithMappings.FromAllInterfaces,
WithName.TypeName);
container.RegisterTypes(Registration.GetTypes(),
WithMappings.FromAllInterfaces,
WithName.Default);
}
}
}
|
using System.Linq;
using JoinRpg.Common.EmailSending.Impl;
using JoinRpg.Dal.Impl;
using JoinRpg.Experimental.Plugin.Interfaces;
using JoinRpg.PluginHost.Impl;
using JoinRpg.PluginHost.Interfaces;
using JoinRpg.Services.Email;
using JoinRpg.Services.Export;
using JoinRpg.Services.Interfaces;
using JoinRpg.Services.Interfaces.Email;
using JoinRpg.Services.Interfaces.Notification;
using JoinRpg.WebPortal.Managers;
using Microsoft.Practices.Unity;
namespace JoinRpg.DI
{
public class ContainerConfig
{
public static void InjectAll(IUnityContainer container)
{
container.RegisterTypes(RepositoriesRegistraton.GetTypes(),
WithMappings.FromAllInterfaces,
WithName.TypeName);
container.RegisterTypes(Services.Impl.Services.GetTypes(),
WithMappings.FromAllInterfaces,
WithName.TypeName);
container.RegisterType<IExportDataService, ExportDataServiceImpl>();
container.RegisterType<IEmailService, EmailServiceImpl>();
container.RegisterType<IPluginFactory, PluginFactoryImpl>();
container.RegisterType<IEmailSendingService, EmailSendingServiceImpl>();
//TODO Automatically load all assemblies that start with JoinRpg.Experimental.Plugin.*
container.RegisterTypes(
AllClasses.FromLoadedAssemblies()
.Where(type => typeof(IPlugin).IsAssignableFrom(type)),
WithMappings.FromAllInterfaces,
WithName.TypeName);
container.RegisterTypes(Registration.GetTypes(),
WithMappings.FromAllInterfaces,
WithName.TypeName);
}
}
}
|
mit
|
C#
|
fb5ce38be59844ab3c42b2e83d302a6578645609
|
Add overloads for GrainServiceClient.GetGrainService with uint and SiloAddress (#8092)
|
dotnet/orleans,waynemunro/orleans,dotnet/orleans,hoopsomuah/orleans,hoopsomuah/orleans,waynemunro/orleans
|
src/Orleans.Runtime/Services/GrainServiceClient.cs
|
src/Orleans.Runtime/Services/GrainServiceClient.cs
|
using System;
using Microsoft.Extensions.DependencyInjection;
using Orleans.CodeGeneration;
using Orleans.Runtime.ConsistentRing;
using Orleans.Services;
namespace Orleans.Runtime.Services
{
/// <summary>
/// Proxies requests to the appropriate GrainService based on the appropriate Ring partitioning strategy.
/// </summary>
/// <typeparam name="TGrainService"></typeparam>
public abstract class GrainServiceClient<TGrainService> : IGrainServiceClient<TGrainService> where TGrainService : IGrainService
{
private readonly IInternalGrainFactory grainFactory;
private readonly IConsistentRingProvider ringProvider;
private readonly GrainType grainType;
/// <summary>
/// Currently we only support a single GrainService per Silo, when multiple are supported we will request the number of GrainServices to partition per silo here.
/// </summary>
/// <param name="serviceProvider">The service provider.</param>
protected GrainServiceClient(IServiceProvider serviceProvider)
{
grainFactory = serviceProvider.GetRequiredService<IInternalGrainFactory>();
ringProvider = serviceProvider.GetRequiredService<IConsistentRingProvider>();
// GrainInterfaceMap only holds IGrain types, not ISystemTarget types, so resolved via Orleans.CodeGeneration.
// Resolve this before merge.
var grainTypeCode = GrainInterfaceUtils.GetGrainClassTypeCode(typeof(TGrainService));
grainType = SystemTargetGrainId.CreateGrainServiceGrainType(grainTypeCode, null);
}
/// <summary>
/// Gets a reference to the the currently executing grain.
/// </summary>
protected GrainReference CurrentGrainReference => RuntimeContext.Current?.GrainReference;
/// <summary>
/// Get a reference to the <see cref="GrainService"/> responsible for actioning the request based on the <paramref name="callingGrainId"/>.
/// </summary>
protected TGrainService GetGrainService(GrainId callingGrainId)
{
return GetGrainService(callingGrainId.GetUniformHashCode());
}
/// <summary>
/// Get a reference to the <see cref="GrainService"/> responsible for actioning the request based on the <paramref name="key"/>.
/// </summary>
protected TGrainService GetGrainService(uint key)
{
return GetGrainService(ringProvider.GetPrimaryTargetSilo(key));
}
/// <summary>
/// Get a reference to the <see cref="GrainService"/> responsible for actioning the request based on the <paramref name="destination"/>.
/// </summary>
protected TGrainService GetGrainService(SiloAddress destination)
{
var grainId = SystemTargetGrainId.CreateGrainServiceGrainId(grainType, destination);
var grainService = grainFactory.GetSystemTarget<TGrainService>(grainId);
return grainService;
}
}
}
|
using System;
using Microsoft.Extensions.DependencyInjection;
using Orleans.CodeGeneration;
using Orleans.Runtime.ConsistentRing;
using Orleans.Services;
namespace Orleans.Runtime.Services
{
/// <summary>
/// Proxies requests to the appropriate GrainService based on the appropriate Ring partitioning strategy.
/// </summary>
/// <typeparam name="TGrainService"></typeparam>
public abstract class GrainServiceClient<TGrainService> : IGrainServiceClient<TGrainService> where TGrainService : IGrainService
{
private readonly IInternalGrainFactory grainFactory;
private readonly IConsistentRingProvider ringProvider;
private readonly GrainType grainType;
/// <summary>
/// Currently we only support a single GrainService per Silo, when multiple are supported we will request the number of GrainServices to partition per silo here.
/// </summary>
/// <param name="serviceProvider">The service provider.</param>
protected GrainServiceClient(IServiceProvider serviceProvider)
{
grainFactory = serviceProvider.GetRequiredService<IInternalGrainFactory>();
ringProvider = serviceProvider.GetRequiredService<IConsistentRingProvider>();
// GrainInterfaceMap only holds IGrain types, not ISystemTarget types, so resolved via Orleans.CodeGeneration.
// Resolve this before merge.
var grainTypeCode = GrainInterfaceUtils.GetGrainClassTypeCode(typeof(TGrainService));
grainType = SystemTargetGrainId.CreateGrainServiceGrainType(grainTypeCode, null);
}
/// <summary>
/// Gets a reference to the the currently executing grain.
/// </summary>
protected GrainReference CurrentGrainReference => RuntimeContext.Current?.GrainReference;
/// <summary>
/// Get a reference to the <see cref="GrainService"/> responsible for actioning the request based on the <paramref name="callingGrainId"/>.
/// </summary>
protected TGrainService GetGrainService(GrainId callingGrainId)
{
var hashCode = callingGrainId.GetUniformHashCode();
var destination = ringProvider.GetPrimaryTargetSilo(hashCode);
var grainId = SystemTargetGrainId.CreateGrainServiceGrainId(grainType, destination);
var grainService = grainFactory.GetSystemTarget<TGrainService>(grainId);
return grainService;
}
}
}
|
mit
|
C#
|
d5d5d2a3a7c3051e4224eb76217c00adce18abc1
|
Update Program.cs
|
leonmeerfeld/selenium-automation
|
selenium-automation/selenium-automation/Program.cs
|
selenium-automation/selenium-automation/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Interactions;
namespace selenium_automation
{
class Program
{
//test
static void Main(string[] args)
{
string baseURL = "http://lhk.uni-trier.de/";
Actions a = new Actions();
Writer w = new Writer();
w.WriteL("Starting test...", null);
a.startWebdriver();
a.gotoBaseURL(baseURL);
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Interactions;
namespace selenium_automation
{
class Program
{
static void Main(string[] args)
{
string baseURL = "http://lhk.uni-trier.de/";
Actions a = new Actions();
Writer w = new Writer();
w.WriteL("Starting test...", null);
a.startWebdriver();
a.gotoBaseURL(baseURL);
Console.ReadKey();
}
}
}
|
mpl-2.0
|
C#
|
adbda466fb3b87d475e8c8031f62962996afe23a
|
prepare speedtest
|
kbilsted/LineCounter.Net
|
LineCounter.Tests/UnitTest.cs
|
LineCounter.Tests/UnitTest.cs
|
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TeamBinary.LineCounter;
namespace TeamBinary.LineCounter.Tests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void run()
{
Stopwatch w = Stopwatch.StartNew();
var res = new DirWalker().DoWork(@"C:\src\");
Console.WriteLine("Time: " + w.ElapsedMilliseconds);
Console.WriteLine(new WebFormatter().CreateGithubShields(res));
}
[TestMethod]
public void DirWalker()
{
var res = new DirWalker().DoWork(@"C:\Users\kbg\Documents\GitHub\StatePrinter\");
Console.WriteLine(new WebFormatter().CreateGithubShields(res));
Assert.AreEqual(3257, res.CodeLines);
Assert.AreEqual(1376, res.DocumentationLines);
Console.WriteLine(new WebFormatter().CreateGithubShields(res));
}
[TestMethod]
public void Webformatter()
{
var stat = new Statistics() { CodeLines = 2399, DocumentationLines = 299 };
var res = new WebFormatter().CreateGithubShields(stat);
Console.WriteLine(res);
Assert.AreEqual(@"[]()
[]()", res);
}
}
}
|
using System;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TeamBinary.LineCounter;
namespace TeamBinary.LineCounter.Tests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void DirWalker()
{
var res = new DirWalker().DoWork(@"C:\Users\kbg\Documents\GitHub\StatePrinter\");
Console.WriteLine(new WebFormatter().CreateGithubShields(res));
Assert.AreEqual(3257, res.CodeLines);
Assert.AreEqual(1376, res.DocumentationLines);
Console.WriteLine(new WebFormatter().CreateGithubShields(res));
}
[TestMethod]
public void Webformatter()
{
var stat = new Statistics() { CodeLines = 2399, DocumentationLines = 299 };
var res = new WebFormatter().CreateGithubShields(stat);
Console.WriteLine(res);
Assert.AreEqual(@"[]()
[]()", res);
}
}
}
|
apache-2.0
|
C#
|
d86bd765adbdbc03c1df895b33a84ed87fbbfcb0
|
Initialize ApplicationConfigurationException with a message
|
appharbor/appharbor-cli
|
src/AppHarbor/ApplicationConfigurationException.cs
|
src/AppHarbor/ApplicationConfigurationException.cs
|
using System;
namespace AppHarbor
{
public class ApplicationConfigurationException : Exception
{
public ApplicationConfigurationException(string message)
: base(message)
{
}
}
}
|
using System;
namespace AppHarbor
{
public class ApplicationConfigurationException : Exception
{
}
}
|
mit
|
C#
|
48fe6e2b8d053b884cfea4113b1bc4208bc2343c
|
Tweak for .net Standard 1.1 compatibility
|
markembling/MarkEmbling.Utils,markembling/MarkEmbling.Utilities
|
src/MarkEmbling.Utils/Extensions/EnumExtensions.cs
|
src/MarkEmbling.Utils/Extensions/EnumExtensions.cs
|
using System;
using System.ComponentModel;
using System.Reflection;
namespace MarkEmbling.Utils.Extensions {
public static class EnumExtensions {
/// <summary>
/// Gets the description of a field in an enumeration. If there is no
/// description attribute, the raw name of the field is provided.
/// </summary>
/// <param name="value">Enum value</param>
/// <returns>Description or raw name</returns>
public static string GetDescription(this Enum value) {
var field = value.GetType().GetRuntimeField(value.ToString());
var attribute = field.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
return attribute == null ? value.ToString() : attribute.Description;
}
}
}
|
using System;
using System.ComponentModel;
using System.Reflection;
namespace MarkEmbling.Utils.Extensions {
public static class EnumExtensions {
/// <summary>
/// Gets the description of a field in an enumeration. If there is no
/// description attribute, the raw name of the field is provided.
/// </summary>
/// <param name="value">Enum value</param>
/// <returns>Description or raw name</returns>
public static string GetDescription(this Enum value) {
var field = value.GetType().GetField(value.ToString());
var attribute = field.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
return attribute == null ? value.ToString() : attribute.Description;
}
}
}
|
mit
|
C#
|
bb31ae5f4c87af2ae2b8b8170e0938479d827f48
|
Fix TestGrain
|
OrleansContrib/OrleansDashboard,OrleansContrib/OrleansDashboard,OrleansContrib/OrleansDashboard
|
Tests/TestGrains/TestGrain.cs
|
Tests/TestGrains/TestGrain.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Orleans;
using Orleans.Runtime;
namespace TestGrains
{
public interface ITestGrain : IGrainWithIntegerKey
{
Task ExampleMethod1();
Task ExampleMethod2();
Task<int> ExampleMethod3();
}
public class TestGrain : Grain, ITestGrain, IRemindable
{
private readonly Random random = new Random();
public async Task ExampleMethod1()
{
await Task.Delay(random.Next(100));
}
public Task ExampleMethod2()
{
if (random.Next(100) > 50)
{
throw new Exception();
}
return Task.CompletedTask;
}
public Task<int> ExampleMethod3()
{
return Task.FromResult(random.Next(100));
}
public override async Task OnActivateAsync(CancellationToken cancellationToken)
{
await RegisterOrUpdateReminder("Frequent", TimeSpan.Zero, TimeSpan.FromMinutes(1));
await RegisterOrUpdateReminder("Daily", TimeSpan.Zero, TimeSpan.FromDays(1));
await RegisterOrUpdateReminder("Weekly", TimeSpan.Zero, TimeSpan.FromDays(7));
}
public Task ReceiveReminder(string reminderName, TickStatus status)
{
return Task.CompletedTask;
}
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Orleans;
using Orleans.Runtime;
namespace TestGrains
{
public interface ITestGrain : IGrainWithIntegerKey
{
Task ExampleMethod1();
Task ExampleMethod2();
Task<int> ExampleMethod3();
}
public class TestGrain : Grain, ITestGrain, IRemindable
{
private readonly Random random = new Random();
public async Task ExampleMethod1()
{
await Task.Delay(random.Next(100));
}
public Task ExampleMethod2()
{
if (random.Next(100) > 50)
{
//throw new Exception();
}
return Task.CompletedTask;
}
public Task<int> ExampleMethod3()
{
return Task.FromResult(random.Next(100));
}
public override async Task OnActivateAsync(CancellationToken cancellationToken)
{
await RegisterOrUpdateReminder("Frequent", TimeSpan.Zero, TimeSpan.FromMinutes(1));
await RegisterOrUpdateReminder("Daily", TimeSpan.Zero, TimeSpan.FromDays(1));
await RegisterOrUpdateReminder("Weekly", TimeSpan.Zero, TimeSpan.FromDays(7));
}
public Task ReceiveReminder(string reminderName, TickStatus status)
{
return Task.CompletedTask;
}
}
}
|
mit
|
C#
|
53110a398a2a5f45acc0fc8a6486dec58f212e10
|
Bump version number
|
smashery/KingsAndQueensHat
|
KingsAndQueensHat/Properties/AssemblyInfo.cs
|
KingsAndQueensHat/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("KingsAndQueensHat")]
[assembly: AssemblyDescription("Management System for a Kings and Queens Hat Tournament")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KingsAndQueensHat")]
[assembly: AssemblyCopyright("Copyright © Ashley Donaldson 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.3")]
[assembly: AssemblyFileVersion("1.0.3")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("KingsAndQueensHat")]
[assembly: AssemblyDescription("Management System for a Kings and Queens Hat Tournament")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KingsAndQueensHat")]
[assembly: AssemblyCopyright("Copyright © Ashley Donaldson 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2")]
[assembly: AssemblyFileVersion("1.0.2")]
|
mit
|
C#
|
775c21834400a1841a233878c7c3bfcf95dc889b
|
add example to write to the database (PetaPoco)
|
jgraber/MicroORM_examples,jgraber/MicroORM_examples,jgraber/MicroORM_examples
|
MicroORM_Dapper/MicroORM_PetaPoco/Program.cs
|
MicroORM_Dapper/MicroORM_PetaPoco/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MicroORM_Dapper;
using PetaPoco;
namespace MicroORM_PetaPoco
{
class Program
{
static void Main(string[] args)
{
ReadData();
WriteData();
}
private static void ReadData()
{
Console.WriteLine("Get all books");
var database = new Database("OrmConnection");
var books = database.Query<Book>("SELECT * FROM BOOK;");
foreach (var book in books)
{
Console.WriteLine(book);
}
}
private static void WriteData()
{
Book book = new Book() { Title = "PetaPoco - The Book", Summary = "Another Micro ORM", Pages = 200, Rating = 5 };
var database = new Database("OrmConnection");
database.Insert("Book", "Id", book);
Console.WriteLine("Inserted book with PetaPoco:");
Console.WriteLine(book);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MicroORM_Dapper;
using PetaPoco;
namespace MicroORM_PetaPoco
{
class Program
{
static void Main(string[] args)
{
ReadData();
}
private static void ReadData()
{
Console.WriteLine("Get all books");
var database = new Database("OrmConnection");
var books = database.Query<Book>("SELECT * FROM BOOK;");
foreach (var book in books)
{
Console.WriteLine(book);
}
}
}
}
|
apache-2.0
|
C#
|
fc4d7c0089d3df6c7a799c74381c79dde6ad4d87
|
Test receive and send message
|
vikekh/stepbot
|
Vikekh.Stepbot/Program.cs
|
Vikekh.Stepbot/Program.cs
|
using SlackAPI;
using System;
using System.Threading;
namespace Vikekh.Stepbot
{
class Program
{
static void Main(string[] args)
{
var botAuthToken = "";
var userAuthToken = "";
var name = "@stepdot";
var age = (new DateTime(2017, 1, 18) - DateTime.Now).Days / 365.0;
var ageString = age.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture);
var version = "0.1.0";
var mommy = "@vem";
ManualResetEventSlim clientReady = new ManualResetEventSlim(false);
SlackSocketClient client = new SlackSocketClient(botAuthToken);
client.Connect((connected) =>
{
// This is called once the client has emitted the RTM start command
clientReady.Set();
}, () =>
{
// This is called once the RTM client has connected to the end point
});
client.OnMessageReceived += (message) =>
{
// Handle each message as you receive them
Console.WriteLine(message.text);
var textData = string.Format("hello w0rld my name is {0} I am {1} years old and my version is {2} and my mommy is {3}", name, ageString, version, mommy);
client.SendMessage((x) => { }, message.channel, textData);
};
clientReady.Wait();
Console.ReadLine();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Vikekh.Stepbot
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
mit
|
C#
|
e4fa0cb825e712c961568a568d85e3d0f0cf19dc
|
Fix menu links
|
surrealist/ParkingSpace,surrealist/ParkingSpace,surrealist/ParkingSpace
|
ParkingSpace.Web/Views/Shared/_Layout.cshtml
|
ParkingSpace.Web/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Parking Space", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Gate In", "Index", "GateIn")</li>
<li>@Html.ActionLink("Gate Out", "Index", "GateOut")</li>
<li>@Html.ActionLink("Tickets", "Index", "Tickets")</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Parking Space", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Gate In", "Index", "GateIn")</li>
<li>@Html.ActionLink("Gate Out", "About", "GateOut")</li>
<li>@Html.ActionLink("Tickets", "Contact", "Tickets")</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
eb24f6daec50970c90d37217fdcfd8c13dd9256f
|
Bump version
|
DotNetAnalyzers/WpfAnalyzers
|
WpfAnalyzers/Suppressors/Sa1202Suppressor.cs
|
WpfAnalyzers/Suppressors/Sa1202Suppressor.cs
|
namespace WpfAnalyzers.Suppressors
{
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class Sa1202Suppressor : DiagnosticSuppressor
{
private static readonly SuppressionDescriptor Descriptor = new SuppressionDescriptor(nameof(Sa1202Suppressor), "SA1202", "Does not handle attached properties correctly.");
public override ImmutableArray<SuppressionDescriptor> SupportedSuppressions { get; } = ImmutableArray.Create(
Descriptor);
public override void ReportSuppressions(SuppressionAnalysisContext context)
{
foreach (var diagnostic in context.ReportedDiagnostics)
{
if (diagnostic.Location is { SourceTree: { } tree } &&
tree.GetRoot(context.CancellationToken) is { } root)
{
switch (root.FindNode(diagnostic.Location.SourceSpan))
{
case VariableDeclaratorSyntax { Parent: VariableDeclarationSyntax { Type: { } type } }
when type == KnownSymbols.DependencyProperty:
context.ReportSuppression(Suppression.Create(Descriptor, diagnostic));
break;
case MethodDeclarationSyntax method
when context.GetSemanticModel(tree) is { } semanticModel &&
GetAttached.Match(method, semanticModel, context.CancellationToken) is { }:
context.ReportSuppression(Suppression.Create(Descriptor, diagnostic));
break;
}
}
}
}
}
}
|
namespace WpfAnalyzers.Suppressors
{
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class Sa1202Suppressor : DiagnosticSuppressor
{
private static readonly SuppressionDescriptor Descriptor = new SuppressionDescriptor(nameof(Sa1202Suppressor), "SA1202", "Does not handle attached properties correctly.");
public override ImmutableArray<SuppressionDescriptor> SupportedSuppressions { get; } = ImmutableArray.Create(
Descriptor);
public override void ReportSuppressions(SuppressionAnalysisContext context)
{
foreach (var diagnostic in context.ReportedDiagnostics)
{
if (diagnostic.Location is { SourceTree: { } tree } &&
tree.GetRoot(context.CancellationToken) is { } root)
{
switch (root.FindNode(diagnostic.Location.SourceSpan))
{
case VariableDeclaratorSyntax { Parent: VariableDeclarationSyntax { Type: { } type } declaratorSyntax }
when type == KnownSymbols.DependencyProperty:
context.ReportSuppression(Suppression.Create(Descriptor, diagnostic));
break;
case MethodDeclarationSyntax method
when context.GetSemanticModel(tree) is { } semanticModel &&
GetAttached.Match(method, semanticModel, context.CancellationToken) is { }:
context.ReportSuppression(Suppression.Create(Descriptor, diagnostic));
break;
}
}
}
}
}
}
|
mit
|
C#
|
e4b30eef9af07d2f65fd2db1aa56ef52b0dab3ef
|
Add previous page tests
|
PioneerCode/pioneer-pagination,PioneerCode/pioneer-pagination,PioneerCode/pioneer-pagination
|
test/Pioneer.Pagination.Tests/PreviousPageTests.cs
|
test/Pioneer.Pagination.Tests/PreviousPageTests.cs
|
using Xunit;
namespace Pioneer.Pagination.Tests
{
/// <summary>
/// Previous Page Tests
/// </summary>
public class PreviousPageTests
{
private readonly PaginatedMetaService _sut = new PaginatedMetaService();
[Fact]
public void PreviousPageNotDisplayed()
{
var result = _sut.GetMetaData(10, 1, 1);
Assert.False(result.PreviousPage.Display, "Expected : Previous Page Displayed = false");
}
[Fact]
public void PreviousPageDisplayed()
{
var result = _sut.GetMetaData(10, 2, 1);
Assert.True(result.PreviousPage.Display, "Expected : Previous Page Displayed = true");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Pioneer.Pagination.Tests
{
class PreviousPageTests
{
}
}
|
mit
|
C#
|
a8505a2c25b3a1265bbfb326b8f11f6c56200dcc
|
Print accel data
|
treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk,treehopper-electronics/treehopper-sdk
|
NET/Libraries/Demos/Sensors/Mpu9250/Program.cs
|
NET/Libraries/Demos/Sensors/Mpu9250/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Treehopper;
using Treehopper.Libraries.Sensors.Inertial;
namespace Mpu9250Demo
{
class Program
{
static void Main(string[] args)
{
App().Wait();
}
static async Task App()
{
var board = await ConnectionService.Instance.GetFirstDeviceAsync();
await board.ConnectAsync();
var imu = new Mpu6050(board.I2c);
while(!Console.KeyAvailable)
{
Console.WriteLine(string.Format("{0:0.00}, {1:0.00}, {2:0.00}", imu.Accelerometer.X, imu.Accelerometer.Y, imu.Accelerometer.Z));
await Task.Delay(100);
}
board.Disconnect();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Treehopper;
using Treehopper.Libraries.Sensors.Inertial;
namespace Mpu9250Demo
{
class Program
{
static void Main(string[] args)
{
App().Wait();
}
static async Task App()
{
var board = await ConnectionService.Instance.GetFirstDeviceAsync();
await board.ConnectAsync();
var imu = new Mpu6050(board.I2c);
board.Disconnect();
}
}
}
|
mit
|
C#
|
6211590a6fa2bcf57f9d804feac0c387407166d8
|
Fix archive name for Windows builds
|
DustinCampbell/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn
|
scripts/archiving.cake
|
scripts/archiving.cake
|
#load "common.cake"
#load "runhelpers.cake"
using System.IO.Compression;
/// <summary>
/// Package a given output folder using a build identifier generated from the RID and framework identifier.
/// </summary>
/// <param name="platform">The platform</param>
/// <param name="contentFolder">The folder containing the files to package</param>
/// <param name="packageFolder">The destination folder for the archive</param>
/// <param name="projectName">The project name</param>
void Package(string platform, string contentFolder, string packageFolder)
{
if (!DirectoryHelper.Exists(packageFolder))
{
DirectoryHelper.Create(packageFolder);
}
var platformId = platform;
if (platformId.StartsWith("win"))
{
var dashIndex = platformId.IndexOf("-");
if (dashIndex >= 0)
{
platformId = "win-" + platformId.Substring(dashIndex + 1);
}
}
var archiveName = $"{packageFolder}/omnisharp-{platformId}";
Information("Packaging {0}...", archiveName);
// On all platforms use ZIP for Windows runtimes
if (platformId.StartsWith("win"))
{
var zipFile = $"{archiveName}.zip";
Zip(contentFolder, zipFile);
}
// On all platforms use TAR.GZ for Unix runtimes
else
{
var tarFile = $"{archiveName}.tar.gz";
// Use 7z to create TAR.GZ on Windows
if (Platform.Current.IsWindows)
{
var tempFile = $"{archiveName}.tar";
try
{
Run("7z", $"a \"{tempFile}\"", contentFolder)
.ExceptionOnError($"Tar-ing failed for {contentFolder} {archiveName}");
Run("7z", $"a \"{tarFile}\" \"{tempFile}\"", contentFolder)
.ExceptionOnError($"Compression failed for {contentFolder} {archiveName}");
FileHelper.Delete(tempFile);
}
catch (Win32Exception)
{
Information("Warning: 7z not available on PATH to pack tar.gz results");
}
}
// Use tar to create TAR.GZ on Unix
else
{
Run("tar", $"czf \"{tarFile}\" .", contentFolder)
.ExceptionOnError($"Compression failed for {contentFolder} {archiveName}");
}
}
}
|
#load "common.cake"
#load "runhelpers.cake"
using System.IO.Compression;
/// <summary>
/// Package a given output folder using a build identifier generated from the RID and framework identifier.
/// </summary>
/// <param name="platform">The platform</param>
/// <param name="contentFolder">The folder containing the files to package</param>
/// <param name="packageFolder">The destination folder for the archive</param>
/// <param name="projectName">The project name</param>
void Package(string platform, string contentFolder, string packageFolder)
{
if (!DirectoryHelper.Exists(packageFolder))
{
DirectoryHelper.Create(packageFolder);
}
var archiveName = $"{packageFolder}/omnisharp-{platform}";
Information("Packaging {0}...", archiveName);
// On all platforms use ZIP for Windows runtimes
if (platform.StartsWith("win") || (platform.Equals("default") && Platform.Current.IsWindows))
{
var zipFile = $"{archiveName}.zip";
Zip(contentFolder, zipFile);
}
// On all platforms use TAR.GZ for Unix runtimes
else
{
var tarFile = $"{archiveName}.tar.gz";
// Use 7z to create TAR.GZ on Windows
if (Platform.Current.IsWindows)
{
var tempFile = $"{archiveName}.tar";
try
{
Run("7z", $"a \"{tempFile}\"", contentFolder)
.ExceptionOnError($"Tar-ing failed for {contentFolder} {archiveName}");
Run("7z", $"a \"{tarFile}\" \"{tempFile}\"", contentFolder)
.ExceptionOnError($"Compression failed for {contentFolder} {archiveName}");
FileHelper.Delete(tempFile);
}
catch (Win32Exception)
{
Information("Warning: 7z not available on PATH to pack tar.gz results");
}
}
// Use tar to create TAR.GZ on Unix
else
{
Run("tar", $"czf \"{tarFile}\" .", contentFolder)
.ExceptionOnError($"Compression failed for {contentFolder} {archiveName}");
}
}
}
|
mit
|
C#
|
a814e637dcce44baa808f92b740a99cd9c65bf6e
|
Update assembly version for a new builder release
|
stevengum97/BotBuilder,msft-shahins/BotBuilder,mmatkow/BotBuilder,Clairety/ConnectMe,xiangyan99/BotBuilder,xiangyan99/BotBuilder,dr-em/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,dr-em/BotBuilder,mmatkow/BotBuilder,Clairety/ConnectMe,dr-em/BotBuilder,stevengum97/BotBuilder,dr-em/BotBuilder,msft-shahins/BotBuilder,xiangyan99/BotBuilder,yakumo/BotBuilder,stevengum97/BotBuilder,yakumo/BotBuilder,Clairety/ConnectMe,stevengum97/BotBuilder,xiangyan99/BotBuilder,mmatkow/BotBuilder,msft-shahins/BotBuilder,yakumo/BotBuilder,Clairety/ConnectMe,mmatkow/BotBuilder
|
CSharp/Library/Properties/AssemblyInfo.cs
|
CSharp/Library/Properties/AssemblyInfo.cs
|
using System.Resources;
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("Microsoft.Bot.Builder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Bot Builder")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")]
// 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.12.8.0")]
[assembly: AssemblyFileVersion("1.12.8.0")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]
[assembly: NeutralResourcesLanguage("en")]
|
using System.Resources;
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("Microsoft.Bot.Builder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Bot Builder")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")]
// 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.12.7.0")]
[assembly: AssemblyFileVersion("1.12.7.0")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]
[assembly: NeutralResourcesLanguage("en")]
|
mit
|
C#
|
cd708918b33f7049ffaafc71e8ddc78ac93cd55f
|
Remove unnecessary async
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
Battery-Commander.Web/Controllers/HomeController.cs
|
Battery-Commander.Web/Controllers/HomeController.cs
|
using BatteryCommander.Web.Models;
using BatteryCommander.Web.Services;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Controllers
{
[Authorize, ApiExplorerSettings(IgnoreApi = true)]
public class HomeController : Controller
{
private readonly Database db;
private async Task<Soldier> CurrentUser() => await UserService.FindAsync(db, User);
public HomeController(Database db)
{
this.db = db;
}
public async Task<ActionResult> Index()
{
var user = await CurrentUser();
if (user?.UnitId > 0)
{
return RedirectToRoute("Unit.Details", new { id = user.UnitId });
}
return RedirectToRoute("Units.List");
}
public ActionResult PrivacyAct()
{
return View();
}
[AllowAnonymous]
public IActionResult Login()
{
return new ChallengeResult("Auth0", new AuthenticationProperties
{
RedirectUri = Url.Action(nameof(PrivacyAct))
});
}
[Route("~/Logout")]
public async Task<IActionResult> Logout()
{
await HttpContext.SignOutAsync();
return RedirectToAction(nameof(Login));
}
public IActionResult Error()
{
return View();
}
}
}
|
using BatteryCommander.Web.Models;
using BatteryCommander.Web.Services;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace BatteryCommander.Web.Controllers
{
[Authorize, ApiExplorerSettings(IgnoreApi = true)]
public class HomeController : Controller
{
private readonly Database db;
private async Task<Soldier> CurrentUser() => await UserService.FindAsync(db, User);
public HomeController(Database db)
{
this.db = db;
}
public async Task<ActionResult> Index()
{
var user = await CurrentUser();
if (user?.UnitId > 0)
{
return RedirectToRoute("Unit.Details", new { id = user.UnitId });
}
return RedirectToRoute("Units.List");
}
public async Task<ActionResult> PrivacyAct()
{
return View();
}
[AllowAnonymous]
public IActionResult Login()
{
return new ChallengeResult("Auth0", new AuthenticationProperties
{
RedirectUri = Url.Action(nameof(PrivacyAct))
});
}
[Route("~/Logout")]
public async Task<IActionResult> Logout()
{
await HttpContext.SignOutAsync();
return RedirectToAction(nameof(Login));
}
public IActionResult Error()
{
return View();
}
}
}
|
mit
|
C#
|
7deffcb1b9c1ad202dbda734c2df241d7b92d48a
|
Add additional functional test cases.
|
mrwizard82d1/wcf_migration
|
ClientServerMix/TimeSeriesService.Client/Program.cs
|
ClientServerMix/TimeSeriesService.Client/Program.cs
|
using System;
using System.Collections.Generic;
using TimeSeries;
using TimeSeriesService.Client.TimeSeriesReference;
namespace TimeSeriesService.Client
{
class Program
{
static void Main()
{
var proxy = new TimeSeriesServiceClient();
var oneDataPoint = new List<DataPoint>
{
new DataPoint()
}.ToArray();
var oneDataPointResult = proxy.New(oneDataPoint);
Console.WriteLine("One data point: {0}", oneDataPointResult);
var twoDataPoints = new List<DataPoint>
{
new DataPoint(),
new DataPoint()
}.ToArray();
var twoDataPointsResult = proxy.New(twoDataPoints);
Console.WriteLine("Two data points: {0}", twoDataPointsResult);
var threeDataPoints = new List<DataPoint>
{
new DataPoint(),
new DataPoint(),
new DataPoint()
}.ToArray();
var threeDataPointsResult = proxy.New(threeDataPoints);
Console.WriteLine("Three data points: {0}",
threeDataPointsResult);
Console.WriteLine();
Console.WriteLine("--");
Console.WriteLine();
Console.WriteLine("Press <ENTER> to terminate client.");
Console.ReadLine();
}
}
}
|
using System;
using System.Collections.Generic;
using TimeSeries;
using TimeSeriesService.Client.TimeSeriesReference;
namespace TimeSeriesService.Client
{
class Program
{
static void Main()
{
var proxy = new TimeSeriesServiceClient();
var oneDataPoint = new List<DataPoint>
{
new DataPoint()
}.ToArray();
var oneDataPointResult = proxy.New(oneDataPoint);
Console.WriteLine("Irregular: {0}", oneDataPointResult);
Console.WriteLine("Press <ENTER> to terminate client.");
Console.ReadLine();
}
}
}
|
epl-1.0
|
C#
|
4a0e354e1d26db17307671f586edf77fead2427b
|
change casing back
|
mkliu/ToDoApp,mkliu/ToDoApp,mkliu/ToDoApp,mkliu/ToDoApp
|
ContosoUniversity/ContosoUniversity/KeyVaultUtil.cs
|
ContosoUniversity/ContosoUniversity/KeyVaultUtil.cs
|
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using Microsoft.Azure.KeyVault;
using System.Web.Configuration;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace ContosoUniversity
{
public static class KeyVaultUtil
{
//this is an optional property to hold the secret after it is retrieved
public static string EncryptSecret { get; set; }
//the method that will be provided to the KeyVaultClient
public async static Task<string> GetToken(string authority, string resource, string scope)
{
var authContext = new AuthenticationContext(authority);
ClientCredential clientCred = new ClientCredential(WebConfigurationManager.AppSettings["ClientId"],
WebConfigurationManager.AppSettings["ClientSecret"]);
AuthenticationResult result = await authContext.AcquireTokenAsync(resource, clientCred);
if (result == null)
throw new InvalidOperationException("Failed to obtain the JWT token");
return result.AccessToken;
}
public static string GetConnString()
{
var kv = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(KeyVaultUtil.GetToken));
string conn = kv.GetSecretAsync(WebConfigurationManager.AppSettings["SecretUri"]).Result.Value;
return conn;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using Microsoft.Azure.KeyVault;
using System.Web.Configuration;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace ContosoUniversity
{
public static class KeyVaultUtil
{
//this is an optional property to hold the secret after it is retrieved
public static string EncryptSecret { get; set; }
//the method that will be provided to the KeyVaultClient
public async static Task<string> GetToken(string authority, string resource, string scope)
{
var authContext = new AuthenticationContext(authority);
ClientCredential clientCred = new ClientCredential(WebConfigurationManager.AppSettings["clientId"],
WebConfigurationManager.AppSettings["clientSecret"]);
AuthenticationResult result = await authContext.AcquireTokenAsync(resource, clientCred);
if (result == null)
throw new InvalidOperationException("Failed to obtain the JWT token");
return result.AccessToken;
}
public static string GetConnString()
{
var kv = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(KeyVaultUtil.GetToken));
string conn = kv.GetSecretAsync(WebConfigurationManager.AppSettings["secretUri"]).Result.Value;
return conn;
}
}
}
|
mit
|
C#
|
e81cf25c9c86a9aac7cb1e5067844975b06bb817
|
Update FocusOnPointerPressedBehavior.cs
|
XamlBehaviors/XamlBehaviors,XamlBehaviors/XamlBehaviors,wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors
|
src/Avalonia.Xaml.Interactions/Core/FocusOnPointerPressedBehavior.cs
|
src/Avalonia.Xaml.Interactions/Core/FocusOnPointerPressedBehavior.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 Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Xaml.Interactivity;
namespace Avalonia.Xaml.Interactions.Core
{
/// <summary>
/// Focuses the AssociatedObject on PointerPressed event.
/// </summary>
public sealed class FocusOnPointerPressedBehavior : Behavior<Control>
{
/// <summary>
/// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>.
/// </summary>
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.PointerPressed += PointerPressed;
}
/// <summary>
/// Called when the behavior is being detached from its <see cref="Behavior.AssociatedObject"/>.
/// </summary>
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.PointerPressed -= PointerPressed;
}
private void PointerPressed(object sender, PointerPressedEventArgs e)
{
AssociatedObject.Focus();
}
}
}
|
// 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 Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Xaml.Interactivity;
namespace Avalonia.Xaml.Interactions.Core
{
/// <summary>
/// Focuses the AssociatedObject on PointerPressed event.
/// </summary>
public sealed class FocusOnPointerPressedBehavior : Behavior<Control>
{
/// <inheritdoc/>
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.PointerPressed += PointerPressed;
}
/// <inheritdoc/>
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.PointerPressed -= PointerPressed;
}
private void PointerPressed(object sender, PointerPressedEventArgs e)
{
AssociatedObject.Focus();
}
}
}
|
mit
|
C#
|
3844e95656a756286f8c31106bea35026b3af904
|
Fix one more instance of the same thing happening
|
EVAST9919/osu,DrabWeb/osu,peppy/osu,EVAST9919/osu,Nabile-Rahmani/osu,johnneijzen/osu,2yangk23/osu,DrabWeb/osu,NeoAdonis/osu,naoey/osu,2yangk23/osu,DrabWeb/osu,smoogipoo/osu,Frontear/osuKyzer,peppy/osu-new,ZLima12/osu,smoogipoo/osu,ppy/osu,johnneijzen/osu,smoogipoo/osu,naoey/osu,naoey/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,ppy/osu,ZLima12/osu,UselessToucan/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu
|
osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs
|
osu.Game/Input/Bindings/DatabasedKeyBindingContainer.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets;
using System.Linq;
namespace osu.Game.Input.Bindings
{
/// <summary>
/// A KeyBindingInputManager with a database backing for custom overrides.
/// </summary>
/// <typeparam name="T">The type of the custom action.</typeparam>
public class DatabasedKeyBindingContainer<T> : KeyBindingContainer<T>
where T : struct
{
private readonly RulesetInfo ruleset;
private readonly int? variant;
private KeyBindingStore store;
public override IEnumerable<KeyBinding> DefaultKeyBindings => ruleset.CreateInstance().GetDefaultKeyBindings(variant ?? 0);
/// <summary>
/// Create a new instance.
/// </summary>
/// <param name="ruleset">A reference to identify the current <see cref="Ruleset"/>. Used to lookup mappings. Null for global mappings.</param>
/// <param name="variant">An optional variant for the specified <see cref="Ruleset"/>. Used when a ruleset has more than one possible keyboard layouts.</param>
/// <param name="simultaneousMode">Specify how to deal with multiple matches of <see cref="KeyCombination"/>s and <see cref="T"/>s.</param>
public DatabasedKeyBindingContainer(RulesetInfo ruleset = null, int? variant = null, SimultaneousBindingMode simultaneousMode = SimultaneousBindingMode.None)
: base(simultaneousMode)
{
this.ruleset = ruleset;
this.variant = variant;
if (ruleset != null && variant == null)
throw new InvalidOperationException($"{nameof(variant)} can not be null when a non-null {nameof(ruleset)} is provided.");
}
[BackgroundDependencyLoader]
private void load(KeyBindingStore keyBindings)
{
store = keyBindings;
}
protected override void LoadComplete()
{
base.LoadComplete();
store.KeyBindingChanged += ReloadMappings;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (store != null)
store.KeyBindingChanged -= ReloadMappings;
}
protected override void ReloadMappings() => KeyBindings = store.Query(ruleset?.ID, variant).ToList();
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets;
using System.Linq;
namespace osu.Game.Input.Bindings
{
/// <summary>
/// A KeyBindingInputManager with a database backing for custom overrides.
/// </summary>
/// <typeparam name="T">The type of the custom action.</typeparam>
public class DatabasedKeyBindingContainer<T> : KeyBindingContainer<T>
where T : struct
{
private readonly RulesetInfo ruleset;
private readonly int? variant;
private KeyBindingStore store;
public override IEnumerable<KeyBinding> DefaultKeyBindings => ruleset.CreateInstance().GetDefaultKeyBindings(variant ?? 0);
/// <summary>
/// Create a new instance.
/// </summary>
/// <param name="ruleset">A reference to identify the current <see cref="Ruleset"/>. Used to lookup mappings. Null for global mappings.</param>
/// <param name="variant">An optional variant for the specified <see cref="Ruleset"/>. Used when a ruleset has more than one possible keyboard layouts.</param>
/// <param name="simultaneousMode">Specify how to deal with multiple matches of <see cref="KeyCombination"/>s and <see cref="T"/>s.</param>
public DatabasedKeyBindingContainer(RulesetInfo ruleset = null, int? variant = null, SimultaneousBindingMode simultaneousMode = SimultaneousBindingMode.None)
: base(simultaneousMode)
{
this.ruleset = ruleset;
this.variant = variant;
if (ruleset != null && variant == null)
throw new InvalidOperationException($"{nameof(variant)} can not be null when a non-null {nameof(ruleset)} is provided.");
}
[BackgroundDependencyLoader]
private void load(KeyBindingStore keyBindings)
{
store = keyBindings;
store.KeyBindingChanged += ReloadMappings;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (store != null)
store.KeyBindingChanged -= ReloadMappings;
}
protected override void ReloadMappings() => KeyBindings = store.Query(ruleset?.ID, variant).ToList();
}
}
|
mit
|
C#
|
0c6f9bcec599ae6c3de862bc0fd66afa50f56d18
|
Build and publish nuget package
|
RockFramework/Rock.Messaging
|
Rock.Messaging/Properties/AssemblyInfo.cs
|
Rock.Messaging/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("Rock.Messaging")]
[assembly: AssemblyDescription("Rock Messaging.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Messaging")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("58c2f915-e27e-436d-bd97-b6cb117ffd6b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.7")]
[assembly: AssemblyInformationalVersion("0.9.7")]
|
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("Rock.Messaging")]
[assembly: AssemblyDescription("Rock Messaging.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Messaging")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("58c2f915-e27e-436d-bd97-b6cb117ffd6b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.6")]
[assembly: AssemblyInformationalVersion("0.9.6")]
|
mit
|
C#
|
5da1b843655f1cb672acc8b916cb97b0bdaa6fd3
|
Remove redundant LINQ method call
|
faithword/IdentityServer3.EntityFramework,IdentityServer/IdentityServer3.EntityFramework,henkmeulekamp/IdentityServer3.EntityFramework,chwilliamson/IdentityServer3.EntityFramework,buybackoff/IdentityServer3.EntityFramework
|
Source/Core.EntityFramework/ScopeStore.cs
|
Source/Core.EntityFramework/ScopeStore.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.Services;
namespace Thinktecture.IdentityServer.Core.EntityFramework
{
public class ScopeStore : IScopeStore
{
private readonly string _connectionString;
public ScopeStore(string connectionString)
{
_connectionString = connectionString;
}
public Task<IEnumerable<Models.Scope>> GetScopesAsync()
{
using (var db = new CoreDbContext(_connectionString))
{
var scopes = db.Scopes
.Include("ScopeClaims");
var models = scopes.ToList().Select(x => x.ToModel());
return Task.FromResult(models);
}
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.Services;
namespace Thinktecture.IdentityServer.Core.EntityFramework
{
public class ScopeStore : IScopeStore
{
private readonly string _connectionString;
public ScopeStore(string connectionString)
{
_connectionString = connectionString;
}
public Task<IEnumerable<Models.Scope>> GetScopesAsync()
{
using (var db = new CoreDbContext(_connectionString))
{
var scopes = db.Scopes
.Include("ScopeClaims")
.ToArray();
var models = scopes.ToList().Select(x => x.ToModel());
return Task.FromResult(models);
}
}
}
}
|
apache-2.0
|
C#
|
6b76f7b4f032c95461d3d0281b2b4ec63edb91ce
|
Rename var
|
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
|
R7.University/Models/UniversityModelContext.cs
|
R7.University/Models/UniversityModelContext.cs
|
using DotNetNuke.Common.Utilities;
using R7.Dnn.Extensions.Data;
using R7.Dnn.Extensions.Models;
using R7.University.Data;
namespace R7.University.Models
{
public class UniversityModelContext: ModelContextBase
{
public UniversityModelContext (IDataContext dataContext): base (dataContext)
{
}
public UniversityModelContext ()
{
}
#region ModelContextBase implementation
public override IDataContext CreateDataContext ()
{
return UniversityDataContextFactory.Instance.Create ();
}
public override bool SaveChanges (bool isFinal = true)
{
var result = base.SaveChanges (isFinal);
if (isFinal) {
DataCache.ClearCache ("//r7_University");
}
return result;
}
#endregion
}
}
|
//
// UniversityModelContext.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2016-2018 Roman M. Yagodin
//
// 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 DotNetNuke.Common.Utilities;
using R7.Dnn.Extensions.Data;
using R7.Dnn.Extensions.Models;
using R7.University.Data;
namespace R7.University.Models
{
public class UniversityModelContext: ModelContextBase
{
public UniversityModelContext (IDataContext dataContext): base (dataContext)
{
}
public UniversityModelContext ()
{
}
#region ModelContextBase implementation
public override IDataContext CreateDataContext ()
{
return UniversityDataContextFactory.Instance.Create ();
}
public override bool SaveChanges (bool dispose = true)
{
var result = base.SaveChanges (dispose);
// drop cache on final call
if (dispose) {
DataCache.ClearCache ("//r7_University");
}
return result;
}
#endregion
}
}
|
agpl-3.0
|
C#
|
de4dd353e065c5ceda6bbbe5c4ecc7ca502cf68d
|
Fix small offset in low quality minimap image
|
MHeasell/Mappy,MHeasell/Mappy
|
Mappy/Util/ImageSampling/NearestNeighbourWrapper.cs
|
Mappy/Util/ImageSampling/NearestNeighbourWrapper.cs
|
namespace Mappy.Util.ImageSampling
{
using System.Drawing;
public class NearestNeighbourWrapper : IPixelImage
{
private readonly IPixelImage source;
public NearestNeighbourWrapper(IPixelImage source, int width, int height)
{
this.source = source;
this.Width = width;
this.Height = height;
}
public int Width { get; private set; }
public int Height { get; private set; }
public Color this[int x, int y]
{
get
{
// sample at the centre of each pixel
float ax = x + 0.5f;
float ay = y + 0.5f;
int imageX = (int)((ax / this.Width) * this.source.Width);
int imageY = (int)((ay / this.Height) * this.source.Height);
return this.source[imageX, imageY];
}
}
}
}
|
namespace Mappy.Util.ImageSampling
{
using System.Drawing;
public class NearestNeighbourWrapper : IPixelImage
{
private readonly IPixelImage source;
public NearestNeighbourWrapper(IPixelImage source, int width, int height)
{
this.source = source;
this.Width = width;
this.Height = height;
}
public int Width { get; private set; }
public int Height { get; private set; }
public Color this[int x, int y]
{
get
{
int imageX = (int)((x / (float)this.Width) * this.source.Width);
int imageY = (int)((y / (float)this.Height) * this.source.Height);
return this.source[imageX, imageY];
}
}
}
}
|
mit
|
C#
|
42fd6bc6636d7359548ae9037e766dd0af1ab2be
|
remove call of nonexisting method
|
tkaretsos/ProceduralBuildings,AlexanderMazaletskiy/ProceduralBuildings
|
Scripts/CameraControl.cs
|
Scripts/CameraControl.cs
|
using UnityEngine;
using System.Collections.Generic;
public class CameraControl : MonoBehaviour
{
private enum CameraMode
{
Horizontal,
Free
}
[SerializeField]
private CameraMode _cameraMode = CameraMode.Horizontal;
[SerializeField]
private float _movementSpeed = 10.0f;
[SerializeField]
private float _rotationSpeed = 200.0f;
private float _x_rotation = 0.0f;
private float _y_rotation = 0.0f;
void Start ()
{
BuildingMesh mesh = new BuildingMesh(new Vector3(1,0,1),
new Vector3(-1,0,1),
new Vector3(-1,0,-1),
new Vector3(1,0,-1),
BuildingType.Neoclassical);
}
void Update ()
{
_y_rotation += Input.GetAxis("Mouse X") * _rotationSpeed * Time.deltaTime;
_x_rotation += Input.GetAxis("Mouse Y") * _rotationSpeed * Time.deltaTime;
ClampCamera();
camera.transform.eulerAngles = new Vector3(-_x_rotation, _y_rotation, 0.0f);
if (Input.GetAxis("Vertical") != 0.0f)
{
if (_cameraMode == CameraMode.Horizontal)
camera.transform.position += Vector3.Cross(camera.transform.right, Vector3.up) *
Input.GetAxis("Vertical") *
_movementSpeed * Time.deltaTime;
else
camera.transform.position += camera.transform.forward *
Input.GetAxis("Vertical") *
_movementSpeed * Time.deltaTime;
}
if (Input.GetAxis("Horizontal") != 0.0f)
camera.transform.position += camera.transform.right *
Input.GetAxis("Horizontal") *
_movementSpeed * Time.deltaTime;
if (Input.GetKey(KeyCode.E))
camera.transform.position += Vector3.up * _movementSpeed * Time.deltaTime;
if (Input.GetKey(KeyCode.C))
camera.transform.position -= Vector3.up * _movementSpeed * Time.deltaTime;
if (Input.GetKeyUp(KeyCode.M))
if (_cameraMode == CameraMode.Free)
_cameraMode = CameraMode.Horizontal;
else
_cameraMode = CameraMode.Free;
}
private void ClampCamera ()
{
if (_y_rotation < -360.0f) _y_rotation += 360.0f;
if (_y_rotation > 360.0f) _y_rotation -= 360.0f;
if (_x_rotation > 80.0f) _x_rotation = 80.0f;
if (_x_rotation < -80.0f) _x_rotation = -80.0f;
}
}
|
using UnityEngine;
using System.Collections.Generic;
public class CameraControl : MonoBehaviour
{
private enum CameraMode
{
Horizontal,
Free
}
[SerializeField]
private CameraMode _cameraMode = CameraMode.Horizontal;
[SerializeField]
private float _movementSpeed = 10.0f;
[SerializeField]
private float _rotationSpeed = 200.0f;
private float _x_rotation = 0.0f;
private float _y_rotation = 0.0f;
void Start ()
{
BuildingMesh mesh = new BuildingMesh(new Vector3(1,0,1),
new Vector3(-1,0,1),
new Vector3(-1,0,-1),
new Vector3(1,0,-1),
BuildingType.Neoclassical);
mesh.test();
}
void Update ()
{
_y_rotation += Input.GetAxis("Mouse X") * _rotationSpeed * Time.deltaTime;
_x_rotation += Input.GetAxis("Mouse Y") * _rotationSpeed * Time.deltaTime;
ClampCamera();
camera.transform.eulerAngles = new Vector3(-_x_rotation, _y_rotation, 0.0f);
if (Input.GetAxis("Vertical") != 0.0f)
{
if (_cameraMode == CameraMode.Horizontal)
camera.transform.position += Vector3.Cross(camera.transform.right, Vector3.up) *
Input.GetAxis("Vertical") *
_movementSpeed * Time.deltaTime;
else
camera.transform.position += camera.transform.forward *
Input.GetAxis("Vertical") *
_movementSpeed * Time.deltaTime;
}
if (Input.GetAxis("Horizontal") != 0.0f)
camera.transform.position += camera.transform.right *
Input.GetAxis("Horizontal") *
_movementSpeed * Time.deltaTime;
if (Input.GetKey(KeyCode.E))
camera.transform.position += Vector3.up * _movementSpeed * Time.deltaTime;
if (Input.GetKey(KeyCode.C))
camera.transform.position -= Vector3.up * _movementSpeed * Time.deltaTime;
if (Input.GetKeyUp(KeyCode.M))
if (_cameraMode == CameraMode.Free)
_cameraMode = CameraMode.Horizontal;
else
_cameraMode = CameraMode.Free;
}
private void ClampCamera ()
{
if (_y_rotation < -360.0f) _y_rotation += 360.0f;
if (_y_rotation > 360.0f) _y_rotation -= 360.0f;
if (_x_rotation > 80.0f) _x_rotation = 80.0f;
if (_x_rotation < -80.0f) _x_rotation = -80.0f;
}
}
|
mit
|
C#
|
27b7beda7170785fcfe7cbf7bd680f454c3c06a0
|
Update Computer.cs
|
jkanchelov/Telerik-OOP-Team-StarFruit
|
TeamworkStarFruit/CatalogueLib/Products/Computer.cs
|
TeamworkStarFruit/CatalogueLib/Products/Computer.cs
|
namespace CatalogueLib
{
using System.Text;
using CatalogueLib.Products.Enumerations;
public abstract class Computer : Product
{
public Computer()
{
}
public Computer(int ID, decimal price, bool isAvailable, Brand brand, string CPU, int DriveMemory, string VideoCardModel, string OperationSystem, double ScreenSize, int RAM)
: base(ID, price, isAvailable, brand)
{
this.CPU = CPU;
this.DriveMemory = DriveMemory;
this.VideoCardModel = VideoCardModel;
this.OperationSystem = OperationSystem;
this.ScreenSize = ScreenSize;
this.RAM = RAM;
}
public string CPU { get; private set; }
//in megabytes
public int DriveMemory { get; private set; }
public string VideoCardModel { get; private set; }
public string OperationSystem { get; private set; }
//in inches
public double ScreenSize { get; private set; }
//in gigs
public int RAM { get; private set; }
public override string ToString()
{
StringBuilder stroitel = new StringBuilder();
stroitel = stroitel.Append(string.Format("{0}", base.ToString()));
stroitel = stroitel.Append(string.Format(" CPU: {0}\n Drive Memory: {1} megabytes\n Video Card: {2}\n Operation System: {3}\n Screen size: {4} inches\n RAM: {5}",this.CPU, this.DriveMemory, this.VideoCardModel, this.OperationSystem, this.ScreenSize, this.RAM));
return stroitel.AppendLine().ToString();
}
}
}
|
namespace CatalogueLib
{
using CatalogueLib.Products.Enumerations;
public abstract class Computer : Product
{
public Computer()
{
}
public Computer(int ID, decimal price, bool isAvailable, Brand brand, string CPU, int DriveMemory, string VideoCardModel, string OperationSystem, double ScreenSize, int RAM)
: base(ID, price, isAvailable, brand)
{
this.CPU = CPU;
this.DriveMemory = DriveMemory;
this.VideoCardModel = VideoCardModel;
this.OperationSystem = OperationSystem;
this.ScreenSize = ScreenSize;
this.RAM = RAM;
}
public string CPU { get; private set; }
//in megabytes
public int DriveMemory { get; private set; }
public string VideoCardModel { get; private set; }
public string OperationSystem { get; private set; }
//in inches
public double ScreenSize { get; private set; }
//in gigs
public int RAM { get; private set; }
public override string ToString()
{
return base.ToString() + $"\nCPU:{this.CPU}\nDrive Memory:{this.DriveMemory} megabytes\nVideo Card:{this.VideoCardModel}\nOperation System:{this.OperationSystem}\nScreen size:{this.ScreenSize} inches\nRAM:{this.RAM}";
}
}
}
|
mit
|
C#
|
78acf92baf23ca3e41078da5349ea8cf4f6fdc92
|
Remove route debugging
|
andyfmiller/LtiSamples,andyfmiller/LtiSamples,andyfmiller/LtiSamples
|
SimpleLti/Global.asax.cs
|
SimpleLti/Global.asax.cs
|
using System;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
namespace SimpleLti
{
public class Global : HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
}
|
using System;
using System.Runtime.Remoting.Channels;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
namespace SimpleLti
{
public class Global : HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
public override void Init()
{
base.Init();
this.AcquireRequestState += ShowRouteValues;
}
protected void ShowRouteValues(object sender, EventArgs e)
{
var context = HttpContext.Current;
if (context == null) return;
var routeData = RouteTable.Routes.GetRouteData(new HttpContextWrapper(context));
}
}
}
|
apache-2.0
|
C#
|
a23fe528fd122ed36101b0c9bc5dbe212ba94447
|
fix bug: webook would fail on validation request
|
TonyAbell/Office-365-Management-Consumer
|
subscription_webhook/run.csx
|
subscription_webhook/run.csx
|
#r "Newtonsoft.Json"
using System;
using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
public static async Task<object> Run(HttpRequestMessage req, IAsyncCollector<object> metadata, TraceWriter log)
{
log.Info($"Webhook was triggered!");
string jsonContent = await req.Content.ReadAsStringAsync();
log.Info(jsonContent);
var token = JToken.Parse(jsonContent);
if (token is JArray)
{
JArray array = JArray.Parse(jsonContent);
foreach (JObject item in array)
{
item.Add("id", item["contentId"]);
await metadata.AddAsync(item);
}
}
else if (token is JObject)
{
log.Info($"Validation Request !");
}
log.Info($"Done!");
return req.CreateResponse(HttpStatusCode.OK);
}
|
#r "Newtonsoft.Json"
using System;
using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
public static async Task<object> Run(HttpRequestMessage req, IAsyncCollector<object> metadata, TraceWriter log)
{
log.Info($"Webhook was triggered!");
string jsonContent = await req.Content.ReadAsStringAsync();
JArray array = JArray.Parse(jsonContent);
foreach (JObject item in array)
{
item.Add("id", item["contentId"]);
await metadata.AddAsync(item);
}
log.Info($"Done!");
return req.CreateResponse(HttpStatusCode.OK);
}
|
mit
|
C#
|
625dc2b22cbdfa1748c04e04c37e9057d70e3a70
|
Update RavenUnitOfWorkBase.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/RavenDB/RavenUnitOfWorkBase.cs
|
TIKSN.Core/Data/RavenDB/RavenUnitOfWorkBase.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Raven.Client.Documents;
using Raven.Client.Documents.Session;
namespace TIKSN.Data.RavenDB
{
public abstract class RavenUnitOfWorkBase : UnitOfWorkBase
{
protected readonly IAsyncDocumentSession _session;
protected RavenUnitOfWorkBase(IDocumentStore store)
{
if (store == null)
{
throw new ArgumentNullException(nameof(store));
}
this._session = store.OpenAsyncSession();
}
public override async Task CompleteAsync(CancellationToken cancellationToken)
{
await this._session.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
this._session.Advanced.Clear();
}
public override void Dispose()
{
this._session.Dispose();
base.Dispose();
}
protected override bool IsDirty() => false;
//return _session.Advanced.HasChanges;
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Raven.Client.Documents;
using Raven.Client.Documents.Session;
namespace TIKSN.Data.RavenDB
{
public abstract class RavenUnitOfWorkBase : UnitOfWorkBase
{
protected readonly IAsyncDocumentSession _session;
protected RavenUnitOfWorkBase(IDocumentStore store)
{
if (store == null)
{
throw new ArgumentNullException(nameof(store));
}
this._session = store.OpenAsyncSession();
}
public override async Task CompleteAsync(CancellationToken cancellationToken)
{
await this._session.SaveChangesAsync(cancellationToken);
this._session.Advanced.Clear();
}
public override void Dispose()
{
this._session.Dispose();
base.Dispose();
}
protected override bool IsDirty() => false;
//return _session.Advanced.HasChanges;
}
}
|
mit
|
C#
|
73d8ff02af320b8ef05156a4268f9996d2c6433b
|
Fix stress test not creating v2
|
mrvoorhe/SaferMutex,mrvoorhe/SaferMutex
|
SaferMutex.Tests/FileBased/ThreadedStressTestsV2.cs
|
SaferMutex.Tests/FileBased/ThreadedStressTestsV2.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NiceIO;
using NUnit.Framework;
using SaferMutex.Tests.BaseSuites;
namespace SaferMutex.Tests.FileBased
{
[TestFixture]
public class ThreadedStressTestsV2 : BaseThreadedStressTests
{
protected override ISaferMutexMutex CreateMutexImplementation(bool initiallyOwned, string name, out bool owned, out bool createdNew)
{
return new SaferMutex.FileBased2(initiallyOwned, name, Scope.CurrentProcess, out owned, out createdNew, _tempDirectory.ToString());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NiceIO;
using NUnit.Framework;
using SaferMutex.Tests.BaseSuites;
namespace SaferMutex.Tests.FileBased
{
[TestFixture]
public class ThreadedStressTestsV2 : BaseThreadedStressTests
{
protected override ISaferMutexMutex CreateMutexImplementation(bool initiallyOwned, string name, out bool owned, out bool createdNew)
{
return new SaferMutex.FileBased(initiallyOwned, name, Scope.CurrentProcess, out owned, out createdNew, _tempDirectory.ToString());
}
}
}
|
mit
|
C#
|
ee55f9c0960df298a4110cc02a5b74847b792d8e
|
Remove unused field.
|
r3c/Verse
|
Verse/src/Schemas/QueryString/ReaderContext.cs
|
Verse/src/Schemas/QueryString/ReaderContext.cs
|
using System.IO;
using System.Text;
namespace Verse.Schemas.QueryString
{
internal class ReaderContext
{
#region Properties
public int Current
{
get
{
return this.current;
}
}
public int Position
{
get
{
return this.position;
}
}
#endregion
#region Attributes
private int current;
private int position;
private readonly StreamReader reader;
#endregion
#region Constructors
public ReaderContext(Stream stream, Encoding encoding)
{
this.current = 0;
this.position = 0;
this.reader = new StreamReader(stream, encoding);
this.Pull();
}
#endregion
#region Methods
public void Pull()
{
this.current = this.reader.Read();
++this.position;
}
#endregion
}
}
|
using System.IO;
using System.Text;
namespace Verse.Schemas.QueryString
{
internal class ReaderContext
{
#region Properties
public int Current
{
get
{
return this.current;
}
}
public int Position
{
get
{
return this.position;
}
}
#endregion
#region Attributes
private int current;
private int position;
public bool IsField;
private readonly StreamReader reader;
#endregion
#region Constructors
public ReaderContext(Stream stream, Encoding encoding)
{
this.current = 0;
this.position = 0;
this.IsField = true;
this.reader = new StreamReader(stream, encoding);
this.Pull();
}
#endregion
#region Methods
public void Pull()
{
this.current = this.reader.Read();
++this.position;
}
#endregion
}
}
|
mit
|
C#
|
b2ac99b4d4721c326f0ba4bfba95c576c2189158
|
Update AssemblyInfo
|
Simie/PrecisionEngineering
|
Src/PrecisionEngineering/Properties/AssemblyInfo.cs
|
Src/PrecisionEngineering/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("Precision Engineering")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Precision Engineering")]
[assembly: AssemblyCopyright("Copyright © Simon Moles 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("97d67e4b-9980-4118-b89a-7646aeaef76f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RoadEngineer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RoadEngineer")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("97d67e4b-9980-4118-b89a-7646aeaef76f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
1c9c971e46d4f992c588ef1220bba61313a70852
|
Update GetAsync to Take String Param
|
LiveTiles/Masticore.Net
|
Http/ApiFactory.cs
|
Http/ApiFactory.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Masticore.Net.Http
{
[Serializable]
public abstract class ApiFactory
{
public string BaseAddress;
public ApiFactory(string path = "")
{
BaseAddress += path;
}
protected virtual ApiClient Client(string path = "")
{
return new ApiClient(BaseAddress + path);
}
public async Task<JObject> GetAsync(string request = "", params string[] query)
{
return await Client().GetAsync(request, query);
}
public async Task<string> GetStringAsync(string request = "", string query = "")
{
return await Client().GetStringAsync(request, query);
}
public async Task<JArray> GetArrayAsync(string request = "", string query = "")
{
return await Client().GetArrayAsync(request, query);
}
public async Task<JObject> PostAsync(string request, JObject json)
{
return await Client().PostAsync(request, json);
}
public async Task<JObject> PostAsync(string request, object value)
{
return await Client().PostAsync(request, value);
}
public async Task<JObject> PostAsync(string request, string text)
{
return await Client().PostAsync(request, text);
}
public async Task<JObject> PostAsync(string request, HttpContent content)
{
return await Client().PostAsync(request, content);
}
public async Task<JObject> PatchAsync(string request, JObject json)
{
return await Client().PatchAsync(request, json);
}
public async Task DeleteAsync(string request)
{
await Client().DeleteAsync(request);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Masticore.Net.Http
{
[Serializable]
public abstract class ApiFactory
{
public string BaseAddress;
public ApiFactory(string path = "")
{
BaseAddress += path;
}
protected virtual ApiClient Client(string path = "")
{
return new ApiClient(BaseAddress + path);
}
public async Task<JObject> GetAsync(string request = "", string query = "")
{
return await Client().GetAsync(request, query);
}
public async Task<string> GetStringAsync(string request = "", string query = "")
{
return await Client().GetStringAsync(request, query);
}
public async Task<JArray> GetArrayAsync(string request = "", string query = "")
{
return await Client().GetArrayAsync(request, query);
}
public async Task<JObject> PostAsync(string request, JObject json)
{
return await Client().PostAsync(request, json);
}
public async Task<JObject> PostAsync(string request, object value)
{
return await Client().PostAsync(request, value);
}
public async Task<JObject> PostAsync(string request, string text)
{
return await Client().PostAsync(request, text);
}
public async Task<JObject> PostAsync(string request, HttpContent content)
{
return await Client().PostAsync(request, content);
}
public async Task<JObject> PatchAsync(string request, JObject json)
{
return await Client().PatchAsync(request, json);
}
public async Task DeleteAsync(string request)
{
await Client().DeleteAsync(request);
}
}
}
|
mit
|
C#
|
7a2c3956284c13ff29e87c414fe12cbdcdf6ba47
|
Improve record timestamp precision
|
criteo/zipkin4net,criteo/zipkin4net
|
Criteo.Profiling.Tracing/Tracers/Zipkin/ZipkinAnnotation.cs
|
Criteo.Profiling.Tracing/Tracers/Zipkin/ZipkinAnnotation.cs
|
using System;
namespace Criteo.Profiling.Tracing.Tracers.Zipkin
{
internal class ZipkinAnnotation
{
private readonly DateTime _timestamp;
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
internal string Value { get; private set; }
public ZipkinAnnotation(DateTime timestamp, string value)
{
_timestamp = timestamp;
Value = value;
}
public Thrift.Annotation ToThrift()
{
var thriftAnn = new Thrift.Annotation()
{
Timestamp = ToUnixTimestamp(_timestamp),
Value = this.Value
};
return thriftAnn;
}
public override string ToString()
{
return String.Format("ZipkinAnn: ts={0} val={1}", ToUnixTimestamp(_timestamp), Value);
}
/// <summary>
/// Create a UNIX timestamp from a UTC date time. Time is expressed in microseconds and not seconds.
/// </summary>
/// <see href="https://en.wikipedia.org/wiki/Unix_time"/>
/// <param name="utcDateTime"></param>
/// <returns></returns>
internal static long ToUnixTimestamp(DateTime utcDateTime)
{
return (long)(utcDateTime.Subtract(Epoch).TotalMilliseconds * 1000L);
}
}
}
|
using System;
namespace Criteo.Profiling.Tracing.Tracers.Zipkin
{
internal class ZipkinAnnotation
{
private readonly DateTime _timestamp;
internal string Value { get; private set; }
public ZipkinAnnotation(DateTime timestamp, string value)
{
_timestamp = timestamp;
Value = value;
}
public Thrift.Annotation ToThrift()
{
var thriftAnn = new Thrift.Annotation()
{
Timestamp = ToUnixTimestamp(_timestamp),
Value = this.Value
};
return thriftAnn;
}
public override string ToString()
{
return String.Format("ZipkinAnn: ts={0} val={1}", ToUnixTimestamp(_timestamp), Value);
}
/// <summary>
/// Create a UNIX timestamp from a UTC date time. Time is expressed in microseconds and not seconds.
/// </summary>
/// <see href="https://en.wikipedia.org/wiki/Unix_time"/>
/// <param name="utcDateTime"></param>
/// <returns></returns>
internal static long ToUnixTimestamp(DateTime utcDateTime)
{
return (long)((utcDateTime.Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds) * 1000L;
}
}
}
|
apache-2.0
|
C#
|
8ef49d527799d6580d3e8f1c1ab43b87794441ac
|
Change ApiKey to AppId add RequireApiAuthToken
|
thewizster/hanc,thewizster/hanc
|
AspNetAPI/Options.cs
|
AspNetAPI/Options.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Hanc.AspNetAPI
{
/// <summary>
/// The options pattern uses custom options classes to represent a group of related settings.
/// See Startup.cs and ValuesController.cs for implimentation code
/// </summary>
public class SecretOptions
{
public SecretOptions()
{
MacSecret = "default_secret";
}
public string MacSecret { get; set; }
public string AppId { get; set; }
public bool RequireApiAuthToken { get; set; }
}
/// <summary>
/// The options pattern uses custom options classes to represent a group of related settings.
/// See Startup.cs and HelloController.cs for implimentation code
/// </summary>
public class HelloOptions
{
public HelloOptions()
{
HelloValue = "...";
}
public string HelloValue { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Hanc.AspNetAPI
{
/// <summary>
/// The options pattern uses custom options classes to represent a group of related settings.
/// See Startup.cs and ValuesController.cs for implimentation code
/// </summary>
public class SecretOptions
{
public SecretOptions()
{
MacSecret = "default_secret";
}
public string MacSecret { get; set; }
public string ApiKey { get; set; }
}
/// <summary>
/// The options pattern uses custom options classes to represent a group of related settings.
/// See Startup.cs and HelloController.cs for implimentation code
/// </summary>
public class HelloOptions
{
public HelloOptions()
{
HelloValue = "...";
}
public string HelloValue { get; set; }
}
}
|
mit
|
C#
|
ddb42f3bd11878163eab67a0a042a1ab6f05fed8
|
Add accessors to SuperPower class
|
LeBodro/super-salaryman-2044
|
Assets/SuperPower.cs
|
Assets/SuperPower.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SuperPower : MonoBehaviour
{
[SerializeField] string power;
[SerializeField] Texture2D icon;
public string Power { get { return power; } }
public Texture2D Icon { get { return icon; } }
void Start()
{
Debug.LogError("SuperPowers should stay prefabs and never be instantiated.");
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SuperPower : MonoBehaviour
{
[SerializeField] string power;
[SerializeField] Texture2D icon;
}
|
mit
|
C#
|
3b56b93ba1822149d495d560263679d7d14ab80e
|
Make the designer work in the sandbox project.
|
wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Perspex
|
samples/Sandbox/Program.cs
|
samples/Sandbox/Program.cs
|
using Avalonia;
namespace Sandbox
{
public class Program
{
static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
}
|
using Avalonia;
namespace Sandbox
{
public class Program
{
static void Main(string[] args)
{
AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace()
.StartWithClassicDesktopLifetime(args);
}
}
}
|
mit
|
C#
|
e8be0538cb9fb78ce4bc074fd32dbcc96040047c
|
Add support for web links
|
aspnet/WebHooks,aspnet/WebHooks
|
src/Microsoft.AspNet.WebHooks.Receivers.VSTS/Payloads/GitPullLinks.cs
|
src/Microsoft.AspNet.WebHooks.Receivers.VSTS/Payloads/GitPullLinks.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Newtonsoft.Json;
namespace Microsoft.AspNet.WebHooks.Payloads
{
/// <summary>
/// Links for the Pull Request
/// </summary>
public class GitPullLinks
{
/// <summary>
/// Pull Request Link
/// </summary>
[JsonProperty("self")]
public GitLink Self { get; set; }
/// <summary>
/// Link to pull request web view
/// </summary>
[JsonProperty("web")]
public GitLink Web { get; set; }
/// <summary>
/// Repository Link
/// </summary>
[JsonProperty("repository")]
public GitLink Repository { get; set; }
/// <summary>
/// Link to Work Items
/// </summary>
[JsonProperty("workItems")]
public GitLink WorkItems { get; set; }
/// <summary>
/// Link to the Source Branch
/// </summary>
[JsonProperty("sourceBranch")]
public GitLink SourceBranch { get; set; }
/// <summary>
/// Link to the Target Branch
/// </summary>
[JsonProperty("targetBranch")]
public GitLink TargetBranch { get; set; }
/// <summary>
/// Link to the Source Commit
/// </summary>
[JsonProperty("sourceCommit")]
public GitLink SourceCommit { get; set; }
/// <summary>
/// Link to the Target Commit
/// </summary>
[JsonProperty("targetCommit")]
public GitLink TargetCommit { get; set; }
/// <summary>
/// Link to user that created the Commit
/// </summary>
[JsonProperty("createdBy")]
public GitLink CreatedBy { get; set; }
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Newtonsoft.Json;
namespace Microsoft.AspNet.WebHooks.Payloads
{
/// <summary>
/// Links for the Pull Request
/// </summary>
public class GitPullLinks
{
/// <summary>
/// Pull Request Link
/// </summary>
[JsonProperty("self")]
public GitLink Self { get; set; }
/// <summary>
/// Repository Link
/// </summary>
[JsonProperty("repository")]
public GitLink Repository { get; set; }
/// <summary>
/// Link to Work Items
/// </summary>
[JsonProperty("workItems")]
public GitLink WorkItems { get; set; }
/// <summary>
/// Link to the Source Branch
/// </summary>
[JsonProperty("sourceBranch")]
public GitLink SourceBranch { get; set; }
/// <summary>
/// Link to the Target Branch
/// </summary>
[JsonProperty("targetBranch")]
public GitLink TargetBranch { get; set; }
/// <summary>
/// Link to the Source Commit
/// </summary>
[JsonProperty("sourceCommit")]
public GitLink SourceCommit { get; set; }
/// <summary>
/// Link to the Target Commit
/// </summary>
[JsonProperty("targetCommit")]
public GitLink TargetCommit { get; set; }
/// <summary>
/// Link to user that created the Commit
/// </summary>
[JsonProperty("createdBy")]
public GitLink CreatedBy { get; set; }
}
}
|
apache-2.0
|
C#
|
80d62001feeaab48cee4cb58938e650ff8557031
|
Refactor Code
|
ishu3101/Wox.Plugin.ChangeCase
|
Wox.Plugin.ChangeCase/Main.cs
|
Wox.Plugin.ChangeCase/Main.cs
|
using System;
using System.Windows.Forms;
using System.Collections.Generic;
namespace Wox.Plugin.ChangeCase
{
public class Main : IPlugin
{
public void Init(PluginInitContext context) { }
public List<Result> Query(Query query)
{
List<Result> results = new List<Result>();
var keyword = query.ActionParameters;
// get the input entered by the user
string input = "";
foreach (string param in keyword)
{
input += " " + param;
}
String title = input.ToLower();
results.Add(Result(title, "Convert to Lowercase", "Images\\lowercase.png", Action(title)));
title = input.ToUpper();
results.Add(Result(title, "Convert to Uppercase", "Images\\uppercase.png", Action(title)));
return results;
}
private static Result Result(String title, String subtitle, String icon, Func<ActionContext, bool> action)
{
return new Result()
{
Title = title,
SubTitle = subtitle,
IcoPath = icon,
Action = action
};
}
// The Action method is called after the user selects the item
private static Func<ActionContext, bool> Action(String text)
{
return e =>
{
CopyToClipboard(text);
// return false to tell Wox don't hide query window, otherwise Wox will hide it automatically
return false;
};
}
// Copy the text entered to the Clipboard
public static void CopyToClipboard(String text)
{
Clipboard.SetText(text);
}
}
}
|
using System.Windows.Forms;
using System.Collections.Generic;
namespace Wox.Plugin.ChangeCase
{
public class Main : IPlugin
{
public void Init(PluginInitContext context) { }
public List<Result> Query(Query query)
{
List<Result> results = new List<Result>();
var keyword = query.ActionParameters;
// get the input entered by the user
string input = "";
foreach (string param in keyword)
{
input += " " + param;
}
results.Add(new Result()
{
Title = input.ToLower(),
SubTitle = "Convert to Lowercase",
IcoPath = "Images\\lowercase.png",
Action = e =>
{
// copy to clipboard after user select the item
Clipboard.SetText(input.ToLower());
// return false to tell Wox don't hide query window, otherwise Wox will hide it automatically
return false;
}
});
results.Add(new Result()
{
Title = input.ToUpper(),
SubTitle = "Convert to Uppercase",
IcoPath = "Images\\uppercase.png",
Action = e =>
{
// copy to clipboard after user select the item
Clipboard.SetText(input.ToUpper());
// return false to tell Wox don't hide query window, otherwise Wox will hide it automatically
return false;
}
});
return results;
}
}
}
|
mit
|
C#
|
e64fd7b61e64e58e5555fe1dfd63a2d256ab20f5
|
Change server
|
AndMu/Wikiled.Sentiment
|
src/Sentiment/Wikiled.Sentiment.AcceptanceTests/Helpers/TestHelper.cs
|
src/Sentiment/Wikiled.Sentiment.AcceptanceTests/Helpers/TestHelper.cs
|
using System;
using System.Configuration;
using System.IO;
using Microsoft.Extensions.Caching.Memory;
using NUnit.Framework;
using Wikiled.Amazon.Logic;
using Wikiled.Redis.Config;
using Wikiled.Redis.Logic;
using Wikiled.Sentiment.Analysis.Processing;
using Wikiled.Sentiment.Analysis.Processing.Splitters;
using Wikiled.Sentiment.Text.Cache;
using Wikiled.Sentiment.Text.Resources;
using Wikiled.Text.Analysis.Cache;
using Wikiled.Text.Analysis.POS;
namespace Wikiled.Sentiment.AcceptanceTests.Helpers
{
public class TestHelper
{
private readonly Lazy<RedisLink> redis;
private readonly Lazy<AmazonRepository> amazonRepository;
private readonly Lazy<ICachedDocumentsSource> cachedDocumentSource;
public TestHelper(string server = "192.168.0.70", int port = 6373)
{
ConfigurationHandler configuration = new ConfigurationHandler();
configuration.SetConfiguration("resources", Path.Combine(TestContext.CurrentContext.TestDirectory, ConfigurationManager.AppSettings["resources"]));
redis = new Lazy<RedisLink>(() =>
{
var instance = new RedisLink("Wikiled", new RedisMultiplexer(new RedisConfiguration(server, port)));
instance.Open();
return instance;
});
amazonRepository = new Lazy<AmazonRepository>(() => new AmazonRepository(Redis));
cachedDocumentSource = new Lazy<ICachedDocumentsSource>(() =>
{
var cacheFactory = new RedisDocumentCacheFactory(Redis);
return cacheFactory.Create(POSTaggerType.SharpNLP);
});
var localCache = new LocalCacheFactory(new MemoryCache(new MemoryCacheOptions()));
SplitterHelper = new MainSplitterFactory(localCache, configuration).Create(POSTaggerType.SharpNLP);
}
public static TestHelper Instance { get; } = new TestHelper();
public AmazonRepository AmazonRepository => amazonRepository.Value;
public ICachedDocumentsSource Cache => cachedDocumentSource.Value;
public ISplitterHelper SplitterHelper { get; }
public IRedisLink Redis => redis.Value;
}
}
|
using System;
using System.Configuration;
using System.IO;
using Microsoft.Extensions.Caching.Memory;
using NUnit.Framework;
using Wikiled.Amazon.Logic;
using Wikiled.Redis.Config;
using Wikiled.Redis.Logic;
using Wikiled.Sentiment.Analysis.Processing;
using Wikiled.Sentiment.Analysis.Processing.Splitters;
using Wikiled.Sentiment.Text.Cache;
using Wikiled.Sentiment.Text.Resources;
using Wikiled.Text.Analysis.Cache;
using Wikiled.Text.Analysis.POS;
namespace Wikiled.Sentiment.AcceptanceTests.Helpers
{
public class TestHelper
{
private readonly Lazy<RedisLink> redis;
private readonly Lazy<AmazonRepository> amazonRepository;
private readonly Lazy<ICachedDocumentsSource> cachedDocumentSource;
public TestHelper(string server = "192.168.0.147", int port = 6373)
{
ConfigurationHandler configuration = new ConfigurationHandler();
configuration.SetConfiguration("resources", Path.Combine(TestContext.CurrentContext.TestDirectory, ConfigurationManager.AppSettings["resources"]));
redis = new Lazy<RedisLink>(() =>
{
var instance = new RedisLink("Wikiled", new RedisMultiplexer(new RedisConfiguration(server, port)));
instance.Open();
return instance;
});
amazonRepository = new Lazy<AmazonRepository>(() => new AmazonRepository(Redis));
cachedDocumentSource = new Lazy<ICachedDocumentsSource>(() =>
{
var cacheFactory = new RedisDocumentCacheFactory(Redis);
return cacheFactory.Create(POSTaggerType.SharpNLP);
});
var localCache = new LocalCacheFactory(new MemoryCache(new MemoryCacheOptions()));
SplitterHelper = new MainSplitterFactory(localCache, configuration).Create(POSTaggerType.SharpNLP);
}
public static TestHelper Instance { get; } = new TestHelper();
public AmazonRepository AmazonRepository => amazonRepository.Value;
public ICachedDocumentsSource Cache => cachedDocumentSource.Value;
public ISplitterHelper SplitterHelper { get; }
public IRedisLink Redis => redis.Value;
}
}
|
apache-2.0
|
C#
|
3142e3efac6e1324590d0696cc45e472fb498af7
|
Add virtual to SaveOrUpdate
|
generik0/Smooth.IoC.Dapper.Repository.UnitOfWork,generik0/Smooth.IoC.Dapper.Repository.UnitOfWork
|
src/Smooth.IoC.Dapper.Repository.UnitOfWork/RepositorySaveOrUpdate.cs
|
src/Smooth.IoC.Dapper.Repository.UnitOfWork/RepositorySaveOrUpdate.cs
|
using System;
using System.Threading.Tasks;
using Smooth.IoC.Repository.UnitOfWork.Extensions;
using Smooth.IoC.UnitOfWork;
namespace Smooth.IoC.Repository.UnitOfWork
{
public abstract partial class Repository< TEntity, TPk>
where TEntity : class
where TPk : IComparable
{
public virtual TPk SaveOrUpdate(TEntity entity, IUnitOfWork uow)
{
if (TryAllKeysDefault(entity))
{
uow.Insert(entity);
}
else
{
uow.Update(entity);
}
var primaryKeyValue = GetPrimaryKeyValue(entity);
return primaryKeyValue != null ? primaryKeyValue : default(TPk);
}
public virtual TPk SaveOrUpdate<TSesssion>(TEntity entity) where TSesssion : class, ISession
{
using (var uow = Factory.Create<IUnitOfWork, TSesssion>())
{
return SaveOrUpdate(entity, uow);
}
}
public virtual Task<TPk> SaveOrUpdateAsync(TEntity entity, IUnitOfWork uow)
{
return Task.Run(() =>
{
if (TryAllKeysDefault(entity))
{
uow.InsertAsync(entity);
}
else
{
uow.UpdateAsync(entity);
}
var primaryKeyValue = GetPrimaryKeyValue(entity);
return primaryKeyValue != null ? primaryKeyValue : default(TPk);
});
}
public virtual async Task<TPk> SaveOrUpdateAsync<TSesssion>(TEntity entity) where TSesssion : class, ISession
{
using (var uow = Factory.Create<IUnitOfWork, TSesssion>())
{
return await SaveOrUpdateAsync(entity, uow);
}
}
}
}
|
using System;
using System.Threading.Tasks;
using Smooth.IoC.Repository.UnitOfWork.Extensions;
using Smooth.IoC.UnitOfWork;
namespace Smooth.IoC.Repository.UnitOfWork
{
public abstract partial class Repository< TEntity, TPk>
where TEntity : class
where TPk : IComparable
{
public TPk SaveOrUpdate(TEntity entity, IUnitOfWork uow)
{
if (TryAllKeysDefault(entity))
{
uow.Insert(entity);
}
else
{
uow.Update(entity);
}
var primaryKeyValue = GetPrimaryKeyValue(entity);
return primaryKeyValue != null ? primaryKeyValue : default(TPk);
}
public virtual TPk SaveOrUpdate<TSesssion>(TEntity entity) where TSesssion : class, ISession
{
using (var uow = Factory.Create<IUnitOfWork, TSesssion>())
{
return SaveOrUpdate(entity, uow);
}
}
public virtual Task<TPk> SaveOrUpdateAsync(TEntity entity, IUnitOfWork uow)
{
return Task.Run(() =>
{
if (TryAllKeysDefault(entity))
{
uow.InsertAsync(entity);
}
else
{
uow.UpdateAsync(entity);
}
var primaryKeyValue = GetPrimaryKeyValue(entity);
return primaryKeyValue != null ? primaryKeyValue : default(TPk);
});
}
public virtual async Task<TPk> SaveOrUpdateAsync<TSesssion>(TEntity entity) where TSesssion : class, ISession
{
using (var uow = Factory.Create<IUnitOfWork, TSesssion>())
{
return await SaveOrUpdateAsync(entity, uow);
}
}
}
}
|
mit
|
C#
|
0ad5dd8e1640acb077ea45d660f3ecf59bc17164
|
bump ver
|
AntonyCorbett/OnlyT,AntonyCorbett/OnlyT
|
SolutionInfo.cs
|
SolutionInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2019, 2020 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.0.28")]
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2019, 2020 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.0.27")]
|
mit
|
C#
|
6f9c99e9a600416ecb383c43adb7d4c96134ea71
|
bump ver
|
AntonyCorbett/OnlyT,AntonyCorbett/OnlyT
|
SolutionInfo.cs
|
SolutionInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2019 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.0.2")]
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2019 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.0.1")]
|
mit
|
C#
|
fc1b7a2e058d6bb1236bc447f1a8c8245f741ff8
|
Fix format strings inside Const
|
lou1306/CIV,lou1306/CIV
|
CIV.Ccs/Const.cs
|
CIV.Ccs/Const.cs
|
using System;
namespace CIV.Ccs
{
public static class Const
{
public static readonly string tau = GetLiteral(CcsLexer.TAU);
public static readonly string nil = GetLiteral(CcsLexer.NIL);
public static readonly string par = GetLiteral(CcsLexer.PAR);
public static readonly string prefix = GetLiteral(CcsLexer.PREFIX);
public static readonly string choice = GetLiteral(CcsLexer.CHOICE);
public static readonly string relab = GetLiteral(CcsLexer.DIV);
public static readonly string restrictFormat =
String.Format(
"{{0}}{0}{{{{1}}}}",
GetLiteral(CcsLexer.T__1));
public static readonly string relabelFormat =
String.Format(
"{{0}}{0}{{1}}{1}",
GetLiteral(CcsLexer.LBRACK),
GetLiteral(CcsLexer.RBRACK));
static string GetLiteral(int id)
{
return CcsLexer.DefaultVocabulary
.GetLiteralName(id)
.Replace("'", "");
}
}
}
|
using System;
namespace CIV.Ccs
{
public static class Const
{
public static readonly string tau = GetLiteral(CcsLexer.TAU);
public static readonly string nil = GetLiteral(CcsLexer.NIL);
public static readonly string par = GetLiteral(CcsLexer.PAR);
public static readonly string prefix = GetLiteral(CcsLexer.PREFIX);
public static readonly string choice = GetLiteral(CcsLexer.CHOICE);
public static readonly string restrictFormat =
String.Format(
"{{0}}{0}{1}{{1}}{2}",
GetLiteral(CcsLexer.T__1),
GetLiteral(CcsLexer.LBRACE),
GetLiteral(CcsLexer.RBRACE));
public static readonly string relabelFormat =
String.Format(
"{{0}}{0}{{1}}{1}",
GetLiteral(CcsLexer.LBRACK),
GetLiteral(CcsLexer.RBRACK));
static string GetLiteral(int id)
{
return CcsLexer.DefaultVocabulary
.GetLiteralName(id)
.Replace("'", "");
}
}
}
|
mit
|
C#
|
1447b5e8beb81a6f8b359ba1606f31f00c8e320a
|
Add top margin to 2FA screen heading (#986)
|
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
|
BTCPayServer/Views/Manage/TwoFactorAuthentication.cshtml
|
BTCPayServer/Views/Manage/TwoFactorAuthentication.cshtml
|
@model TwoFactorAuthenticationViewModel
@{
ViewData.SetActivePageAndTitle(ManageNavPages.TwoFactorAuthentication, "Two-factor authentication");
}
@if(Model.Is2faEnabled)
{
if(Model.RecoveryCodesLeft == 0)
{
<div class="alert alert-danger">
<strong>You have no recovery codes left.</strong>
<p>You must <a asp-action="GenerateRecoveryCodes">generate a new set of recovery codes</a> before you can log in with a recovery code.</p>
</div>
}
else if(Model.RecoveryCodesLeft == 1)
{
<div class="alert alert-danger">
<strong>You have 1 recovery code left.</strong>
<p>You can <a asp-action="GenerateRecoveryCodes">generate a new set of recovery codes</a>.</p>
</div>
}
else if(Model.RecoveryCodesLeft <= 3)
{
<div class="alert alert-warning">
<strong>You have @Model.RecoveryCodesLeft recovery codes left.</strong>
<p>You should <a asp-action="GenerateRecoveryCodes">generate a new set of recovery codes</a>.</p>
</div>
}
<a asp-action="Disable2faWarning" class="btn btn-primary">Disable 2FA</a>
<a asp-action="GenerateRecoveryCodes" class="btn btn-primary">Reset recovery codes</a>
}
<h5 class="mt-4">Authenticator app</h5>
@if(!Model.HasAuthenticator)
{
<a asp-action="EnableAuthenticator" class="btn btn-primary">Add authenticator app</a>
}
else
{
<a asp-action="EnableAuthenticator" class="btn btn-primary">Configure authenticator app</a>
<a asp-action="ResetAuthenticatorWarning" class="btn btn-primary">Reset authenticator key</a>
}
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
|
@model TwoFactorAuthenticationViewModel
@{
ViewData.SetActivePageAndTitle(ManageNavPages.TwoFactorAuthentication, "Two-factor authentication");
}
@if(Model.Is2faEnabled)
{
if(Model.RecoveryCodesLeft == 0)
{
<div class="alert alert-danger">
<strong>You have no recovery codes left.</strong>
<p>You must <a asp-action="GenerateRecoveryCodes">generate a new set of recovery codes</a> before you can log in with a recovery code.</p>
</div>
}
else if(Model.RecoveryCodesLeft == 1)
{
<div class="alert alert-danger">
<strong>You have 1 recovery code left.</strong>
<p>You can <a asp-action="GenerateRecoveryCodes">generate a new set of recovery codes</a>.</p>
</div>
}
else if(Model.RecoveryCodesLeft <= 3)
{
<div class="alert alert-warning">
<strong>You have @Model.RecoveryCodesLeft recovery codes left.</strong>
<p>You should <a asp-action="GenerateRecoveryCodes">generate a new set of recovery codes</a>.</p>
</div>
}
<a asp-action="Disable2faWarning" class="btn btn-primary">Disable 2FA</a>
<a asp-action="GenerateRecoveryCodes" class="btn btn-primary">Reset recovery codes</a>
}
<h5>Authenticator app</h5>
@if(!Model.HasAuthenticator)
{
<a asp-action="EnableAuthenticator" class="btn btn-primary">Add authenticator app</a>
}
else
{
<a asp-action="EnableAuthenticator" class="btn btn-primary">Configure authenticator app</a>
<a asp-action="ResetAuthenticatorWarning" class="btn btn-primary">Reset authenticator key</a>
}
@section Scripts {
@await Html.PartialAsync("_ValidationScriptsPartial")
}
|
mit
|
C#
|
723799949217fea5438b8b8264a200eb1262a753
|
Add GET All Names endpoint
|
Salgat/EventSourcing-Demo
|
DataReader/DataReader/Controllers/NameQueryController.cs
|
DataReader/DataReader/Controllers/NameQueryController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using DataReader.BusinessLogic;
using DataReader.Models;
namespace DataReader.Controllers
{
[RoutePrefix("api")]
public class NameQueryController : ApiController
{
private readonly INameBusinessLogic _nameBusinessLogic;
public NameQueryController(INameBusinessLogic nameBusinessLogic)
{
_nameBusinessLogic = nameBusinessLogic;
}
[Route("fullName/{id}")]
[HttpGet]
public IHttpActionResult GetName(string id)
{
var result = default(NameDTO);
try
{
result = _nameBusinessLogic.GetById(id);
}
catch (Exception ex)
{
return StatusCode(HttpStatusCode.ExpectationFailed);
}
return Ok(result);
}
[Route("fullName")]
[HttpGet]
public IHttpActionResult GetAllNames()
{
var result = default(string[]);
try
{
result = _nameBusinessLogic.GetAllNameIds();
}
catch (Exception ex)
{
return StatusCode(HttpStatusCode.ExpectationFailed);
}
return Ok(result);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using DataReader.BusinessLogic;
using DataReader.Models;
namespace DataReader.Controllers
{
[RoutePrefix("api")]
public class NameQueryController : ApiController
{
private readonly INameBusinessLogic _nameBusinessLogic;
public NameQueryController(INameBusinessLogic nameBusinessLogic)
{
_nameBusinessLogic = nameBusinessLogic;
}
[Route("fullName/{id}")]
[HttpGet]
public async Task<IHttpActionResult> GetData(string id)
{
var result = default(NameDTO);
try
{
result = _nameBusinessLogic.GetById(id);
}
catch (Exception ex)
{
return StatusCode(HttpStatusCode.ExpectationFailed);
}
return Ok(result);
}
}
}
|
mit
|
C#
|
d3335838edb479de816ca7d894da8d810c505ed9
|
update version number;
|
functionGHW/JsonTextViewer
|
JsonTextViewer/JsonTextViewer/Properties/AssemblyInfo.cs
|
JsonTextViewer/JsonTextViewer/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("JsonTextViewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JsonTextViewer")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("JsonTextViewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JsonTextViewer")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
|
mit
|
C#
|
8a6849717897bafcfbc6e47d27cf065df1bd1f5d
|
Add TODO on fake CallNumber
|
crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin,crdschurch/crds-signin-checkin
|
SignInCheckIn/SignInCheckIn/Models/DTO/ParticipantDto.cs
|
SignInCheckIn/SignInCheckIn/Models/DTO/ParticipantDto.cs
|
using System;
using System.Linq;
using Microsoft.Practices.ObjectBuilder2;
namespace SignInCheckIn.Models.DTO
{
public class ParticipantDto
{
public int EventParticipantId { get; set; }
public int ParticipantId { get; set; }
public int ContactId { get; set; }
public int HouseholdId { get; set; }
public int HouseholdPositionId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime DateOfBirth { get; set; }
public bool Selected { get; set; } = false;
public int ParticipationStatusId { get; set; }
public int? AssignedRoomId { get; set; }
public string AssignedRoomName { get; set; }
public int? AssignedSecondaryRoomId { get; set; } // adventure club field
public string AssignedSecondaryRoomName { get; set; } // adventure club field
public string CallNumber
{
// TODO Faking out a call number for now (last 4 of EventParticipantId), eventually need to store a real call number on Event Participant
get
{
var c = $"0000{EventParticipantId}";
return c.Substring(c.Length - 4);
}
}
}
}
|
using System;
using System.Linq;
using Microsoft.Practices.ObjectBuilder2;
namespace SignInCheckIn.Models.DTO
{
public class ParticipantDto
{
public int EventParticipantId { get; set; }
public int ParticipantId { get; set; }
public int ContactId { get; set; }
public int HouseholdId { get; set; }
public int HouseholdPositionId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime DateOfBirth { get; set; }
public bool Selected { get; set; } = false;
public int ParticipationStatusId { get; set; }
public int? AssignedRoomId { get; set; }
public string AssignedRoomName { get; set; }
public int? AssignedSecondaryRoomId { get; set; } // adventure club field
public string AssignedSecondaryRoomName { get; set; } // adventure club field
public string CallNumber
{
get
{
var c = $"0000{EventParticipantId}";
return c.Substring(c.Length - 4);
}
}
}
}
|
bsd-2-clause
|
C#
|
1baf9104aa8b805495195bc048e36943d947df6f
|
return null on DashboardController.Home if not allowed
|
AlejandroCano/extensions,MehdyKarimpour/extensions,signumsoftware/framework,signumsoftware/extensions,signumsoftware/framework,AlejandroCano/extensions,MehdyKarimpour/extensions,signumsoftware/extensions
|
Signum.React.Extensions/Dashboard/DashboardController.cs
|
Signum.React.Extensions/Dashboard/DashboardController.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Signum.Engine.Authorization;
using Signum.Entities;
using Signum.Entities.Authorization;
using Signum.Services;
using Signum.Utilities;
using Signum.React.Facades;
using Signum.React.Authorization;
using Signum.React.ApiControllers;
using Signum.Entities.UserQueries;
using Signum.Engine.UserQueries;
using Signum.Engine.Basics;
using Signum.Entities.UserAssets;
using Signum.Entities.DynamicQuery;
using Signum.Engine.DynamicQuery;
using Signum.Engine;
using Signum.Entities.Dashboard;
using Signum.Engine.Dashboard;
namespace Signum.React.Dashboard
{
public class DashboardController : ApiController
{
[Route("api/dashboard/forEntityType/{typeName}"), HttpGet]
public IEnumerable<Lite<DashboardEntity>> FromEntityType(string typeName)
{
return DashboardLogic.GetDashboardsEntity(TypeLogic.GetType(typeName));
}
[Route("api/dashboard/embedded/{typeName}/{position}"), HttpGet]
public DashboardEntity Embedded(string typeName, DashboardEmbedededInEntity position)
{
var result = DashboardLogic.GetEmbeddedDashboard(TypeLogic.GetType(typeName));
return result == null || result.EmbeddedInEntity != position ? null : result;
}
[Route("api/dashboard/home"), HttpGet]
public Lite<DashboardEntity> Home()
{
if (TypeAuthLogic.GetAllowed(typeof(DashboardEntity)).MaxUI() == TypeAllowedBasic.None)
return null;
var result = DashboardLogic.GetHomePageDashboard();
return result?.ToLite();
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Signum.Engine.Authorization;
using Signum.Entities;
using Signum.Entities.Authorization;
using Signum.Services;
using Signum.Utilities;
using Signum.React.Facades;
using Signum.React.Authorization;
using Signum.React.ApiControllers;
using Signum.Entities.UserQueries;
using Signum.Engine.UserQueries;
using Signum.Engine.Basics;
using Signum.Entities.UserAssets;
using Signum.Entities.DynamicQuery;
using Signum.Engine.DynamicQuery;
using Signum.Engine;
using Signum.Entities.Dashboard;
using Signum.Engine.Dashboard;
namespace Signum.React.Dashboard
{
public class DashboardController : ApiController
{
[Route("api/dashboard/forEntityType/{typeName}"), HttpGet]
public IEnumerable<Lite<DashboardEntity>> FromEntityType(string typeName)
{
return DashboardLogic.GetDashboardsEntity(TypeLogic.GetType(typeName));
}
[Route("api/dashboard/embedded/{typeName}/{position}"), HttpGet]
public DashboardEntity Embedded(string typeName, DashboardEmbedededInEntity position)
{
var result = DashboardLogic.GetEmbeddedDashboard(TypeLogic.GetType(typeName));
return result == null || result.EmbeddedInEntity != position ? null : result;
}
[Route("api/dashboard/home"), HttpGet]
public Lite<DashboardEntity> Home()
{
var result = DashboardLogic.GetHomePageDashboard();
return result?.ToLite();
}
}
}
|
mit
|
C#
|
31de56936f3e698284801b8144e63c15eef8d193
|
Improve TCP reading code to read more than 4096 bytes if available
|
nwoolls/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner,IWBWbiz/MultiMiner
|
MultiMiner.Xgminer.Api/ApiContext.cs
|
MultiMiner.Xgminer.Api/ApiContext.cs
|
using MultiMiner.Xgminer.Api.Parsers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace MultiMiner.Xgminer.Api
{
public class ApiContext
{
private TcpClient tcpClient;
public ApiContext(int port)
{
tcpClient = new TcpClient("127.0.0.1", port);
}
public List<DeviceInformation> GetDeviceInformation()
{
string textResponse = GetResponse(ApiVerb.Devs);
List<DeviceInformation> result = new List<DeviceInformation>();
DeviceInformationParser.ParseTextForDeviceInformation(textResponse, result);
return result;
}
public void QuitMining()
{
GetResponse(ApiVerb.Quit);
}
private string GetResponse(string apiVerb)
{
NetworkStream tcpStream = tcpClient.GetStream();
Byte[] request = Encoding.ASCII.GetBytes(apiVerb);
tcpStream.Write(request, 0, request.Length);
Byte[] responseBuffer = new Byte[4096];
string response = string.Empty;
do
{
int bytesRead = tcpStream.Read(responseBuffer, 0, responseBuffer.Length);
response = response + Encoding.ASCII.GetString(responseBuffer, 0, bytesRead);
} while (tcpStream.DataAvailable);
return response;
}
}
}
|
using MultiMiner.Xgminer.Api.Parsers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace MultiMiner.Xgminer.Api
{
public class ApiContext
{
private TcpClient tcpClient;
public ApiContext(int port)
{
tcpClient = new TcpClient("127.0.0.1", port);
}
public List<DeviceInformation> GetDeviceInformation()
{
string textResponse = GetResponse(ApiVerb.Devs);
List<DeviceInformation> result = new List<DeviceInformation>();
DeviceInformationParser.ParseTextForDeviceInformation(textResponse, result);
return result;
}
public void QuitMining()
{
GetResponse(ApiVerb.Quit);
}
private string GetResponse(string apiVerb)
{
NetworkStream stream = tcpClient.GetStream();
Byte[] request = System.Text.Encoding.ASCII.GetBytes(apiVerb);
stream.Write(request, 0, request.Length);
Byte[] responseBuffer = new Byte[4096];
string response = string.Empty;
int bytesRead = stream.Read(responseBuffer, 0, responseBuffer.Length);
response = System.Text.Encoding.ASCII.GetString(responseBuffer, 0, bytesRead);
return response;
}
}
}
|
mit
|
C#
|
930aead170d737a6693b298694cf9438431ef490
|
Change access level (.NET).
|
mntone/UniversityScheduleClient,mntone/UniversityScheduleClient
|
NET/UniversitySchedule.Core/Class.cs
|
NET/UniversitySchedule.Core/Class.cs
|
using System;
using System.Runtime.Serialization;
namespace Mntone.UniversitySchedule.Core
{
/// <summary>
/// Class
/// </summary>
[DataContract]
public sealed class Class
{
private const string DATE_FORMAT = "yyyy'-'MM'-'dd";
private Class() { }
/// <summary>
/// Constructor
/// </summary>
/// <param name="hash">Hash</param>
/// <param name="date">Date</param>
/// <param name="period"><see cref="Period"/></param>
/// <param name="campusName">Campus name</param>
/// <param name="department">Department</param>
/// <param name="subject">Subject</param>
/// <param name="lecturer">Lecturer</param>
/// <param name="grade">Grade</param>
/// <param name="note">Note</param>
internal Class( string hash, DateTime date, Period period, string campusName, string department, string subject, string lecturer, string grade, string note )
{
this.Hash = hash;
this.Date = date;
this.Period = period;
this.CampusName = campusName;
this.Department = department;
this.Subject = subject;
this.Lecturer = lecturer;
this.Grade = grade;
this.Note = note;
}
/// <summary>
/// Hash
/// </summary>
[DataMember( Name = "hash", IsRequired = true )]
public string Hash { get; private set; }
/// <summary>
/// Date
/// </summary>
public DateTime Date { get; private set; }
[DataMember( Name = "date", IsRequired = true )]
private String DateImpl
{
get { return this.Date.ToString( DATE_FORMAT ); }
set { this.Date = DateTime.ParseExact( value, DATE_FORMAT, null ); }
}
/// <summary>
/// Period
/// </summary>
[DataMember( Name = "period", IsRequired = true )]
public Period Period { get; private set; }
/// <summary>
/// Campus name
/// </summary>
[DataMember( Name = "campus_name" )]
public string CampusName { get; private set; }
/// <summary>
/// Department
/// </summary>
[DataMember( Name = "department" )]
public string Department { get; private set; }
/// <summary>
/// Subject
/// </summary>
[DataMember( Name = "subject", IsRequired = true )]
public string Subject { get; private set; }
/// <summary>
/// Lecturer
/// </summary>
[DataMember( Name = "lecturer", IsRequired = true )]
public string Lecturer { get; private set; }
/// <summary>
/// Grade
/// </summary>
[DataMember( Name = "grade" )]
public string Grade { get; private set; }
/// <summary>
/// Note message
/// </summary>
[DataMember( Name = "note" )]
public string Note { get; private set; }
}
}
|
using System;
using System.Runtime.Serialization;
namespace Mntone.UniversitySchedule.Core
{
/// <summary>
/// Class
/// </summary>
[DataContract]
public sealed class Class
{
private static readonly string DATE_FORMAT = "yyyy'-'MM'-'dd";
private Class() { }
/// <summary>
/// Constructor
/// </summary>
/// <param name="hash">Hash</param>
/// <param name="date">Date</param>
/// <param name="period"><see cref="Period"/></param>
/// <param name="campusName">Campus name</param>
/// <param name="department">Department</param>
/// <param name="subject">Subject</param>
/// <param name="lecturer">Lecturer</param>
/// <param name="grade">Grade</param>
/// <param name="note">Note</param>
internal Class( string hash, DateTime date, Period period, string campusName, string department, string subject, string lecturer, string grade, string note )
{
this.Hash = hash;
this.Date = date;
this.Period = period;
this.CampusName = campusName;
this.Department = department;
this.Subject = subject;
this.Lecturer = lecturer;
this.Grade = grade;
this.Note = note;
}
/// <summary>
/// Hash
/// </summary>
[DataMember( Name = "hash", IsRequired = true )]
public string Hash { get; private set; }
/// <summary>
/// Date
/// </summary>
public DateTime Date { get; private set; }
[DataMember( Name = "date", IsRequired = true )]
private String DateImpl
{
get { return this.Date.ToString( DATE_FORMAT ); }
set { this.Date = DateTime.ParseExact( value, DATE_FORMAT, null ); }
}
/// <summary>
/// Period
/// </summary>
[DataMember( Name = "period", IsRequired = true )]
public Period Period { get; private set; }
/// <summary>
/// Campus name
/// </summary>
[DataMember( Name = "campus_name" )]
public string CampusName { get; private set; }
/// <summary>
/// Department
/// </summary>
[DataMember( Name = "department" )]
public string Department { get; private set; }
/// <summary>
/// Subject
/// </summary>
[DataMember( Name = "subject", IsRequired = true )]
public string Subject { get; private set; }
/// <summary>
/// Lecturer
/// </summary>
[DataMember( Name = "lecturer", IsRequired = true )]
public string Lecturer { get; private set; }
/// <summary>
/// Grade
/// </summary>
[DataMember( Name = "grade" )]
public string Grade { get; private set; }
/// <summary>
/// Note message
/// </summary>
[DataMember( Name = "note" )]
public string Note { get; private set; }
}
}
|
mit
|
C#
|
04bdebb999745359f4922f2e16e2891a2db85a55
|
Delete TODO list
|
mshmelev/Shaspect
|
ShaspectBuilder/ShaspectBuildTask.cs
|
ShaspectBuilder/ShaspectBuildTask.cs
|
using System;
using System.Diagnostics;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Shaspect.Builder
{
public class ShaspectBuildTask : Task
{
[Required]
public string AssemblyFile { get; set; }
[Required]
public string References { get; set; }
public string KeyFile { get; set; }
public override bool Execute()
{
try
{
var stopwatch = Stopwatch.StartNew();
var injector = new AspectsInjector (AssemblyFile, References);
if (injector.ProcessAssembly() == 0)
{
Log.LogWarning (
"No aspects detected in {0}. You can uninstall Shaspect package for this assembly to speed up the build.",
AssemblyFile);
}
stopwatch.Stop();
Log.LogMessage ("ShaspectBuildTask took {0}ms", stopwatch.ElapsedMilliseconds);
return true;
}
catch (ApplicationException ex)
{
Log.LogError (ex.Message);
}
return false;
}
}
}
|
using System;
using System.Diagnostics;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Shaspect.Builder
{
public class ShaspectBuildTask : Task
{
[Required]
public string AssemblyFile { get; set; }
[Required]
public string References { get; set; }
public string KeyFile { get; set; }
public override bool Execute()
{
try
{
var stopwatch = Stopwatch.StartNew();
var injector = new AspectsInjector (AssemblyFile, References);
if (injector.ProcessAssembly() == 0)
{
Log.LogWarning (
"No aspects detected in {0}. You can uninstall Shaspect package for this assembly to speed up the build.",
AssemblyFile);
}
// TODO: specifying targets (properties, methods). Now done only for ctor. Don't forget about Exclude.
// TODO: specifying targets by name (Namespace1.Namespace2.Class.*). Don't forget about Exclude.
// TODO: Implement priorities (cut-through across all the nesting levels). Don't forget about Exclude.
// TODO: inheritance
// TODO: aspect on interfaces
// TODO: aspect in a referenced assembly (assembly resolver); resolving using configuration from app.config
// TODO: handle signed assemblies
// TODO: optimize performance of the Builder
// TODO: process only once (check if there's Shaspect.Implementation namespace there
// TODO: support changing of method arguments (something like args.SetArgument (0, "12345") )
// TODO: support async methods
// TODO: support aspects on each yield return (now it's only supported as returning of IEnumerable<T> in return value)
stopwatch.Stop();
Log.LogMessage ("ShaspectBuildTask took {0}ms", stopwatch.ElapsedMilliseconds);
return true;
}
catch (ApplicationException ex)
{
Log.LogError (ex.Message);
}
return false;
}
}
}
|
mit
|
C#
|
ebd13ba268887b5f607c1dae79a9121247272834
|
fix compile bug
|
doubleleft/hook-csharp
|
Hook/Request.cs
|
Hook/Request.cs
|
using System;
using System.Net;
using RestSharp;
using JsonFx.Serialization;
using JsonFx.Json;
namespace Hook
{
public class Request
{
public RestClient client;
public RestRequest request;
// protected object resultType = null;
public Request (RestClient client, RestRequest request)
{
this.client = client;
this.request = request;
}
// public RestRequestAsyncHandle ContinueWith(Action<object> callback)
// {
// if (this.resultType == null) {
// throw new Exception ("Please use `ContinueWith<TResult>(callback)`.");
// }
// return ContinueWith<this.resultType> (callback);
// }
public RestRequestAsyncHandle ContinueWith<TResult>(Action<TResult> callback)
{
return this.client.ExecuteAsync(this.request, response => {
var settings = new DataReaderSettings ();
var reader = new JsonReader (settings);
var data = reader.Read<TResult>(response.Content);
if (response.StatusCode != HttpStatusCode.OK) {
throw new Exception(response.ErrorMessage);
} else {
callback(data);
}
});
}
protected void OnCompleted(object sender, EventArgs e)
{
}
public delegate void CompletedHandler(object sender, EventArgs e);
public delegate void SuccessHandler(object sender, EventArgs e);
public delegate void ErrorHandler(object sender, EventArgs e);
}
}
|
using System;
using System.Net;
using RestSharp;
using JsonFx.Serialization;
using JsonFx.Json;
namespace Hook
{
public class Request
{
public RestClient client;
public RestRequest request;
protected object resultType = null;
public Request (RestClient client, RestRequest request)
{
this.client = client;
this.request = request;
}
public RestRequestAsyncHandle ContinueWith(Action<object> callback)
{
if (this.resultType == null) {
throw new Exception ("Please use `ContinueWith<TResult>(callback)`.");
}
return ContinueWith<this.resultType> (callback);
}
public RestRequestAsyncHandle ContinueWith<TResult>(Action<TResult> callback)
{
return this.client.ExecuteAsync(this.request, response => {
var settings = new DataReaderSettings ();
var reader = new JsonReader (settings);
var data = reader.Read<TResult>(response.Content);
if (response.StatusCode != HttpStatusCode.OK) {
throw new Exception(response.ErrorMessage);
} else {
callback(data);
}
});
}
protected void OnCompleted(object sender, EventArgs e)
{
}
public delegate void CompletedHandler(object sender, EventArgs e);
public delegate void SuccessHandler(object sender, EventArgs e);
public delegate void ErrorHandler(object sender, EventArgs e);
}
}
|
mit
|
C#
|
7c602a916ab1c72a9240320ce5096920ea07bc85
|
Refactor BaseForm uses Machine.Evaluate
|
ajlopez/ClojSharp
|
Src/ClojSharp.Core/Forms/BaseForm.cs
|
Src/ClojSharp.Core/Forms/BaseForm.cs
|
namespace ClojSharp.Core.Forms
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClojSharp.Core.Language;
using ClojSharp.Core.Exceptions;
public abstract class BaseForm : IForm
{
public object Evaluate(Context context, IList<object> arguments)
{
int arity = arguments == null ? 0 : arguments.Count;
if (this.VariableArity)
{
if (this.RequiredArity > arity)
throw new ArityException(this.GetType(), arity);
}
else if (this.RequiredArity != arity)
throw new ArityException(this.GetType(), arity);
if (arguments == null)
return this.EvaluateForm(context, null);
for (var k = 0; k < arguments.Count; k++)
arguments[k] = Machine.Evaluate(arguments[k], context);
return this.EvaluateForm(context, arguments);
}
public abstract object EvaluateForm(Context context, IList<object> arguments);
public abstract int RequiredArity { get; }
public virtual bool VariableArity { get { return true; } }
}
}
|
namespace ClojSharp.Core.Forms
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClojSharp.Core.Language;
using ClojSharp.Core.Exceptions;
public abstract class BaseForm : IForm
{
public object Evaluate(Context context, IList<object> arguments)
{
int arity = arguments == null ? 0 : arguments.Count;
if (this.VariableArity)
{
if (this.RequiredArity > arity)
throw new ArityException(this.GetType(), arity);
}
else if (this.RequiredArity != arity)
throw new ArityException(this.GetType(), arity);
if (arguments == null)
return this.EvaluateForm(context, null);
for (var k = 0; k < arguments.Count; k++)
if (arguments[k] is IEvaluable)
arguments[k] = ((IEvaluable)arguments[k]).Evaluate(context);
return this.EvaluateForm(context, arguments);
}
public abstract object EvaluateForm(Context context, IList<object> arguments);
public abstract int RequiredArity { get; }
public virtual bool VariableArity { get { return true; } }
}
}
|
mit
|
C#
|
e366aea629385975f3eecff73b3869ad33d18f82
|
Revert "Remove IEndpointDeliveryService<TEndpoint>"
|
justinjstark/Delivered,justinjstark/Verdeler
|
Verdeler/IEndpointDeliveryService.cs
|
Verdeler/IEndpointDeliveryService.cs
|
namespace Verdeler
{
public interface IEndpointDeliveryService
{
void Deliver(IDistributable distributable, IEndpoint endpoint);
}
public interface IEndpointDeliveryService<in TEndpoint> : IEndpointDeliveryService
{
void Deliver(IDistributable distributable, TEndpoint endpoint);
}
public interface IEndpointDeliveryService<in TDistributable, in TEndpoint> : IEndpointDeliveryService<TEndpoint>
where TDistributable : IDistributable
where TEndpoint : IEndpoint
{
void Deliver(TDistributable disributable, TEndpoint endpoint);
}
}
|
namespace Verdeler
{
public interface IEndpointDeliveryService
{
void Deliver(IDistributable distributable, IEndpoint endpoint);
}
public interface IEndpointDeliveryService<in TDistributable, in TEndpoint> : IEndpointDeliveryService
where TDistributable : IDistributable
where TEndpoint : IEndpoint
{
void Deliver(TDistributable disributable, TEndpoint endpoint);
}
}
|
mit
|
C#
|
c963effd59e099cf9dc5ccc9c6120a6276ed57af
|
Add Rotate methods contributed by CLA signers
|
charlenni/Mapsui,charlenni/Mapsui
|
Mapsui/MPoint2.cs
|
Mapsui/MPoint2.cs
|
using Mapsui.Utilities;
namespace Mapsui;
public class MPoint2
{
public double X { get; set; }
public double Y { get; set; }
/// <summary>
/// Calculates a new point by rotating this point clockwise about the specified center point
/// </summary>
/// <param name="degrees">Angle to rotate clockwise (degrees)</param>
/// <param name="centerX">X coordinate of point about which to rotate</param>
/// <param name="centerY">Y coordinate of point about which to rotate</param>
/// <returns>Returns the rotated point</returns>
public MPoint Rotate(double degrees, double centerX, double centerY)
{
// translate this point back to the center
var newX = X - centerX;
var newY = Y - centerY;
// rotate the values
var p = Algorithms.RotateClockwiseDegrees(newX, newY, degrees);
// translate back to original reference frame
newX = p.X + centerX;
newY = p.Y + centerY;
return new MPoint(newX, newY);
}
/// <summary>
/// Calculates a new point by rotating this point clockwise about the specified center point
/// </summary>
/// <param name="degrees">Angle to rotate clockwise (degrees)</param>
/// <param name="center">MPoint about which to rotate</param>
/// <returns>Returns the rotated point</returns>
public MPoint Rotate(double degrees, MPoint center)
{
return Rotate(degrees, center.X, center.Y);
}
}
|
namespace Mapsui;
public class MPoint2
{
public double X { get; set; }
public double Y { get; set; }
}
|
mit
|
C#
|
81ab82fafe13df7aa513c5d64f3bb205feac6102
|
Tidy up nesting
|
UselessToucan/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,smoogipooo/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,ppy/osu
|
osu.Game.Tournament/Components/TournamentModIcon.cs
|
osu.Game.Tournament/Components/TournamentModIcon.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using 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.Rulesets;
using osu.Game.Rulesets.UI;
using osu.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Components
{
/// <summary>
/// Mod icon displayed in tournament usages, allowing user overridden graphics.
/// </summary>
public class TournamentModIcon : CompositeDrawable
{
private readonly string modAcronym;
[Resolved]
private RulesetStore rulesets { get; set; }
public TournamentModIcon(string modAcronym)
{
this.modAcronym = modAcronym;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures, LadderInfo ladderInfo)
{
var customTexture = textures.Get($"mods/{modAcronym}");
if (customTexture != null)
{
AddInternal(new Sprite
{
FillMode = FillMode.Fit,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Texture = customTexture
});
return;
}
var ruleset = rulesets.GetRuleset(ladderInfo.Ruleset.Value?.ID ?? 0);
var modIcon = ruleset?.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == modAcronym);
if (modIcon == null)
return;
AddInternal(new ModIcon(modIcon, false)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.5f)
});
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using 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.Rulesets;
using osu.Game.Rulesets.UI;
using osu.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Components
{
/// <summary>
/// Mod icon displayed in tournament usages, allowing user overridden graphics.
/// </summary>
public class TournamentModIcon : CompositeDrawable
{
private readonly string modAcronym;
[Resolved]
private RulesetStore rulesets { get; set; }
public TournamentModIcon(string modAcronym)
{
this.modAcronym = modAcronym;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures, LadderInfo ladderInfo)
{
var texture = textures.Get($"mods/{modAcronym}");
if (texture != null)
{
AddInternal(new Sprite
{
FillMode = FillMode.Fit,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Texture = texture
});
}
else
{
var ruleset = rulesets.GetRuleset(ladderInfo.Ruleset.Value?.ID ?? 0);
var modIcon = ruleset?.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == modAcronym);
if (modIcon == null)
return;
AddInternal(new ModIcon(modIcon, false)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.5f)
});
}
}
}
}
|
mit
|
C#
|
74647c35c7f0adad1c468682e70aa1861aa9ed08
|
Update Cake.Issues.Recipe to 0.3.4
|
cake-contrib/Cake.Recipe,cake-contrib/Cake.Recipe
|
Cake.Recipe/Content/addins.cake
|
Cake.Recipe/Content/addins.cake
|
///////////////////////////////////////////////////////////////////////////////
// ADDINS
///////////////////////////////////////////////////////////////////////////////
#addin nuget:?package=Cake.Codecov&version=0.9.1
#addin nuget:?package=Cake.Coveralls&version=0.10.2
#addin nuget:?package=Cake.Coverlet&version=2.4.2
#addin nuget:?package=Cake.Email&version=0.9.2&loaddependencies=true // loading dependencies is important to ensure Cake.Email.Common is loaded as well
#addin nuget:?package=Cake.Figlet&version=1.3.1
#addin nuget:?package=Cake.Gitter&version=0.11.1
#addin nuget:?package=Cake.Incubator&version=5.1.0
#addin nuget:?package=Cake.Kudu&version=0.10.1
#addin nuget:?package=Cake.MicrosoftTeams&version=0.9.0
#addin nuget:?package=Cake.Slack&version=0.13.0
#addin nuget:?package=Cake.Transifex&version=0.8.0
#addin nuget:?package=Cake.Twitter&version=0.10.1
#addin nuget:?package=Cake.Wyam&version=2.2.9
#load nuget:?package=Cake.Issues.Recipe&version=0.3.4
Action<string, IDictionary<string, string>> RequireAddin = (code, envVars) => {
var script = MakeAbsolute(File(string.Format("./{0}.cake", Guid.NewGuid())));
try
{
System.IO.File.WriteAllText(script.FullPath, code);
var arguments = new Dictionary<string, string>();
if (BuildParameters.CakeConfiguration.GetValue("NuGet_UseInProcessClient") != null) {
arguments.Add("nuget_useinprocessclient", BuildParameters.CakeConfiguration.GetValue("NuGet_UseInProcessClient"));
}
if (BuildParameters.CakeConfiguration.GetValue("Settings_SkipVerification") != null) {
arguments.Add("settings_skipverification", BuildParameters.CakeConfiguration.GetValue("Settings_SkipVerification"));
}
CakeExecuteScript(script,
new CakeSettings
{
EnvironmentVariables = envVars,
Arguments = arguments
});
}
finally
{
if (FileExists(script))
{
DeleteFile(script);
}
}
};
|
///////////////////////////////////////////////////////////////////////////////
// ADDINS
///////////////////////////////////////////////////////////////////////////////
#addin nuget:?package=Cake.Codecov&version=0.9.1
#addin nuget:?package=Cake.Coveralls&version=0.10.2
#addin nuget:?package=Cake.Coverlet&version=2.4.2
#addin nuget:?package=Cake.Email&version=0.9.2&loaddependencies=true // loading dependencies is important to ensure Cake.Email.Common is loaded as well
#addin nuget:?package=Cake.Figlet&version=1.3.1
#addin nuget:?package=Cake.Gitter&version=0.11.1
#addin nuget:?package=Cake.Incubator&version=5.1.0
#addin nuget:?package=Cake.Kudu&version=0.10.1
#addin nuget:?package=Cake.MicrosoftTeams&version=0.9.0
#addin nuget:?package=Cake.Slack&version=0.13.0
#addin nuget:?package=Cake.Transifex&version=0.8.0
#addin nuget:?package=Cake.Twitter&version=0.10.1
#addin nuget:?package=Cake.Wyam&version=2.2.9
#load nuget:?package=Cake.Issues.Recipe&version=0.3.3
Action<string, IDictionary<string, string>> RequireAddin = (code, envVars) => {
var script = MakeAbsolute(File(string.Format("./{0}.cake", Guid.NewGuid())));
try
{
System.IO.File.WriteAllText(script.FullPath, code);
var arguments = new Dictionary<string, string>();
if (BuildParameters.CakeConfiguration.GetValue("NuGet_UseInProcessClient") != null) {
arguments.Add("nuget_useinprocessclient", BuildParameters.CakeConfiguration.GetValue("NuGet_UseInProcessClient"));
}
if (BuildParameters.CakeConfiguration.GetValue("Settings_SkipVerification") != null) {
arguments.Add("settings_skipverification", BuildParameters.CakeConfiguration.GetValue("Settings_SkipVerification"));
}
CakeExecuteScript(script,
new CakeSettings
{
EnvironmentVariables = envVars,
Arguments = arguments
});
}
finally
{
if (FileExists(script))
{
DeleteFile(script);
}
}
};
|
mit
|
C#
|
9b6fe121bd14aaa8f1267c5d1dd53364a0581bb2
|
Update BehaviorOfT.cs
|
wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors
|
src/Avalonia.Xaml.Interactivity/BehaviorOfT.cs
|
src/Avalonia.Xaml.Interactivity/BehaviorOfT.cs
|
using System;
namespace Avalonia.Xaml.Interactivity
{
/// <summary>
/// A base class for behaviors making them code compatible with older frameworks,
/// and allow for typed associated objects.
/// </summary>
/// <typeparam name="T">The object type to attach to</typeparam>
public abstract class Behavior<T> : Behavior where T : class, IAvaloniaObject
{
/// <summary>
/// Gets the object to which this behavior is attached.
/// </summary>
public new T? AssociatedObject => base.AssociatedObject as T;
/// <summary>
/// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>.
/// </summary>
/// <remarks>
/// Override this to hook up functionality to the <see cref="Behavior.AssociatedObject"/>
/// </remarks>
protected override void OnAttached()
{
base.OnAttached();
if (AssociatedObject is null && base.AssociatedObject is { })
{
string actualType = base.AssociatedObject.GetType().FullName;
string expectedType = typeof(T).FullName;
string message = $"AssociatedObject is of type {actualType} but should be of type {expectedType}.";
throw new InvalidOperationException(message);
}
}
}
}
|
using System;
namespace Avalonia.Xaml.Interactivity
{
/// <summary>
/// A base class for behaviors making them code compatible with older frameworks,
/// and allow for typed associated objects.
/// </summary>
/// <typeparam name="T">The object type to attach to</typeparam>
public abstract class Behavior<T> : Behavior where T : class, IAvaloniaObject
{
/// <summary>
/// Gets the object to which this behavior is attached.
/// </summary>
public new T? AssociatedObject => base.AssociatedObject as T;
/// <summary>
/// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>.
/// </summary>
/// <remarks>
/// Override this to hook up functionality to the <see cref="Behavior.AssociatedObject"/>
/// </remarks>
protected override void OnAttached()
{
base.OnAttached();
if (AssociatedObject is null && base.AssociatedObject is { })
{
string actualType = base.AssociatedObject.GetType().FullName;
string expectedType = typeof(T).FullName;
string message = string.Format("AssociatedObject is of type {0} but should be of type {1}.", actualType, expectedType);
throw new InvalidOperationException(message);
}
}
}
}
|
mit
|
C#
|
29df2644e0c9f3af0b6be43dca75ca39e0714baf
|
Fix internal path for embedded client
|
Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype
|
src/Glimpse.Server/Resources/ClientResource.cs
|
src/Glimpse.Server/Resources/ClientResource.cs
|
using System.Reflection;
using Glimpse.Server.Web;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.StaticFiles;
namespace Glimpse.Server.Resources
{
public class ClientResource : IResourceStartup
{
public void Configure(IResourceBuilder resourceBuilder)
{
// TODO: Add HTTP Caching
var options = new FileServerOptions();
options.RequestPath = "/Client";
options.EnableDefaultFiles = false;
options.StaticFileOptions.ContentTypeProvider = new FileExtensionContentTypeProvider();
options.FileProvider = new EmbeddedFileProvider(typeof(ClientResource).GetTypeInfo().Assembly, "Glimpse.Server.Resources.Embeded.Client");
resourceBuilder.AppBuilder.UseFileServer(options);
}
public ResourceType Type => ResourceType.Client;
}
}
|
using System.Reflection;
using Glimpse.Server.Web;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.StaticFiles;
namespace Glimpse.Server.Resources
{
public class ClientResource : IResourceStartup
{
public void Configure(IResourceBuilder resourceBuilder)
{
// TODO: Add HTTP Caching
var options = new FileServerOptions();
options.RequestPath = "/Client";
options.EnableDefaultFiles = false;
options.StaticFileOptions.ContentTypeProvider = new FileExtensionContentTypeProvider();
options.FileProvider = new EmbeddedFileProvider(typeof(ClientResource).GetTypeInfo().Assembly, "Glimpse.Server.Resources.Embed.Client");
resourceBuilder.AppBuilder.UseFileServer(options);
}
public ResourceType Type => ResourceType.Client;
}
}
|
mit
|
C#
|
9963adcfafa606d9e6481836fcfe556fba244171
|
fix RSFTest
|
fengyhack/csharp-sdk,qiniu/csharp-sdk
|
Qiniu.Test/RSF/RSFClientTest.cs
|
Qiniu.Test/RSF/RSFClientTest.cs
|
using System;
using System.Collections.Generic;
using NUnit.Framework;
using Qiniu.RSF;
using Qiniu.Conf;
using Qiniu.Test.TestHelper;
namespace Qiniu.Test.RSF
{
/// <summary>
///这是 RSFClientTest 的测试类,旨在
///包含所有 RSFClientTest 单元测试
///</summary>
[TestFixture]
public class RSFClientTest:QiniuTestBase
{
private List<string> tmpKeys=new List<string>();
public RSFClientTest()
{
}
[TestFixtureSetUp]
public void BeforeTest()
{
#region before test
tmpKeys = RSHelper.RSPut(Bucket,3);
#endregion
}
[TestFixtureTearDown]
public void AfterTest()
{
foreach (string k in tmpKeys) {
RSHelper.RSDel (Bucket, k);
}
}
/// <summary>
///Next 的测试
///</summary>
[Test]
public void NextTest()
{
RSFClient target = new RSFClient(Bucket); // TODO: 初始化为适当的值
target.Init();
target.Marker = string.Empty;
target.Prefix = string.Empty;
target.Limit = 1000;
List<DumpItem> actual;
int count = 0;
actual = target.Next();
while (actual != null)
{
count += actual.Count;
actual = target.Next();
}
Assert.IsTrue(count >= 3, "ListPrefixTest Failure");
}
/// <summary>
///ListPrefix 的测试
///</summary>
[Test]
public void ListPrefixTest()
{
RSFClient target = new RSFClient(Bucket); // TODO: 初始化为适当的值
target.Marker = string.Empty;
target.Prefix = string.Empty;
target.Limit = 100;
DumpRet actual;
actual = target.ListPrefix(Bucket);
foreach (DumpItem item in actual.Items)
{
Console.WriteLine("Key:{0},Hash:{1},Mime:{2},PutTime:{3},EndUser:{4}", item.Key, item.Hash, item.Mime, item.PutTime, item.EndUser);
}
//error params
Assert.IsTrue(actual.Items.Count>=3, "ListPrefixTest Failure");
}
}
}
|
using System;
using System.Collections.Generic;
using NUnit.Framework;
using Qiniu.RSF;
using Qiniu.Conf;
using Qiniu.Test.TestHelper;
namespace Qiniu.Test.RSF
{
/// <summary>
///这是 RSFClientTest 的测试类,旨在
///包含所有 RSFClientTest 单元测试
///</summary>
[TestFixture]
public class RSFClientTest:QiniuTestBase
{
private List<string> tmpKeys=new List<string>();
public RSFClientTest()
{
}
[TestFixtureSetUp]
public void BeforeTest()
{
#region before test
tmpKeys = RSHelper.RSPut(Bucket,3);
#endregion
}
[TestFixtureTearDown]
public void AfterTest()
{
foreach (string k in tmpKeys) {
RSHelper.RSDel (Bucket, k);
}
}
/// <summary>
///Next 的测试
///</summary>
[Test]
public void NextTest()
{
RSFClient target = new RSFClient(Bucket); // TODO: 初始化为适当的值
target.Init();
target.Marker = string.Empty;
target.Prefix = string.Empty;
target.Limit = 1000;
List<DumpItem> actual;
int count = 0;
actual = target.Next();
while (actual != null)
{
count += actual.Count;
actual = target.Next();
}
Assert.IsTrue(count == 3, "ListPrefixTest Failure");
}
/// <summary>
///ListPrefix 的测试
///</summary>
[Test]
public void ListPrefixTest()
{
RSFClient target = new RSFClient(Bucket); // TODO: 初始化为适当的值
target.Marker = string.Empty;
target.Prefix = string.Empty;
target.Limit = 100;
DumpRet actual;
actual = target.ListPrefix(Bucket);
foreach (DumpItem item in actual.Items)
{
Console.WriteLine("Key:{0},Hash:{1},Mime:{2},PutTime:{3},EndUser:{4}", item.Key, item.Hash, item.Mime, item.PutTime, item.EndUser);
}
//error params
Assert.IsTrue(actual.Items.Count==3, "ListPrefixTest Failure");
}
}
}
|
mit
|
C#
|
33d51c75c7abbdb2d050d06cecf9f26f1ec29ec6
|
bump ver
|
AntonyCorbett/OnlyT,AntonyCorbett/OnlyT
|
SolutionInfo.cs
|
SolutionInfo.cs
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2018 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1.0.53")]
|
using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2018 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1.0.52")]
|
mit
|
C#
|
49949bf6984d712a0e3267f7f23350180983888d
|
fix minor param/directive errors
|
johnneijzen/osu,peppy/osu,ppy/osu,2yangk23/osu,NeoAdonis/osu,smoogipoo/osu,ZLima12/osu,UselessToucan/osu,johnneijzen/osu,naoey/osu,Nabile-Rahmani/osu,ZLima12/osu,2yangk23/osu,naoey/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,NeoAdonis/osu,naoey/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,peppy/osu-new,peppy/osu,EVAST9919/osu,EVAST9919/osu,ppy/osu,DrabWeb/osu,ppy/osu,Frontear/osuKyzer,DrabWeb/osu,DrabWeb/osu,smoogipoo/osu
|
osu.Game/Overlays/BeatmapSet/HeaderButton.cs
|
osu.Game/Overlays/BeatmapSet/HeaderButton.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.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Audio;
using osu.Framework.Allocation;
namespace osu.Game.Overlays.BeatmapSet
{
public class HeaderButton : TriangleButton
{
public HeaderButton()
{
Height = 0;
RelativeSizeAxes = Axes.Y;
}
[BackgroundDependencyLoader]
private void load()
{
Masking = true;
CornerRadius = 3;
BackgroundColour = OsuColour.FromHex(@"094c5f");
Triangles.ColourLight = OsuColour.FromHex(@"0f7c9b");
Triangles.ColourDark = OsuColour.FromHex(@"094c5f");
Triangles.TriangleScale = 1.5f;
}
}
}
|
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers;
using osu.Framework.Audio;
using osu.Framework.Allocation;
namespace osu.Game.Overlays.BeatmapSet
{
public class HeaderButton : TriangleButton
{
public HeaderButton()
{
Height = 0;
RelativeSizeAxes = Axes.Y;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, AudioManager audio)
{
Masking = true;
CornerRadius = 3;
BackgroundColour = OsuColour.FromHex(@"094c5f");
Triangles.ColourLight = OsuColour.FromHex(@"0f7c9b");
Triangles.ColourDark = OsuColour.FromHex(@"094c5f");
Triangles.TriangleScale = 1.5f;
}
}
}
|
mit
|
C#
|
976e19629e9a9d79a03a29c3a04b85affb9e60f3
|
Add hr under biography
|
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
|
src/ChessVariantsTraining/Views/User/Profile.cshtml
|
src/ChessVariantsTraining/Views/User/Profile.cshtml
|
@model ChessVariantsTraining.ViewModels.User
@section Title {Profile page of @Model.Username}
@section AddToHead {
<link rel="stylesheet" href="@Url.Content("~/styles/profile.css")">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.bundle.min.js"></script>
<script type="text/javascript" src="@Url.Content("~/scripts/profile-page.js")"></script>
}
<h1>@Model.Username</h1>
About:
<p class="ws-pre-line">
@Model.About
</p>
<hr>
<p>
Puzzles made: @Model.PuzzlesMade<br />
Percentage correct: @Model.PercentageCorrect %
</p>
<p>
Role: @ChessVariantsTraining.Models.UserRole.UserRolesToString(Model.Roles)
</p>
<p>
Rating: @Model.Rating
</p>
<div class="chartWithOptions">
Range:
<select id="ratingChartDateRangeSelector" autocomplete="off">
<option value="all" selected>All</option>
<option value="1d">Today (UTC)</option>
<option value="7d">Last 7 days</option>
<option value="30d">Last 30 days</option>
<option value="1y">1 year</option>
<option value="ytd">Year-to-date</option>
</select>
<br>
Show:
<select id="ratingChartShownSelector" autocomplete="off">
<option value="each" selected>Rating after each puzzle</option>
<option value="endDay">Rating at the end of the day</option>
<option value="bestDay">Best rating of the day</option>
</select>
<div>
<canvas id="ratingChart"></canvas>
</div>
</div>
<div class="chartWithOptions">
<select id="ttsChartDateRangeSelector" autocomplete="off">
<option value="all" selected>All</option>
<option value="1d">Today (UTC)</option>
<option value="7d">Last 7 days</option>
<option value="30d">Last 30 days</option>
<option value="1y">1 year</option>
<option value="ytd">Year-to-date</option>
</select>
Show:
<select id="ttsChartShownSelector" autocomplete="off">
<option value="each" selected>Score for each timed training session</option>
<option value="avgDay">Average score of the day</option>
<option value="bestDay">Best score of the day</option>
</select>
<div>
<canvas id="ttsChart"></canvas>
</div>
</div>
|
@model ChessVariantsTraining.ViewModels.User
@section Title {Profile page of @Model.Username}
@section AddToHead {
<link rel="stylesheet" href="@Url.Content("~/styles/profile.css")">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.bundle.min.js"></script>
<script type="text/javascript" src="@Url.Content("~/scripts/profile-page.js")"></script>
}
<h1>@Model.Username</h1>
About:
<p class="ws-pre-line">
@Model.About
</p>
<p>
Puzzles made: @Model.PuzzlesMade<br />
Percentage correct: @Model.PercentageCorrect %
</p>
<p>
Role: @ChessVariantsTraining.Models.UserRole.UserRolesToString(Model.Roles)
</p>
<p>
Rating: @Model.Rating
</p>
<div class="chartWithOptions">
Range:
<select id="ratingChartDateRangeSelector" autocomplete="off">
<option value="all" selected>All</option>
<option value="1d">Today (UTC)</option>
<option value="7d">Last 7 days</option>
<option value="30d">Last 30 days</option>
<option value="1y">1 year</option>
<option value="ytd">Year-to-date</option>
</select>
<br>
Show:
<select id="ratingChartShownSelector" autocomplete="off">
<option value="each" selected>Rating after each puzzle</option>
<option value="endDay">Rating at the end of the day</option>
<option value="bestDay">Best rating of the day</option>
</select>
<div>
<canvas id="ratingChart"></canvas>
</div>
</div>
<div class="chartWithOptions">
<select id="ttsChartDateRangeSelector" autocomplete="off">
<option value="all" selected>All</option>
<option value="1d">Today (UTC)</option>
<option value="7d">Last 7 days</option>
<option value="30d">Last 30 days</option>
<option value="1y">1 year</option>
<option value="ytd">Year-to-date</option>
</select>
Show:
<select id="ttsChartShownSelector" autocomplete="off">
<option value="each" selected>Score for each timed training session</option>
<option value="avgDay">Average score of the day</option>
<option value="bestDay">Best score of the day</option>
</select>
<div>
<canvas id="ttsChart"></canvas>
</div>
</div>
|
agpl-3.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.