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 |
---|---|---|---|---|---|---|---|---|
6f78e49d4181078706346bf753ef1c29b9508ede
|
Fix IdentityProvider, CurrentPrincipal can be null
|
peopleware/net-ppwcode-vernacular-nhibernate
|
src/III.CastleWindsor/IdentityProvider.cs
|
src/III.CastleWindsor/IdentityProvider.cs
|
// Copyright 2018 by PeopleWare n.v..
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Threading;
namespace PPWCode.Vernacular.NHibernate.III.CastleWindsor
{
public class IdentityProvider : IIdentityProvider
{
/// <inheritdoc />
public string IdentityName
=> Thread.CurrentPrincipal?.Identity?.IsAuthenticated == true
? Thread.CurrentPrincipal.Identity.Name
: "Not Authenticated";
}
}
|
// Copyright 2018 by PeopleWare n.v..
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Threading;
namespace PPWCode.Vernacular.NHibernate.III.CastleWindsor
{
public class IdentityProvider : IIdentityProvider
{
/// <inheritdoc />
public string IdentityName
=> Thread.CurrentPrincipal.Identity.IsAuthenticated
? Thread.CurrentPrincipal.Identity.Name
: "Not Authenticated";
}
}
|
apache-2.0
|
C#
|
b5bedf07b507746e27db21f3411cc28dc81160e1
|
Remove setters from IObservable properties
|
MHeasell/Mappy,MHeasell/Mappy
|
Mappy/Models/IMapViewSettingsModel.cs
|
Mappy/Models/IMapViewSettingsModel.cs
|
namespace Mappy.Models
{
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Mappy.Data;
using Mappy.Database;
public interface IMapViewSettingsModel
{
IObservable<bool> GridVisible { get; }
IObservable<Color> GridColor { get; }
IObservable<Size> GridSize { get; }
IObservable<bool> HeightmapVisible { get; }
IObservable<bool> FeaturesVisible { get; }
IObservable<IFeatureDatabase> FeatureRecords { get; }
IObservable<IMainModel> Map { get; }
IObservable<int> ViewportWidth { get; }
IObservable<int> ViewportHeight { get; }
void SetViewportSize(Size size);
void SetViewportLocation(Point pos);
void OpenFromDragDrop(string filename);
void DragDropData(IDataObject data, Point loc);
}
}
|
namespace Mappy.Models
{
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Mappy.Data;
using Mappy.Database;
public interface IMapViewSettingsModel
{
IObservable<bool> GridVisible { get; }
IObservable<Color> GridColor { get; }
IObservable<Size> GridSize { get; }
IObservable<bool> HeightmapVisible { get; }
IObservable<bool> FeaturesVisible { get; }
IObservable<IFeatureDatabase> FeatureRecords { get; }
IObservable<IMainModel> Map { get; }
IObservable<int> ViewportWidth { get; set; }
IObservable<int> ViewportHeight { get; set; }
void SetViewportSize(Size size);
void SetViewportLocation(Point pos);
void OpenFromDragDrop(string filename);
void DragDropData(IDataObject data, Point loc);
}
}
|
mit
|
C#
|
598655e92f0a795df8f647bd14041d8be17ef56e
|
Update AssemblyInfo.cs
|
subterraneanbob/TopMost
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("topmost")]
[assembly: AssemblyDescription("Start application and place it on top of other windows.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("topmost")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("ee27e2cc-a9de-4221-a615-059ea3f96746")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Управление общими сведениями о сборке осуществляется с помощью
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("topmost")]
[assembly: AssemblyDescription("Start application and place it on top of other windows.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("topmost")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Параметр ComVisible со значением FALSE делает типы в сборке невидимыми
// для COM-компонентов. Если требуется обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("ee27e2cc-a9de-4221-a615-059ea3f96746")]
// Сведения о версии сборки состоят из следующих четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер построения
// Редакция
//
// Можно задать все значения или принять номер построения и номер редакции по умолчанию,
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
|
mit
|
C#
|
d1b73c112ca670e136c09108e76e2f5118fcd457
|
Bump version
|
transistor1/SQLFormatterPlugin
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SQLFormatterPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SQLFormatterPlugin")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("22247641-9910-4c24-9a9d-dd295a749d41")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SQLFormatterPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SQLFormatterPlugin")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("22247641-9910-4c24-9a9d-dd295a749d41")]
// 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.10006.0")]
[assembly: AssemblyFileVersion("1.0.10006.0")]
|
bsd-3-clause
|
C#
|
16180fd5d656c415e5aa01e129e556b1054f9c2d
|
Update version to 1.1
|
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
using TweetDck;
// 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("TweetDeck client for Windows")]
[assembly: AssemblyDescription("TweetDeck client for Windows")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct(Program.BrandName)]
[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("7f09373d-8beb-416f-a48d-45d8aaeb8caf")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]
|
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
using TweetDck;
// 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("TweetDeck client for Windows")]
[assembly: AssemblyDescription("TweetDeck client for Windows")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct(Program.BrandName)]
[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("7f09373d-8beb-416f-a48d-45d8aaeb8caf")]
// 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")]
[assembly: NeutralResourcesLanguageAttribute("en")]
|
mit
|
C#
|
b7fe0481f8442dea6528655d9141b0e9623a01d2
|
Update UnitOfWorkBase.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/UnitOfWorkBase.cs
|
TIKSN.Core/Data/UnitOfWorkBase.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data
{
public abstract class UnitOfWorkBase : IUnitOfWork
{
public abstract Task CompleteAsync(CancellationToken cancellationToken);
public abstract Task DiscardAsync(CancellationToken cancellationToken);
public virtual void Dispose()
{
if (IsDirty())
{
throw new InvalidOperationException("Unit of work disposed without completion.");
}
}
public async ValueTask DisposeAsync()
{
if (IsDirty())
{
await DiscardAsync(default);
}
}
protected abstract bool IsDirty();
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data
{
public abstract class UnitOfWorkBase : IUnitOfWork
{
public abstract Task CompleteAsync(CancellationToken cancellationToken);
public virtual void Dispose()
{
if (IsDirty())
throw new InvalidOperationException("Unit of work disposed without completion.");
}
protected abstract bool IsDirty();
}
}
|
mit
|
C#
|
a2a17abbde4b973cc9b810b856fb793a4aa0e9bf
|
modify BillingFactory.
|
robertzml/Phoebe
|
Phoebe.Core/Billing/BillingFactory.cs
|
Phoebe.Core/Billing/BillingFactory.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Phoebe.Core.Billing
{
using Phoebe.Core.Utility;
/// <summary>
/// 计费方式工厂方法
/// </summary>
public static class BillingFactory
{
#region Method
/// <summary>
/// 创建计费
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static IBillingProcess Create(BillingType type)
{
IBillingProcess billingProcess = null;
switch (type)
{
case BillingType.UnitWeight:
billingProcess = new BillingUnitWeight();
break;
case BillingType.Count:
billingProcess = new BillingCount();
break;
case BillingType.VariousWeight:
billingProcess = new BillingVariousWeight();
break;
}
return billingProcess;
}
#endregion //Method
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Phoebe.Core.Billing
{
using Phoebe.Core.Utility;
/// <summary>
/// 计费方式工厂方法
/// </summary>
public static class BillingFactory
{
#region Method
/// <summary>
/// 创建计费
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static IBillingProcess Create(BillingType type)
{
IBillingProcess billingProcess = null;
switch (type)
{
case BillingType.UnitWeight:
billingProcess = new BillingUnitWeight();
break;
case BillingType.Count:
billingProcess = new BillingCount();
break;
//case BillingType.VariousWeight:
// billingProcess = new BillingVariousWeight();
// break;
}
return billingProcess;
}
#endregion //Method
}
}
|
mit
|
C#
|
b6afc3767f3326d04af3a9685e1711517c98b0e7
|
Modify assembly version
|
sillsdev/icu-dotnet,sillsdev/icu-dotnet,ermshiperete/icu-dotnet,ermshiperete/icu-dotnet,conniey/icu-dotnet,conniey/icu-dotnet
|
source/icu.net/Properties/AssemblyInfo.cs
|
source/icu.net/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("icu.net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SIL International")]
[assembly: AssemblyProduct("icu.net")]
[assembly: AssemblyCopyright("Copyright © SIL International 2007")]
[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("3439151b-347b-4321-9f2f-d5fa28b46477")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.2.1.0")]
[assembly: AssemblyFileVersion("4.8.1.1")]
//Location of the public/private key pair for strong naming this assembly --TA 7 Oct 2008
[assembly: AssemblyKeyFile("icu.net.snk")]
|
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("icu.net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SIL International")]
[assembly: AssemblyProduct("icu.net")]
[assembly: AssemblyCopyright("Copyright © SIL International 2007")]
[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("3439151b-347b-4321-9f2f-d5fa28b46477")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
//Location of the public/private key pair for strong naming this assembly --TA 7 Oct 2008
[assembly: AssemblyKeyFile("icu.net.snk")]
|
mit
|
C#
|
48da1a27153befd1ed52c6e1e4a8c7170da0b5ae
|
bump version
|
alecgorge/adzerk-dot-net
|
Adzerk.Api/Properties/AssemblyInfo.cs
|
Adzerk.Api/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("Adzerk.Api")]
[assembly: AssemblyDescription("Unofficial Adzerk API client.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Stack Exchange")]
[assembly: AssemblyProduct("Adzerk.Api")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d05e1e25-d95d-43d6-a74b-3cb38492fa7e")]
// 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.0.0.4")]
[assembly: AssemblyFileVersion("0.0.0.4")]
|
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("Adzerk.Api")]
[assembly: AssemblyDescription("Unofficial Adzerk API client.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Stack Exchange")]
[assembly: AssemblyProduct("Adzerk.Api")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d05e1e25-d95d-43d6-a74b-3cb38492fa7e")]
// 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.0.0.3")]
[assembly: AssemblyFileVersion("0.0.0.3")]
|
mit
|
C#
|
0770951a5eba03550c4b671d35249189c27563a0
|
fix platform edit
|
llafuente/unity-platformer,llafuente/unity-platformer
|
Assets/Editor/MovingPlatformEditor.cs
|
Assets/Editor/MovingPlatformEditor.cs
|
using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityPlatformer.Characters;
namespace UnityPlatformer.Tiles {
[CustomEditor(typeof(MovingPlatform))]
class MovingPlatformEditor : Editor {
/* TODO FIXME i want this to be displayed all the time not just when selected.
void OnEnable(){
SceneView.onSceneGUIDelegate += CustomSceneGUI;
}
void OnDisable(){
SceneView.onSceneGUIDelegate -= CustomSceneGUI;
}
void CustomSceneGUI(UnityEditor.SceneView sceneView) {
*/
void OnSceneGUI() {
// Do your drawing here using Handles.
//Handles.BeginGUI();
MovingPlatform mp = target as MovingPlatform;
if (mp.localWaypoints != null) {
Handles.color = Color.red;
float size = .3f;
Vector3[] list = new Vector3[mp.localWaypoints.Length * 2];
for (int i = 0; i < mp.localWaypoints.Length; ++i) {
Vector3 globalWaypointPos = (Application.isPlaying) ? mp.globalWaypoints[i] : mp.localWaypoints[i] + mp.transform.position;
if (i != mp.localWaypoints.Length - 1) {
list[i*2] = globalWaypointPos;
list[i*2+1] = (Application.isPlaying) ? mp.globalWaypoints[i + 1] : mp.localWaypoints[i + 1] + mp.transform.position;
}
Handles.DrawLine(globalWaypointPos - Vector3.up * size, globalWaypointPos + Vector3.up * size);
Handles.DrawLine(globalWaypointPos - Vector3.left * size, globalWaypointPos + Vector3.left * size);
Handles.Label(globalWaypointPos + new Vector3(-0.1f, 0.8f, 0), "" + i);;
}
Handles.DrawLines(list);
}
// Do your drawing here using GUI.
//Handles.EndGUI();
}
}
}
|
using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityPlatformer.Characters;
namespace UnityPlatformer.Tiles {
[CustomEditor(typeof(MovingPlatform))]
class MovingPlatformEditor : Editor {
/* TODO FIXME i want this to be displayed all the time not just when selected.
void OnEnable(){
SceneView.onSceneGUIDelegate += CustomSceneGUI;
}
void OnDisable(){
SceneView.onSceneGUIDelegate -= CustomSceneGUI;
}
void CustomSceneGUI(UnityEditor.SceneView sceneView) {
*/
void CustomSceneGUI() {
// Do your drawing here using Handles.
//Handles.BeginGUI();
MovingPlatform mp = target as MovingPlatform;
if (mp.localWaypoints != null) {
Handles.color = Color.red;
float size = .3f;
for (int i =0; i < mp.localWaypoints.Length; i ++) {
Vector3 globalWaypointPos = (Application.isPlaying) ? mp.globalWaypoints[i] : mp.localWaypoints[i] + mp.transform.position;
Handles.DrawLine(globalWaypointPos - Vector3.up * size, globalWaypointPos + Vector3.up * size);
Handles.DrawLine(globalWaypointPos - Vector3.left * size, globalWaypointPos + Vector3.left * size);
Handles.Label(globalWaypointPos + new Vector3(-0.1f, 0.8f, 0), "" + i);;
}
}
// Do your drawing here using GUI.
//Handles.EndGUI();
}
}
}
|
mit
|
C#
|
81e25d2b041fe03cd1ec5a077dc83c1e3fcd819d
|
Update token TTL when verifying session
|
returnString/Servya
|
Samples/AccountBackend/AuthService.cs
|
Samples/AccountBackend/AuthService.cs
|
using System;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Servya;
using StackExchange.Redis;
namespace AccountBackend
{
[Service]
public class AuthService
{
private readonly IDatabase m_db;
private readonly TimeSpan m_tokenTTL;
public AuthService(IDatabase db)
{
m_db = db;
m_tokenTTL = TimeSpan.FromMinutes(10);
}
[JsonRoute(Verb = HttpVerb.Post)]
public async Task<Response> Register(string name, string password)
{
var key = UserKey(name);
var transaction = m_db.CreateTransaction();
var nameNotTaken = transaction.AddCondition(Condition.KeyNotExists(key));
transaction.HashSetAsync(key, "password", PasswordHash(password)).Forget();
if (await transaction.ExecuteAsync())
return Status.Ok;
if (!nameNotTaken.WasSatisfied)
return Status.NameTaken;
return Status.InternalError;
}
[JsonRoute(Verb = HttpVerb.Post)]
public async Task<Response<string>> Login(string name, string password)
{
var key = UserKey(name);
var storedPassword = await m_db.HashGetAsync(key, "password");
if (storedPassword == PasswordHash(password))
{
var token = Guid.NewGuid().ToString();
await m_db.StringSetAsync(TokenKey(token), name, m_tokenTTL);
return token;
}
return Status.InvalidCredentials;
}
[JsonRoute]
public async Task<Response> Verify(string token)
{
if (await m_db.KeyExpireAsync(TokenKey(token), m_tokenTTL))
return Status.Ok;
return Status.TokenExpired;
}
private byte[] PasswordHash(string password)
{
using (var alg = new SHA512Managed())
{
var bytes = Encoding.UTF8.GetBytes(password);
return alg.ComputeHash(bytes);
}
}
private string UserKey(string name)
{
return "user:" + name;
}
private string TokenKey(string token)
{
return "token:" + token;
}
}
}
|
using System;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Servya;
using StackExchange.Redis;
namespace AccountBackend
{
[Service]
public class AuthService
{
private readonly IDatabase m_db;
private readonly TimeSpan m_tokenTTL;
public AuthService(IDatabase db)
{
m_db = db;
m_tokenTTL = TimeSpan.FromMinutes(10);
}
[JsonRoute(Verb = HttpVerb.Post)]
public async Task<Response> Register(string name, string password)
{
var key = UserKey(name);
var transaction = m_db.CreateTransaction();
var nameNotTaken = transaction.AddCondition(Condition.KeyNotExists(key));
transaction.HashSetAsync(key, "password", PasswordHash(password)).Forget();
if (await transaction.ExecuteAsync())
return Status.Ok;
if (!nameNotTaken.WasSatisfied)
return Status.NameTaken;
return Status.InternalError;
}
[JsonRoute(Verb = HttpVerb.Post)]
public async Task<Response<string>> Login(string name, string password)
{
var key = UserKey(name);
var storedPassword = await m_db.HashGetAsync(key, "password");
if (storedPassword == PasswordHash(password))
{
var token = Guid.NewGuid().ToString();
await m_db.StringSetAsync(TokenKey(token), name, m_tokenTTL);
return token;
}
return Status.InvalidCredentials;
}
[JsonRoute]
public async Task<Response> Verify(string token)
{
if (await m_db.KeyExistsAsync(TokenKey(token)))
return Status.Ok;
return Status.TokenExpired;
}
private byte[] PasswordHash(string password)
{
using (var alg = new SHA512Managed())
{
var bytes = Encoding.UTF8.GetBytes(password);
return alg.ComputeHash(bytes);
}
}
private string UserKey(string name)
{
return "user:" + name;
}
private string TokenKey(string token)
{
return "token:" + token;
}
}
}
|
mit
|
C#
|
e65f39694bb4df823bf71f9e67213e2a0e18f24b
|
Include type name in reference error (#1429)
|
graphql-dotnet/graphql-dotnet,graphql-dotnet/graphql-dotnet,joemcbride/graphql-dotnet,joemcbride/graphql-dotnet,graphql-dotnet/graphql-dotnet
|
src/GraphQL/Types/GraphQLTypeReference.cs
|
src/GraphQL/Types/GraphQLTypeReference.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace GraphQL.Types
{
[DebuggerDisplay("ref {TypeName,nq}")]
public class GraphQLTypeReference : InterfaceGraphType, IObjectGraphType
{
public GraphQLTypeReference(string typeName)
{
SetName("__GraphQLTypeReference", validate: false);
TypeName = typeName;
}
public string TypeName { get; private set; }
public Func<object, bool> IsTypeOf
{
get => throw Invalid();
set => throw Invalid();
}
public void AddResolvedInterface(IInterfaceGraphType graphType) => throw Invalid();
public IEnumerable<Type> Interfaces
{
get => throw Invalid();
set => throw Invalid();
}
public IEnumerable<IInterfaceGraphType> ResolvedInterfaces
{
get => throw Invalid();
set => throw Invalid();
}
private InvalidOperationException Invalid() => new InvalidOperationException(
$"This is just a reference to '{TypeName}'. Resolve the real type first.");
public override bool Equals(object obj)
{
if (obj is GraphQLTypeReference other)
{
return TypeName == other.TypeName;
}
return base.Equals(obj);
}
public override int GetHashCode() => TypeName?.GetHashCode() ?? 0;
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace GraphQL.Types
{
[DebuggerDisplay("ref {TypeName,nq}")]
public class GraphQLTypeReference : InterfaceGraphType, IObjectGraphType
{
public GraphQLTypeReference(string typeName)
{
SetName("__GraphQLTypeReference", validate: false);
TypeName = typeName;
}
public string TypeName { get; private set; }
public Func<object, bool> IsTypeOf
{
get => throw Invalid();
set => throw Invalid();
}
public void AddResolvedInterface(IInterfaceGraphType graphType) => throw Invalid();
public IEnumerable<Type> Interfaces
{
get => throw Invalid();
set => throw Invalid();
}
public IEnumerable<IInterfaceGraphType> ResolvedInterfaces
{
get => throw Invalid();
set => throw Invalid();
}
private InvalidOperationException Invalid() => new InvalidOperationException("This is just a reference. Resolve the real type first.");
public override bool Equals(object obj)
{
if (obj is GraphQLTypeReference other)
{
return TypeName == other.TypeName;
}
return base.Equals(obj);
}
public override int GetHashCode() => TypeName?.GetHashCode() ?? 0;
}
}
|
mit
|
C#
|
c9d28fabe528a7f921493b2dbb16f5174ae99358
|
Fix possible NPE
|
peopleware/net-ppwcode-vernacular-nhibernate
|
src/III.CastleWindsor/IdentityProvider.cs
|
src/III.CastleWindsor/IdentityProvider.cs
|
// Copyright 2018 by PeopleWare n.v..
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Threading;
namespace PPWCode.Vernacular.NHibernate.III.CastleWindsor
{
public class IdentityProvider : IIdentityProvider
{
/// <inheritdoc />
public string IdentityName
=> Thread.CurrentPrincipal?.Identity?.IsAuthenticated == true
? Thread.CurrentPrincipal.Identity.Name ?? "Authenticated"
: "Not Authenticated";
}
}
|
// Copyright 2018 by PeopleWare n.v..
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Threading;
namespace PPWCode.Vernacular.NHibernate.III.CastleWindsor
{
public class IdentityProvider : IIdentityProvider
{
/// <inheritdoc />
public string IdentityName
=> Thread.CurrentPrincipal?.Identity?.IsAuthenticated == true
? Thread.CurrentPrincipal.Identity.Name
: "Not Authenticated";
}
}
|
apache-2.0
|
C#
|
574554aae8023acce89af3aedbc3091477752170
|
Format example code
|
dncuug/X.PagedList
|
examples/X.PagedList.Mvc.Example.Core/Views/Home/_NameListPartial.cshtml
|
examples/X.PagedList.Mvc.Example.Core/Views/Home/_NameListPartial.cshtml
|
@*use this for the fake AjaxOptions since ajax helpers were dropped in .net core*@
@model IPagedList<string>
@*import this so we get our HTML Helper*@
@using X.PagedList.Mvc.Core;
@*import this so we can cast our list to IPagedList (only necessary because ViewBag is dynamic)*@
@using X.PagedList;
@using X.PagedList.Web.Common
<ul>
@foreach (var name in Model)
{
<li>@name</li>
}
</ul>
@Html.PagedListPager(
list: (IPagedList<string>)ViewBag.Names,
generatePageUrl: page => Url.Action("GetOnePageOfNames", new { page }),
options: PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(
renderOptions: new PagedListRenderOptions
{
MaximumPageNumbersToDisplay = 5,
DisplayPageCountAndCurrentLocation = true,
UlElementClasses = new[]
{
"pagination"
},
ContainerDivClasses = new[]
{
"pagination-container"
}
},
ajaxOptions: new AjaxOptions
{
HttpMethod = "GET",
UpdateTargetId = "nameListContainer"
})
)
|
@*use this for the fake AjaxOptions since ajax helpers were dropped in .net core*@
@model IPagedList<string>
@*import this so we get our HTML Helper*@
@using X.PagedList.Mvc.Core;
@*import this so we can cast our list to IPagedList (only necessary because ViewBag is dynamic)*@
@using X.PagedList;
@using X.PagedList.Web.Common
<ul>
@foreach (var name in Model)
{
<li>@name</li>
}
</ul>
@Html.PagedListPager((IPagedList<string>)ViewBag.Names, page => Url.Action("GetOnePageOfNames", new { page }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new PagedListRenderOptions { MaximumPageNumbersToDisplay = 5, DisplayPageCountAndCurrentLocation = true, UlElementClasses = new[] { "pagination" }, ContainerDivClasses = new[] { "pagination-container" } }, new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "nameListContainer" }))
|
mit
|
C#
|
2e6f7f593d26accf36c99b11ca9e1a7fe175a268
|
Bump version to 2.0
|
dreamer2908/YAXBPC,dreamer2908/YAXBPC
|
YAXBPC/Properties/AssemblyInfo.cs
|
YAXBPC/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("Yet Another xdelta-based Patch Creator")]
[assembly: AssemblyDescription("Yet Another xdelta-based Patch Creator")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Yet Another xdelta-based Patch Creator")]
[assembly: AssemblyCopyright("Copyleft © dreamer2908, 2012 - 2016. All wrongs reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("74ce6b2a-b97c-4a4b-91cc-9343b4a87ecb")]
// 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("2.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("Yet Another xdelta-based Patch Creator")]
[assembly: AssemblyDescription("Yet Another xdelta-based Patch Creator")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Yet Another xdelta-based Patch Creator")]
[assembly: AssemblyCopyright("Copyleft © dreamer2908, 2012 - 2016. All wrongs reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("74ce6b2a-b97c-4a4b-91cc-9343b4a87ecb")]
// 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.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]
|
apache-2.0
|
C#
|
0cb0edbe9d2876eae3b4fe08f666490a7db317fe
|
Fix parsedblock representation
|
puckipedia/StackStream
|
StackStream.Lib/Tokens/PackedBlock.cs
|
StackStream.Lib/Tokens/PackedBlock.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StackStream.Tokens
{
public class PackedBlock : IToken
{
public List<IToken> Value
{
get;
private set;
}
public PackedBlock(IEnumerable<IToken> tokens)
{
Value = tokens.ToList();
}
public string AsString()
{
return new string(Value.Select(a => (char)((Number)a).Value).ToArray());
}
public IToken Duplicate()
{
return new PackedBlock(Value.Select(a => a.Duplicate()));
}
public override string ToString()
{
return "( " + string.Join(" ", Value.Select(a => a.ToString()).Reverse()) + " )";
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StackStream.Tokens
{
public class PackedBlock : IToken
{
public List<IToken> Value
{
get;
private set;
}
public PackedBlock(IEnumerable<IToken> tokens)
{
Value = tokens.ToList();
}
public string AsString()
{
return new string(Value.Select(a => (char)((Number)a).Value).ToArray());
}
public IToken Duplicate()
{
return new PackedBlock(Value.Select(a => a.Duplicate()));
}
public override string ToString()
{
return "( " + string.Join(" ", Value.Select(a => a.ToString())) + " )";
}
}
}
|
mit
|
C#
|
7391dd11c786c2c66dc765da45d196b8758ff34f
|
Fix method docs
|
MindscapeHQ/raygun4net,MindscapeHQ/raygun4net,MindscapeHQ/raygun4net
|
Mindscape.Raygun4Net/ProfilingSupport/APM.cs
|
Mindscape.Raygun4Net/ProfilingSupport/APM.cs
|
using System;
using System.Runtime.CompilerServices;
#if !NETSTANDARD1_6 && !NETSTANDARD2_0
using System.Web;
#endif
namespace Mindscape.Raygun4Net
{
public static class APM
{
[ThreadStatic] private static bool _enabled = false;
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void Enable()
{
_enabled = true;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void Disable()
{
_enabled = false;
}
public static bool IsEnabled
{
get { return _enabled; }
}
public static bool ProfilerAttached
{
get
{
#if NETSTANDARD1_6 || NETSTANDARD2_0
// Look for .NET CORE compatible Environment Variables
return
Environment.GetEnvironmentVariable("CORECLR_PROFILER") == "{e2338988-38cc-48cd-a6b6-b441c31f34f1}" &&
Environment.GetEnvironmentVariable("CORECLR_ENABLE_PROFILING") == "1";
#else
// Look for .NET FRAMEWORK compatible Environment Variables
return
Environment.GetEnvironmentVariable("COR_PROFILER") == "{e2338988-38cc-48cd-a6b6-b441c31f34f1}" &&
Environment.GetEnvironmentVariable("COR_ENABLE_PROFILING") == "1";
#endif
}
}
#if !NETSTANDARD1_6 && !NETSTANDARD2_0
/// <summary>
/// Initializes enhanced features when using Raygun APM.
/// Should be called once on Application init.
/// This will be called automatically by the RaygunHttpModule if configured.
/// </summary>
/// <param name="context">The current HttpApplication instance</param>
/// <param name="appIdentifier">The identifier for your application, generally the IIS AppPool name</param>
public static void Initialize(HttpApplication context, string appIdentifier = null)
{
var initializer = new HttpApplicationInitializer();
initializer.Initialize(context, appIdentifier);
}
#endif
}
}
|
using System;
using System.Runtime.CompilerServices;
#if !NETSTANDARD1_6 && !NETSTANDARD2_0
using System.Web;
#endif
namespace Mindscape.Raygun4Net
{
public static class APM
{
[ThreadStatic] private static bool _enabled = false;
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void Enable()
{
_enabled = true;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void Disable()
{
_enabled = false;
}
public static bool IsEnabled
{
get { return _enabled; }
}
public static bool ProfilerAttached
{
get
{
#if NETSTANDARD1_6 || NETSTANDARD2_0
// Look for .NET CORE compatible Environment Variables
return
Environment.GetEnvironmentVariable("CORECLR_PROFILER") == "{e2338988-38cc-48cd-a6b6-b441c31f34f1}" &&
Environment.GetEnvironmentVariable("CORECLR_ENABLE_PROFILING") == "1";
#else
// Look for .NET FRAMEWORK compatible Environment Variables
return
Environment.GetEnvironmentVariable("COR_PROFILER") == "{e2338988-38cc-48cd-a6b6-b441c31f34f1}" &&
Environment.GetEnvironmentVariable("COR_ENABLE_PROFILING") == "1";
#endif
}
}
#if !NETSTANDARD1_6 && !NETSTANDARD2_0
/// <summary>
/// Initializes enhanced features when using Raygun APM.
/// Should be called once on Application init. Subsequent calls will do nothing once initialized.
/// This will be called automatically by the RaygunHttpModule if configured.
/// </summary>
/// <param name="context"></param>
public static void Initialize(HttpApplication context, string appIdentifier = null)
{
var initializer = new HttpApplicationInitializer();
initializer.Initialize(context, appIdentifier);
}
#endif
}
}
|
mit
|
C#
|
d87dca0262705b54e0ffeecf71b93b0843f7ecac
|
Split responsibility of ConvertMovie() method
|
milleniumbug/OpeningsMoeDesktop
|
OpeningsMoeWpfClient/FfmpegMovieConverter.cs
|
OpeningsMoeWpfClient/FfmpegMovieConverter.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpeningsMoeWpfClient
{
class FfmpegMovieConverter : IMovieConverter
{
private string ffmpegPath;
private Task<int> LaunchProcess(Func<Process> factory, Action<Process> postLaunchConfiguration)
{
var tcs = new TaskCompletionSource<int>();
var process = factory();
process.Exited += (sender, args) =>
{
tcs.SetResult(process.ExitCode);
process.Dispose();
};
process.Start();
postLaunchConfiguration(process);
return tcs.Task;
}
public async Task<string> ConvertMovie(string sourcePath, string targetPath)
{
int exitCode = await LaunchProcess(() => new Process
{
StartInfo =
{
UseShellExecute = false,
FileName = ffmpegPath,
Arguments =
$@"-i ""{sourcePath}"" -vcodec msmpeg4v2 -acodec libmp3lame -strict -2 ""{targetPath}""",
CreateNoWindow = true
},
EnableRaisingEvents = true
}, process =>
{
process.PriorityClass = ProcessPriorityClass.BelowNormal;
});
if(exitCode == 0)
return targetPath;
throw new InvalidOperationException("SOMETHING WENT WRONG");
}
public FfmpegMovieConverter(string ffmpegPath)
{
this.ffmpegPath = ffmpegPath;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpeningsMoeWpfClient
{
class FfmpegMovieConverter : IMovieConverter
{
private string ffmpegPath;
public Task<string> ConvertMovie(string sourcePath, string targetPath)
{
var tcs = new TaskCompletionSource<string>();
var process = new Process
{
StartInfo =
{
UseShellExecute = false,
FileName = ffmpegPath,
Arguments = $@"-i ""{sourcePath}"" -vcodec msmpeg4v2 -acodec libmp3lame -strict -2 ""{targetPath}""",
CreateNoWindow = true
},
EnableRaisingEvents = true
};
process.Exited += (sender, args) =>
{
if(process.ExitCode == 0)
tcs.SetResult(targetPath);
else
tcs.SetException(new InvalidOperationException("SOMETHING WENT WRONG"));
process.Dispose();
};
process.Start();
process.PriorityClass = ProcessPriorityClass.BelowNormal;
return tcs.Task;
}
public FfmpegMovieConverter(string ffmpegPath)
{
this.ffmpegPath = ffmpegPath;
}
}
}
|
mit
|
C#
|
fa927f09f9f788b1087bf72dbb4f7729b4ae40df
|
Update XColor.cs
|
wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D
|
Test/Core/XColor.cs
|
Test/Core/XColor.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test.Core
{
public class XColor : XObject
{
private byte _a;
private byte _r;
private byte _g;
private byte _b;
public byte A
{
get { return _a; }
set
{
if (value != _a)
{
_a = value;
Notify("A");
}
}
}
public byte R
{
get { return _r; }
set
{
if (value != _r)
{
_r = value;
Notify("R");
}
}
}
public byte G
{
get { return _g; }
set
{
if (value != _g)
{
_g = value;
Notify("G");
}
}
}
public byte B
{
get { return _b; }
set
{
if (value != _b)
{
_b = value;
Notify("B");
}
}
}
public static XColor Create(byte a, byte r, byte g, byte b)
{
return new XColor() { A = a, R = r, G = g, B = b };
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test.Core
{
public class XColor : XObject
{
private byte _a;
private byte _r;
private byte _g;
private byte _b;
public byte A
{
get { return _a; }
set
{
if (value != _a)
{
_a = value;
Notify("A");
}
}
}
public byte R
{
get { return _r; }
set
{
if (value != _r)
{
_r = value;
Notify("R");
}
}
}
public byte G
{
get { return _g; }
set
{
if (value != _g)
{
_g = value;
Notify("G");
}
}
}
public byte B
{
get { return _b; }
set
{
if (value != _b)
{
_b = value;
Notify("B");
}
}
}
public static XColor Create(byte a, byte r, byte g, byte b)
{
return new XColor() { A = a, R = r, G = g, B = b };
}
}
}
|
mit
|
C#
|
c0fa86b90f46c3395bc77f0e8c38915eea50d8f9
|
Update XShape.cs
|
wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
|
Test/Core/XShape.cs
|
Test/Core/XShape.cs
|
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test.Core
{
public abstract class XShape : XObject
{
public abstract void Draw(object dc, IRenderer renderer, double dx, double dy);
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test.Core
{
public abstract class XShape : XObject
{
public abstract void Draw(object dc, IRenderer renderer, double dx, double dy);
}
}
|
mit
|
C#
|
e0d1f5bacff8cdf99c7dec637633adb66c0b3bb5
|
Test for at se om build deployer til test
|
miracle-as/kitos,miracle-as/kitos,os2kitos/kitos,miracle-as/kitos,os2kitos/kitos,os2kitos/kitos,os2kitos/kitos,miracle-as/kitos
|
Presentation.Web/Views/Shared/_Layout.cshtml
|
Presentation.Web/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html lang="da">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title data-ng-bind="page.title + ' - KITOS XXXXXXX'">KITOS</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon">
<meta name="viewport" content="width=device-width">
<link href="//kendo.cdn.telerik.com/2016.2.714/styles/kendo.common-bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="//kendo.cdn.telerik.com/2016.2.714/styles/kendo.bootstrap.min.css" rel="stylesheet" type="text/css" />
@Styles.Render("~/Content/css/css")
@Scripts.Render("~/Scripts/vendor")
@Scripts.Render("~/Scripts/angular")
<script src="//kendo.cdn.telerik.com/2016.2.714/js/jszip.min.js"></script>
<script src="//kendo.cdn.telerik.com/2016.2.714/js/kendo.web.min.js"></script>
<!-- Kendo localization -->
<script src="//kendo.cdn.telerik.com/2016.2.714/js/messages/kendo.messages.da-DK.min.js"></script>
<!-- Kendo globalization -->
<script src="//kendo.cdn.telerik.com/2016.2.714/js/cultures/kendo.culture.da-DK.min.js"></script>
@if (ViewBag.Environment != "Prod")
{
if (ViewBag.Environment == "Test")
{
<style>
#navbar-top {
background-color: red !important;
}
</style>
}
else if (ViewBag.Environment == "Sandbox")
{
<style>
#navbar-top {
background-color: #444 !important;
}
</style>
}
}
</head>
<body data-ng-app="app" data-ng-cloak data-ng-strict-di>
@RenderBody()
<script>
// set current culture to "da-DK"
kendo.culture("da-DK");
</script>
@Scripts.Render("~/Scripts/app")
</body>
</html>
|
<!DOCTYPE html>
<html lang="da">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title data-ng-bind="page.title + ' - KITOS'">KITOS</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon">
<meta name="viewport" content="width=device-width">
<link href="//kendo.cdn.telerik.com/2016.2.714/styles/kendo.common-bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="//kendo.cdn.telerik.com/2016.2.714/styles/kendo.bootstrap.min.css" rel="stylesheet" type="text/css" />
@Styles.Render("~/Content/css/css")
@Scripts.Render("~/Scripts/vendor")
@Scripts.Render("~/Scripts/angular")
<script src="//kendo.cdn.telerik.com/2016.2.714/js/jszip.min.js"></script>
<script src="//kendo.cdn.telerik.com/2016.2.714/js/kendo.web.min.js"></script>
<!-- Kendo localization -->
<script src="//kendo.cdn.telerik.com/2016.2.714/js/messages/kendo.messages.da-DK.min.js"></script>
<!-- Kendo globalization -->
<script src="//kendo.cdn.telerik.com/2016.2.714/js/cultures/kendo.culture.da-DK.min.js"></script>
@if (ViewBag.Environment != "Prod")
{
if (ViewBag.Environment == "Test")
{
<style>
#navbar-top {
background-color: red !important;
}
</style>
}
else if (ViewBag.Environment == "Sandbox")
{
<style>
#navbar-top {
background-color: #444 !important;
}
</style>
}
}
</head>
<body data-ng-app="app" data-ng-cloak data-ng-strict-di>
@RenderBody()
<script>
// set current culture to "da-DK"
kendo.culture("da-DK");
</script>
@Scripts.Render("~/Scripts/app")
</body>
</html>
|
mpl-2.0
|
C#
|
0672d2082d88c106cd96c7ab9feab123bed06cd3
|
Add resolution deserialization unit test
|
jameschch/Lean,JKarathiya/Lean,AlexCatarino/Lean,jameschch/Lean,QuantConnect/Lean,jameschch/Lean,AlexCatarino/Lean,jameschch/Lean,QuantConnect/Lean,StefanoRaggi/Lean,JKarathiya/Lean,AlexCatarino/Lean,AlexCatarino/Lean,JKarathiya/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,QuantConnect/Lean,StefanoRaggi/Lean,StefanoRaggi/Lean,JKarathiya/Lean,jameschch/Lean,QuantConnect/Lean
|
Tests/Common/Packets/ControlsTests.cs
|
Tests/Common/Packets/ControlsTests.cs
|
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using NUnit.Framework;
using QuantConnect.Packets;
namespace QuantConnect.Tests.Common.Packets
{
public class ControlsTests
{
[TestCase(0)]
[TestCase(1)]
[TestCase(2)]
[TestCase(3)]
[TestCase(FileAccess.Read)]
[TestCase(FileAccess.Write)]
[TestCase(FileAccess.ReadWrite)]
public void StoragePermissionsJsonRoundTrip(FileAccess permissions)
{
var control = new Controls { StoragePermissions = permissions };
var json = JsonConvert.SerializeObject(control);
var result = JsonConvert.DeserializeObject<Controls>(json);
Assert.AreEqual(permissions, result.StoragePermissions);
}
[TestCase(0)]
[TestCase(1)]
[TestCase(2)]
[TestCase(3)]
[TestCase(4)]
[TestCase(Resolution.Daily)]
[TestCase(Resolution.Hour)]
[TestCase(Resolution.Minute)]
[TestCase(Resolution.Second)]
[TestCase(Resolution.Tick)]
public void DataResolutionPermissionsJsonRoundTrip(Resolution resolution)
{
var control = new Controls { DataResolutionPermissions = new HashSet<Resolution>{ resolution } };
var json = JsonConvert.SerializeObject(control);
var result = JsonConvert.DeserializeObject<Controls>(json);
Assert.AreEqual(resolution, result.DataResolutionPermissions.Single());
}
[Test]
public void StringDataResolutionPermissionsJsonRoundTrip()
{
var json = "{\"dataResolutionPermissions\":[\"Tick\", \"daily\", \"1\"]}";
var result = JsonConvert.DeserializeObject<Controls>(json);
Assert.AreEqual(3, result.DataResolutionPermissions.Count);
Assert.IsTrue(result.DataResolutionPermissions.Contains(Resolution.Second));
Assert.IsTrue(result.DataResolutionPermissions.Contains(Resolution.Tick));
Assert.IsTrue(result.DataResolutionPermissions.Contains(Resolution.Daily));
}
}
}
|
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using NUnit.Framework;
using QuantConnect.Packets;
namespace QuantConnect.Tests.Common.Packets
{
public class ControlsTests
{
[TestCase(0)]
[TestCase(1)]
[TestCase(2)]
[TestCase(3)]
[TestCase(FileAccess.Read)]
[TestCase(FileAccess.Write)]
[TestCase(FileAccess.ReadWrite)]
public void StoragePermissionsJsonRoundTrip(FileAccess permissions)
{
var control = new Controls { StoragePermissions = permissions };
var json = JsonConvert.SerializeObject(control);
var result = JsonConvert.DeserializeObject<Controls>(json);
Assert.AreEqual(permissions, result.StoragePermissions);
}
[TestCase(0)]
[TestCase(1)]
[TestCase(2)]
[TestCase(3)]
[TestCase(4)]
[TestCase(Resolution.Daily)]
[TestCase(Resolution.Hour)]
[TestCase(Resolution.Minute)]
[TestCase(Resolution.Second)]
[TestCase(Resolution.Tick)]
public void DataResolutionPermissionsJsonRoundTrip(Resolution resolution)
{
var control = new Controls { DataResolutionPermissions = new HashSet<Resolution>{ resolution } };
var json = JsonConvert.SerializeObject(control);
var result = JsonConvert.DeserializeObject<Controls>(json);
Assert.AreEqual(resolution, result.DataResolutionPermissions.Single());
}
}
}
|
apache-2.0
|
C#
|
a14f12537f1af784fb9a874223d9e129887e2cbd
|
test DisposableStack.
|
vjacquet/WmcSoft
|
WmcSoft.Core.Tests/DisposableTests.cs
|
WmcSoft.Core.Tests/DisposableTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace WmcSoft
{
[TestClass]
public class DisposableTests
{
[TestMethod]
public void CheckDisposableStackDisposeInReverseOrder() {
int a = 0;
int b = 0;
int c = 0;
int sequence = 0;
var bin = new DisposableStack {
new Disposer(() => a = ++sequence),
new Disposer(() => b = ++sequence),
new Disposer(() => c = ++sequence),
};
bin.Dispose();
Assert.AreEqual(1, c);
Assert.AreEqual(2, b);
Assert.AreEqual(3, a);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace WmcSoft
{
[TestClass]
public class DisposableTests
{
[TestMethod]
public void CanInitializeDisposableBin() {
bool aIsDisposed = false;
bool bIsDisposed = false;
var a = new Disposer(() => aIsDisposed = true);
var b = new Disposer(() => bIsDisposed = true);
Assert.IsFalse(aIsDisposed);
Assert.IsFalse(bIsDisposed);
var bin = new DisposableStack {
a, b
};
Assert.IsTrue(aIsDisposed);
Assert.IsTrue(bIsDisposed);
}
}
}
|
mit
|
C#
|
8f77f22794b96d768c76726cb9b15a801c658614
|
Allow .par in auto in case of '(T) expr.par'
|
controlflow/resharper-postfix
|
Templates/ParenthesizedExpressionTemplate.cs
|
Templates/ParenthesizedExpressionTemplate.cs
|
using System.Linq;
using JetBrains.Annotations;
using JetBrains.ReSharper.Feature.Services.Lookup;
using JetBrains.ReSharper.PostfixTemplates.LookupItems;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
namespace JetBrains.ReSharper.PostfixTemplates.Templates
{
[PostfixTemplate(
templateName: "par",
description: "Parenthesizes current expression",
example: "(expr)")]
public class ParenthesizedExpressionTemplate : IPostfixTemplate
{
public ILookupItem CreateItem(PostfixTemplateContext context)
{
PrefixExpressionContext bestContext = null;
foreach (var expressionContext in context.Expressions.Reverse())
{
if (CommonUtils.IsNiceExpression(expressionContext.Expression))
{
bestContext = expressionContext;
break;
}
}
// available in auto over cast expressions
var targetContext = bestContext ?? context.OuterExpression;
var insideCastExpression = CastExpressionNavigator.GetByOp(targetContext.Expression) != null;
if (!insideCastExpression && context.IsAutoCompletion) return null;
return new ParenthesesItem(targetContext);
}
private sealed class ParenthesesItem : ExpressionPostfixLookupItem<ICSharpExpression>
{
public ParenthesesItem([NotNull] PrefixExpressionContext context) : base("par", context) { }
protected override ICSharpExpression CreateExpression(CSharpElementFactory factory,
ICSharpExpression expression)
{
return factory.CreateExpression("($0)", expression);
}
}
}
}
|
using System.Linq;
using JetBrains.Annotations;
using JetBrains.ReSharper.Feature.Services.Lookup;
using JetBrains.ReSharper.PostfixTemplates.LookupItems;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
namespace JetBrains.ReSharper.PostfixTemplates.Templates
{
// todo: (Bar) foo.par - available in auto?
[PostfixTemplate(
templateName: "par",
description: "Parenthesizes current expression",
example: "(expr)")]
public class ParenthesizedExpressionTemplate : IPostfixTemplate
{
public ILookupItem CreateItem(PostfixTemplateContext context)
{
if (context.IsAutoCompletion) return null;
PrefixExpressionContext bestContext = null;
foreach (var expressionContext in context.Expressions.Reverse())
{
if (CommonUtils.IsNiceExpression(expressionContext.Expression))
{
bestContext = expressionContext;
break;
}
}
return new ParenthesesItem(bestContext ?? context.OuterExpression);
}
private sealed class ParenthesesItem : ExpressionPostfixLookupItem<ICSharpExpression>
{
public ParenthesesItem([NotNull] PrefixExpressionContext context) : base("par", context) { }
protected override ICSharpExpression CreateExpression(CSharpElementFactory factory,
ICSharpExpression expression)
{
return factory.CreateExpression("($0)", expression);
}
}
}
}
|
mit
|
C#
|
10625452b8c097cbe2cc9dc99b9d0f2b90c3d6d3
|
Update Base62CorrelationServiceOptions.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Integration/Correlation/Base62CorrelationServiceOptions.cs
|
TIKSN.Core/Integration/Correlation/Base62CorrelationServiceOptions.cs
|
namespace TIKSN.Integration.Correlation
{
public class Base62CorrelationServiceOptions
{
public Base62CorrelationServiceOptions()
{
ByteLength = 16;
}
public int ByteLength { get; set; }
}
}
|
namespace TIKSN.Integration.Correlation
{
public class Base62CorrelationServiceOptions
{
}
}
|
mit
|
C#
|
8b080272ef80bfa2537afca5517cdce0ed23d667
|
Fix using directive ordering
|
MHeasell/Mappy,MHeasell/Mappy
|
Mappy/Models/IMinimapFormViewModel.cs
|
Mappy/Models/IMinimapFormViewModel.cs
|
namespace Mappy.Models
{
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Reactive.Subjects;
public interface IMinimapFormViewModel : INotifyPropertyChanged
{
bool MinimapVisible { get; }
Maybe<Bitmap> MinimapImage { get; }
Rectangle MinimapRect { get; }
// TODO: replace with IReadOnlyList<IObservable...> after updating to .NET 4.5
IList<BehaviorSubject<Maybe<Point>>> StartPositions { get; }
void MouseDown(Point location);
void MouseMove(Point location);
void MouseUp();
void FormCloseButtonClick();
}
}
|
namespace Mappy.Models
{
using System.Collections.Generic;
using System.Drawing;
using System.ComponentModel;
using System.Reactive.Subjects;
public interface IMinimapFormViewModel : INotifyPropertyChanged
{
bool MinimapVisible { get; }
Maybe<Bitmap> MinimapImage { get; }
Rectangle MinimapRect { get; }
// TODO: replace with IReadOnlyList<IObservable...> after updating to .NET 4.5
IList<BehaviorSubject<Maybe<Point>>> StartPositions { get; }
void MouseDown(Point location);
void MouseMove(Point location);
void MouseUp();
void FormCloseButtonClick();
}
}
|
mit
|
C#
|
4536113bf5173f9f6461b040e0a7b4fd276c624d
|
increase version no
|
gigya/microdot
|
SolutionVersion.cs
|
SolutionVersion.cs
|
#region Copyright
// Copyright 2017 Gigya Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Gigya Inc.")]
[assembly: AssemblyCopyright("© 2017 Gigya Inc.")]
[assembly: AssemblyDescription("Microdot Framework")]
[assembly: AssemblyVersion("1.7.2.0")]
[assembly: AssemblyFileVersion("1.7.2.0")]
[assembly: AssemblyInformationalVersion("1.7.2.0")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
|
#region Copyright
// Copyright 2017 Gigya Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Gigya Inc.")]
[assembly: AssemblyCopyright("© 2017 Gigya Inc.")]
[assembly: AssemblyDescription("Microdot Framework")]
[assembly: AssemblyVersion("1.7.1.0")]
[assembly: AssemblyFileVersion("1.7.1.0")]
[assembly: AssemblyInformationalVersion("1.7.1.0")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
|
apache-2.0
|
C#
|
8ed13e0cd4b1cc8681721ae59f01075dd81d1dae
|
add urls to code
|
corstijank/blog-dotnet-jenkins,corstijank/blog-dotnet-jenkins
|
TodoApi/Program.cs
|
TodoApi/Program.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
namespace TodoApi
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseUrls("http://0.0.0.0:5000/")
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
namespace TodoApi
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
|
apache-2.0
|
C#
|
1fed7fb5afb4cd48b73d3478cdd7ea0af35ece3b
|
fix for sqlite
|
btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver
|
BTCPayServer.Data/Migrations/20201208054211_invoicesorderindex.cs
|
BTCPayServer.Data/Migrations/20201208054211_invoicesorderindex.cs
|
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20201208054211_invoicesorderindex")]
public partial class invoicesorderindex : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
if (!migrationBuilder.IsSqlite())
{
migrationBuilder.AlterColumn<string>(
name: "OrderId",
table: "Invoices",
maxLength: 100,
nullable: true,
oldClrType: typeof(string));
}
migrationBuilder.CreateIndex(
name: "IX_Invoices_OrderId",
table: "Invoices",
column: "OrderId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Invoices_OrderId",
table: "Invoices");
}
}
}
|
using BTCPayServer.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20201208054211_invoicesorderindex")]
public partial class invoicesorderindex : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "OrderId",
table: "Invoices",
maxLength: 100,
nullable: true,
oldClrType: typeof(string));
migrationBuilder.CreateIndex(
name: "IX_Invoices_OrderId",
table: "Invoices",
column: "OrderId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Invoices_OrderId",
table: "Invoices");
}
}
}
|
mit
|
C#
|
7407b623b596e8764d1acd36c1b709c9fdf80a5d
|
Fix tiny syntax error...
|
georgiwe/Selftaught,georgiwe/Selftaught
|
Code/Selftaught.Web/Views/Languages/_ChangeLanguagePartial.cshtml
|
Code/Selftaught.Web/Views/Languages/_ChangeLanguagePartial.cshtml
|
@using System.Collections.Generic;
@model IEnumerable<string>
<ul class="nav navbar-nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Languages<b class="caret"></b></a>
<ul class="dropdown-menu">
@foreach (var langName in Model)
{
string currName = null;
if (this.Session["language"] != null)
{
currName = this.Session["language"].ToString();
}
<li>
@if (currName == langName)
{
<span class="glyphicon glyphicon-ok"></span>
}
@Html.ActionLink(langName, "ChangeLanguage", "Languages", new { langName = langName, returnUrl = Request.RawUrl }, new { @class = "text-center lang-label" })
</li>
}
@if (User.Identity.IsAuthenticated)
{
<li class="divider"></li>
<li>@Html.ActionLink("Manage Languages", "Manage", "Languages", new { @class = "text-center lang-label" })</li>
}
</ul>
</li>
</ul>
|
@using System.Collections.Generic;
@model IEnumerable<string>
<ul class="nav navbar-nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Languages<b class="caret"></b></a>
<ul class="dropdown-menu">
@foreach (var langName in Model)
{
string currName = null;
if (this.Session["language"] != null)
{
currName = this.Session["language"].ToString();
}
<li>
@if (currName == langName)
{
<span class="glyphicon glyphicon-ok"></span>
}
@Html.ActionLink(langName, "ChangeLanguage", "Languages", new { langName = langName, returnUrl = Request.RawUrl }, new { @class = "text-center lang-label" })
</li>
}
@if (User.Identity.IsAuthenticated)
{
<li class="divider"></li>
<li>@Html.ActionLink("Manage Languages", "Manage", "Languages", , new { @class = "text-center lang-label" })</li>
}
</ul>
</li>
</ul>
|
mit
|
C#
|
175377083566e806e85eab86612848990bc3f931
|
Add mising namespace to LeapCoreAssetsDetector
|
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
|
Assets/MRTK/Examples/Demos/HandTracking/Scripts/LeapCoreAssetsDetector.cs
|
Assets/MRTK/Examples/Demos/HandTracking/Scripts/LeapCoreAssetsDetector.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEngine;
using UnityEngine.UI;
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
/// <summary>
/// Detects if the Leap Motion Data Provider can be used given the current unity project configuration and displays a message
/// to the LeapMotionHandTrackingExample menu panel.
/// </summary>
public class LeapCoreAssetsDetector : MonoBehaviour
{
void Start()
{
var text = gameObject.GetComponent<Text>();
#if LEAPMOTIONCORE_PRESENT
text.text = "The Leap Data Provider can be used in this project";
text.color = Color.green;
#else
text.text = "This project has not met the requirements to use the Leap Data Provider. For more information, visit the MRTK Leap Motion Documentation";
text.color = Color.red;
#endif
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Detects if the Leap Motion Data Provider can be used given the current unity project configuration and displays a message
/// to the LeapMotionHandTrackingExample menu panel.
/// </summary>
public class LeapCoreAssetsDetector : MonoBehaviour
{
void Start()
{
var text = gameObject.GetComponent<Text>();
#if LEAPMOTIONCORE_PRESENT
text.text = "The Leap Data Provider can be used in this project";
text.color = Color.green;
#else
text.text = "This project has not met the requirements to use the Leap Data Provider. For more information, visit the MRTK Leap Motion Documentation";
text.color = Color.red;
#endif
}
}
|
mit
|
C#
|
699b16d28ec280bad0e3c1a0a0f31398a0b858e7
|
remove unused field of FrameInterval
|
m-ishikawa/UniRx,neuecc/UniRx,ppcuni/UniRx,endo0407/UniRx,OrangeCube/UniRx,kimsama/UniRx,ufcpp/UniRx,OC-Leon/UniRx,ataihei/UniRx,saruiwa/UniRx,TORISOUP/UniRx
|
Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs
|
Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs
|
using System;
namespace UniRx.Operators
{
internal class FrameIntervalObservable<T> : OperatorObservableBase<UniRx.FrameInterval<T>>
{
readonly IObservable<T> source;
public FrameIntervalObservable(IObservable<T> source)
: base(source.IsRequiredSubscribeOnCurrentThread())
{
this.source = source;
}
protected override IDisposable SubscribeCore(IObserver<UniRx.FrameInterval<T>> observer, IDisposable cancel)
{
return source.Subscribe(new FrameInterval(observer, cancel));
}
class FrameInterval : OperatorObserverBase<T, UniRx.FrameInterval<T>>
{
int lastFrame;
public FrameInterval(IObserver<UniRx.FrameInterval<T>> observer, IDisposable cancel)
: base(observer, cancel)
{
this.lastFrame = UnityEngine.Time.frameCount;
}
public override void OnNext(T value)
{
var now = UnityEngine.Time.frameCount;
var span = now - lastFrame;
lastFrame = now;
base.observer.OnNext(new UniRx.FrameInterval<T>(value, span));
}
public override void OnError(Exception error)
{
try { observer.OnError(error); }
finally { Dispose(); }
}
public override void OnCompleted()
{
try { observer.OnCompleted(); }
finally { Dispose(); }
}
}
}
}
|
using System;
namespace UniRx.Operators
{
internal class FrameIntervalObservable<T> : OperatorObservableBase<UniRx.FrameInterval<T>>
{
readonly IObservable<T> source;
public FrameIntervalObservable(IObservable<T> source)
: base(source.IsRequiredSubscribeOnCurrentThread())
{
this.source = source;
}
protected override IDisposable SubscribeCore(IObserver<UniRx.FrameInterval<T>> observer, IDisposable cancel)
{
return source.Subscribe(new FrameInterval(this, observer, cancel));
}
class FrameInterval : OperatorObserverBase<T, UniRx.FrameInterval<T>>
{
readonly FrameIntervalObservable<T> parent;
int lastFrame;
public FrameInterval(FrameIntervalObservable<T> parent, IObserver<UniRx.FrameInterval<T>> observer, IDisposable cancel)
: base(observer, cancel)
{
this.parent = parent;
this.lastFrame = UnityEngine.Time.frameCount;
}
public override void OnNext(T value)
{
var now = UnityEngine.Time.frameCount;
var span = now - lastFrame;
lastFrame = now;
base.observer.OnNext(new UniRx.FrameInterval<T>(value, span));
}
public override void OnError(Exception error)
{
try { observer.OnError(error); }
finally { Dispose(); }
}
public override void OnCompleted()
{
try { observer.OnCompleted(); }
finally { Dispose(); }
}
}
}
}
|
mit
|
C#
|
6bb86d08d505fb66dbdd6368127235b674bf9ccb
|
Update Array HW
|
owolp/Telerik-Academy,owolp/Telerik-Academy,owolp/Telerik-Academy,owolp/Telerik-Academy
|
Modul-1/CSharp-Part-2/01-Arrays/03.CompareCharArrays/CompareCharArrays.cs
|
Modul-1/CSharp-Part-2/01-Arrays/03.CompareCharArrays/CompareCharArrays.cs
|
using System;
// 80/100 BGCODER
namespace CompareCharArrays
{
class CompareCharArrays
{
static void Main()
{
string firstString = Console.ReadLine();
string secondString = Console.ReadLine();
if (firstString.Length > secondString.Length)
{
Console.WriteLine(">");
}
else if (firstString.Length < secondString.Length)
{
Console.WriteLine("<");
}
else
{
int compare = firstString.CompareTo(secondString);
if (compare == -1)
{
Console.WriteLine("<");
}
else if (compare == 1)
{
Console.WriteLine(">");
}
else
{
Console.WriteLine("=");
}
}
}
}
}
|
using System;
namespace CompareCharArrays
{
class CompareCharArrays
{
static void Main()
{
var input = Console.ReadLine();
char[] firstArray = input.ToCharArray();
input = Console.ReadLine();
char[] secondArray = input.ToCharArray();
char symbol = 'a';
if (firstArray.Length > secondArray.Length)
{
symbol = '>';
Console.WriteLine(symbol);
return;
}
else if (firstArray.Length < secondArray.Length)
{
symbol = '<';
Console.WriteLine(symbol);
return;
}
int length = Math.Min(firstArray.Length, secondArray.Length);
bool equal = true;
for (int i = 0; i < length; i++)
{
var firstArraySymbol = firstArray[i];
var secondArraySymbol = secondArray[i];
if (firstArraySymbol - 'a' < 0 && 0 <= secondArraySymbol - 'a')
{
symbol = '>';
equal = false;
}
else if (secondArraySymbol - 'a' < 0 && 0 <= firstArraySymbol - 'a')
{
symbol = '<';
equal = false;
}
else
{
if (firstArraySymbol < secondArraySymbol)
{
symbol = '<';
equal = false;
}
else if (firstArraySymbol > secondArraySymbol)
{
symbol = '>';
equal = false;
}
}
}
Console.WriteLine(equal == true ? "=" : "{0}", symbol);
}
}
}
|
mit
|
C#
|
3e6a6d452d8d3d9019341f123e43d3548b54df75
|
Update UnsignedBigIntegerBinaryDeserializer.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Serialization/Numerics/UnsignedBigIntegerBinaryDeserializer.cs
|
TIKSN.Core/Serialization/Numerics/UnsignedBigIntegerBinaryDeserializer.cs
|
using System.Linq;
using System.Numerics;
namespace TIKSN.Serialization.Numerics
{
/// <summary>
/// Custom (specialized or typed) deserializer for unsigned <see cref="BigInteger"/>
/// </summary>
public class UnsignedBigIntegerBinaryDeserializer : ICustomDeserializer<byte[], BigInteger>
{
/// <summary>
/// Deserializes byte array to unsigned <see cref="BigInteger"/>
/// </summary>
/// <param name="serial"></param>
/// <returns></returns>
public BigInteger Deserialize(byte[] serial)
{
var last = serial[serial.Length - 1];
if (last < 0b_1000_0000)
return new BigInteger(serial);
return new BigInteger(serial.Concat(new byte[] { 0b_0000_0000 }).ToArray());
}
}
}
|
using System.Linq;
using System.Numerics;
namespace TIKSN.Serialization.Numerics
{
/// <summary>
/// Custom (specialized or typed) deserializer for unsigned <see cref="BigInteger"/>
/// </summary>
public class UnsignedBigIntegerBinaryDeserializer : ICustomDeserializer<byte[], BigInteger>
{
/// <summary>
/// Deserializes byte array to unsigned <see cref="BigInteger"/>
/// </summary>
/// <param name="serial"></param>
/// <returns></returns>
public BigInteger Deserialize(byte[] serial)
{
var last = serial[serial.Length - 1];
if (last < 0b_1000_0000)
return new BigInteger(serial);
return new BigInteger(serial.Concat(new byte[] { 0b_0000_0000 }).ToArray());
}
}
}
|
mit
|
C#
|
e01daa9ba4a10cdcd34267fcec9bac8d92481b2b
|
Fix AgileUploader (remove SO image resizer)
|
planetClaire/Orchard-LETS,planetClaire/Orchard-LETS,planetClaire/Orchard-LETS,planetClaire/Orchard-LETS,planetClaire/Orchard-LETS
|
src/Orchard.Web/Modules/LETS/Views/Fields/AgileUploader-Photos.cshtml
|
src/Orchard.Web/Modules/LETS/Views/Fields/AgileUploader-Photos.cshtml
|
@{
Style.Include("slimbox2.css");
Script.Require("jQuery").AtFoot();
Script.Include("slimbox2.js").AtFoot();
}
@if (!string.IsNullOrEmpty(Model.ContentField.FileNames))
{
<div class="stripGallery">
@foreach (var fileName in Model.ContentField.FileNames.Split(';'))
{
<a href="@fileName" rel="lightbox-gallery">
@{ var alternateText = string.IsNullOrEmpty(Model.ContentField.AlternateText) ? Path.GetFileNameWithoutExtension(fileName) : Model.ContentField.AlternateText; }
<img alt="@alternateText" src='@Display.ResizeMediaUrl(Width: 250, Path: fileName)' />
</a>
}
</div>
}
|
@using So.ImageResizer.Helpers
@{
Style.Include("slimbox2.css");
Script.Require("jQuery").AtFoot();
Script.Include("slimbox2.js").AtFoot();
}
@if (!string.IsNullOrEmpty(Model.ContentField.FileNames))
{
<div class="stripGallery">
@foreach (var fileName in Model.ContentField.FileNames.Split(';'))
{
<a href="@fileName" rel="lightbox-gallery">
@{ var alternateText = string.IsNullOrEmpty(Model.ContentField.AlternateText) ? Path.GetFileNameWithoutExtension(fileName) : Model.ContentField.AlternateText; }
<img width="100" height="80" src='@string.Format("/resizedImage?url={0}&width=100&height=80&maxWidth=100&maxheight=80&cropMode={1}&scale={2}&stretchMode={3}", fileName, ResizeSettingType.CropMode.Auto, ResizeSettingType.ScaleMode.DownscaleOnly, ResizeSettingType.StretchMode.Proportionally)' alt="@alternateText"/>
</a>
}
</div>
}
|
bsd-3-clause
|
C#
|
eeb6647bc50986ff123e483888df59f1af4b721b
|
remove schedule in set current path
|
peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,peppy/osu,peppy/osu,smoogipoo/osu
|
osu.Game/Overlays/Wiki/Markdown/WikiMarkdownContainer.cs
|
osu.Game/Overlays/Wiki/Markdown/WikiMarkdownContainer.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 Markdig.Extensions.Yaml;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Game.Graphics.Containers.Markdown;
namespace osu.Game.Overlays.Wiki.Markdown
{
public class WikiMarkdownContainer : OsuMarkdownContainer
{
public string CurrentPath
{
set => DocumentUrl = $"{DocumentUrl}wiki/{value}";
}
protected override void AddMarkdownComponent(IMarkdownObject markdownObject, FillFlowContainer container, int level)
{
switch (markdownObject)
{
case YamlFrontMatterBlock yamlFrontMatterBlock:
container.Add(CreateNotice(yamlFrontMatterBlock));
return;
}
base.AddMarkdownComponent(markdownObject, container, level);
}
public override MarkdownTextFlowContainer CreateTextFlow() => new WikiMarkdownTextFlowContainer();
protected override MarkdownParagraph CreateParagraph(ParagraphBlock paragraphBlock, int level) => new WikiMarkdownParagraph(paragraphBlock);
protected virtual FillFlowContainer CreateNotice(YamlFrontMatterBlock yamlFrontMatterBlock) => new WikiNoticeContainer(yamlFrontMatterBlock);
private class WikiMarkdownTextFlowContainer : OsuMarkdownTextFlowContainer
{
protected override void AddImage(LinkInline linkInline) => AddDrawable(new WikiMarkdownImage(linkInline));
}
}
}
|
// 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 Markdig.Extensions.Yaml;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Game.Graphics.Containers.Markdown;
namespace osu.Game.Overlays.Wiki.Markdown
{
public class WikiMarkdownContainer : OsuMarkdownContainer
{
public string CurrentPath
{
set => Schedule(() => DocumentUrl += $"wiki/{value}");
}
protected override void AddMarkdownComponent(IMarkdownObject markdownObject, FillFlowContainer container, int level)
{
switch (markdownObject)
{
case YamlFrontMatterBlock yamlFrontMatterBlock:
container.Add(CreateNotice(yamlFrontMatterBlock));
return;
}
base.AddMarkdownComponent(markdownObject, container, level);
}
public override MarkdownTextFlowContainer CreateTextFlow() => new WikiMarkdownTextFlowContainer();
protected override MarkdownParagraph CreateParagraph(ParagraphBlock paragraphBlock, int level) => new WikiMarkdownParagraph(paragraphBlock);
protected virtual FillFlowContainer CreateNotice(YamlFrontMatterBlock yamlFrontMatterBlock) => new WikiNoticeContainer(yamlFrontMatterBlock);
private class WikiMarkdownTextFlowContainer : OsuMarkdownTextFlowContainer
{
protected override void AddImage(LinkInline linkInline) => AddDrawable(new WikiMarkdownImage(linkInline));
}
}
}
|
mit
|
C#
|
36a9c6b3ec2a60c70407452fe0ee55926a50be81
|
Fix embeddedresource manager
|
gr8woo/RazorLight,toddams/RazorLight,toddams/RazorLight,gr8woo/RazorLight
|
src/RazorLight/Templating/Embedded/EmbeddedResourceTemplateManager.cs
|
src/RazorLight/Templating/Embedded/EmbeddedResourceTemplateManager.cs
|
using System;
using System.IO;
using System.Reflection;
namespace RazorLight.Templating.Embedded
{
public class EmbeddedResourceTemplateManager : ITemplateManager
{
/// <summary>
/// Initializes a new TemplateManager.
/// </summary>
/// <param name="rootType">The type from the assembly that contains embedded resources that will act as a root type for Assembly.GetManifestResourceStream() calls.</param>
public EmbeddedResourceTemplateManager(Type rootType)
{
if (rootType == null)
{
throw new ArgumentNullException(nameof(rootType));
}
this.RootType = rootType;
}
/// <summary>
/// The type from the assembly that contains embedded resources
/// </summary>
public Type RootType { get; }
public ITemplateSource Resolve(string key)
{
Assembly assembly = this.RootType.GetTypeInfo().Assembly;
using (var stream = assembly.GetManifestResourceStream(this.RootType.Namespace + "." + key + ".cshtml"))
{
if (stream == null)
{
throw new RazorLightException(string.Format("Couldn't load resource '{0}.{1}.cshtml' from assembly {2}", this.RootType.Namespace, key, this.RootType.AssemblyQualifiedName));
}
using (var reader = new StreamReader(stream))
{
return new LoadedTemplateSource(reader.ReadToEnd());
}
}
}
}
}
|
using System;
using System.IO;
using System.Reflection;
namespace RazorLight.Templating.Embedded
{
public class EmbeddedResourceTemplateManager : ITemplateManager
{
/// <summary>
/// Initializes a new TemplateManager.
/// </summary>
/// <param name="rootType">The type from the assembly that contains embedded resources that will act as a root type for Assembly.GetManifestResourceStream() calls.</param>
public EmbeddedResourceTemplateManager(Type rootType)
{
if (rootType == null)
{
throw new ArgumentNullException(nameof(rootType));
}
this.RootType = rootType;
}
/// <summary>
/// The type from the assembly that contains embedded resources
/// </summary>
public Type RootType { get; }
public ITemplateSource Resolve(string key)
{
Assembly assembly = this.RootType.GetTypeInfo().Assembly;
using (var stream = assembly.GetManifestResourceStream(key + ".cshtml"))
{
if (stream == null)
{
throw new RazorLightException(string.Format("Couldn't load resource '{0}.{1}.cshtml' from assembly {2}", this.RootType.Namespace, key, this.RootType.AssemblyQualifiedName));
}
using (var reader = new StreamReader(stream))
{
return new LoadedTemplateSource(reader.ReadToEnd());
}
}
}
}
}
|
apache-2.0
|
C#
|
aaf7202e8f329cd29a0dcd188a08b4d758ddd8fb
|
Fix typo
|
Teknikaali/BenchmarkDotNet,Teknikaali/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,Ky7m/BenchmarkDotNet,Ky7m/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,Teknikaali/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,Ky7m/BenchmarkDotNet,Ky7m/BenchmarkDotNet,adamsitnik/BenchmarkDotNet
|
tests/BenchmarkDotNet.IntegrationTests.Classic/BenchmarkTestRunner.cs
|
tests/BenchmarkDotNet.IntegrationTests.Classic/BenchmarkTestRunner.cs
|
using System.Linq;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Tests.Loggers;
using Xunit;
using Xunit.Abstractions;
namespace BenchmarkDotNet.IntegrationTests.Classic
{
internal static class BenchmarkTestRunner
{
internal static void CanCompileAndRun<TBenchmark>(ITestOutputHelper output)
{
var summary = BenchmarkRunner.Run<TBenchmark>(new SingleRunFastConfig(output));
Assert.True(summary.Reports.Any());
Assert.True(summary.Reports.All(report => report.ExecuteResults.All(executeResult => executeResult.FoundExecutable)));
Assert.True(summary.Reports.All(report => report.AllMeasurements.Any()), "There are no available measurements");
}
private class SingleRunFastConfig : ManualConfig
{
internal SingleRunFastConfig(ITestOutputHelper output)
{
Add(Job.Dry);
Add(Loggers.ConsoleLogger.Default);
Add(new OutputLogger(output));
}
}
}
}
|
using System.Linq;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Tests.Loggers;
using Xunit;
using Xunit.Abstractions;
namespace BenchmarkDotNet.IntegrationTests.Classic
{
internal static class BenchmarkTestRunner
{
internal static void CanCompileAndRun<TBenchmark>(ITestOutputHelper output)
{
var summary = BenchmarkRunner.Run<TBenchmark>(new SingleRunFastConfig(output));
Assert.True(summary.Reports.Any());
Assert.True(summary.Reports.All(report => report.ExecuteResults.All(executeResult => executeResult.FoundExecutable)));
Assert.True(summary.Reports.All(report => report.AllMeasurements.Any()), "There are no any available measurements");
}
private class SingleRunFastConfig : ManualConfig
{
internal SingleRunFastConfig(ITestOutputHelper output)
{
Add(Job.Dry);
Add(Loggers.ConsoleLogger.Default);
Add(new OutputLogger(output));
}
}
}
}
|
mit
|
C#
|
fc4dafc4817d4427a039430fad2c405e35fe3174
|
Add QueueDataGraphic constructor
|
60071jimmy/UartOscilloscope,60071jimmy/UartOscilloscope
|
QueueDataGraphic/QueueDataGraphic/CSharpFiles/QueueDataGraphic.cs
|
QueueDataGraphic/QueueDataGraphic/CSharpFiles/QueueDataGraphic.cs
|
/********************************************************************
* Develop by Jimmy Hu *
* This program is licensed under the Apache License 2.0. *
* QueueDataGraphic.cs *
* 本檔案用於佇列資料繪圖功能 *
********************************************************************
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QueueDataGraphic.CSharpFiles
{ // namespace start, 進入命名空間
class QueueDataGraphic // QueueDataGraphic class, QueueDataGraphic類別
{ // QueueDataGraphic class start, 進入QueueDataGraphic類別
List<DataQueue> DataQueueList; // DataQueueList object, DataQueueList物件
/// <summary>
/// QueueDataGraphic constructor, QueueDataGraphic建構子
/// </summary>
public QueueDataGraphic()
{
}
} // QueueDataGraphic class end, 結束QueueDataGraphic類別
} // namespace end, 結束命名空間
|
/********************************************************************
* Develop by Jimmy Hu *
* This program is licensed under the Apache License 2.0. *
* QueueDataGraphic.cs *
* 本檔案用於佇列資料繪圖功能 *
********************************************************************
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QueueDataGraphic.CSharpFiles
{ // namespace start, 進入命名空間
class QueueDataGraphic // QueueDataGraphic class, QueueDataGraphic類別
{ // QueueDataGraphic class start, 進入QueueDataGraphic類別
List<DataQueue> DataQueueList; // DataQueueList object, DataQueueList物件
} // QueueDataGraphic class end, 結束QueueDataGraphic類別
} // namespace end, 結束命名空間
|
apache-2.0
|
C#
|
583c4546192be4b2538cd7a266f9ba90680c33af
|
replace email with names of the uploader
|
SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery
|
AstroPhotoGallery/AstroPhotoGallery/Views/Home/ListPictures.cshtml
|
AstroPhotoGallery/AstroPhotoGallery/Views/Home/ListPictures.cshtml
|
@model List<AstroPhotoGallery.Models.Picture>
@{
ViewBag.Title = "List Pictures";
}
<div class="container">
<h2>@TempData["CategoryName"]</h2>
<div class="row">
@foreach (var picture in Model)
{
<div class="col-sm-6 text-center">
<article>
<header>
<h3>
@Html.ActionLink(@picture.PicTitle, "Details", "Picture", new { @id = picture.Id }, null)
</h3>
</header>
<div class="img-thumbnail">
<img src="@Url.Content(picture.ImagePath)" style="width: 360px" class="img-responsive img-rounded center-block" alt="Astro picture" />
</div>
<p>
<br />
<div style="word-wrap: break-word;">
@picture.PicDescription
</div>
</p>
<footer>
<small>
Uploader: @picture.PicUploader.FirstName @picture.PicUploader.LastName
</small>
</footer>
</article>
</div>
}
</div>
</div>
|
@model List<AstroPhotoGallery.Models.Picture>
@{
ViewBag.Title = "List Pictures";
}
<div class="container">
<h2>@TempData["CategoryName"]</h2>
<div class="row">
@foreach (var picture in Model)
{
<div class="col-sm-6 text-center">
<article>
<header>
<h3>
@Html.ActionLink(@picture.PicTitle, "Details", "Picture", new { @id = picture.Id }, null)
</h3>
</header>
<div class="img-thumbnail">
<img src="@Url.Content(picture.ImagePath)" style="width: 360px" class="img-responsive img-rounded center-block" alt="Astro picture" />
</div>
<p>
<br />
<div style="word-wrap: break-word;">
@picture.PicDescription
</div>
</p>
<footer>
<small>
Uploader: @picture.PicUploader.Email
</small>
</footer>
</article>
</div>
}
</div>
</div>
|
mit
|
C#
|
d8f5f3b53692db5bd2a4ec9c5d7066316380b416
|
Revert "Fixed Resolve visitor to resolve argument expressions"
|
dsharlet/ComputerAlgebra
|
ComputerAlgebra/Extensions/Resolve.cs
|
ComputerAlgebra/Extensions/Resolve.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ComputerAlgebra
{
/// <summary>
/// Expression visitor for substiting expressions in for other expressions.
/// </summary>
class ResolveVisitor : RecursiveExpressionVisitor
{
protected Namespace ns;
public ResolveVisitor(Namespace Namespace) { ns = Namespace; }
protected override Expression VisitCall(Call F)
{
if (F.Target is UnknownFunction)
{
IEnumerable<Function> lookup = ns.LookupFunction(F.Target.Name, F.Arguments);
switch (lookup.Count())
{
case 0: return F;
case 1: return Call.New(lookup.Single(), F.Arguments);
default: throw new UnresolvedName(F.Target.Name);
}
}
return F;
}
protected override Expression VisitVariable(Variable V)
{
IEnumerable<Expression> lookup = ns.LookupName(V.Name);
switch (lookup.Count())
{
case 0: return V;
case 1: return lookup.Single();
default: throw new UnresolvedName(V.Name);
}
}
}
public static class ResolveExtension
{
/// <summary>
/// Substitute variables x0 into f.
/// </summary>
/// <param name="f"></param>
/// <param name="x0"></param>
/// <returns></returns>
public static Expression Resolve(this Expression f, Namespace Namespace)
{
return new ResolveVisitor(Namespace).Visit(f);
}
/// <summary>
/// Substitute variables x0 into f.
/// </summary>
/// <param name="f"></param>
/// <param name="x0"></param>
/// <returns></returns>
public static IEnumerable<Expression> Resolve(this IEnumerable<Expression> f, Namespace Namespace)
{
ResolveVisitor V = new ResolveVisitor(Namespace);
return f.Select(i => V.Visit(i));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ComputerAlgebra
{
/// <summary>
/// Expression visitor for substiting expressions in for other expressions.
/// </summary>
class ResolveVisitor : RecursiveExpressionVisitor
{
protected Namespace ns;
public ResolveVisitor(Namespace Namespace) { ns = Namespace; }
protected override Expression VisitCall(Call F)
{
F = (Call)base.VisitCall(F);
if (F.Target is UnknownFunction)
{
IEnumerable<Function> lookup = ns.LookupFunction(F.Target.Name, F.Arguments);
switch (lookup.Count())
{
case 0: return F;
case 1: return Call.New(lookup.Single(), F.Arguments);
default: throw new UnresolvedName(F.Target.Name);
}
}
return F;
}
protected override Expression VisitVariable(Variable V)
{
IEnumerable<Expression> lookup = ns.LookupName(V.Name);
switch (lookup.Count())
{
case 0: return V;
case 1: return lookup.Single();
default: throw new UnresolvedName(V.Name);
}
}
}
public static class ResolveExtension
{
/// <summary>
/// Substitute variables x0 into f.
/// </summary>
/// <param name="f"></param>
/// <param name="x0"></param>
/// <returns></returns>
public static Expression Resolve(this Expression f, Namespace Namespace)
{
return new ResolveVisitor(Namespace).Visit(f);
}
/// <summary>
/// Substitute variables x0 into f.
/// </summary>
/// <param name="f"></param>
/// <param name="x0"></param>
/// <returns></returns>
public static IEnumerable<Expression> Resolve(this IEnumerable<Expression> f, Namespace Namespace)
{
ResolveVisitor V = new ResolveVisitor(Namespace);
return f.Select(i => V.Visit(i));
}
}
}
|
mit
|
C#
|
984f00c02d4b0698a4087e02320ef3e398e31c92
|
升级版本到2.3.5
|
geffzhang/equeue,geffzhang/equeue,tangxuehua/equeue,tangxuehua/equeue,tangxuehua/equeue
|
src/EQueue/Properties/AssemblyInfo.cs
|
src/EQueue/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.5")]
[assembly: AssemblyFileVersion("2.3.5")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.4")]
[assembly: AssemblyFileVersion("2.3.4")]
|
mit
|
C#
|
b26af61a4caa73af4473eaeed1aace5532db39fa
|
Fix for Binding singleton to instance.
|
Disturbing/suice
|
cmn-tools/suice/suice/SingletonProvider.cs
|
cmn-tools/suice/suice/SingletonProvider.cs
|
using System;
namespace CmnTools.Suice
{
/// <summary>
/// @author DisTurBinG
/// </summary>
public class SingletonProvider : AbstractProvider
{
internal object Instance;
public SingletonProvider (Type providedType)
: base(providedType)
{
}
internal virtual void CreateSingletonInstance()
{
if (Instance == null)
{
SetInstance(Activator.CreateInstance(ProvidedType, ConstructorDependencies));
}
}
internal void SetInstance (object instance)
{
DependencyProxy dependencyProxy = Instance as DependencyProxy;
if (dependencyProxy == null)
{
Instance = instance;
}
else
{
dependencyProxy.SetInstance(instance);
}
}
protected override object ProvideObject()
{
return Instance ?? (Instance = new DependencyProxy (ProvidedType));
}
}
}
|
using System;
namespace CmnTools.Suice
{
/// <summary>
/// @author DisTurBinG
/// </summary>
public class SingletonProvider : AbstractProvider
{
internal object Instance;
public SingletonProvider (Type providedType)
: base(providedType)
{
}
internal virtual void CreateSingletonInstance()
{
SetInstance(Activator.CreateInstance(ProvidedType, ConstructorDependencies));
}
internal void SetInstance (object instance)
{
DependencyProxy dependencyProxy = Instance as DependencyProxy;
if (dependencyProxy == null)
{
Instance = instance;
}
else
{
dependencyProxy.SetInstance(instance);
}
}
protected override object ProvideObject()
{
return Instance ?? (Instance = new DependencyProxy (ProvidedType));
}
}
}
|
mit
|
C#
|
c9942a884ef50983e291268ee8775613dc688b14
|
add string enum converter.
|
SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments
|
src/CommitmentsV2/SFA.DAS.CommitmentsV2.Types/ChangeOfPartyRequestType.cs
|
src/CommitmentsV2/SFA.DAS.CommitmentsV2.Types/ChangeOfPartyRequestType.cs
|
using System.Text.Json.Serialization;
namespace SFA.DAS.CommitmentsV2.Types
{
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum ChangeOfPartyRequestType : byte
{
ChangeEmployer = 0,
ChangeProvider = 1
}
}
|
namespace SFA.DAS.CommitmentsV2.Types
{
public enum ChangeOfPartyRequestType : byte
{
ChangeEmployer = 0,
ChangeProvider = 1
}
}
|
mit
|
C#
|
f2bdca3b6b01a1f67fd1cb9aa271c8b681893daf
|
fix metric weight test
|
jonthysell/Mzinga
|
src/Mzinga.Test/MetricWeightsTests.cs
|
src/Mzinga.Test/MetricWeightsTests.cs
|
// Copyright (c) Jon Thysell <http://jonthysell.com>
// Licensed under the MIT License.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Mzinga.Core.AI;
namespace Mzinga.Test
{
[TestClass]
public class MetricWeightsTests
{
[TestMethod]
public void MetricWeights_NewTest()
{
MetricWeights mw = new MetricWeights();
Assert.IsNotNull(mw);
}
[TestMethod]
public void MetricWeights_GetNormalizedTest()
{
MetricWeights mw = new MetricWeights();
Assert.IsNotNull(mw);
var normalized = mw.GetNormalized();
Assert.IsNotNull(normalized);
}
}
}
|
// Copyright (c) Jon Thysell <http://jonthysell.com>
// Licensed under the MIT License.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Mzinga.Core.AI;
namespace Mzinga.Test
{
[TestClass]
public class MetricWeightsTests
{
[TestMethod]
public void MetricWeights_NewTest()
{
MetricWeights mw = new MetricWeights();
Assert.IsNotNull(mw);
}
[TestMethod]
public void MetricWeights_GetNormalizedTest()
{
MetricWeights mw = new MetricWeights();
Assert.IsNotNull(mw);
_ = mw.GetNormalized();
Assert.IsNotNull(mw);
}
}
}
|
mit
|
C#
|
3cc1a5feaaadd7dd8e62334d062f4aab735f9507
|
Fix NH-2267 (by Patrick Earl)
|
fredericDelaporte/nhibernate-core,RogerKratz/nhibernate-core,nkreipke/nhibernate-core,hazzik/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,livioc/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,ManufacturingIntelligence/nhibernate-core,lnu/nhibernate-core,livioc/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,gliljas/nhibernate-core,livioc/nhibernate-core,gliljas/nhibernate-core,gliljas/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,alobakov/nhibernate-core,alobakov/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,fredericDelaporte/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,nkreipke/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nkreipke/nhibernate-core
|
src/NHibernate/Driver/NpgsqlDriver.cs
|
src/NHibernate/Driver/NpgsqlDriver.cs
|
namespace NHibernate.Driver
{
/// <summary>
/// The PostgreSQL data provider provides a database driver for PostgreSQL.
/// <p>
/// Author: <a href="mailto:oliver@weichhold.com">Oliver Weichhold</a>
/// </p>
/// </summary>
/// <remarks>
/// <p>
/// In order to use this Driver you must have the Npgsql.dll Assembly available for
/// NHibernate to load it.
/// </p>
/// <p>
/// Please check the products website
/// <a href="http://www.postgresql.org/">http://www.postgresql.org/</a>
/// for any updates and or documentation.
/// </p>
/// <p>
/// The homepage for the .NET DataProvider is:
/// <a href="http://pgfoundry.org/projects/npgsql">http://pgfoundry.org/projects/npgsql</a>.
/// </p>
/// </remarks>
public class NpgsqlDriver : ReflectionBasedDriver
{
/// <summary>
/// Initializes a new instance of the <see cref="NpgsqlDriver"/> class.
/// </summary>
/// <exception cref="HibernateException">
/// Thrown when the <c>Npgsql</c> assembly can not be loaded.
/// </exception>
public NpgsqlDriver() : base(
"Npgsql",
"Npgsql.NpgsqlConnection",
"Npgsql.NpgsqlCommand")
{
}
public override bool UseNamedPrefixInSql
{
get { return true; }
}
public override bool UseNamedPrefixInParameter
{
get { return true; }
}
public override string NamedPrefix
{
get { return ":"; }
}
public override bool SupportsMultipleOpenReaders
{
get { return false; }
}
protected override bool SupportsPreparingCommands
{
// NH-2267 Patrick Earl
get { return true; }
}
public override bool SupportsMultipleQueries
{
get { return true; }
}
}
}
|
namespace NHibernate.Driver
{
/// <summary>
/// The PostgreSQL data provider provides a database driver for PostgreSQL.
/// <p>
/// Author: <a href="mailto:oliver@weichhold.com">Oliver Weichhold</a>
/// </p>
/// </summary>
/// <remarks>
/// <p>
/// In order to use this Driver you must have the Npgsql.dll Assembly available for
/// NHibernate to load it.
/// </p>
/// <p>
/// Please check the products website
/// <a href="http://www.postgresql.org/">http://www.postgresql.org/</a>
/// for any updates and or documentation.
/// </p>
/// <p>
/// The homepage for the .NET DataProvider is:
/// <a href="http://pgfoundry.org/projects/npgsql">http://pgfoundry.org/projects/npgsql</a>.
/// </p>
/// </remarks>
public class NpgsqlDriver : ReflectionBasedDriver
{
/// <summary>
/// Initializes a new instance of the <see cref="NpgsqlDriver"/> class.
/// </summary>
/// <exception cref="HibernateException">
/// Thrown when the <c>Npgsql</c> assembly can not be loaded.
/// </exception>
public NpgsqlDriver() : base(
"Npgsql",
"Npgsql.NpgsqlConnection",
"Npgsql.NpgsqlCommand")
{
}
public override bool UseNamedPrefixInSql
{
get { return true; }
}
public override bool UseNamedPrefixInParameter
{
get { return true; }
}
public override string NamedPrefix
{
get { return ":"; }
}
public override bool SupportsMultipleOpenReaders
{
get { return false; }
}
protected override bool SupportsPreparingCommands
{
// NOTE: Npgsql1.0 and 2.0-preview apparently doesn't correctly support prepared commands.
// The following exception is thrown on insert statements:
// Npgsql.NpgsqlException : ERROR: 42601: cannot insert multiple commands into a prepared statement
get { return false; }
}
public override bool SupportsMultipleQueries
{
get { return true; }
}
}
}
|
lgpl-2.1
|
C#
|
817b55f18a34fb5b15cae580369b8236925c8eb6
|
Improve puzzle 2 performance
|
martincostello/project-euler
|
src/ProjectEuler/Puzzles/Puzzle002.cs
|
src/ProjectEuler/Puzzles/Puzzle002.cs
|
// Copyright (c) Martin Costello, 2015. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.ProjectEuler.Puzzles
{
using System;
/// <summary>
/// A class representing the solution to <c>https://projecteuler.net/problem=2</c>. This class cannot be inherited.
/// </summary>
public sealed class Puzzle002 : Puzzle
{
/// <inheritdoc />
public override string Question => "By considering the terms in the Fibonacci sequence starting with 1 and 2 whose values do not exceed the specified value, what is the sum of the even-valued terms?";
/// <inheritdoc />
protected override int MinimumArguments => 1;
/// <inheritdoc />
protected override int SolveCore(string[] args)
{
if (!TryParseInt32(args[0], out int max) || max < 1)
{
Console.WriteLine("The specified maximum value is invalid.");
return -1;
}
int first = 1;
int second = 2;
int sum = second;
while (true)
{
int next = first + second;
if (next > max)
{
break;
}
if (next % 2 == 0)
{
sum += next;
}
first = second;
second = next;
}
Answer = sum;
return 0;
}
}
}
|
// Copyright (c) Martin Costello, 2015. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
namespace MartinCostello.ProjectEuler.Puzzles
{
using System;
using System.Collections.Generic;
/// <summary>
/// A class representing the solution to <c>https://projecteuler.net/problem=2</c>. This class cannot be inherited.
/// </summary>
public sealed class Puzzle002 : Puzzle
{
/// <inheritdoc />
public override string Question => "By considering the terms in the Fibonacci sequence starting with 1 and 2 whose values do not exceed the specified value, what is the sum of the even-valued terms?";
/// <inheritdoc />
protected override int MinimumArguments => 1;
/// <inheritdoc />
protected override int SolveCore(string[] args)
{
if (!TryParseInt32(args[0], out int max) || max < 1)
{
Console.WriteLine("The specified maximum value is invalid.");
return -1;
}
var fibonacciValues = new List<int>() { 1, 2 };
while (true)
{
int count = fibonacciValues.Count;
int next = fibonacciValues[count - 1] + fibonacciValues[count - 2];
if (next > max)
{
break;
}
fibonacciValues.Add(next);
}
int answer = 0;
for (int i = 0; i < fibonacciValues.Count; i++)
{
int number = fibonacciValues[i];
if (number % 2 == 0)
{
answer += number;
}
}
Answer = answer;
return 0;
}
}
}
|
apache-2.0
|
C#
|
ccb811961a4707d5f56ad16af41c265c1e524756
|
Remove realm property
|
msoler8785/ExoMail
|
ExoMail.Smtp/Interfaces/IUserStore.cs
|
ExoMail.Smtp/Interfaces/IUserStore.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExoMail.Smtp.Interfaces
{
public interface IUserStore
{
List<IUserIdentity> Identities { get; set; }
//string Realm { get; set; }
bool IsUserAuthenticated(string userName, string password);
bool IsValidRecipient(string emailAddress);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExoMail.Smtp.Interfaces
{
public interface IUserStore
{
List<IUserIdentity> Identities { get; set; }
string Realm { get; set; }
bool IsUserAuthenticated(string userName, string password);
bool IsValidRecipient(string emailAddress);
}
}
|
mit
|
C#
|
220f428a7082a93770ac2ea290300299618d4e9c
|
Prepare for multiple samples
|
weblinq/WebLinq,weblinq/WebLinq,atifaziz/WebLinq,atifaziz/WebLinq
|
eg/Program.cs
|
eg/Program.cs
|
namespace WebLinq.Samples
{
#region Imports
using System;
using System.IO;
using static HttpQuery;
using static Html.HtmlQuery;
#endregion
static class Program
{
public static void Main()
{
Sample1();
}
static void Sample1()
{
var q =
from com in Http.UserAgent(@"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko")
.Get(new Uri("http://www.example.com/"))
.Html()
select new {com.Id, Html = com.Content.QuerySelector("p")?.OuterHtml}
into com
from net in Http.Get(new Uri("http://www.example.net/"))
.Html()
from link in Links(net.Content)
select new
{
Com = com,
Net = new
{
net.Id,
Html = net.Content.QuerySelector("p")?.OuterHtml,
Link = link,
}
}
into e
where e.Com.Html?.Length == e.Net.Html?.Length
select e;
q.Dump();
}
static void Dump<T>(this Query<T> query, TextWriter output = null)
{
output = output ?? Console.Out;
foreach (var e in query.ToEnumerable(DefaultQueryContext.Create))
output.WriteLine(e);
}
}
}
|
namespace WebLinq.Samples
{
#region Imports
using System;
using static HttpQuery;
using static Html.HtmlQuery;
#endregion
static class Program
{
public static void Main()
{
var q =
from com in Http.UserAgent(@"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko")
.Get(new Uri("http://www.example.com/"))
.Html()
select new { com.Id, Html = com.Content.QuerySelector("p")?.OuterHtml } into com
from net in Http.Get(new Uri("http://www.example.net/"))
.Html()
from link in Links(net.Content)
select new
{
Com = com,
Net = new
{
net.Id,
Html = net.Content.QuerySelector("p")?.OuterHtml,
Link = link,
}
}
into e
where e.Com.Html?.Length == e.Net.Html?.Length
select e;
foreach (var e in q.ToEnumerable(DefaultQueryContext.Create))
Console.WriteLine(e);
}
}
}
|
apache-2.0
|
C#
|
d36d9bdba60ce06c1792a1b38a7bae2c76e5e17e
|
Refactor code in KVO events receiver method.
|
peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework
|
osu.Framework.iOS/GameAppDelegate.cs
|
osu.Framework.iOS/GameAppDelegate.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 UIKit;
using Foundation;
using System.Drawing;
using SixLabors.ImageSharp.PixelFormats;
using AVFoundation;
using System;
namespace osu.Framework.iOS
{
public abstract class GameAppDelegate : UIApplicationDelegate
{
public override UIWindow Window { get; set; }
private IOSGameView gameView;
private IOSGameHost host;
protected abstract Game CreateGame();
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
aotImageSharp();
Window = new UIWindow(UIScreen.MainScreen.Bounds);
gameView = new IOSGameView(new RectangleF(0.0f, 0.0f, (float)Window.Frame.Size.Width, (float)Window.Frame.Size.Height));
host = new IOSGameHost(gameView);
Window.RootViewController = new GameViewController(gameView, host);
Window.MakeKeyAndVisible();
// required to trigger the osuTK update loop, which is used for input handling.
gameView.Run();
host.Run(CreateGame());
// Watch for the volume button changing in order to change audio policy
AVAudioSession audioSession = AVAudioSession.SharedInstance();
audioSession.AddObserver(this, "outputVolume", NSKeyValueObservingOptions.New, IntPtr.Zero);
return true;
}
private void aotImageSharp()
{
System.Runtime.CompilerServices.Unsafe.SizeOf<Rgba32>();
System.Runtime.CompilerServices.Unsafe.SizeOf<long>();
try
{
new SixLabors.ImageSharp.Formats.Png.PngDecoder().Decode<Rgba32>(SixLabors.ImageSharp.Configuration.Default, null);
}
catch
{
}
}
public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
{
switch (keyPath)
{
case "outputVolume":
AVAudioSession.SharedInstance().SetCategory(AVAudioSessionCategory.Playback);
break;
}
}
}
}
|
// 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 UIKit;
using Foundation;
using System.Drawing;
using SixLabors.ImageSharp.PixelFormats;
using AVFoundation;
using System;
namespace osu.Framework.iOS
{
public abstract class GameAppDelegate : UIApplicationDelegate
{
public override UIWindow Window { get; set; }
private IOSGameView gameView;
private IOSGameHost host;
protected abstract Game CreateGame();
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
aotImageSharp();
Window = new UIWindow(UIScreen.MainScreen.Bounds);
gameView = new IOSGameView(new RectangleF(0.0f, 0.0f, (float)Window.Frame.Size.Width, (float)Window.Frame.Size.Height));
host = new IOSGameHost(gameView);
Window.RootViewController = new GameViewController(gameView, host);
Window.MakeKeyAndVisible();
// required to trigger the osuTK update loop, which is used for input handling.
gameView.Run();
host.Run(CreateGame());
// Watch for the volume button changing in order to change audio policy
AVAudioSession audioSession = AVAudioSession.SharedInstance();
audioSession.AddObserver(this, "outputVolume", NSKeyValueObservingOptions.New, IntPtr.Zero);
return true;
}
private void aotImageSharp()
{
System.Runtime.CompilerServices.Unsafe.SizeOf<Rgba32>();
System.Runtime.CompilerServices.Unsafe.SizeOf<long>();
try
{
new SixLabors.ImageSharp.Formats.Png.PngDecoder().Decode<Rgba32>(SixLabors.ImageSharp.Configuration.Default, null);
}
catch
{
}
}
public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
{
if (keyPath != "outputVolume")
return;
AVAudioSession audioSession = AVAudioSession.SharedInstance();
audioSession.SetCategory(AVAudioSessionCategory.Playback);
}
}
}
|
mit
|
C#
|
1a02b3e982bdca38908ff6a7200041457d0978c6
|
Update Deploy
|
WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework
|
Framework.BuildTool/Command/Deploy.cs
|
Framework.BuildTool/Command/Deploy.cs
|
using System;
using System.IO;
namespace Framework.BuildTool
{
public class CommandDeploy : Command
{
public CommandDeploy()
: base("deploy", "Deploy to Azure git")
{
this.AzureGitUrl = ArgumentAdd("azureGitUrl", "Azure Git Url");
}
public readonly Argument AzureGitUrl;
public override void Run()
{
string azureGitUrl = AzureGitUrl.Value;
string folderPublish = UtilFramework.FolderName + "Server/bin/Debug/netcoreapp2.0/publish/";
//
UtilBuildTool.DirectoryDelete(folderPublish);
UtilFramework.Assert(!Directory.Exists(folderPublish), "Delete folder failed!");
UtilBuildTool.DotNetPublish(UtilFramework.FolderName + "Server/");
UtilFramework.Assert(Directory.Exists(folderPublish), "Publish failed!");
UtilBuildTool.Start(folderPublish, "git", "init");
UtilBuildTool.Start(folderPublish, "git", "config user.email \"deploy@deploy.deploy\""); // Prevent: Error "Please tell me who you are". See also: http://www.thecreativedev.com/solution-github-please-tell-me-who-you-are-error/
UtilBuildTool.Start(folderPublish, "git", "config user.name \"Bhumi Shah\"");
UtilBuildTool.Start(folderPublish, "git", "remote add azure " + azureGitUrl);
UtilBuildTool.Start(folderPublish, "git", "fetch --all -q"); // -q do not write to stderr.
UtilBuildTool.Start(folderPublish, "git", "add .", isRedirectStdErr: true);
UtilBuildTool.Start(folderPublish, "git", "commit -m Deploy");
UtilBuildTool.Start(folderPublish, "git", "push azure master -f", isRedirectStdErr: true); // Do not write to stderr. Can be tested with "dotnet run -- deploy [AzureGitUrl] 2>Error.txt"
}
}
}
|
using System;
using System.IO;
namespace Framework.BuildTool
{
public class CommandDeploy : Command
{
public CommandDeploy()
: base("deploy", "Deploy to Azure git")
{
this.AzureGitUrl = ArgumentAdd("azureGitUrl", "Azure Git Url");
}
public readonly Argument AzureGitUrl;
public override void Run()
{
string azureGitUrl = AzureGitUrl.Value;
string folderPublish = UtilFramework.FolderName + "Server/bin/Debug/netcoreapp2.0/publish/";
//
UtilBuildTool.DirectoryDelete(folderPublish);
UtilFramework.Assert(!Directory.Exists(folderPublish), "Delete folder failed!");
UtilBuildTool.DotNetPublish(UtilFramework.FolderName + "Server/");
UtilFramework.Assert(Directory.Exists(folderPublish), "Publish failed!");
UtilBuildTool.Start(folderPublish, "git", "init");
UtilBuildTool.Start(folderPublish, "git", "remote add azure " + azureGitUrl);
UtilBuildTool.Start(folderPublish, "git", "fetch --all -q"); // -q do not write to stderr.
UtilBuildTool.Start(folderPublish, "git", "add .", isRedirectStdErr: true);
UtilBuildTool.Start(folderPublish, "git", "commit -m Deploy");
UtilBuildTool.Start(folderPublish, "git", "push azure master -f", isRedirectStdErr: true); // Do not write to stderr. Can be tested with "dotnet run -- deploy [AzureGitUrl] 2>Error.txt"
}
}
}
|
mit
|
C#
|
3c10db7a7cb6034d9e79d7b950af37d751cdb2b4
|
update setup
|
dkataskin/bstrkr
|
bstrkr.mobile/bstrkr.android/Setup.cs
|
bstrkr.mobile/bstrkr.android/Setup.cs
|
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Threading;
using Android.Content;
using bstrkr.android.services.resources;
using bstrkr.android.views;
using bstrkr.core;
using bstrkr.core.android.config;
using bstrkr.core.android.presenters;
using bstrkr.core.android.services;
using bstrkr.core.android.services.location;
using bstrkr.core.config;
using bstrkr.core.services.location;
using bstrkr.core.services.resources;
using bstrkr.mvvm;
using bstrkr.mvvm.bindings;
using bstrkr.mvvm.views;
using bstrkr.providers;
using Cirrious.CrossCore;
using Cirrious.CrossCore.Converters;
using Cirrious.CrossCore.Platform;
using Cirrious.MvvmCross.Binding.Bindings.Target.Construction;
using Cirrious.MvvmCross.Droid.Platform;
using Cirrious.MvvmCross.Droid.Views;
using Cirrious.MvvmCross.Localization;
using Cirrious.MvvmCross.ViewModels;
//using Xamarin;
namespace bstrkr.android
{
public class Setup : MvxAndroidSetup
{
public Setup(Context applicationContext) : base(applicationContext)
{
}
protected override void InitializeFirstChance()
{
Mvx.LazyConstructAndRegisterSingleton<IConfigManager, ConfigManager>();
Mvx.LazyConstructAndRegisterSingleton<ILocationService, LocationService>();
Mvx.LazyConstructAndRegisterSingleton<IAreaPositioningService, AreaPositioningService>();
Mvx.LazyConstructAndRegisterSingleton<IBusTrackerLocationService, BusTrackerLocationService>();
Mvx.LazyConstructAndRegisterSingleton<IAppResourceManager, AndroidAppResourceManager>();
Mvx.LazyConstructAndRegisterSingleton<ILiveDataProviderFactory, DefaultLiveDataProviderFactory>();
Mvx.RegisterSingleton<ICustomPresenter>(new CustomPresenter());
base.InitializeFirstChance();
}
protected override IMvxApplication CreateApp()
{
return new BusTrackerApp();
}
protected override IMvxTrace CreateDebugTrace()
{
return new DebugTrace();
}
protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
{
registry.RegisterCustomBindingFactory<MonoDroidGoogleMapsView>(
"Zoom",
mapView => new MapViewZoomTargetBinding(mapView));
registry.RegisterCustomBindingFactory<MonoDroidGoogleMapsView>(
"VisibleRegion",
mapView => new MapViewVisibleRegionTargetBinding(mapView));
base.FillTargetFactories(registry);
}
protected override IMvxAndroidViewPresenter CreateViewPresenter()
{
return Mvx.Resolve<ICustomPresenter>();
}
protected override void FillValueConverters(IMvxValueConverterRegistry registry)
{
base.FillValueConverters(registry);
}
}
}
|
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Threading;
using Android.Content;
using bstrkr.android.services.resources;
using bstrkr.android.views;
using bstrkr.core;
using bstrkr.core.android.config;
using bstrkr.core.android.presenters;
using bstrkr.core.android.services;
using bstrkr.core.android.services.location;
using bstrkr.core.config;
using bstrkr.core.services.location;
using bstrkr.core.services.resources;
using bstrkr.mvvm;
using bstrkr.mvvm.bindings;
using bstrkr.mvvm.views;
using bstrkr.providers;
using Cirrious.CrossCore;
using Cirrious.CrossCore.Converters;
using Cirrious.CrossCore.Platform;
using Cirrious.MvvmCross.Binding.Bindings.Target.Construction;
using Cirrious.MvvmCross.Droid.Platform;
using Cirrious.MvvmCross.Droid.Views;
using Cirrious.MvvmCross.Localization;
using Cirrious.MvvmCross.ViewModels;
using Xamarin;
namespace bstrkr.android
{
public class Setup : MvxAndroidSetup
{
public Setup(Context applicationContext) : base(applicationContext)
{
}
protected override void InitializeFirstChance()
{
Mvx.LazyConstructAndRegisterSingleton<IConfigManager, ConfigManager>();
Mvx.LazyConstructAndRegisterSingleton<ILocationService, LocationService>();
Mvx.LazyConstructAndRegisterSingleton<IAreaPositioningService, AreaPositioningService>();
Mvx.LazyConstructAndRegisterSingleton<IBusTrackerLocationService, BusTrackerLocationService>();
Mvx.LazyConstructAndRegisterSingleton<IAppResourceManager, AndroidAppResourceManager>();
Mvx.LazyConstructAndRegisterSingleton<ILiveDataProviderFactory, DefaultLiveDataProviderFactory>();
Mvx.RegisterSingleton<ICustomPresenter>(new CustomPresenter());
base.InitializeFirstChance();
}
protected override IMvxApplication CreateApp()
{
return new BusTrackerApp();
}
protected override IMvxTrace CreateDebugTrace()
{
return new DebugTrace();
}
protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
{
registry.RegisterCustomBindingFactory<MonoDroidGoogleMapsView>(
"Zoom",
mapView => new MapViewZoomTargetBinding(mapView));
registry.RegisterCustomBindingFactory<MonoDroidGoogleMapsView>(
"VisibleRegion",
mapView => new MapViewVisibleRegionTargetBinding(mapView));
base.FillTargetFactories(registry);
}
protected override IMvxAndroidViewPresenter CreateViewPresenter()
{
return Mvx.Resolve<ICustomPresenter>();
}
protected override void FillValueConverters(IMvxValueConverterRegistry registry)
{
base.FillValueConverters(registry);
}
}
}
|
bsd-2-clause
|
C#
|
fa61b08a05211ddcda53dc68a238c68ef703ecdd
|
Mark LadderTestScene abstract
|
2yangk23/osu,2yangk23/osu,peppy/osu-new,johnneijzen/osu,NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu,ZLima12/osu,peppy/osu,ZLima12/osu,UselessToucan/osu,NeoAdonis/osu,EVAST9919/osu,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,ppy/osu,ppy/osu,peppy/osu,smoogipoo/osu,peppy/osu,johnneijzen/osu
|
osu.Game.Tournament.Tests/LadderTestScene.cs
|
osu.Game.Tournament.Tests/LadderTestScene.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Tests.Visual;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Tests
{
public abstract class LadderTestScene : OsuTestScene
{
[Resolved]
protected LadderInfo Ladder { get; private set; }
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Game.Tests.Visual;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Tests
{
public class LadderTestScene : OsuTestScene
{
[Resolved]
protected LadderInfo Ladder { get; private set; }
}
}
|
mit
|
C#
|
c55580a995f375b07ecbc2a46a3ead38443a1821
|
attach spawns to dungeon
|
YesAndGames/four-friends
|
Assets/Scripts/Spawner.cs
|
Assets/Scripts/Spawner.cs
|
using UnityEngine;
/// <summary>
/// A persistent spawner that spawns things.
/// </summary>
public class Spawner : MonoBehaviour {
/// <summary>
/// The prefab that gets spawned.
/// </summary>
[SerializeField] private GameObject spawnPrefab;
/// <summary>
/// If set to true, spawns the prefabs as long as it is alive.
/// </summary>
[SerializeField] private bool spawnsInfinitely = true;
/// <summary>
/// If set to true, the party needs to trigger this portal.
/// </summary>
[SerializeField] private bool requiresTrigger = false;
/// <summary>
/// If this doesn't spawn infinitely, spawn this many things.
/// </summary>
[SerializeField] private int numSpawns = 5;
/// <summary>
/// Spawn a thing every spawnInterval seconds.
/// </summary>
[SerializeField] private float spawnInterval = 2f;
/// <summary>
/// Whether other not this spawner is spawning currently.
/// </summary>
private bool triggered = false;
/// <summary>
/// Time counter.
/// </summary>
private float t = 0;
/// <summary>
/// Initialize this component.
/// </summary>
void Start () {
t = 0;
triggered = !requiresTrigger;
}
/// <summary>
/// Update this component.
/// </summary>
void Update () {
if (triggered) {
t += Time.deltaTime;
while (t >= spawnInterval) {
Spawn ();
t -= spawnInterval;
}
}
}
/// <summary>
/// Fires when another trigger enters this one.
/// </summary>
/// <param name="other">Other collider.</param>
void OnTriggerEnter2D (Collider2D other) {
Party party = other.GetComponent<Party> ();
if (party != null) {
triggered = true;
}
}
/// <summary>
/// Spawn a thing.
/// </summary>
private void Spawn () {
GameObject spawned = Instantiate (spawnPrefab, transform.position, Quaternion.identity) as GameObject;
spawned.transform.SetParent (transform.parent);
// Decrement remaining spawns.
if (!spawnsInfinitely) {
numSpawns--;
if (numSpawns <= 0) {
DestroySelf ();
}
}
}
/// <summary>
/// Destroy this spawner thing.
/// </summary>
private void DestroySelf () {
Destroy (gameObject);
}
}
|
using UnityEngine;
/// <summary>
/// A persistent spawner that spawns things.
/// </summary>
public class Spawner : MonoBehaviour {
/// <summary>
/// The prefab that gets spawned.
/// </summary>
[SerializeField] private GameObject spawnPrefab;
/// <summary>
/// If set to true, spawns the prefabs as long as it is alive.
/// </summary>
[SerializeField] private bool spawnsInfinitely = true;
/// <summary>
/// If set to true, the party needs to trigger this portal.
/// </summary>
[SerializeField] private bool requiresTrigger = false;
/// <summary>
/// If this doesn't spawn infinitely, spawn this many things.
/// </summary>
[SerializeField] private int numSpawns = 5;
/// <summary>
/// Spawn a thing every spawnInterval seconds.
/// </summary>
[SerializeField] private float spawnInterval = 2f;
/// <summary>
/// Whether other not this spawner is spawning currently.
/// </summary>
private bool triggered = false;
/// <summary>
/// Time counter.
/// </summary>
private float t = 0;
/// <summary>
/// Initialize this component.
/// </summary>
void Start () {
t = 0;
triggered = !requiresTrigger;
}
/// <summary>
/// Update this component.
/// </summary>
void Update () {
if (triggered) {
t += Time.deltaTime;
while (t >= spawnInterval) {
Spawn ();
t -= spawnInterval;
}
}
}
/// <summary>
/// Fires when another trigger enters this one.
/// </summary>
/// <param name="other">Other collider.</param>
void OnTriggerEnter2D (Collider2D other) {
Party party = other.GetComponent<Party> ();
if (party != null) {
triggered = true;
}
}
/// <summary>
/// Spawn a thing.
/// </summary>
private void Spawn () {
Instantiate (spawnPrefab, transform.position, Quaternion.identity);
// Decrement remaining spawns.
if (!spawnsInfinitely) {
numSpawns--;
if (numSpawns <= 0) {
DestroySelf ();
}
}
}
/// <summary>
/// Destroy this spawner thing.
/// </summary>
private void DestroySelf () {
Destroy (gameObject);
}
}
|
mit
|
C#
|
fd1192bdcca7400e2f1f0923f9fbc833a1377d54
|
Fix extracting exception type
|
cezarypiatek/MaintainableSelenium,cezarypiatek/Tellurium,cezarypiatek/Tellurium,cezarypiatek/MaintainableSelenium,cezarypiatek/MaintainableSelenium,cezarypiatek/Tellurium
|
Src/MvcPages/Utils/ExceptionHelper.cs
|
Src/MvcPages/Utils/ExceptionHelper.cs
|
using System;
namespace Tellurium.MvcPages.Utils
{
public static class ExceptionHelper
{
public static string GetFullExceptionMessage(this Exception exception)
{
if (exception == null)
{
return string.Empty;
}
var innerExceptionMessage = exception.InnerException.GetFullExceptionMessage();
return $"{innerExceptionMessage}\r\n{exception.GetType().FullName}: {exception.Message}\r\n{exception.StackTrace}".Trim();
}
public static T SwallowException<T>(Func<T> func, T defaultValue)
{
try
{
return func();
}
catch
{
return defaultValue;
}
}
public static void SwallowException(Action func)
{
try
{
func();
}
catch
{
}
}
}
}
|
using System;
namespace Tellurium.MvcPages.Utils
{
public static class ExceptionHelper
{
public static string GetFullExceptionMessage(this Exception exception)
{
if (exception == null)
{
return string.Empty;
}
var innerExceptionMessage = exception.InnerException.GetFullExceptionMessage();
return $"{innerExceptionMessage}\r\n{typeof(Exception).FullName}: {exception.Message}\r\n{exception.StackTrace}".Trim();
}
public static T SwallowException<T>(Func<T> func, T defaultValue)
{
try
{
return func();
}
catch
{
return defaultValue;
}
}
public static void SwallowException(Action func)
{
try
{
func();
}
catch
{
}
}
}
}
|
mit
|
C#
|
2e3c02f57dd28d513790f8378d89ea8cbc09c36a
|
Add helper method for reading bytes from stream in StreamDecoder
|
paszczi/MLabs.Ogg
|
Mlabs.Ogg/src/Streams/StreamDecoder.cs
|
Mlabs.Ogg/src/Streams/StreamDecoder.cs
|
using System.Collections.Generic;
using System.IO;
using Mlabs.Ogg.Metadata;
namespace Mlabs.Ogg.Streams
{
public abstract class StreamDecoder
{
private readonly Stream m_stream;
protected StreamDecoder(Stream stream)
{
m_stream = stream;
}
/// <summary>
/// Checks whether the specific decoder can decode this stream.
/// </summary>
/// <param name="pages">The pages.</param>
/// <returns></returns>
public abstract bool CanDecode(IEnumerable<Page> pages);
/// <summary>
/// Decodes given stream info <see cref="OggStream"/>.
/// </summary>
/// <param name="pages">The pages.</param>
/// <returns></returns>
public abstract OggStream Decode(IEnumerable<Page> pages);
protected byte[] Read(long fileOffset, int size)
{
byte[] buffer = new byte[size];
m_stream.Seek(fileOffset, SeekOrigin.Begin);
if (m_stream.Read(buffer, 0, size) != size)
throw new IOException("Unable to read " + size + " bytes from the stream");
return buffer;
}
}
}
|
using System.Collections.Generic;
using System.IO;
using Mlabs.Ogg.Metadata;
namespace Mlabs.Ogg.Streams
{
public abstract class StreamDecoder
{
private readonly Stream m_stream;
protected StreamDecoder (Stream stream)
{
m_stream = stream;
}
/// <summary>
/// Checks whether the specific decoder can decode this stream.
/// </summary>
/// <param name="pages">The pages.</param>
/// <returns></returns>
public abstract bool CanDecode(IEnumerable<Page> pages);
/// <summary>
/// Decodes given stream info <see cref="OggStream"/>.
/// </summary>
/// <param name="pages">The pages.</param>
/// <returns></returns>
public abstract OggStream Decode(IEnumerable<Page> pages);
}
}
|
mit
|
C#
|
cceb787db65d50679fd3453171d6b82fe9ec7514
|
Remove strict option from LongerThanAttribute
|
Hammerstad/Moya
|
Moya/Attributes/LongerThanAttribute.cs
|
Moya/Attributes/LongerThanAttribute.cs
|
namespace Moya.Attributes
{
using System;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class LongerThanAttribute : MoyaAttribute
{
public LongerThanAttribute(int seconds)
{
Seconds = seconds;
}
public LongerThanAttribute()
{
}
public int Seconds { get; set; }
}
}
|
namespace Moya.Attributes
{
using System;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class LongerThanAttribute : MoyaAttribute
{
public LongerThanAttribute(int seconds)
{
Seconds = seconds;
}
public LongerThanAttribute()
{
}
public bool Strict { get; set; }
public int Seconds { get; set; }
}
}
|
mit
|
C#
|
b2d45c3dd03475f6483adcf323ab6d6d55172269
|
Make TestApplicationErrorLogger thread-safe
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
test/shared/TestApplicationErrorLogger.cs
|
test/shared/TestApplicationErrorLogger.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 System;
using System.Collections.Concurrent;
using System.Linq;
using Microsoft.AspNetCore.Server.Kestrel.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Testing
{
public class TestApplicationErrorLogger : ILogger
{
// Application errors are logged using 13 as the eventId.
private const int ApplicationErrorEventId = 13;
public ConcurrentBag<LogMessage> Messages { get; } = new ConcurrentBag<LogMessage>();
public int TotalErrorsLogged => Messages.Count(message => message.LogLevel == LogLevel.Error);
public int CriticalErrorsLogged => Messages.Count(message => message.LogLevel == LogLevel.Critical);
public int ApplicationErrorsLogged => Messages.Count(message => message.EventId.Id == ApplicationErrorEventId);
public IDisposable BeginScope<TState>(TState state)
{
return new Disposable(() => { });
}
public bool IsEnabled(LogLevel logLevel)
{
return true;
}
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
#if false
Console.WriteLine($"Log {logLevel}[{eventId}]: {formatter(state, exception)} {exception?.Message}");
#endif
Messages.Add(new LogMessage { LogLevel = logLevel, EventId = eventId, Exception = exception });
}
public class LogMessage
{
public LogLevel LogLevel { get; set; }
public EventId EventId { get; set; }
public Exception Exception { 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 System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Server.Kestrel.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Testing
{
public class TestApplicationErrorLogger : ILogger
{
// Application errors are logged using 13 as the eventId.
private const int ApplicationErrorEventId = 13;
public List<LogMessage> Messages { get; } = new List<LogMessage>();
public int TotalErrorsLogged => Messages.Count(message => message.LogLevel == LogLevel.Error);
public int CriticalErrorsLogged => Messages.Count(message => message.LogLevel == LogLevel.Critical);
public int ApplicationErrorsLogged => Messages.Count(message => message.EventId.Id == ApplicationErrorEventId);
public IDisposable BeginScope<TState>(TState state)
{
return new Disposable(() => { });
}
public bool IsEnabled(LogLevel logLevel)
{
return true;
}
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
#if false
Console.WriteLine($"Log {logLevel}[{eventId}]: {formatter(state, exception)} {exception?.Message}");
#endif
Messages.Add(new LogMessage { LogLevel = logLevel, EventId = eventId, Exception = exception });
}
public class LogMessage
{
public LogLevel LogLevel { get; set; }
public EventId EventId { get; set; }
public Exception Exception { get; set; }
}
}
}
|
apache-2.0
|
C#
|
ad12733b26229789faa13ff4b6694a2e4d2d35c5
|
fix background color
|
marihachi/CrystalResonanceForDesktop
|
src/Program.cs
|
src/Program.cs
|
using DxSharp;
using DxSharp.Data;
using DxSharp.Storage;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace CrystalResonanceDesktop
{
class Program
{
static void Main(string[] args)
{
using (var core = SystemCore.Initialize(new Size(1280, 720), Color.FromArgb(82, 195, 202), "Crystal Resonance Desktop"))
{
try
{
var sceneManager = SceneStorage.Instance;
sceneManager.TargetScene = sceneManager.FindByName("Title");
FontStorage.Instance.Add("メイリオ16", new DxSharp.Data.Font("メイリオ", 16));
while (core.Update())
{
sceneManager.Update();
Utility.FpsHelper.Instance.Wait();
}
}
catch(Exception ex)
{
MessageBox.Show($"[内容]:\r\n{ex.Message}\r\n\r\n[スタックトレース]:\r\n{ex.StackTrace}", $"実行時エラー({ex.GetType()})", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}
|
using DxSharp;
using DxSharp.Data;
using DxSharp.Storage;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace CrystalResonanceDesktop
{
class Program
{
static void Main(string[] args)
{
using (var core = SystemCore.Initialize(new Size(1280, 720), Color.LightSeaGreen, "Crystal Resonance Desktop"))
{
try
{
var sceneManager = SceneStorage.Instance;
sceneManager.TargetScene = sceneManager.FindByName("Title");
FontStorage.Instance.Add("メイリオ16", new DxSharp.Data.Font("メイリオ", 16));
while (core.Update())
{
sceneManager.Update();
Utility.FpsHelper.Instance.Wait();
}
}
catch(Exception ex)
{
MessageBox.Show($"[内容]:\r\n{ex.Message}\r\n\r\n[スタックトレース]:\r\n{ex.StackTrace}", $"実行時エラー({ex.GetType()})", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}
|
mit
|
C#
|
7efb4da2eb44f8cdb7d1817ef25d600151a3d5bc
|
remove non-generic IQuery as it's no longer needed
|
dstockhammer/Darker,BrighterCommand/Darker
|
src/Darker/IQuery.cs
|
src/Darker/IQuery.cs
|
namespace Darker
{
public interface IQuery<TResult>
{
}
}
|
namespace Darker
{
public interface IQuery
{
}
public interface IQuery<TResult> : IQuery
{
}
}
|
mit
|
C#
|
9244474adb96e0ac9dc8e5253cffdcd606882d4f
|
Add helper to QTTrack as well
|
dlech/monomac,kangaroo/monomac,PlayScriptRedux/monomac
|
src/QTKit/QTMovie.cs
|
src/QTKit/QTMovie.cs
|
//
// Copyright 2010, Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using MonoMac.Foundation;
using MonoMac.AppKit;
namespace MonoMac.QTKit {
public enum QTCodecQuality {
Lossless = 0x00000400,
Max = 0x000003FF,
Min = 0x00000000,
Low = 0x00000100,
Normal = 0x00000200,
High = 0x00000300
}
public class QTImageAttributes {
public QTImageAttributes ()
{
}
public string CodecType { get; set; }
public QTCodecQuality? Quality { get; set; }
public int? TimeScale { get; set; }
public NSDictionary ToDictionary ()
{
var dict = new NSMutableDictionary ();
if (CodecType != null)
dict.SetObject (new NSString (CodecType), QTMovie.ImageCodecType);
if (Quality.HasValue)
dict.SetObject (NSNumber.FromInt32 ((int) Quality.Value), QTMovie.ImageCodecQuality);
if (TimeScale.HasValue)
dict.SetObject (NSNumber.FromInt32 (TimeScale.Value), QTTrack.TimeScaleAttribute);
return dict;
}
}
public partial class QTTrack {
public void AddImage (NSImage image, QTTime forDuration, QTImageAttributes attributes)
{
if (attributes == null)
throw new ArgumentNullException ("attributes");
AddImage (image, forDuration, attributes.ToDictionary ());
}
}
public partial class QTMovie {
public void AddImage (NSImage image, QTTime forDuration, QTImageAttributes attributes)
{
if (attributes == null)
throw new ArgumentNullException ("attributes");
AddImage (image, forDuration, attributes.ToDictionary ());
}
}
}
|
//
// Copyright 2010, Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using MonoMac.Foundation;
using MonoMac.AppKit;
namespace MonoMac.QTKit {
public enum QTCodecQuality {
Lossless = 0x00000400,
Max = 0x000003FF,
Min = 0x00000000,
Low = 0x00000100,
Normal = 0x00000200,
High = 0x00000300
}
public class QTImageAttributes {
public QTImageAttributes ()
{
}
public string CodecType { get; set; }
public QTCodecQuality? Quality { get; set; }
public int? TimeScale { get; set; }
public NSDictionary ToDictionary ()
{
var dict = new NSMutableDictionary ();
if (CodecType != null)
dict.SetObject (new NSString (CodecType), QTMovie.ImageCodecType);
if (Quality.HasValue)
dict.SetObject (NSNumber.FromInt32 ((int) Quality.Value), QTMovie.ImageCodecQuality);
if (TimeScale.HasValue)
dict.SetObject (NSNumber.FromInt32 (TimeScale.Value), QTTrack.TimeScaleAttribute);
return dict;
}
}
public partial class QTMovie {
public void AddImage (NSImage image, QTTime forDuration, QTImageAttributes attributes)
{
if (attributes == null)
throw new ArgumentNullException ("attributes");
AddImageForDuration (image, forDuration, attributes.ToDictionary ());
}
}
}
|
apache-2.0
|
C#
|
ec25ad5e274537c9a8a9c4a113672ef9fc1205be
|
return error
|
SIROK/growthbeat-unity,growthbeat/growthbeat-unity,growthbeat/growthbeat-unity,SIROK/growthbeat-unity
|
sample/Assets/GrowthbeatComponent.cs
|
sample/Assets/GrowthbeatComponent.cs
|
//
// GrowthbeatComponent.cs
//
// Created by Shigeru Ogawa on 2015/06/15.
// Copyright (c) 2015年 SIROK, Inc. All rights reserved.
//
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using Growthbeat;
#if UNITY_IPHONE
using NotificationServices = UnityEngine.iOS.NotificationServices;
#endif
public class GrowthbeatComponent : MonoBehaviour
{
#if UNITY_IPHONE
bool tokenSent = false;
#endif
public string applicationId = "";
public string credentialId = "";
public string senderId = "";
public GrowthPush.Environment environment = GrowthPush.Environment.Unknown;
void Awake ()
{
GrowthbeatCore.GetInstance ().Initialize (applicationId, credentialId);
IntentHandler.GetInstance ().AddNoopIntentHandler ();
IntentHandler.GetInstance ().AddUrlIntentHandler ();
IntentHandler.GetInstance ().AddCustomIntentHandler ("GrowthbeatComponent", "HandleCustomIntent");
GrowthLink.GetInstance().Initialize (applicationId, credentialId);
GrowthPush.GetInstance ().RequestDeviceToken (senderId, environment);
GrowthbeatCore.GetInstance ().Start ();
}
void Start ()
{
}
void Update ()
{
#if UNITY_IPHONE
if (!tokenSent) {
byte[] token = NotificationServices.deviceToken;
if (token != null) {
GrowthPush.GetInstance ().SetDeviceToken(System.BitConverter.ToString(token).Replace("-", "").ToLower());
tokenSent = true;
}
}
#endif
}
void OnDisable ()
{
GrowthbeatCore.GetInstance ().Stop ();
}
void HandleCustomIntent(string extra) {
Debug.Log("Enter HandleCustomIntent");
Debug.Log(extra);
}
public void ClickedRandom() {
GrowthAnalytics.GetInstance ().SetRandom ();
}
public Toggle developmentToggle;
public void ClickedDevelopment () {
bool development = developmentToggle.isOn ? true : false;
GrowthAnalytics.GetInstance ().SetDevelopment (development);
}
public InputField levelField;
public void EndInputLevel () {
string level = levelField.text;
GrowthAnalytics.GetInstance ().SetLevel (int.Parse(level));
}
public InputField itemField;
public InputField priceField;
public void ClickedPurchase () {
string item = itemField.text;
string price = priceField.text;
GrowthAnalytics.GetInstance ().Purchase (int.Parse(price), null, item);
}
}
|
//
// GrowthbeatComponent.cs
//
// Created by Shigeru Ogawa on 2015/06/15.
// Copyright (c) 2015年 SIROK, Inc. All rights reserved.
//
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using growthbeat;
#if UNITY_IPHONE
using NotificationServices = UnityEngine.iOS.NotificationServices;
#endif
public class GrowthbeatComponent : MonoBehaviour
{
#if UNITY_IPHONE
bool tokenSent = false;
#endif
public string applicationId = "";
public string credentialId = "";
public string senderId = "";
public GrowthPush.Environment environment = GrowthPush.Environment.Unknown;
void Awake ()
{
Growthbeat.GetInstance ().Initialize (applicationId, credentialId);
IntentHandler.GetInstance ().AddNoopIntentHandler ();
IntentHandler.GetInstance ().AddUrlIntentHandler ();
IntentHandler.GetInstance ().AddCustomIntentHandler ("GrowthbeatComponent", "HandleCustomIntent");
GrowthLink.GetInstance().Initialize (applicationId, credentialId);
GrowthPush.GetInstance ().RequestDeviceToken (senderId, environment);
Growthbeat.GetInstance ().Start ();
}
void Start ()
{
}
void Update ()
{
#if UNITY_IPHONE
if (!tokenSent) {
byte[] token = NotificationServices.deviceToken;
if (token != null) {
GrowthPush.GetInstance ().SetDeviceToken(System.BitConverter.ToString(token).Replace("-", "").ToLower());
tokenSent = true;
}
}
#endif
}
void OnDisable ()
{
Growthbeat.GetInstance ().Stop ();
}
void HandleCustomIntent(string extra) {
Debug.Log("Enter HandleCustomIntent");
Debug.Log(extra);
}
public void ClickedRandom() {
GrowthAnalytics.GetInstance ().SetRandom ();
}
public Toggle developmentToggle;
public void ClickedDevelopment () {
bool development = developmentToggle.isOn ? true : false;
GrowthAnalytics.GetInstance ().SetDevelopment (development);
}
public InputField levelField;
public void EndInputLevel () {
string level = levelField.text;
GrowthAnalytics.GetInstance ().SetLevel (int.Parse(level));
}
public InputField itemField;
public InputField priceField;
public void ClickedPurchase () {
string item = itemField.text;
string price = priceField.text;
GrowthAnalytics.GetInstance ().Purchase (int.Parse(price), null, item);
}
}
|
apache-2.0
|
C#
|
4f6786ff916603c60bca8c71461f43f1f6098e4e
|
remove log hp enemy
|
AcessDeniedAD/ggj2016,AcessDeniedAD/ggj2016
|
Assets/Scripts/EnnemisMain.cs
|
Assets/Scripts/EnnemisMain.cs
|
using UnityEngine;
using System.Collections;
public class EnnemisMain : MonoBehaviour {
public float HP ;
public float damage;
public float speed;
protected GameObject tree;
public bool hasReachTheTree = false;
[HideInInspector]public bool isAlive = true;
[HideInInspector]public Animator animator;
[HideInInspector]public AudioSource audioSource;
public AudioClip deathSound;
public EnnemisMain()
{
HP = 100;
damage = 10;
speed = 100;
isAlive = true;
animator = animator;
}
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update () {
}
public void takeDamage(float damage)
{
HP -= damage;
if (HP <= 0 && isAlive)
{
StartCoroutine(setDestroy());
}
}
IEnumerator setDestroy()
{
isAlive = false;
audioSource.PlayOneShot (deathSound);
//ici jouer les animations de mort avant la destruction
animator.SetBool ("canDie", true);
yield return new WaitForEndOfFrame ();
yield return new WaitForSeconds (3);
Destroy(gameObject);
yield return 0;
}
//Retrun the closest tree
protected GameObject findClosestTree() {
GameObject[] gos;
gos = GameObject.FindGameObjectsWithTag("Tree");
GameObject closest = null;
float distance = Mathf.Infinity;
Vector3 position = transform.position;
foreach (GameObject go in gos) {
Vector3 diff = go.transform.position - position;
float curDistance = diff.sqrMagnitude;
if (curDistance < distance) {
closest = go;
distance = curDistance;
}
}
return closest;
}
}
|
using UnityEngine;
using System.Collections;
public class EnnemisMain : MonoBehaviour {
public float HP ;
public float damage;
public float speed;
protected GameObject tree;
public bool hasReachTheTree = false;
[HideInInspector]public bool isAlive = true;
[HideInInspector]public Animator animator;
[HideInInspector]public AudioSource audioSource;
public AudioClip deathSound;
public EnnemisMain()
{
HP = 100;
damage = 10;
speed = 100;
isAlive = true;
animator = animator;
}
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update () {
}
public void takeDamage(float damage)
{
HP -= damage;
if (HP <= 0 && isAlive)
{
StartCoroutine(setDestroy());
}
Debug.Log ("enemy as : "+ HP+" HP");
}
IEnumerator setDestroy()
{
isAlive = false;
audioSource.PlayOneShot (deathSound);
//ici jouer les animations de mort avant la destruction
animator.SetBool ("canDie", true);
yield return new WaitForEndOfFrame ();
yield return new WaitForSeconds (3);
Destroy(gameObject);
yield return 0;
}
//Retrun the closest tree
protected GameObject findClosestTree() {
GameObject[] gos;
gos = GameObject.FindGameObjectsWithTag("Tree");
GameObject closest = null;
float distance = Mathf.Infinity;
Vector3 position = transform.position;
foreach (GameObject go in gos) {
Vector3 diff = go.transform.position - position;
float curDistance = diff.sqrMagnitude;
if (curDistance < distance) {
closest = go;
distance = curDistance;
}
}
return closest;
}
}
|
cc0-1.0
|
C#
|
0d0b9531222ad90671d89558a3b428b62b7544d8
|
Add the ability to create TablePerBoundedContext with BoundedContextName directly.
|
Elders/Cronus.Persistence.Cassandra,Elders/Cronus.Persistence.Cassandra
|
src/Elders.Cronus.Persistence.Cassandra/TablePerBoundedContext.cs
|
src/Elders.Cronus.Persistence.Cassandra/TablePerBoundedContext.cs
|
using System;
using System.Collections.Concurrent;
using System.Reflection;
using Elders.Cronus.DomainModeling;
using Elders.Cronus.EventStore;
namespace Elders.Cronus.Persistence.Cassandra
{
public class TablePerBoundedContext : ICassandraEventStoreTableNameStrategy
{
private readonly ConcurrentDictionary<string, string> eventsTableName = new ConcurrentDictionary<string, string>();
private readonly string boundedContextName;
public TablePerBoundedContext(Assembly aggregatesAssemblies)
{
this.boundedContextName = aggregatesAssemblies.GetBoundedContext().BoundedContextName;
}
public TablePerBoundedContext(string boundedContextName)
{
this.boundedContextName = boundedContextName;
}
public string GetEventsTableName(AggregateCommit aggregateCommit)
{
// mynkow if(Environment.GetEnvironmentVariable("ForceCronusChecks"))
// if (boundedContext)
var boundedContext = aggregateCommit.BoundedContext;
return GetEventsTableName(boundedContext);
}
public string[] GetAllTableNames()
{
return (new System.Collections.Generic.List<string>() { GetEventsTableName(boundedContextName) }).ToArray();
}
public string GetEventsTableName(string boundedContext)
{
string tableName;
if (!eventsTableName.TryGetValue(boundedContext, out tableName))
{
tableName = String.Format("{0}Events", boundedContext).ToLowerInvariant();
eventsTableName.TryAdd(boundedContext, tableName);
}
return tableName;
}
}
}
|
using System;
using System.Collections.Concurrent;
using System.Reflection;
using Elders.Cronus.DomainModeling;
using Elders.Cronus.EventStore;
namespace Elders.Cronus.Persistence.Cassandra
{
public class TablePerBoundedContext : ICassandraEventStoreTableNameStrategy
{
private readonly ConcurrentDictionary<string, string> eventsTableName = new ConcurrentDictionary<string, string>();
private readonly Assembly aggregatesAssemblies;
public TablePerBoundedContext(Assembly aggregatesAssemblies)
{
this.aggregatesAssemblies = aggregatesAssemblies;
}
public string GetEventsTableName(AggregateCommit aggregateCommit)
{
// mynkow if(Environment.GetEnvironmentVariable("ForceCronusChecks"))
// if (boundedContext)
var boundedContext = aggregateCommit.BoundedContext;
return GetEventsTableName(boundedContext);
}
public string[] GetAllTableNames()
{
var boundedContext = aggregatesAssemblies.GetBoundedContext().BoundedContextName;
return (new System.Collections.Generic.List<string>() { GetEventsTableName(boundedContext) }).ToArray();
}
public string GetEventsTableName(string boundedContext)
{
string tableName;
if (!eventsTableName.TryGetValue(boundedContext, out tableName))
{
tableName = String.Format("{0}Events", boundedContext).ToLowerInvariant();
eventsTableName.TryAdd(boundedContext, tableName);
}
return tableName;
}
}
}
|
apache-2.0
|
C#
|
c5ea5105f8a99bdba37171b978f73fc1f74e4db6
|
bump version
|
user1568891/PropertyChanged,0x53A/PropertyChanged,Fody/PropertyChanged
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyTitle("PropertyChanged")]
[assembly: AssemblyProduct("PropertyChanged")]
[assembly: AssemblyVersion("1.48.0")]
[assembly: AssemblyFileVersion("1.48.0")]
|
using System.Reflection;
[assembly: AssemblyTitle("PropertyChanged")]
[assembly: AssemblyProduct("PropertyChanged")]
[assembly: AssemblyVersion("1.47.0")]
[assembly: AssemblyFileVersion("1.47.0")]
|
mit
|
C#
|
487410c4139effd16ad58d417a5c6635958ee212
|
bump version to v0.7.1
|
Dalet/140-speedrun-timer,Dalet/140-speedrun-timer,Dalet/140-speedrun-timer
|
SharedAssemblyInfo.cs
|
SharedAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyVersion("0.7.1")]
[assembly: AssemblyFileVersion("0.7.1")]
|
using System.Reflection;
[assembly: AssemblyVersion("0.7")]
[assembly: AssemblyFileVersion("0.7")]
|
unlicense
|
C#
|
bc415c9db0326e53ecaa803cadcf6f166858a6eb
|
Make SerializableDictionary public
|
spriest487/spacetrader-utils
|
SerializableDictionary.cs
|
SerializableDictionary.cs
|
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using UnityEngine;
namespace SpaceTrader.Util {
[Serializable]
public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, ISerializationCallbackReceiver {
[SerializeField]
private List<TKey> keys;
[SerializeField]
private List<TValue> values;
public SerializableDictionary() {
this.keys = new List<TKey>();
this.values = new List<TValue>();
}
public SerializableDictionary(IDictionary<TKey, TValue> input) : base(input) {
this.keys = new List<TKey>();
this.values = new List<TValue>();
}
public void OnBeforeSerialize() {
this.keys.Clear();
this.values.Clear();
foreach (var (key, value) in this) {
this.keys.Add(key);
this.values.Add(value);
}
}
public void OnAfterDeserialize() {
this.Clear();
if (this.keys.Count != this.values.Count) {
throw new SerializationException(
$"there are {this.keys.Count} keys and {this.values.Count} "
+ "values after deserialization. Make sure that both key and value types are serializable."
);
}
for (var i = 0; i < this.keys.Count; i++) {
this.Add(this.keys[i], this.values[i]);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using UnityEngine;
namespace SpaceTrader.Util {
[Serializable]
internal class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, ISerializationCallbackReceiver {
[SerializeField]
private List<TKey> keys;
[SerializeField]
private List<TValue> values;
public SerializableDictionary() {
this.keys = new List<TKey>();
this.values = new List<TValue>();
}
public SerializableDictionary(IDictionary<TKey, TValue> input) : base(input) {
this.keys = new List<TKey>();
this.values = new List<TValue>();
}
public void OnBeforeSerialize() {
this.keys.Clear();
this.values.Clear();
foreach (var (key, value) in this) {
this.keys.Add(key);
this.values.Add(value);
}
}
public void OnAfterDeserialize() {
this.Clear();
if (this.keys.Count != this.values.Count) {
throw new SerializationException(
$"there are {this.keys.Count} keys and {this.values.Count} "
+ "values after deserialization. Make sure that both key and value types are serializable."
);
}
for (var i = 0; i < this.keys.Count; i++) {
this.Add(this.keys[i], this.values[i]);
}
}
}
}
|
mit
|
C#
|
558a860e8b4834c3cee1a632b23b5eab8aea0942
|
bump version
|
Fody/Immutable
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyTitle("Immutable")]
[assembly: AssemblyProduct("Immutable")]
[assembly: AssemblyVersion("0.1.2.0")]
[assembly: AssemblyFileVersion("0.1.2.0")]
|
using System.Reflection;
[assembly: AssemblyTitle("Immutable")]
[assembly: AssemblyProduct("Immutable")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
|
mit
|
C#
|
8585b96efef0bd80e9d798c5443929154adf1ec9
|
Fix NullReference when using T4MVC
|
IRlyDontKnow/twilio-csharp,mplacona/twilio-csharp,twilio/twilio-csharp
|
src/Twilio.Mvc/TwiMLResult.cs
|
src/Twilio.Mvc/TwiMLResult.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Xml.Linq;
namespace Twilio.TwiML.Mvc
{
public class TwiMLResult : ActionResult
{
XDocument data;
public TwiMLResult()
{
}
public TwiMLResult(string twiml)
{
data = XDocument.Parse(twiml);
}
public TwiMLResult(XDocument twiml)
{
data = twiml;
}
public TwiMLResult(TwilioResponse response)
{
if (response != null)
data = response.ToXDocument();
}
public override void ExecuteResult(ControllerContext controllerContext)
{
var context = controllerContext.RequestContext.HttpContext;
context.Response.ContentType = "application/xml";
if (data == null)
{
data = new XDocument(new XElement("Response"));
}
data.Save(context.Response.Output);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Xml.Linq;
namespace Twilio.TwiML.Mvc
{
public class TwiMLResult : ActionResult
{
XDocument data;
public TwiMLResult()
{
}
public TwiMLResult(string twiml)
{
data = XDocument.Parse(twiml);
}
public TwiMLResult(XDocument twiml)
{
data = twiml;
}
public TwiMLResult(TwilioResponse response)
{
data = response.ToXDocument();
}
public override void ExecuteResult(ControllerContext controllerContext)
{
var context = controllerContext.RequestContext.HttpContext;
context.Response.ContentType = "application/xml";
if (data == null)
{
data = new XDocument(new XElement("Response"));
}
data.Save(context.Response.Output);
}
}
}
|
mit
|
C#
|
7f34a12378d1b1b3271589fdc4ed591aa93c5bc6
|
Change Removed unused code
|
dacucar/fenixlib
|
FenixLib/FenixLib/Core/ISprite.cs
|
FenixLib/FenixLib/Core/ISprite.cs
|
/* Copyright 2016 Darío Cutillas Carrillo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections.Generic;
namespace FenixLib.Core
{
public interface ISprite : IGraphic
{
string Description { get; set; }
ICollection<PivotPoint> PivotPoints { get; }
void ClearPivotPoints ();
void DefinePivotPoint ( int id, int x, int y );
void DeletePivotPoint ( int id );
PivotPoint GetPivotPoint ( int id );
int? FindFreePivotPointId ( int start = 0,
Sprite.SearchDirection direction = Sprite.SearchDirection.Fordward );
bool IsPivotPointDefined ( int id );
}
}
|
/* Copyright 2016 Darío Cutillas Carrillo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections.Generic;
namespace FenixLib.Core
{
public interface ISprite : IGraphic
{
string Description { get; set; }
//int? Id { get; }
//bool IsInAssortment { get; }
//SpriteAssortment ParentAssortment { get; set; }
ICollection<PivotPoint> PivotPoints { get; }
void ClearPivotPoints ();
void DefinePivotPoint ( int id, int x, int y );
void DeletePivotPoint ( int id );
PivotPoint GetPivotPoint ( int id );
int? FindFreePivotPointId ( int start = 0,
Sprite.SearchDirection direction = Sprite.SearchDirection.Fordward );
bool IsPivotPointDefined ( int id );
}
}
|
apache-2.0
|
C#
|
b492e26a25fd3a0788a4ddae65fcb2c379fb5f38
|
Bump version to 2.0.0.0
|
CodefoundryDE/LegacyWrapper,CodefoundryDE/LegacyWrapper
|
GlobalAssemblyInfo.cs
|
GlobalAssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyDescription("LegacyWrapper uses a x86 wrapper to call legacy dlls from a 64 bit process.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("codefoundry.de")]
[assembly: AssemblyCopyright("Copyright (c) 2017, Franz Wimmer. (MIT License)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyDescription("LegacyWrapper uses a x86 wrapper to call legacy dlls from a 64 bit process.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("codefoundry.de")]
[assembly: AssemblyCopyright("Copyright (c) 2017, Franz Wimmer. (MIT License)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
|
mit
|
C#
|
1d7e7de1bdee71c0048f673dee33a466d706c7a1
|
Fix helloworld
|
BlackFrog1/PowerArgs,workabyte/PowerArgs,adamabdelhamed/PowerArgs,BlackFrog1/PowerArgs,adamabdelhamed/PowerArgs,workabyte/PowerArgs
|
HelloWorld/Program.cs
|
HelloWorld/Program.cs
|
using ArgsTests;
using PowerArgs.Cli;
using PowerArgs;
using System;
using System.Collections.Generic;
using System.Threading;
namespace HelloWorld
{
class Program
{
[STAThread]
static void Main(string[] args)
{
// Samples.SearchSample.Run();
// Samples.ProgressBarSample.Run();
// Samples.CalculatorProgramSample._Main(args); // a simple 4 function calculator
Samples.HelloWorldParse._Main(args); // The simplest way to use the parser. All this sample does is parse the arguments and send them back to your program.
// Samples.HelloWorldInvoke._Main(args); // A simple way to have the parser parse your arguments and then call a new Main method that you build.
// Samples.Git._Main(args); // Sample that shows how to implement a program that accepts multiple commands and where each command takes its own set of arguments.
// Samples.REPLInvoke._Main(args); // Sample that shows how to implement a REPL (Read Evaluate Print Loop)
// Samples.HelloWorldConditionalIInvoke._Main(args);
}
}
}
|
using ArgsTests;
using PowerArgs.Cli;
using PowerArgs;
using System;
using System.Collections.Generic;
using System.Threading;
namespace HelloWorld
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Random r = new Random();
ConsoleApp appy = new ConsoleApp();
appy.LayoutRoot.Add(new MatrixPanel()).Fill();
appy.QueueAction(() =>
{
Dialog.ShowMessage("Welcome to the Matrix".ToGreen(),
(b)=> { },
true,
10,
new DialogButton() { DisplayText = "Red Pill".ToRed() }, new DialogButton() { DisplayText = "Blue Pill".ToDarkCyan() });
});
appy.Start().Wait();
return;
var viewModel = new BasicXmlAppViewModel();
var app = ConsoleApp.FromMvVm(ArgsTests.Resources.BasicXmlApp, viewModel);
var task = app.Start();
task.Wait();
Console.WriteLine(viewModel.Customer.Name);
// Samples.SearchSample.Run();
// Samples.ProgressBarSample.Run();
// Samples.CalculatorProgramSample._Main(args); // a simple 4 function calculator
//Samples.HelloWorldParse._Main(args); // The simplest way to use the parser. All this sample does is parse the arguments and send them back to your program.
// Samples.HelloWorldInvoke._Main(args); // A simple way to have the parser parse your arguments and then call a new Main method that you build.
// Samples.Git._Main(args); // Sample that shows how to implement a program that accepts multiple commands and where each command takes its own set of arguments.
// Samples.REPLInvoke._Main(args); // Sample that shows how to implement a REPL (Read Evaluate Print Loop)
// Samples.HelloWorldConditionalIInvoke._Main(args);
}
}
}
|
mit
|
C#
|
38e539c926fd4eb236602435af24d529c064d5cb
|
Fix a bug of wrong counting characters with HTTPS URL
|
fin-alice/Mystique,azyobuzin/Mystique
|
Inscribe/Text/TweetTextCounter.cs
|
Inscribe/Text/TweetTextCounter.cs
|
using System.Linq;
using System.Text.RegularExpressions;
namespace Inscribe.Text
{
public static class TweetTextCounter
{
public static int Count(string input)
{
// URL is MAX 20 Chars (if URL has HTTPS scheme, URL is MAX 21 Chars)
int prevIndex = 0;
int totalCount = 0;
foreach (var m in RegularExpressions.UrlRegex.Matches(input).OfType<Match>())
{
totalCount += m.Index - prevIndex;
prevIndex = m.Index + m.Groups[0].Value.Length;
bool isHasHttpsScheme = m.Groups[0].Value.Contains("https");
if (m.Groups[0].Value.Length < TwitterDefine.UrlMaxLength + ((isHasHttpsScheme) ? 1 : 0))
totalCount += m.Groups[0].Value.Length;
else
totalCount += TwitterDefine.UrlMaxLength + ((isHasHttpsScheme) ? 1 : 0);
}
totalCount += input.Length - prevIndex;
return totalCount;
}
}
}
|
using System.Linq;
using System.Text.RegularExpressions;
namespace Inscribe.Text
{
public static class TweetTextCounter
{
public static int Count(string input)
{
// URL is MAX 19 Chars.
int prevIndex = 0;
int totalCount = 0;
foreach (var m in RegularExpressions.UrlRegex.Matches(input).OfType<Match>())
{
totalCount += m.Index - prevIndex;
prevIndex = m.Index + m.Groups[0].Value.Length;
if (m.Groups[0].Value.Length < TwitterDefine.UrlMaxLength)
totalCount += m.Groups[0].Value.Length;
else
totalCount += TwitterDefine.UrlMaxLength;
}
totalCount += input.Length - prevIndex;
return totalCount;
}
}
}
|
mit
|
C#
|
678103c4e7d47290a695d536e13c1996672333e5
|
Fix typo in Error.cshtml
|
kirillkos/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net
|
Joinrpg/Views/Shared/Error.cshtml
|
Joinrpg/Views/Shared/Error.cshtml
|
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Error</title>
</head>
<body>
<hgroup>
<h1>Error.</h1>
<h2>An error occurred while processing your request.</h2>
</hgroup>
</body>
</html>
|
{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Error</title>
</head>
<body>
<hgroup>
<h1>Error.</h1>
<h2>An error occurred while processing your request.</h2>
</hgroup>
</body>
</html>
|
mit
|
C#
|
d04dab6ff07aa483e698a2f851fc678dd6ff7f46
|
Disable Auto-Open behavior for Stack Trace Explorer (#59785)
|
jasonmalinowski/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,weltkante/roslyn,mavasani/roslyn,dotnet/roslyn,weltkante/roslyn,bartdesmet/roslyn,weltkante/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,dotnet/roslyn
|
src/Features/Core/Portable/StackTraceExplorer/StackTraceExplorerOptions.cs
|
src/Features/Core/Portable/StackTraceExplorer/StackTraceExplorerOptions.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.StackTraceExplorer
{
internal static class StackTraceExplorerOptions
{
/// <summary>
/// Used to determine if a user focusing VS should look at the clipboard for a callstack and automatically
/// open the tool window with the callstack inserted
/// </summary>
public static readonly Option2<bool> OpenOnFocus = new(
nameof(StackTraceExplorerOptions),
nameof(OpenOnFocus),
false,
storageLocation: new RoamingProfileStorageLocation("StackTraceExplorer.Options.OpenOnFocus"));
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.StackTraceExplorer
{
internal static class StackTraceExplorerOptions
{
/// <summary>
/// Used to determine if a user focusing VS should look at the clipboard for a callstack and automatically
/// open the tool window with the callstack inserted
/// </summary>
public static readonly Option2<bool> OpenOnFocus = new(
nameof(StackTraceExplorerOptions),
nameof(OpenOnFocus),
true,
storageLocation: new RoamingProfileStorageLocation("StackTraceExplorer.Options.OpenOnFocus"));
}
}
|
mit
|
C#
|
c78ed4943723936a0c4cf0cdfa17d743c01a05ee
|
Fix Format
|
StephenBonikowsky/wcf,mconnew/wcf,mconnew/wcf,mconnew/wcf,imcarolwang/wcf,dotnet/wcf,StephenBonikowsky/wcf,imcarolwang/wcf,dotnet/wcf,imcarolwang/wcf,dotnet/wcf
|
src/System.ServiceModel.Security/tests/ServiceModel/SecurityKeyTypeTest.cs
|
src/System.ServiceModel.Security/tests/ServiceModel/SecurityKeyTypeTest.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.IdentityModel.Tokens;
using Infrastructure.Common;
using Xunit;
public static class SecurityKeyTypeTest
{
[WcfFact]
public static void Get_EnumMembers_Test()
{
SecurityKeyType sk = SecurityKeyType.SymmetricKey;
Assert.Equal(SecurityKeyType.SymmetricKey, sk);
SecurityKeyType ak = SecurityKeyType.AsymmetricKey;
Assert.Equal(SecurityKeyType.AsymmetricKey, ak);
SecurityKeyType bk = SecurityKeyType.BearerKey;
Assert.Equal(SecurityKeyType.BearerKey, bk);
}
[Theory]
[InlineData(SecurityKeyType.SymmetricKey, 0)]
[InlineData(SecurityKeyType.AsymmetricKey, 1)]
[InlineData(SecurityKeyType.BearerKey, 2)]
public static void TypeConvert_EnumToInt_Test(SecurityKeyType key, int value)
{
Assert.Equal((int)key, value);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.IdentityModel.Tokens;
using Infrastructure.Common;
using Xunit;
public static class SecurityKeyTypeTest
{
[WcfFact]
public static void Get_EnumMembers_Test()
{
SecurityKeyType skt0 = SecurityKeyType.SymmetricKey;
Assert.Equal(SecurityKeyType.SymmetricKey, skt0);
SecurityKeyType skt1 = SecurityKeyType.AsymmetricKey;
Assert.Equal(SecurityKeyType.AsymmetricKey, skt1);
SecurityKeyType skt2 = SecurityKeyType.BearerKey;
Assert.Equal(SecurityKeyType.BearerKey, skt2);
}
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
public static void TypeConvert_EnumToInt_Test(int value)
{
switch (value)
{
case 0:
Assert.Equal((int)SecurityKeyType.SymmetricKey, value);
break;
case 1:
Assert.Equal((int)SecurityKeyType.AsymmetricKey, value);
break;
default:
Assert.Equal((int)SecurityKeyType.BearerKey, value);
break;
}
}
}
|
mit
|
C#
|
35cb3594d8a86117b6a09f7625654a9522e18dd9
|
Update SwaggerResultType.cs
|
quails4Eva/NSwag,RSuter/NSwag,aelbatal/NSwag,RSuter/NSwag,RSuter/NSwag,quails4Eva/NSwag,aelbatal/NSwag,aelbatal/NSwag,NSwag/NSwag,quails4Eva/NSwag,NSwag/NSwag,NSwag/NSwag,aelbatal/NSwag,NSwag/NSwag,RSuter/NSwag,RSuter/NSwag,quails4Eva/NSwag
|
src/NSwag.Annotations/SwaggerResultType.cs
|
src/NSwag.Annotations/SwaggerResultType.cs
|
//-----------------------------------------------------------------------
// <copyright file="SwaggerResultTypeAttribute.cs" company="NSwag">
// Copyright (c) Rico Suter. All rights reserved.
// </copyright>
// <license>https://github.com/NSwag/NSwag/blob/master/LICENSE.md</license>
// <author>Rico Suter, mail@rsuter.com</author>
//-----------------------------------------------------------------------
using System;
namespace NSwag.Annotations
{
/// <summary>Specifies the result type of a web service method to correctly generate a Swagger definition.</summary>
public class SwaggerResultTypeAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="SwaggerResultTypeAttribute"/> class.</summary>
/// <param name="resultType">The operation result type.</param>
public SwaggerResultTypeAttribute(Type resultType)
{
ResultType = resultType; // TODO: Check for this attribute on WebAPI methods
}
/// <summary>Gets or sets the JSON result type of an MVC or Web API action method.</summary>
public Type ResultType { get; set; }
}
}
|
//-----------------------------------------------------------------------
// <copyright file="SwaggerResultTypeAttribute.cs" company="NSwag">
// Copyright (c) Rico Suter. All rights reserved.
// </copyright>
// <license>https://github.com/NSwag/NSwag/blob/master/LICENSE.md</license>
// <author>Rico Suter, mail@rsuter.com</author>
//-----------------------------------------------------------------------
using System;
namespace NSwag.Annotations
{
/// <summary>Specifies the result type of a web service method to correctly generate a Swagger definition.</summary>
public class SwaggerResultTypeAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="SwaggerResultTypeAttribute"/> class.</summary>
/// <param name="resultType">The operation result type.</param>
public SwaggerResultTypeAttribute(Type resultType)
{
ResultType = resultType; // TODO: Check for this attribute on WebAPI methods
}
/// <summary>Gets or sets the result type.</summary>
public Type ResultType { get; set; }
}
}
|
mit
|
C#
|
357c49d8c8d1f45bcea3fae6fb15f0e8d47cc647
|
Remove locks in PointWriter
|
davidaramant/buddhabrot,davidaramant/buddhabrot
|
src/Buddhabrot/Points/PointWriter.cs
|
src/Buddhabrot/Points/PointWriter.cs
|
using System.Collections.Generic;
using System.IO;
using Buddhabrot.Core;
using Buddhabrot.Extensions;
using log4net;
namespace Buddhabrot.Points
{
sealed class PointWriter
{
private static readonly ILog Log = LogManager.GetLogger(nameof(PointWriter));
private readonly string _filePath;
public PointWriter(string filePath)
{
_filePath = filePath;
}
public void Save(FComplex point)
{
using (var stream = File.Open(_filePath, FileMode.Append))
using (var writer = new BinaryWriter(stream))
{
writer.WriteComplex(point);
Log.Info("Wrote a point!");
}
}
public void Save(IEnumerable<FComplex> points)
{
using (var stream = File.Open(_filePath, FileMode.Append))
using (var writer = new BinaryWriter(stream))
{
int count = 0;
foreach (var point in points)
{
writer.WriteComplex(point);
count++;
}
Log.Info($"Wrote {count} points!");
}
}
}
}
|
using System.Collections.Generic;
using System.IO;
using Buddhabrot.Core;
using Buddhabrot.Extensions;
using log4net;
namespace Buddhabrot.Points
{
sealed class PointWriter
{
private static readonly ILog Log = LogManager.GetLogger(nameof(PointWriter));
private readonly object _fileLock = new object();
private readonly string _filePath;
public PointWriter(string filePath)
{
_filePath = filePath;
}
public void Save(FComplex point)
{
lock (_fileLock)
{
using (var stream = File.Open(_filePath, FileMode.Append))
using (var writer = new BinaryWriter(stream))
{
writer.WriteComplex(point);
Log.Info("Wrote a point!");
}
}
}
public void Save(IEnumerable<FComplex> points)
{
lock (_fileLock)
{
using (var stream = File.Open(_filePath, FileMode.Append))
using (var writer = new BinaryWriter(stream))
{
int count = 0;
foreach (var point in points)
{
writer.WriteComplex(point);
count++;
}
Log.Info($"Wrote {count} points!");
}
}
}
}
}
|
bsd-2-clause
|
C#
|
6ff3f73aa4d0537164dee170164dc89bec9594ee
|
fix dir for net core
|
NServiceBusSqlPersistence/NServiceBus.SqlPersistence
|
src/SqlPersistence/ScriptLocation.cs
|
src/SqlPersistence/ScriptLocation.cs
|
using System;
using System.IO;
using System.Reflection;
using NServiceBus;
static class ScriptLocation
{
public static string FindScriptDirectory(SqlDialect dialect)
{
var codeBase = Assembly.GetEntryAssembly().CodeBase;
var currentDirectory = Directory.GetParent(new Uri(codeBase).LocalPath).FullName;
return Path.Combine(currentDirectory, "NServiceBus.Persistence.Sql", dialect.Name);
}
public static void ValidateScriptExists(string createScript)
{
if (!File.Exists(createScript))
{
throw new Exception($"Expected '{createScript}' to exist. It is possible it was not deployed with the endpoint or NServiceBus.Persistence.Sql.MsBuild nuget was not included in the project.");
}
}
}
|
using System;
using System.IO;
using System.Reflection;
using NServiceBus;
static class ScriptLocation
{
public static string FindScriptDirectory(SqlDialect dialect)
{
var codeBase = Assembly.GetExecutingAssembly().CodeBase;
var currentDirectory = Directory.GetParent(new Uri(codeBase).LocalPath).FullName;
return Path.Combine(currentDirectory, "NServiceBus.Persistence.Sql", dialect.Name);
}
public static void ValidateScriptExists(string createScript)
{
if (!File.Exists(createScript))
{
throw new Exception($"Expected '{createScript}' to exist. It is possible it was not deployed with the endpoint or NServiceBus.Persistence.Sql.MsBuild nuget was not included in the project.");
}
}
}
|
mit
|
C#
|
e2c0681287b096e25e0e428c3bf39ca7613230b4
|
Add problem function (with IsMacroType=true)
|
Excel-DNA/Samples
|
RtdArrayTest/TestFunctions.cs
|
RtdArrayTest/TestFunctions.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using ExcelDna.Integration;
namespace RtdArrayTest
{
public static class TestFunctions
{
public static object RtdArrayTest(string prefix)
{
object rtdValue = XlCall.RTD("RtdArrayTest.TestRtdServer", null, prefix);
var resultString = rtdValue as string;
if (resultString == null)
return rtdValue;
// We have a string value, parse and return as an 2x1 array
var parts = resultString.Split(';');
Debug.Assert(parts.Length == 2);
var result = new object[2, 1];
result[0, 0] = parts[0];
result[1, 0] = parts[1];
return result;
}
// NOTE: This is that problem case discussed in https://groups.google.com/d/topic/exceldna/62cgmRMVtfQ/discussion
// It seems that the DisconnectData will not be called on updates triggered by parameters from the sheet
// for RTD functions that are marked IsMacroType=true.
[ExcelFunction(IsMacroType=true)]
public static object RtdArrayTestMT(string prefix)
{
object rtdValue = XlCall.RTD("RtdArrayTest.TestRtdServer", null, "X" + prefix);
var resultString = rtdValue as string;
if (resultString == null)
return rtdValue;
// We have a string value, parse and return as an 2x1 array
var parts = resultString.Split(';');
Debug.Assert(parts.Length == 2);
var result = new object[2, 1];
result[0, 0] = parts[0];
result[1, 0] = parts[1];
return result;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using ExcelDna.Integration;
namespace RtdArrayTest
{
public static class TestFunctions
{
public static object RtdArrayTest(string prefix)
{
object rtdValue = XlCall.RTD("RtdArrayTest.TestRtdServer", null, prefix);
var resultString = rtdValue as string;
if (resultString == null)
return rtdValue;
// We have a string value, parse and return as an 2x1 array
var parts = resultString.Split(';');
Debug.Assert(parts.Length == 2);
var result = new object[2, 1];
result[0, 0] = parts[0];
result[1, 0] = parts[1];
return result;
}
}
}
|
mit
|
C#
|
30ee8ae5977f688ed9937a36c4394288a3599865
|
Fix issue with Dispatcher not initializing queue
|
rit-sse-mycroft/core
|
Mycroft/Dispatcher.cs
|
Mycroft/Dispatcher.cs
|
using Mycroft.Cmd;
using Mycroft.Server;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mycroft
{
public class Dispatcher
{
private ConcurrentQueue<Command> DispatchQueue;
private TcpServer Server;
public Dispatcher(TcpServer server)
{
Server = server;
DispatchQueue = new ConcurrentQueue<Command>();
}
public void Run()
{
Command currentCmd;
while (true)
{
if (DispatchQueue.TryDequeue(out currentCmd))
{
// Issue all the commands o/
Server.Issue(currentCmd);
}
}
}
public void Enqueue(Command cmd)
{
DispatchQueue.Enqueue(cmd);
}
}
}
|
using Mycroft.Cmd;
using Mycroft.Server;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mycroft
{
public class Dispatcher
{
private ConcurrentQueue<Command> DispatchQueue;
private TcpServer Server;
public Dispatcher(TcpServer server)
{
Server = server;
}
public void Run()
{
Command currentCmd;
while (true)
{
if (DispatchQueue.TryDequeue(out currentCmd))
{
// Issue all the commands o/
Server.Issue(currentCmd);
}
}
}
public void Enqueue(Command cmd)
{
DispatchQueue.Enqueue(cmd);
}
}
}
|
bsd-3-clause
|
C#
|
be63103bccf5cb78c1e0ea0f4b66a03e0710684e
|
rename the picture to logo
|
YangEricLiu/Pop,YangEricLiu/Pop
|
src/Web/WebHost/Model/DeviceModel.cs
|
src/Web/WebHost/Model/DeviceModel.cs
|
namespace SE.DSP.Pop.Web.WebHost.Model
{
public class DeviceModel : BaseHierarchyModel
{
public string Factory { get; set; }
public string Description { get; set; }
public long? GatewayId { get; set; }
public LogoModel Logo { get; set; }
}
}
|
namespace SE.DSP.Pop.Web.WebHost.Model
{
public class DeviceModel : BaseHierarchyModel
{
public string Factory { get; set; }
public string Description { get; set; }
public long? GatewayId { get; set; }
public LogoModel Picture { get; set; }
}
}
|
apache-2.0
|
C#
|
02ea0fa5667c4b84e8a32da72bae0507ce953745
|
Use transform.Find instead of deprecated transform.FindChild
|
lealeelu/Fungus,snozbot/fungus,inarizushi/Fungus,FungusGames/Fungus
|
Assets/Tests/Narrative/PortraitFlipTest.cs
|
Assets/Tests/Narrative/PortraitFlipTest.cs
|
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using System.Collections;
public class PortraitFlipTest : MonoBehaviour {
void Update ()
{
Transform t = gameObject.transform.Find("Canvas/JohnCharacter");
if (t == null)
{
return;
}
if (t.transform.localScale.x != -1f)
{
IntegrationTest.Fail("Character object not flipped horizontally");
}
}
}
|
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
using System.Collections;
public class PortraitFlipTest : MonoBehaviour {
void Update ()
{
Transform t = gameObject.transform.FindChild("Canvas/JohnCharacter");
if (t == null)
{
return;
}
if (t.transform.localScale.x != -1f)
{
IntegrationTest.Fail("Character object not flipped horizontally");
}
}
}
|
mit
|
C#
|
b29a4904cbf067ad0dadaa0e0a6d0a2717b555f0
|
Remove old UI IDs from android sample
|
durandt/Xamarin.Auth,xamarin/Xamarin.Auth,severino32/Xamarin.Auth,xamarin/Xamarin.Auth,YoupHulsebos/Xamarin.Auth,nachocove/Xamarin.Auth,xamarin/Xamarin.Auth,ofetisov/Xamarin.Auth,LoQIStar/Xamarin.Auth,jorik041/Xamarin.Auth,dbelcher/Xamarin.Auth
|
samples/Xamarin.Auth.Sample.Android/Resources/Resource.designer.cs
|
samples/Xamarin.Auth.Sample.Android/Resources/Resource.designer.cs
|
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Xamarin.Auth.Sample.Android
{
public partial class Resource
{
public partial class Attribute
{
private Attribute()
{
}
}
public partial class Drawable
{
// aapt resource value: 0x7f020000
public const int Icon = 2130837504;
private Drawable()
{
}
}
public partial class Id
{
// aapt resource value: 0x7f050000
public const int FacebookButton = 2131034112;
// aapt resource value: 0x7f050001
public const int FacebookTextView = 2131034113;
private Id()
{
}
}
public partial class Layout
{
// aapt resource value: 0x7f030000
public const int Main = 2130903040;
private Layout()
{
}
}
public partial class String
{
// aapt resource value: 0x7f040001
public const int Facebook = 2130968577;
// aapt resource value: 0x7f040000
public const int app_name = 2130968576;
private String()
{
}
}
}
}
|
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Xamarin.Auth.Sample.Android
{
public partial class Resource
{
public partial class Attribute
{
private Attribute()
{
}
}
public partial class Drawable
{
// aapt resource value: 0x7f020000
public const int Icon = 2130837504;
private Drawable()
{
}
}
public partial class Id
{
// aapt resource value: 0x7f050000
public const int FacebookButton = 2131034112;
// aapt resource value: 0x7f050001
public const int FacebookTextView = 2131034113;
// aapt resource value: 0x7f050002
public const int SkydriveButton = 2131034114;
// aapt resource value: 0x7f050003
public const int SkydriveTextView = 2131034115;
private Id()
{
}
}
public partial class Layout
{
// aapt resource value: 0x7f030000
public const int Main = 2130903040;
private Layout()
{
}
}
public partial class String
{
// aapt resource value: 0x7f040001
public const int Facebook = 2130968577;
// aapt resource value: 0x7f040002
public const int Skydrive = 2130968578;
// aapt resource value: 0x7f040000
public const int app_name = 2130968576;
private String()
{
}
}
}
}
|
apache-2.0
|
C#
|
a34c7a5d3afc10b3716aacf9c6b2874bf3178787
|
Add LookupIsoCodeModel.GetExactLanguageMatch()
|
glasseyes/libpalaso,tombogle/libpalaso,gmartin7/libpalaso,gtryus/libpalaso,JohnThomson/libpalaso,mccarthyrb/libpalaso,chrisvire/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,darcywong00/libpalaso,ddaspit/libpalaso,andrew-polk/libpalaso,marksvc/libpalaso,JohnThomson/libpalaso,hatton/libpalaso,gmartin7/libpalaso,ddaspit/libpalaso,hatton/libpalaso,glasseyes/libpalaso,JohnThomson/libpalaso,darcywong00/libpalaso,tombogle/libpalaso,darcywong00/libpalaso,sillsdev/libpalaso,mccarthyrb/libpalaso,chrisvire/libpalaso,hatton/libpalaso,JohnThomson/libpalaso,gtryus/libpalaso,gmartin7/libpalaso,marksvc/libpalaso,ermshiperete/libpalaso,ddaspit/libpalaso,chrisvire/libpalaso,andrew-polk/libpalaso,ermshiperete/libpalaso,gtryus/libpalaso,marksvc/libpalaso,ddaspit/libpalaso,andrew-polk/libpalaso,chrisvire/libpalaso,andrew-polk/libpalaso,sillsdev/libpalaso,ermshiperete/libpalaso,sillsdev/libpalaso,gmartin7/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,sillsdev/libpalaso,ermshiperete/libpalaso,mccarthyrb/libpalaso,hatton/libpalaso,gtryus/libpalaso
|
PalasoUIWindowsForms/WritingSystems/LookupISOCodeModel.cs
|
PalasoUIWindowsForms/WritingSystems/LookupISOCodeModel.cs
|
using System.Collections.Generic;
using System.Linq;
using Palaso.WritingSystems;
namespace Palaso.UI.WindowsForms.WritingSystems
{
///<summary>
/// Basically just handles selecting from likely options, based on what you type
///</summary>
public class LookupIsoCodeModel
{
private readonly IList<Iso639LanguageCode> _languageCodes;
public LookupIsoCodeModel()
{
_languageCodes = StandardTags.ValidIso639LanguageCodes;
}
/// <summary>
/// Maybe this doesn't belong here... using it in Bloom which is more concerned with language than writing system
/// </summary>
/// <param name="iso639Code"></param>
/// <returns></returns>
public Iso639LanguageCode GetExactLanguageMatch(string iso639Code)
{
iso639Code = iso639Code.ToLowerInvariant();
return _languageCodes.FirstOrDefault(
code => code.Code.ToLowerInvariant() == iso639Code
);
}
public IEnumerable<Iso639LanguageCode> GetMatchingWritingSystems(string typedText)
{
/* This works, but the results are satisfactory yet (they could be with some enancement to the matcher
We would need it to favor exact prefix matches... currently an exact match could be several items down the list.
var d = new ApproximateMatcher.GetStringDelegate<WritingSystemDefinition.Iso639LanguageCode>(c => c.Name);
var languages = ApproximateMatcher.FindClosestForms(_languageCodes, d, s, ApproximateMatcherOptions.IncludePrefixedAndNextClosestForms);
*/
typedText = typedText.ToLowerInvariant();
foreach (Iso639LanguageCode lang in _languageCodes)
{
if (string.IsNullOrEmpty(typedText) // in which case, show all of them
|| (lang.Code.ToLowerInvariant().StartsWith(typedText)
|| lang.Name.ToLowerInvariant().StartsWith(typedText)))
{
yield return lang;
}
}
}
}
}
|
using System.Collections.Generic;
using Palaso.WritingSystems;
namespace Palaso.UI.WindowsForms.WritingSystems
{
///<summary>
/// Basically just handles selecting from likely options, based on what you type
///</summary>
public class LookupIsoCodeModel
{
private readonly IList<Iso639LanguageCode> _languageCodes;
public LookupIsoCodeModel()
{
_languageCodes = StandardTags.ValidIso639LanguageCodes;
}
public IEnumerable<Iso639LanguageCode> GetMatchingWritingSystems(string typedText)
{
/* This works, but the results are satisfactory yet (they could be with some enancement to the matcher
We would need it to favor exact prefix matches... currently an exact match could be several items down the list.
var d = new ApproximateMatcher.GetStringDelegate<WritingSystemDefinition.Iso639LanguageCode>(c => c.Name);
var languages = ApproximateMatcher.FindClosestForms(_languageCodes, d, s, ApproximateMatcherOptions.IncludePrefixedAndNextClosestForms);
*/
typedText = typedText.ToLowerInvariant();
foreach (Iso639LanguageCode lang in _languageCodes)
{
if (string.IsNullOrEmpty(typedText) // in which case, show all of them
|| (lang.Code.ToLowerInvariant().StartsWith(typedText)
|| lang.Name.ToLowerInvariant().StartsWith(typedText)))
{
yield return lang;
}
}
}
}
}
|
mit
|
C#
|
043d3c99e3a1b9ab3e65f30a0b5f7248c3c812c1
|
Make RdKafka.Offset fields const
|
bjornicus/confluent-kafka-dotnet,MrGlenThomas/confluent-kafka-dotnet,treziac/confluent-kafka-dotnet,bjornicus/confluent-kafka-dotnet,MaximGurschi/rdkafka-dotnet,MrGlenThomas/confluent-kafka-dotnet,ah-/rdkafka-dotnet,treziac/confluent-kafka-dotnet
|
src/RdKafka/Offset.cs
|
src/RdKafka/Offset.cs
|
namespace RdKafka
{
public static class Offset
{
/// <summary>
/// Start consuming from beginning of kafka partition queue: oldest msg
/// </summary>
public const long Beginning = -2;
/// <summary>
/// Start consuming from end of kafka partition queue: next msg
/// </summary>
public const long End = -1;
/// <summary>
/// Start consuming from offset retrieved from offset store
/// </summary>
public const long Stored = -1000;
/// <summary>
/// Invalid offset
/// </summary>
public const long Invalid = -1001;
}
}
|
namespace RdKafka
{
public static class Offset
{
/// <summary>
/// Start consuming from beginning of kafka partition queue: oldest msg
/// </summary>
public static long Beginning = -2;
/// <summary>
/// Start consuming from end of kafka partition queue: next msg
/// </summary>
public static long End = -1;
/// <summary>
/// Start consuming from offset retrieved from offset store
/// </summary>
public static long Stored = -1000;
/// <summary>
/// Invalid offset
/// </summary>
public static long Invalid = -1001;
}
}
|
apache-2.0
|
C#
|
53ed864513ca058343d7d49a7b5ed200c5a2240a
|
Add test description and fix param order in Assert call
|
jacobdufault/fullserializer,zodsoft/fullserializer,nuverian/fullserializer,Ksubaka/fullserializer,lazlo-bonin/fullserializer,caiguihou/myprj_02,jacobdufault/fullserializer,karlgluck/fullserializer,shadowmint/fullserializer,jagt/fullserializer,shadowmint/fullserializer,jacobdufault/fullserializer,darress/fullserializer,jagt/fullserializer,Ksubaka/fullserializer,Ksubaka/fullserializer,shadowmint/fullserializer,jagt/fullserializer
|
Testing/Editor/InitialInstanceTests.cs
|
Testing/Editor/InitialInstanceTests.cs
|
using NUnit.Framework;
namespace FullSerializer.Tests.InitialInstance {
public class SimpleModel {
public int A;
}
public class InitialInstanceTests {
[Test]
public void TestPopulateObject() {
// This test verifies that when we pass in an existing object
// instance that same instance is used to deserialize into, ie,
// we can do the equivalent of Json.NET's PopulateObject
SimpleModel model1 = new SimpleModel { A = 3 };
fsData data;
var serializer = new fsSerializer();
Assert.IsTrue(serializer.TrySerialize(model1, out data).Succeeded);
model1.A = 1;
SimpleModel model2 = model1;
Assert.AreEqual(1, model1.A);
Assert.AreEqual(1, model2.A);
Assert.IsTrue(serializer.TryDeserialize(data, ref model2).Succeeded);
Assert.AreEqual(3, model1.A);
Assert.AreEqual(3, model2.A);
Assert.IsTrue(ReferenceEquals(model1, model2));
}
}
}
|
using NUnit.Framework;
namespace FullSerializer.Tests.InitialInstance {
public class SimpleModel {
public int A;
}
public class InitialInstanceTests {
[Test]
public void TestInitialInstance() {
SimpleModel model1 = new SimpleModel { A = 3 };
fsData data;
var serializer = new fsSerializer();
Assert.IsTrue(serializer.TrySerialize(model1, out data).Succeeded);
model1.A = 1;
SimpleModel model2 = model1;
Assert.IsTrue(serializer.TryDeserialize(data, ref model2).Succeeded);
Assert.AreEqual(model1.A, 3);
Assert.AreEqual(model2.A, 3);
Assert.IsTrue(ReferenceEquals(model1, model2));
}
}
}
|
mit
|
C#
|
796a6aeecb1a297144999d5951cda9ff50b11152
|
Comment fix.
|
MindscapeHQ/raygun4net,ddunkin/raygun4net,nelsonsar/raygun4net,ddunkin/raygun4net,tdiehl/raygun4net,articulate/raygun4net,MindscapeHQ/raygun4net,nelsonsar/raygun4net,articulate/raygun4net,MindscapeHQ/raygun4net,tdiehl/raygun4net
|
Mindscape.Raygun4Net/IRaygunApplication.cs
|
Mindscape.Raygun4Net/IRaygunApplication.cs
|
namespace Mindscape.Raygun4Net
{
/// <summary>
/// This is used by the HttpModule to generate RaygunClients. If you wish to use the HttpModule but need to make customizations
/// to the RaygunClient, then implement this interface with your HttpApplication.
/// </summary>
public interface IRaygunApplication
{
/// <summary>
/// This is called by the HttpModule to get a customised RaygunClient.
/// </summary>
RaygunClient GenerateRaygunClient();
}
}
|
namespace Mindscape.Raygun4Net
{
/// <summary>
/// This is used by the HttpModule to generate RaygunClients. If you wish to
/// use it then, implement this interface with your HttpApplication.
/// </summary>
public interface IRaygunApplication
{
/// <summary>
/// This is called by the HttpModule to get a customised RaygunClient.
/// </summary>
RaygunClient GenerateRaygunClient();
}
}
|
mit
|
C#
|
c7e0fd68417d637bcc6a86731e98f8201091d4b7
|
Use `var`
|
12joan/hangman
|
table.cs
|
table.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Hangman {
public class Table {
public int Width;
public int Spacing;
public Row[] Rows;
public Table(int width, int spacing, Row[] rows) {
Width = width;
Spacing = spacing;
Rows = rows;
}
public string Draw() {
return String.Join("\n", Lines());
}
public string[] Lines() {
var rowTexts = new List<string>();
foreach (var row in Rows) {
rowTexts.Add(row.Text);
}
return rowTexts.ToArray();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace Hangman {
public class Table {
public int Width;
public int Spacing;
public Row[] Rows;
public Table(int width, int spacing, Row[] rows) {
Width = width;
Spacing = spacing;
Rows = rows;
}
public string Draw() {
return String.Join("\n", Lines());
}
public string[] Lines() {
List<string> rowTexts = new List<string>();
foreach (var row in Rows) {
rowTexts.Add(row.Text);
}
return rowTexts.ToArray();
}
}
}
|
unlicense
|
C#
|
d43741127af82d2c875e4f1af5ac50060befaa1f
|
make hosting file optional
|
0xFireball/PenguinUpload,0xFireball/PenguinUpload,0xFireball/PenguinUpload,0xFireball/PenguinUpload
|
PenguinUpload/src/PenguinUpload/Program.cs
|
PenguinUpload/src/PenguinUpload/Program.cs
|
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
namespace PenguinUpload
{
public class Program
{
public static void Main(string[] args)
{
// Load PenguinUpload Config
if (File.Exists(PenguinUploadRegistry.ConfigFileName))
{
var configFileContents = File.ReadAllText(PenguinUploadRegistry.ConfigFileName);
JsonConvert.PopulateObject(configFileContents, PenguinUploadRegistry.Configuration);
}
// Load ASP.NET Core web app
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "hosting.json"), true)
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
|
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
namespace PenguinUpload
{
public class Program
{
public static void Main(string[] args)
{
// Load PenguinUpload Config
if (File.Exists(PenguinUploadRegistry.ConfigFileName))
{
var configFileContents = File.ReadAllText(PenguinUploadRegistry.ConfigFileName);
JsonConvert.PopulateObject(configFileContents, PenguinUploadRegistry.Configuration);
}
// Load ASP.NET Core web app
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "hosting.json"))
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
|
apache-2.0
|
C#
|
4e1b2c87d7c0975406bf0692ebbbcb9200feb2f2
|
Change assembly version from 2.0.0.0 to 2.0.*
|
arthurrump/Zermelo.API
|
Zermelo.API/Properties/AssemblyInfo.cs
|
Zermelo.API/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("Zermelo.API")]
[assembly: AssemblyDescription("Connect to Zermelo from your .NET app")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Zermelo.API")]
[assembly: AssemblyCopyright("Copyright 2016 Arthur Rump")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// Make internal classes and functions available for testing
[assembly: InternalsVisibleTo("Zermelo.API.Tests")]
|
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("Zermelo.API")]
[assembly: AssemblyDescription("Connect to Zermelo from your .NET app")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Zermelo.API")]
[assembly: AssemblyCopyright("Copyright 2016 Arthur Rump")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// Make internal classes and functions available for testing
[assembly: InternalsVisibleTo("Zermelo.API.Tests")]
|
mit
|
C#
|
9fe0ccf79deb3a78318ad8814ea6344b01020703
|
Use empty stopwords set when the default stopwords file is missing.
|
anderscui/jieba.NET
|
src/Analyser/KeywordExtractor.cs
|
src/Analyser/KeywordExtractor.cs
|
using System.Collections.Generic;
using System.IO;
namespace JiebaNet.Analyser
{
public abstract class KeywordExtractor
{
protected static readonly List<string> DefaultStopWords = new List<string>()
{
"the", "of", "is", "and", "to", "in", "that", "we", "for", "an", "are",
"by", "be", "as", "on", "with", "can", "if", "from", "which", "you", "it",
"this", "then", "at", "have", "all", "not", "one", "has", "or", "that"
};
protected virtual ISet<string> StopWords { get; set; }
public void SetStopWords(string stopWordsFile)
{
StopWords = new HashSet<string>();
var path = Path.GetFullPath(stopWordsFile);
if (File.Exists(path))
{
var lines = File.ReadAllLines(path);
foreach (var line in lines)
{
StopWords.Add(line.Trim());
}
}
}
public abstract IEnumerable<string> ExtractTags(string text, int count = 20, IEnumerable<string> allowPos = null);
public abstract IEnumerable<WordWeightPair> ExtractTagsWithWeight(string text, int count = 20, IEnumerable<string> allowPos = null);
}
}
|
using System.Collections.Generic;
using System.IO;
namespace JiebaNet.Analyser
{
public abstract class KeywordExtractor
{
protected static readonly List<string> DefaultStopWords = new List<string>()
{
"the", "of", "is", "and", "to", "in", "that", "we", "for", "an", "are",
"by", "be", "as", "on", "with", "can", "if", "from", "which", "you", "it",
"this", "then", "at", "have", "all", "not", "one", "has", "or", "that"
};
protected virtual ISet<string> StopWords { get; set; }
public void SetStopWords(string stopWordsFile)
{
var path = Path.GetFullPath(stopWordsFile);
if (File.Exists(path))
{
var lines = File.ReadAllLines(path);
StopWords = new HashSet<string>();
foreach (var line in lines)
{
StopWords.Add(line.Trim());
}
}
}
public abstract IEnumerable<string> ExtractTags(string text, int count = 20, IEnumerable<string> allowPos = null);
public abstract IEnumerable<WordWeightPair> ExtractTagsWithWeight(string text, int count = 20, IEnumerable<string> allowPos = null);
}
}
|
mit
|
C#
|
fabacd2f311b7d85c76c806fe55a7fd99dd64ea3
|
Update ValuesController.cs
|
cayodonatti/TopGearApi
|
TopGearApi/Controllers/ValuesController.cs
|
TopGearApi/Controllers/ValuesController.cs
|
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace TopGearApi.Controllers
{
public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
public string Get(int id)
{
return "value";
}
// POST api/values
public void Post([FromBody]string value)
{
}
// PUT api/values/5
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
public void Delete(int id)
{
}
[HttpGet]
[Route("Test")]
public IEnumerable<string> Obter()
{
return new List<string { "teste1", "teste2 " };
}
}
}
|
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace TopGearApi.Controllers
{
public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
public string Get(int id)
{
return "value";
}
// POST api/values
public void Post([FromBody]string value)
{
}
// PUT api/values/5
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
public void Delete(int id)
{
}
[HttpGet]
[Route("Test")]
public Object Obter()
{
return new { ab = "teste1", cd = "teste2 " };
}
}
}
|
mit
|
C#
|
8e21f1cd345f0ffbcfcd5e7c22f30beb0f2f452a
|
Fix up InternalsVisibleTo to new name
|
octokit/octokit.net,cH40z-Lord/octokit.net,Sarmad93/octokit.net,SLdragon1989/octokit.net,thedillonb/octokit.net,editor-tools/octokit.net,octokit-net-test-org/octokit.net,kdolan/octokit.net,shiftkey/octokit.net,rlugojr/octokit.net,TattsGroup/octokit.net,shiftkey-tester/octokit.net,thedillonb/octokit.net,M-Zuber/octokit.net,khellang/octokit.net,daukantas/octokit.net,dampir/octokit.net,shana/octokit.net,adamralph/octokit.net,shiftkey-tester/octokit.net,Red-Folder/octokit.net,octokit-net-test-org/octokit.net,alfhenrik/octokit.net,fffej/octokit.net,dampir/octokit.net,nsrnnnnn/octokit.net,michaKFromParis/octokit.net,dlsteuer/octokit.net,SamTheDev/octokit.net,magoswiat/octokit.net,kolbasov/octokit.net,editor-tools/octokit.net,SmithAndr/octokit.net,SamTheDev/octokit.net,brramos/octokit.net,khellang/octokit.net,gdziadkiewicz/octokit.net,yonglehou/octokit.net,M-Zuber/octokit.net,hitesh97/octokit.net,mminns/octokit.net,chunkychode/octokit.net,naveensrinivasan/octokit.net,Sarmad93/octokit.net,TattsGroup/octokit.net,ivandrofly/octokit.net,nsnnnnrn/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,ivandrofly/octokit.net,gabrielweyer/octokit.net,eriawan/octokit.net,darrelmiller/octokit.net,bslliw/octokit.net,geek0r/octokit.net,octokit/octokit.net,mminns/octokit.net,yonglehou/octokit.net,octokit-net-test/octokit.net,shiftkey/octokit.net,fake-organization/octokit.net,hahmed/octokit.net,gdziadkiewicz/octokit.net,devkhan/octokit.net,devkhan/octokit.net,gabrielweyer/octokit.net,takumikub/octokit.net,rlugojr/octokit.net,forki/octokit.net,alfhenrik/octokit.net,shana/octokit.net,hahmed/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,chunkychode/octokit.net,eriawan/octokit.net,ChrisMissal/octokit.net,SmithAndr/octokit.net
|
SolutionInfo.cs
|
SolutionInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion(SolutionInfo.Version + ".0")]
[assembly: AssemblyInformationalVersion(SolutionInfo.Version)]
[assembly: AssemblyFileVersion(SolutionInfo.Version + ".0")]
[assembly: ComVisible(false)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GitHub")]
[assembly: AssemblyProduct("Octokit")]
[assembly: AssemblyCopyright("Copyright GitHub 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("Octokit.Tests")]
[assembly: InternalsVisibleTo("Octokit.Tests-NetCore45")]
[assembly: CLSCompliant(false)]
class SolutionInfo
{
public const string Version = "0.1.0";
}
|
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion(SolutionInfo.Version + ".0")]
[assembly: AssemblyInformationalVersion(SolutionInfo.Version)]
[assembly: AssemblyFileVersion(SolutionInfo.Version + ".0")]
[assembly: ComVisible(false)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GitHub")]
[assembly: AssemblyProduct("Octokit")]
[assembly: AssemblyCopyright("Copyright GitHub 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("Octokit.Tests")]
[assembly: InternalsVisibleTo("OctokitRT.Tests")]
[assembly: CLSCompliant(false)]
class SolutionInfo
{
public const string Version = "0.1.0";
}
|
mit
|
C#
|
b32ff16a8691b2b06cb7a493fda810d53e1229b1
|
add analyze ILoopStatement when elide await
|
BigBabay/AsyncConverter,BigBabay/AsyncConverter
|
AsyncConverter/AsyncHelpers/AwaitElideChecker/AwaitElideChecker.cs
|
AsyncConverter/AsyncHelpers/AwaitElideChecker/AwaitElideChecker.cs
|
using JetBrains.Annotations;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.CSharp.Util;
namespace AsyncConverter.AsyncHelpers.AwaitElideChecker
{
[SolutionComponent]
internal class AwaitElideChecker : IAwaitElideChecker
{
public bool MayBeElided(IAwaitExpression element)
{
var statement = element.Parent as ICSharpStatement;
if (statement != null
&& IsFinalStatement(statement)
&& statement.GetContainingNode<IUsingStatement>() == null
&& statement.GetContainingNode<ITryStatement>() == null
&& statement.GetContainingNode<ILoopStatement>() == null)
return true;
var arrowExpressionClause = element.Parent as IArrowExpressionClause;
if (arrowExpressionClause != null)
return true;
var lambdaExpression = element.Parent as ILambdaExpression;
if (lambdaExpression != null)
return true;
return false;
}
private bool IsFinalStatement([NotNull]ICSharpStatement statement)
{
while (statement.GetNextStatement() == null)
{
if (statement == null)
{
return true;
}
statement = statement.GetContainingStatement();
}
return false;
}
}
}
|
using JetBrains.Annotations;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.CSharp.Util;
namespace AsyncConverter.AsyncHelpers.AwaitElideChecker
{
[SolutionComponent]
internal class AwaitElideChecker : IAwaitElideChecker
{
public bool MayBeElided(IAwaitExpression element)
{
var statement = element.Parent as ICSharpStatement;
if (statement != null
&& IsFinalStatement(statement)
&& statement.GetContainingNode<IUsingStatement>() == null
&& statement.GetContainingNode<ITryStatement>() == null)
return true;
var arrowExpressionClause = element.Parent as IArrowExpressionClause;
if (arrowExpressionClause != null)
return true;
var lambdaExpression = element.Parent as ILambdaExpression;
if (lambdaExpression != null)
return true;
return false;
}
private bool IsFinalStatement([NotNull]ICSharpStatement statement)
{
while (statement.GetNextStatement() == null)
{
if (statement == null)
{
return true;
}
statement = statement.GetContainingStatement();
}
return false;
}
}
}
|
mit
|
C#
|
3c417dc59e4fc1c80f650fac831766a6b21e3753
|
Split time delay in between high and low states for a more even pulse
|
benbrandt22/PBJJ,benbrandt22/PBJJ,benbrandt22/PBJJ
|
PBJJ/Core/CarriageStepperMotor.cs
|
PBJJ/Core/CarriageStepperMotor.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Devices.Gpio;
namespace PBJJ.Core
{
public class CarriageStepperMotor
{
private readonly Stopwatch _sw;
public CarriageStepperMotor()
{
this._sw = new System.Diagnostics.Stopwatch();
}
/// <summary>
/// Moves the stepper by the specified number of steps.
/// Negative values go in reverse direction.
/// </summary>
public void MoveSteps(int steps, IProgress<int> progress, double stepPeriodMilliseconds = 1)
{
if (steps == 0) { return; }
int directionMultiplier;
if (steps > 0)
{
// forward
directionMultiplier = 1;
GpioConnections.StepperDirectionPin.Write(GpioPinValue.High);
}
else
{
// reverse
directionMultiplier = -1;
GpioConnections.StepperDirectionPin.Write(GpioPinValue.Low);
}
for (int i = 0; i < Math.Abs(steps); i++)
{
// easydriver steps for every low-to-high transition
GpioConnections.StepperStepPin.Write(GpioPinValue.Low);
ShortDelay(stepPeriodMilliseconds / 2);
GpioConnections.StepperStepPin.Write(GpioPinValue.High);
ShortDelay(stepPeriodMilliseconds / 2);
progress?.Report(directionMultiplier * (i + 1));
}
}
private void ShortDelay(double milliseconds)
{
_sw.Start();
while ((_sw.Elapsed).TotalMilliseconds < milliseconds) { }
_sw.Reset();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Devices.Gpio;
namespace PBJJ.Core
{
public class CarriageStepperMotor
{
private readonly Stopwatch _sw;
public CarriageStepperMotor()
{
this._sw = new System.Diagnostics.Stopwatch();
}
/// <summary>
/// Moves the stepper by the specified number of steps.
/// Negative values go in reverse direction.
/// </summary>
public void MoveSteps(int steps, IProgress<int> progress, double stepPeriodMilliseconds = 1)
{
if (steps == 0) { return; }
int directionMultiplier;
if (steps > 0)
{
// forward
directionMultiplier = 1;
GpioConnections.StepperDirectionPin.Write(GpioPinValue.High);
}
else
{
// reverse
directionMultiplier = -1;
GpioConnections.StepperDirectionPin.Write(GpioPinValue.Low);
}
for (int i = 0; i < Math.Abs(steps); i++)
{
// easydriver steps for every low-to-high transition
GpioConnections.StepperStepPin.Write(GpioPinValue.Low);
GpioConnections.StepperStepPin.Write(GpioPinValue.High);
_sw.Start();
while ((_sw.Elapsed).TotalMilliseconds < stepPeriodMilliseconds) { }
_sw.Reset();
progress?.Report(directionMultiplier * (i + 1));
}
}
}
}
|
mit
|
C#
|
a9c574ae9b46099905be5f444479e24185bbd82d
|
Improve xmldoc for SerialCollectionDefinition.
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Tests/XunitConfiguration/SerialCollectionDefinition.cs
|
WalletWasabi.Tests/XunitConfiguration/SerialCollectionDefinition.cs
|
using Xunit;
namespace WalletWasabi.Tests.XunitConfiguration
{
/// <summary>
/// The tests in a test collection denoted using this collection definition are time-sensitive, therefore the test collection is run in a special way:
/// Parallel-capable test collections will be run first (in parallel), followed by parallel-disabled test collections (run sequentially) like this one.
/// </summary>
/// <remarks>This class has no code, and is never created. Its purpose is simply to be the place to apply <see cref="CollectionDefinitionAttribute"/>.</remarks>
/// <seealso href="https://xunit.net/docs/shared-context#collection-fixture"/>
/// <seealso href="https://xunit.net/docs/running-tests-in-parallel.html#parallelism-in-test-frameworks"/>
[CollectionDefinition("Serial unit tests collection", DisableParallelization = true)]
public class SerialCollectionDefinition
{
}
}
|
using Xunit;
namespace WalletWasabi.Tests.XunitConfiguration
{
/// <summary>
/// This class has no code, and is never created. Its purpose is simply
// to be the place to apply [CollectionDefinition].
/// </summary>
/// <seealso href="https://xunit.net/docs/shared-context#collection-fixture"/>
[CollectionDefinition("Serial unit tests collection", DisableParallelization = true)]
public class SerialCollectionDefinition
{
}
}
|
mit
|
C#
|
a91c32a5e7a1156850d30dd8999cd282426b3865
|
Fix PDA ID light (#9938)
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
|
Content.Shared/PDA/SharedPDASystem.cs
|
Content.Shared/PDA/SharedPDASystem.cs
|
using Content.Shared.Access.Components;
using Content.Shared.Containers.ItemSlots;
using Robust.Shared.Containers;
namespace Content.Shared.PDA
{
public abstract class SharedPDASystem : EntitySystem
{
[Dependency] protected readonly ItemSlotsSystem ItemSlotsSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PDAComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<PDAComponent, ComponentRemove>(OnComponentRemove);
SubscribeLocalEvent<PDAComponent, EntInsertedIntoContainerMessage>(OnItemInserted);
SubscribeLocalEvent<PDAComponent, EntRemovedFromContainerMessage>(OnItemRemoved);
}
protected virtual void OnComponentInit(EntityUid uid, PDAComponent pda, ComponentInit args)
{
if (pda.IdCard != null)
pda.IdSlot.StartingItem = pda.IdCard;
ItemSlotsSystem.AddItemSlot(uid, PDAComponent.PDAIdSlotId, pda.IdSlot);
ItemSlotsSystem.AddItemSlot(uid, PDAComponent.PDAPenSlotId, pda.PenSlot);
UpdatePDAAppearance(pda);
}
private void OnComponentRemove(EntityUid uid, PDAComponent pda, ComponentRemove args)
{
ItemSlotsSystem.RemoveItemSlot(uid, pda.IdSlot);
ItemSlotsSystem.RemoveItemSlot(uid, pda.PenSlot);
}
protected virtual void OnItemInserted(EntityUid uid, PDAComponent pda, EntInsertedIntoContainerMessage args)
{
if (args.Container.ID == PDAComponent.PDAIdSlotId)
pda.ContainedID = CompOrNull<IdCardComponent>(args.Entity);
UpdatePDAAppearance(pda);
}
protected virtual void OnItemRemoved(EntityUid uid, PDAComponent pda, EntRemovedFromContainerMessage args)
{
if (args.Container.ID == pda.IdSlot.ID)
pda.ContainedID = null;
UpdatePDAAppearance(pda);
}
private void UpdatePDAAppearance(PDAComponent pda)
{
if (TryComp(pda.Owner, out AppearanceComponent ? appearance))
appearance.SetData(PDAVisuals.IDCardInserted, pda.ContainedID != null);
}
}
}
|
using Content.Shared.Access.Components;
using Content.Shared.Containers.ItemSlots;
using Robust.Shared.Containers;
namespace Content.Shared.PDA
{
public abstract class SharedPDASystem : EntitySystem
{
[Dependency] protected readonly ItemSlotsSystem ItemSlotsSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PDAComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<PDAComponent, ComponentRemove>(OnComponentRemove);
SubscribeLocalEvent<PDAComponent, EntInsertedIntoContainerMessage>(OnItemInserted);
SubscribeLocalEvent<PDAComponent, EntRemovedFromContainerMessage>(OnItemRemoved);
}
protected virtual void OnComponentInit(EntityUid uid, PDAComponent pda, ComponentInit args)
{
if (pda.IdCard != null)
pda.IdSlot.StartingItem = pda.IdCard;
ItemSlotsSystem.AddItemSlot(uid, PDAComponent.PDAIdSlotId, pda.IdSlot);
ItemSlotsSystem.AddItemSlot(uid, PDAComponent.PDAPenSlotId, pda.PenSlot);
UpdatePDAAppearance(pda);
}
private void OnComponentRemove(EntityUid uid, PDAComponent pda, ComponentRemove args)
{
ItemSlotsSystem.RemoveItemSlot(uid, pda.IdSlot);
ItemSlotsSystem.RemoveItemSlot(uid, pda.PenSlot);
}
protected virtual void OnItemInserted(EntityUid uid, PDAComponent pda, EntInsertedIntoContainerMessage args)
{
if (!pda.Initialized) return;
if (args.Container.ID == pda.IdSlot.ID)
pda.ContainedID = CompOrNull<IdCardComponent>(args.Entity);
UpdatePDAAppearance(pda);
}
protected virtual void OnItemRemoved(EntityUid uid, PDAComponent pda, EntRemovedFromContainerMessage args)
{
if (args.Container.ID == pda.IdSlot.ID)
pda.ContainedID = null;
UpdatePDAAppearance(pda);
}
private void UpdatePDAAppearance(PDAComponent pda)
{
if (TryComp(pda.Owner, out AppearanceComponent ? appearance))
appearance.SetData(PDAVisuals.IDCardInserted, pda.ContainedID != null);
}
}
}
|
mit
|
C#
|
f958b33ca9b570c67a7aa3980c699107f170e60d
|
Bump version to 0.4.3
|
NJAldwin/Pequot
|
Pequot/Properties/AssemblyInfo.cs
|
Pequot/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Pequot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Shaken Software")]
[assembly: AssemblyProduct("Pequot")]
[assembly: AssemblyCopyright("©2009-2011 Shaken Software")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("83e5cf5c-13c9-4367-b1be-e9574b2e4680")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.4.3.*")]
[assembly: AssemblyFileVersion("0.4.3.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Pequot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Shaken Software")]
[assembly: AssemblyProduct("Pequot")]
[assembly: AssemblyCopyright("©2009-2011 Shaken Software")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("83e5cf5c-13c9-4367-b1be-e9574b2e4680")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.4.2.*")]
[assembly: AssemblyFileVersion("0.4.2.0")]
|
mit
|
C#
|
725b6e35d6f6deaf508e098216771d89b91597b4
|
change image display size
|
marieeriksson/Ecommerce,marieeriksson/Ecommerce,marieeriksson/Ecommerce
|
Ecommerce/Views/Products/Index.cshtml
|
Ecommerce/Views/Products/Index.cshtml
|
@model List<Ecommerce.Models.ProductsViewModel>
@{
ViewBag.Title = "All Records";
}
<h2>All Records</h2>
@foreach (var record in Model)
{
<img src="@Url.Content("~/Content/" + record.ImgUrl)" alt="@record.Title" width="100" />
<a href="/products/details/@(record.Id)">@(record.Title)</a> <br />
}
|
@model List<Ecommerce.Models.ProductsViewModel>
@{
ViewBag.Title = "All Records";
}
<h2>All Records</h2>
@foreach (var record in Model)
{
<img src="@Url.Content("~/Content/" + record.ImgUrl)" alt="@record.Title" />
<a href="/products/details/@(record.Id)">@(record.Title)</a> <br />
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.