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
6424b01e89fb4c7444b38ed2a1052b67ebd8718c
Create test fixture for Contact class
SICU-Stress-Measurement-System/frontend-cs
StressMeasurementSystem.Tests/Models/ContactTest.cs
StressMeasurementSystem.Tests/Models/ContactTest.cs
using NUnit.Framework; namespace StressMeasurementSystem.Tests.Models { [TestFixture] public class ContactTest { } }
apache-2.0
C#
7a78e45a4ee7ada6291c0f0d2e60b2c556fc77bd
Add a Task extension to handle timeouts
alexandrnikitin/CircuitBreaker.Net,alexandrnikitin/CircuitBreaker.Net
src/CircuitBreaker.Net/TaskExtensions.cs
src/CircuitBreaker.Net/TaskExtensions.cs
using System; using System.Threading; using System.Threading.Tasks; namespace CircuitBreaker.Net { // The following code is taken from "Crafting a Task.TimeoutAfter Method" post by Joe Hoag // http://blogs.msdn.com/b/pfxteam/archive/2011/11/10/10235834.aspx public static class TaskExtensions { public static Task TimeoutAfter(this Task task, int millisecondsTimeout) { // Short-circuit #1: infinite timeout or task already completed if (task.IsCompleted || (millisecondsTimeout == Timeout.Infinite)) { // Either the task has already completed or timeout will never occur. // No proxy necessary. return task; } // tcs.Task will be returned as a proxy to the caller TaskCompletionSource<VoidTypeStruct> tcs = new TaskCompletionSource<VoidTypeStruct>(); // Short-circuit #2: zero timeout if (millisecondsTimeout == 0) { // We've already timed out. tcs.SetException(new TimeoutException()); return tcs.Task; } // Set up a timer to complete after the specified timeout period Timer timer = new Timer( state => { // Recover your state information var myTcs = (TaskCompletionSource<VoidTypeStruct>)state; // Fault our proxy with a TimeoutException myTcs.TrySetException(new TimeoutException()); }, tcs, millisecondsTimeout, Timeout.Infinite); // Wire up the logic for what happens when source task completes task.ContinueWith( (antecedent, state) => { // Recover our state data var tuple = (Tuple<Timer, TaskCompletionSource<VoidTypeStruct>>)state; // Cancel the Timer tuple.Item1.Dispose(); // Marshal results to proxy MarshalTaskResults(antecedent, tuple.Item2); }, Tuple.Create(timer, tcs), CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default); return tcs.Task; } internal struct VoidTypeStruct { } internal static void MarshalTaskResults<TResult>( Task source, TaskCompletionSource<TResult> proxy) { switch (source.Status) { case TaskStatus.Faulted: proxy.TrySetException(source.Exception); break; case TaskStatus.Canceled: proxy.TrySetCanceled(); break; case TaskStatus.RanToCompletion: Task<TResult> castedSource = source as Task<TResult>; proxy.TrySetResult( castedSource == null ? default(TResult) : // source is a Task castedSource.Result); // source is a Task<TResult> break; } } } }
mit
C#
95d183e9b86f0b060f5f8dc9fa42ac86df6577d7
add a mock websocket implementation
Mazyod/PhoenixSharp
PhoenixTests/WebSocketImpl/MockWebSocket.cs
PhoenixTests/WebSocketImpl/MockWebSocket.cs
using Phoenix; using System.Collections.Generic; namespace PhoenixTests { public sealed class MockWebsocketAdapter : IWebsocket { public readonly WebsocketConfiguration config; public MockWebsocketAdapter(WebsocketConfiguration config) { this.config = config; } #region IWebsocket methods public WebsocketState state => mockState; public WebsocketState mockState = WebsocketState.Closed; public int callConnectCount = 0; public void Connect() { callConnectCount += 1; } public List<string> callSend = new(); public void Send(string message) { callSend.Add(message); } public int callCloseCount = 0; public void Close(ushort? code = null, string message = null) { callCloseCount += 1; } #endregion } public sealed class MockWebsocketFactory : IWebsocketFactory { public IWebsocket Build(WebsocketConfiguration config) => new MockWebsocketAdapter(config); } }
mit
C#
6a7e5992f4541ba55599d9543109e56c287c6689
add C# implementation for stack datastructure
ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms
data_structures/Stack/CSharp/Stack.cs
data_structures/Stack/CSharp/Stack.cs
using System; namespace data_structures.Stack.CSharp { public class Stack { private int _indexRunner; private object[] _storage; private const int LAST_INDEX = -1; public Stack(int length) { _indexRunner = LAST_INDEX; _storage = new object[length]; } public void Push(object obj) { if (_indexRunner == _storage.Length - 1) { throw new OverflowException("stack is overflow"); } _storage[++_indexRunner] = obj; } public object Pop() { if (_indexRunner == LAST_INDEX) { throw new OverflowException("nothing in stack right now"); } return _storage[_indexRunner--]; } public int Size() => _indexRunner + 1; } }
cc0-1.0
C#
e72b78859a1f54df797d97b0b34572ec4aaacc6b
add forgotten file with repeatable transactions
tiltom/PV247-Expense-manager,tiltom/PV247-Expense-manager,tiltom/PV247-Expense-manager
ExpenseManager/ExpenseManager.Web/Views/Home/UpdateRepeatable.cshtml
ExpenseManager/ExpenseManager.Web/Views/Home/UpdateRepeatable.cshtml
@{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title></title> </head> <body> <div> </div> </body> </html>
mit
C#
5a3bec2ce2a75eeca5e2db2f5965c96f00fe4d64
Create GradientTextureMaker.cs
UnityCommunity/UnityLibrary
Assets/Scripts/Texture/GradientTextureMaker.cs
Assets/Scripts/Texture/GradientTextureMaker.cs
// returns gradient Texture2D (size=256x1) using UnityEngine; namespace UnityLibrary { public static class GradientTextureMaker { const int width = 256; const int height = 1; public static Texture2D Create(Color[] colors, TextureWrapMode textureWrapMode = TextureWrapMode.Clamp, FilterMode filterMode = FilterMode.Point, bool isLinear = false, bool hasMipMap = false) { if (colors == null || colors.Length == 0) { Debug.LogError("No colors assigned"); return null; } int length = colors.Length; if (colors.Length > 8) { Debug.LogWarning("Too many colors! maximum is 8, assigned: " + colors.Length); length = 8; } // build gradient from colors var colorKeys = new GradientColorKey[length]; var alphaKeys = new GradientAlphaKey[length]; float steps = length - 1f; for (int i = 0; i < length; i++) { float step = i / steps; colorKeys[i].color = colors[i]; colorKeys[i].time = step; alphaKeys[i].alpha = colors[i].a; alphaKeys[i].time = step; } // create gradient Gradient gradient = new Gradient(); gradient.SetKeys(colorKeys, alphaKeys); // create texture Texture2D outputTex = new Texture2D(width, height, TextureFormat.ARGB32, false, isLinear); outputTex.wrapMode = textureWrapMode; outputTex.filterMode = filterMode; // draw texture for (int i = 0; i < width; i++) { outputTex.SetPixel(i, 0, gradient.Evaluate((float)i / (float)width)); } outputTex.Apply(false); return outputTex; } // BuildGradientTexture } // class } // namespcae
mit
C#
ffce697a8fd52c20bc11ea562e9675b69b5d67e7
Add InstituteMappings
denismaster/dcs,denismaster/dcs,denismaster/dcs,denismaster/dcs
src/Diploms.Services/Institutes/InstitutesMappings.cs
src/Diploms.Services/Institutes/InstitutesMappings.cs
using AutoMapper; using Diploms.Core; using Diploms.Dto.Institutes; namespace Diploms.Services.Institutes { public class InstitutesMappings : Profile { public InstitutesMappings() { CreateMap<InstituteEditDto, Institute>(); CreateMap<Institute, InstituteEditDto>(); } } }
mit
C#
d6e3214cdbf569e3b39fbd68890392a44d94255b
Add Filters
ValeriyH/training,ValeriyH/training,ValeriyH/training,ValeriyH/training,ValeriyH/training
WebAPI/WebAPI/Filters/TestFilter.cs
WebAPI/WebAPI/Filters/TestFilter.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Http.Controllers; using System.Web.Http.Filters; namespace WebAPI.Filters { public class TestFilterAttribute : ActionFilterAttribute { public override void OnActionExecuting(HttpActionContext actionContext) { var test = actionContext; //if (actionContext.ActionArguments["shift"] != 0) //{ // actionContext.ActionArguments["id"] = actionContext.ActionArguments["shift"]; //} } } }
mit
C#
3c36447ec8baac8d6f59b88b005900dab63a7098
Create IDoorAction.cs
MercedeX/StrangeStateMachineExample
IDoorAction.cs
IDoorAction.cs
namespace Domain { public interface IDoorAction { void Open(); void Close(); void Lock(); void Unlock(); } }
apache-2.0
C#
ba97010062f6a2794e04a3810430c7c0f63ebdbe
Create Command.cs
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
src/Core2D/ViewModels/Command.cs
src/Core2D/ViewModels/Command.cs
using System; using System.Windows.Input; namespace Core2D.ViewModels { public class Command : ICommand { private readonly Action _execute; private readonly Func<bool> _canExecute; public event EventHandler? CanExecuteChanged; public Command(Action execute, Func<bool>? canExecute = null) { _execute = execute; _canExecute = canExecute ?? (() => true); } public bool CanExecute(object? parameter) { return _canExecute.Invoke(); } public void Execute(object? parameter) { _execute.Invoke(); } } public class Command<T> : ICommand { private readonly Action<T?> _execute; private readonly Func<T?, bool> _canExecute; public event EventHandler? CanExecuteChanged; public Command(Action<T?> execute, Func<T?, bool>? canExecute = null) { _execute = execute; _canExecute = canExecute ?? (_ => true); } public bool CanExecute(object? parameter) { return _canExecute.Invoke((T?)parameter); } public void Execute(object? parameter) { _execute.Invoke((T?)parameter); } } }
mit
C#
5895f615cb83572920a9bb44679c9d2cd1faf92c
Create Singleton.cs
gmich/Gem
Gem.Network/Singleton.cs
Gem.Network/Singleton.cs
public class Singleton<T> : Singleton { static T instance; /// <summary>The singleton instance for the specified type T. Only one instance (at the time) of this object for each type of T.</summary> public static T Instance { get { return instance; } set { instance = value; AllSingletons[typeof(T)] = value; } } } /// <summary> /// Provides a singleton list for a certain type. /// </summary> /// <typeparam name="T">The type of list to store.</typeparam> public class SingletonList<T> : Singleton<IList<T>> { static SingletonList() { Singleton<IList<T>>.Instance = new List<T>(); } /// <summary>The singleton instance for the specified type T. Only one instance (at the time) of this list for each type of T.</summary> public new static IList<T> Instance { get { return Singleton<IList<T>>.Instance; } } } /// <summary> /// Provides a singleton dictionary for a certain key and vlaue type. /// </summary> /// <typeparam name="TKey">The type of key.</typeparam> /// <typeparam name="TValue">The type of value.</typeparam> public class SingletonDictionary<TKey, TValue> : Singleton<IDictionary<TKey, TValue>> { static SingletonDictionary() { Singleton<Dictionary<TKey, TValue>>.Instance = new Dictionary<TKey, TValue>(); } /// <summary>The singleton instance for the specified type T. Only one instance (at the time) of this dictionary for each type of T.</summary> public new static IDictionary<TKey, TValue> Instance { get { return Singleton<Dictionary<TKey, TValue>>.Instance; } } } /// <summary> /// Provides access to all "singletons" stored by <see cref="Singleton{T}"/>. /// </summary> public class Singleton { static Singleton() { allSingletons = new Dictionary<Type, object>(); } static readonly IDictionary<Type, object> allSingletons; /// <summary>Dictionary of type to singleton instances.</summary> public static IDictionary<Type, object> AllSingletons { get { return allSingletons; } } }
mit
C#
ba3be146dd39ba3dd78e39ba51954fce9a417ec3
add claims
josealencar/Aritter,josealencar/Aritter,josealencar/Aritter,josealencar/Aritter,josealencar/Aritter,arsouza/Aritter,aritters/Ritter,arsouza/Aritter
src/Aritter.API/Core/Filters/IdentityBasicAuthenticationAttribute.cs
src/Aritter.API/Core/Filters/IdentityBasicAuthenticationAttribute.cs
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using System; using System.Collections.Generic; using System.Security.Claims; using System.Security.Principal; using System.Threading; using System.Threading.Tasks; namespace Aritter.API.Core.Filters { public class IdentityBasicAuthenticationAttribute : BasicAuthenticationAttribute { protected override async Task<IPrincipal> AuthenticateAsync(string userName, string password, CancellationToken cancellationToken) { UserManager<IdentityUser> userManager = CreateUserManager(); cancellationToken.ThrowIfCancellationRequested(); // Unfortunately, UserManager doesn't support CancellationTokens. IdentityUser user = await userManager.FindAsync(userName, password); if (user == null) { // No user with userName/password exists. return null; } // Create a ClaimsIdentity with all the claims for this user. cancellationToken.ThrowIfCancellationRequested(); // Unfortunately, IClaimsIdenityFactory doesn't support CancellationTokens. var claims = new List<Claim>(); claims.Add(new Claim(ClaimTypes.Name, "Brock")); claims.Add(new Claim(ClaimTypes.Email, "brockallen@gmail.com")); var id = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie); ClaimsIdentity identity = await userManager.ClaimsIdentityFactory.CreateAsync(userManager, user, "Basic"); return new ClaimsPrincipal(identity); } private static UserManager<IdentityUser> CreateUserManager() { throw new NotImplementedException(); //return new UserManager<IdentityUser>(new UserStore<IdentityUser>(new UsersDbContext())); } } }
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using System; using System.Security.Claims; using System.Security.Principal; using System.Threading; using System.Threading.Tasks; namespace Aritter.API.Core.Filters { public class IdentityBasicAuthenticationAttribute : BasicAuthenticationAttribute { protected override async Task<IPrincipal> AuthenticateAsync(string userName, string password, CancellationToken cancellationToken) { UserManager<IdentityUser> userManager = CreateUserManager(); cancellationToken.ThrowIfCancellationRequested(); // Unfortunately, UserManager doesn't support CancellationTokens. IdentityUser user = await userManager.FindAsync(userName, password); if (user == null) { // No user with userName/password exists. return null; } // Create a ClaimsIdentity with all the claims for this user. cancellationToken.ThrowIfCancellationRequested(); // Unfortunately, IClaimsIdenityFactory doesn't support CancellationTokens. ClaimsIdentity identity = await userManager.ClaimsIdentityFactory.CreateAsync(userManager, user, "Basic"); return new ClaimsPrincipal(identity); } private static UserManager<IdentityUser> CreateUserManager() { throw new NotImplementedException(); //return new UserManager<IdentityUser>(new UserStore<IdentityUser>(new UsersDbContext())); } } }
mit
C#
badb9a4564e43f55e26a6e4d8f4b0ab662b7fe55
return binary data with MVC
djMax/AlienForce
Utilities/Web/BinaryContentResult.cs
Utilities/Web/BinaryContentResult.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.Mvc; using ICSharpCode.SharpZipLib.GZip; namespace AlienForce.Utilities.Web { /// <summary> /// A content result which can accept binart data and will write to the output /// stream. If GZip is set to true the content will be GZipped and the relevant /// header added to the response HTTP Headers /// /// Courtesy: http://weblogs.asp.net/andrewrea/archive/2010/02/16/a-binarycontentresult-for-asp-net-mvc.aspx /// </summary> public class BinaryContentResult : ActionResult { /// <summary> /// Construct an empty binary content result /// </summary> public BinaryContentResult() { } /// <summary> /// Construct a binary content result from a mime blob. /// </summary> /// <param name="data"></param> /// <param name="contentType"></param> public BinaryContentResult(byte[] data, string contentType) { Data = data; Headers["Content-Type"] = contentType; } private Dictionary<string, string> _Headers; public Dictionary<string, string> Headers { get { if (_Headers == null) { _Headers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); } return _Headers; } } public byte[] Data { get; set; } public bool Gzip { get; set; } public override void ExecuteResult(ControllerContext context) { if (_Headers != null) { foreach (var kv in Headers) { context.HttpContext.Response.AddHeader(kv.Key, kv.Value); } } if (Gzip) { using (var os = new GZipOutputStream(context.HttpContext.Response.OutputStream)) { os.Write(Data, 0, Data.Length); } context.HttpContext.Response.AddHeader("Content-Encoding", "gzip"); } else { context.HttpContext.Response.BinaryWrite(Data); } context.HttpContext.Response.End(); } } }
mit
C#
5634800720418e6101b7bb604165bef4368bac6d
Create Howl.cs
SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming
Kattis-Solutions/Howl.cs
Kattis-Solutions/Howl.cs
using System; namespace Howl { class Program { static void Main(string[] args) { String s = Console.ReadLine(); if (s.Substring(s.Length - 1, 1) == "W") { s += "H"; } else if (s.Substring(s.Length - 1, 1) == "O") { s += "W"; } else if (s.Substring(s.Length - 1, 1) == "H") { s += "O"; } Console.WriteLine(s); } } }
mit
C#
4c0ac28c229d05b31c0970f985bf4aded5743341
Create int.cs
FrostCat/nefarious-octo-spork
int.cs
int.cs
using External; namespace Intermediate { public class Int { public string GetExt() { ext e = new ext(); return e.thing(); } } }
mit
C#
389920276e55c39432e97e5302d81014ddac8108
Add sample class with implementation of IComparable<>
caronyan/CSharpRecipe
CSharpRecipe/Recipe.ClassAndGeneric/ComparableImpl.cs
CSharpRecipe/Recipe.ClassAndGeneric/ComparableImpl.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Recipe.ClassAndGeneric { /// <summary> /// Simple class that implements IComparable<> /// </summary> public class Square : IComparable<Square> { public Square() { } public Square(int height, int width) { this.Height = height; this.Width = width; } public int Height { get; set; } public int Width { get; set; } public int CompareTo(object obj) { Square square = obj as Square; if (square != null) { return CompareTo(square); } throw new ArgumentException("Both objects being compared must be of type Square"); } public override string ToString() => ($"Height:{this.Height} Width:{this.Width}"); public override bool Equals(object obj) { if (obj == null) { return false; } Square square = obj as Square; if (square != null) { return this.Height == square.Height; } return false; } public override int GetHashCode() { return this.Height.GetHashCode() | this.Width.GetHashCode(); } public static bool operator ==(Square x, Square y) => x.Equals(y); public static bool operator !=(Square x, Square y) => !(x == y); public static bool operator >(Square x, Square y) => (x.CompareTo(y) < 0); public static bool operator <(Square x, Square y) => (x.CompareTo(y) > 0); public int CompareTo(Square other) { long area1 = this.Height * this.Width; long area2 = other.Height * other.Width; if (area1 == area2) { return 0; } else if (area1 > area2) { return 1; } else if (area2 > area1) { return -1; } else { return -1; } } } }
mit
C#
239befb49851ac9d37c39f7b7798ba4322c9e4e0
Create MathExtensions.cs
AOmelaienko/Camila.ArrayUtils
MathExtensions.cs
MathExtensions.cs
using System.Collections.Generic; using System.Linq; namespace Camila { public static class MathExtensions { public static int Product ( this IEnumerable<int> Enumeration ) { return Enumeration.Aggregate ( 1, ( seed, element ) => seed * element ); } } }
mit
C#
0bcd9252651f04aa5fb278383404a6b70997f2fb
Create GfxEditor.cs
bonimy/MushROMs
Snes/GfxEditor.cs
Snes/GfxEditor.cs
using System; using System.Collections.Generic; using System.Text; using Helper; namespace Snes { public class GfxEditor { /// <summary> /// The raw, unformatted GFX data. /// </summary> /// <remarks> /// This array contains just the data with no information about formatting. It can be converted to any format (1BPP, 2BPP NES, 4BPP SNES, 8BPP Mode7, etc.). The idea is that whenever we need to get a selection of data (e.g. the range of tiles to draw in the GUI, or a selection of tiles to -for example- rotate 90 degrees), we pass the selection info, and return an array of formatted GFX data. /// </remarks> private byte[] Data { get; set; } private interface IGfxSelection { int StartIndex { get; } GraphicsFormat GraphicsFormat { get; } } } }
agpl-3.0
C#
27f48dca99fe43ef513fc82e52300c125160aa09
Add class to auto-activate touch controls.
cmilr/Unity2D-Components,jguarShark/Unity2D-Components
Camera/AutoEnableTouchControls.cs
Camera/AutoEnableTouchControls.cs
using UnityEngine; using UnityEngine.Assertions; [ExecuteInEditMode] public class AutoEnableTouchControls : BaseBehaviour { private GameObject canvasGo; private GameObject eventSystem; void Start() { canvasGo = gameObject.transform.Find("Canvas").gameObject; Assert.IsNotNull(canvasGo); eventSystem = gameObject.transform.Find("EventSystem").gameObject; Assert.IsNotNull(eventSystem); #if UNITY_STANDALONE canvasGo.SetActive(false); eventSystem.SetActive(false); #endif #if UNITY_IOS canvasGo.SetActive(true); eventSystem.SetActive(true); #endif } }
mit
C#
bd32ec38375263f6b1a77a1a0757c032d8f0f2b3
Add basic test for RouteValueEqualityComparer.Equals(...). (#883)
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
test/Microsoft.AspNetCore.Routing.Tests/RouteValueEqualityComparerTest.cs
test/Microsoft.AspNetCore.Routing.Tests/RouteValueEqualityComparerTest.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 Xunit; namespace Microsoft.AspNetCore.Routing { public class RouteValueEqualityComparerTest { private readonly RouteValueEqualityComparer _comparer; public RouteValueEqualityComparerTest() { _comparer = new RouteValueEqualityComparer(); } [Theory] [InlineData(5, 7, false)] [InlineData("foo", "foo", true)] [InlineData("foo", "FoO", true)] [InlineData("foo", "boo", false)] [InlineData("7", 7, true)] [InlineData(7, "7", true)] [InlineData(5.7d, 5.7d, true)] [InlineData(null, null, true)] [InlineData(null, "foo", false)] [InlineData("foo", null, false)] [InlineData(null, "", true)] [InlineData("", null, true)] [InlineData("", "", true)] [InlineData("", "foo", false)] [InlineData("foo", "", false)] [InlineData(true, true, true)] [InlineData(true, false, false)] public void EqualsTest(object x, object y, bool expected) { var actual = _comparer.Equals(x, y); Assert.Equal(expected, actual); } } }
apache-2.0
C#
f13a1f0e059011fdd544489e727f015c84afa036
test PO generator
rdio/vernacular,dsuess/vernacular,dsuess/vernacular,rdio/vernacular,benoitjadinon/vernacular,StephaneDelcroix/vernacular,mightea/vernacular,mightea/vernacular,StephaneDelcroix/vernacular,gabornemeth/vernacular,gabornemeth/vernacular,benoitjadinon/vernacular
Vernacular.Test/GeneratorTests.cs
Vernacular.Test/GeneratorTests.cs
// // GeneratorTests.cs // // Author: // Aaron Bockover <abock@rd.io> // // Copyright 2012 Rdio, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Collections.Generic; using NUnit.Framework; using Vernacular.Tool; using Vernacular.Generators; namespace Vernacular.Test { [TestFixture] public class GeneratorTests { [Test] public void TestPoGenerator () { var generator = new PoGenerator (); foreach (var unit in ParserTests.ParseAssembly ()) { generator.Add (unit); } generator.Generate ("../../Catalog/en_US.pot"); } } }
mit
C#
eb831876324c14cdae58a0451133004cd99171ec
Add Datasource(3rd?
tobyclh/UnityCNTK,tobyclh/UnityCNTK
Assets/UnityCNTK/Scripts/DataSource.cs
Assets/UnityCNTK/Scripts/DataSource.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using System; using UnityEngine.Assertions; using CNTK; namespace UnityCNTK { public class DataSource : MonoBehaviour { public enum PredefinedSource { none, pos, rot, quat, velocity, acceleration, camera, custom } public PredefinedSource pSource; public delegate Value getData(); public getData GetData; private new Transform transform; private Rigidbody rb; private CNTKManager manager; public int width; public int height; private Texture2D dummyTexture; private RenderTexture renderTexture; private Camera cam; private Rect rect; void Start() { transform = base.transform; switch (pSource) { case PredefinedSource.pos: { GetData = new getData(() => transform.position.ToValue(CNTKManager.device)); break; } case PredefinedSource.rot: { GetData = new getData(() => transform.rotation.eulerAngles.ToValue(CNTKManager.device)); break; } case PredefinedSource.quat: { GetData = new getData(() => transform.rotation.ToValue(CNTKManager.device)); break; } case PredefinedSource.velocity: { rb = GetComponent<Rigidbody>(); if (rb == null) { throw new MissingComponentException("Missing Rigidbody"); } GetData = new getData(() => rb.velocity.ToValue(CNTKManager.device)); break; } case PredefinedSource.camera: { cam = GetComponent<Camera>(); if (cam == null) { throw new MissingComponentException("Missing Camera"); } rect = new Rect(0, 0, width, height); dummyTexture = new Texture2D(width, height); GetData = new getData(()=> { cam.targetTexture = renderTexture; cam.Render(); dummyTexture.ReadPixels(rect, 0, 0, false); return dummyTexture.ToValue(CNTKManager.device); }); break; } default: { Debug.Log("Predefined source not set"); break; } } } } }
mit
C#
85d38e8f4a8934aab03c2d6d97df0eec0f83fe54
Add an extension method to the worksheet
jeffgbutler/delete_your_for_loops,jeffgbutler/delete_your_for_loops,jeffgbutler/delete_your_for_loops
csharp/ScriptBuilder/WorksheetExtensions.cs
csharp/ScriptBuilder/WorksheetExtensions.cs
using OfficeOpenXml; public static class WorksheetExtensions { public static string[,] ToStringArray(this ExcelWorksheet sheet) { string[,] answer = new string[sheet.Dimension.Rows, sheet.Dimension.Columns]; for (var rowNumber = 1; rowNumber <= sheet.Dimension.Rows; rowNumber++) { for (var columnNumber = 1; columnNumber <= sheet.Dimension.Columns; columnNumber++) { var cell = sheet.Cells[rowNumber, columnNumber].Value; if (cell == null) { answer[rowNumber -1, columnNumber -1] = ""; } else { answer[rowNumber - 1, columnNumber - 1] = cell.ToString(); } } } return answer; } }
mit
C#
973fef8ec5bdfe1bf63dd4fc43a6dabd83ac80ab
Create EnumerableExtensions.cs
keith-hall/Extensions,keith-hall/Extensions
src/EnumerableExtensions.cs
src/EnumerableExtensions.cs
public static EnumerableExtensions { public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng) { // http://stackoverflow.com/questions/1287567/is-using-random-and-orderby-a-good-shuffle-algorithm T[] elements = source.ToArray(); for (int i = elements.Length - 1; i >= 0; i--) { // Swap element "i" with a random earlier element it (or itself) // ... except we don't really need to swap it fully, as we can // return it immediately, and afterwards it's irrelevant. int swapIndex = rng.Next(i + 1); yield return elements[swapIndex]; elements[swapIndex] = elements[i]; } } } }
apache-2.0
C#
889b8ff0491cb963b44695e745473bd31003f8ec
Support for covariance
onurgoker/MvcPaging,martijnboland/MvcPaging,onurgoker/MvcPaging,rippo/MvcPaging,rsaladrigas/MvcPaging
src/MvcPaging/IPagedList.cs
src/MvcPaging/IPagedList.cs
using System.Collections.Generic; namespace MvcPaging { public interface IPagedList { int PageCount { get; } int TotalItemCount { get; } int PageIndex { get; } int PageNumber { get; } int PageSize { get; } bool HasPreviousPage { get; } bool HasNextPage { get; } bool IsFirstPage { get; } bool IsLastPage { get; } int ItemStart { get; } int ItemEnd { get; } } public interface IPagedList<out T> : IPagedList, IEnumerable<T> { } }
using System.Collections.Generic; namespace MvcPaging { public interface IPagedList { int PageCount { get; } int TotalItemCount { get; } int PageIndex { get; } int PageNumber { get; } int PageSize { get; } bool HasPreviousPage { get; } bool HasNextPage { get; } bool IsFirstPage { get; } bool IsLastPage { get; } int ItemStart { get; } int ItemEnd { get; } } public interface IPagedList<T> : IPagedList, IList<T> { } }
mit
C#
00a85400eb83d5a67e4ba581967b5813e057ef7d
Create initial KafkaEndpoint
JasperFx/jasper,JasperFx/jasper,JasperFx/jasper
Jasper.ConfluentKafka/KafkaEndpoint.cs
Jasper.ConfluentKafka/KafkaEndpoint.cs
using System; using System.Collections.Generic; using System.Linq; using Baseline; using Confluent.Kafka; using Jasper.Configuration; using Jasper.ConfluentKafka.Internal; using Jasper.Runtime; using Jasper.Transports; using Jasper.Transports.Sending; using Jasper.Util; namespace Jasper.ConfluentKafka { public class KafkaEndpoint<TKey, TVal> : Endpoint { private const string TopicToken = "stream"; public string TopicName { get; private set; } public ProducerConfig ProducerConfig { get; private set; } internal KafkaTransport<TKey, TVal> Parent { get; set; } public override Uri Uri => BuildUri(); private Uri BuildUri(bool forReply = false) { var list = new List<string>(); if (TopicName.IsNotEmpty()) { list.Add(TopicName); list.Add(TopicName.ToLowerInvariant()); } if (forReply && IsDurable) { list.Add(TransportConstants.Durable); } var uri = $"{KafkaTransport<TKey, TVal>.ProtocolName}://{list.Join("/")}".ToUri(); return uri; } public override Uri ReplyUri() => BuildUri(); public override void Parse(Uri uri) { if (uri.Scheme != KafkaTransport<TKey, TVal>.ProtocolName) { throw new ArgumentOutOfRangeException($"This is not a {nameof(KafkaTransport<TKey, TVal>)} Uri"); } var raw = uri.Segments.Where(x => x != "/").Select(x => x.Trim('/')); var segments = new Queue<string>(); segments.Enqueue(uri.Host); foreach (var segment in raw) { segments.Enqueue(segment); } while (segments.Any()) { if (segments.Peek().EqualsIgnoreCase(TopicToken)) { segments.Dequeue(); // token TopicName = segments.Dequeue(); // value } else if (segments.Peek().EqualsIgnoreCase(TransportConstants.Durable)) { segments.Dequeue(); // token IsDurable = true; } else { throw new InvalidOperationException($"The Uri '{uri}' is invalid for an {nameof(KafkaTransport<TKey, TVal>)} endpoint"); } } } protected internal override void StartListening(IMessagingRoot root, ITransportRuntime runtime) { throw new NotImplementedException(); } protected override ISender CreateSender(IMessagingRoot root) { return new ConfluentKafkaSender<TKey, TVal>(this, Parent, root.TransportLogger, root.Cancellation); } } }
mit
C#
5d43f8f69907191f4ec2a109f43d70dd32267479
Add a CompositeTransition
SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,akrisiun/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Perspex,Perspex/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia
src/Avalonia.Visuals/Animation/CompositeTransition.cs
src/Avalonia.Visuals/Animation/CompositeTransition.cs
using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Avalonia.Metadata; namespace Avalonia.Animation { /// <summary> /// Defines a composite transition that can be used to combine multiple transitions into one. /// </summary> /// <remarks> /// <para> /// Instantiate the <see cref="CompositeTransition" /> in XAML and initialize the /// <see cref="Transitions" /> property in order to have many animations triggered at once. /// For example, you can combine <see cref="CrossFade"/> and <see cref="PageSlide"/>. /// <code> /// <![CDATA[ /// <reactiveUi:RoutedViewHost Router="{Binding Router}"> /// <reactiveUi:RoutedViewHost.PageTransition> /// <CompositeTransition> /// <PageSlide Duration="0.5" /> /// <CrossFade Duration="0.5" /> /// </CompositeTransition> /// </reactiveUi:RoutedViewHost.PageTransition> /// </reactiveUi:RoutedViewHost> /// ]]> /// </code> /// </para> /// </remarks> public class CompositeTransition : IPageTransition { /// <summary> /// Gets or sets the transitions to be executed. Can be defined from XAML. /// </summary> [Content] public List<IPageTransition> Transitions { get; set; } = new List<IPageTransition>(); /// <summary> /// Starts the animation. /// </summary> /// <param name="from"> /// The control that is being transitioned away from. May be null. /// </param> /// <param name="to"> /// The control that is being transitioned to. May be null. /// </param> /// <param name="forward"> /// Defines the direction of the transition. /// </param> /// <returns> /// A <see cref="Task"/> that tracks the progress of the animation. /// </returns> public Task Start(Visual from, Visual to, bool forward) { var transitionTasks = Transitions .Select(transition => transition.Start(from, to, forward)) .ToList(); return Task.WhenAll(transitionTasks); } } }
mit
C#
a5f1e38a3abd6c8c831fc4e29dcee98ab5cfbe62
Fix #51 Added Payments My and Terms
lucasdavid/Gamedalf,lucasdavid/Gamedalf
Gamedalf/Views/Payments/My.cshtml
Gamedalf/Views/Payments/My.cshtml
@model IEnumerable<Payment> @section scripts { @Scripts.Render("~/Scripts/app/ajax/search.js") @Scripts.Render("~/Scripts/app/elements/BtnSubmitter.js") } @Html.Partial("_Search", "/Payments") <div id="list-search"> @Html.Partial("_List", Model) </div>
mit
C#
3543204794b0de6a832d5ba33aeb0ca90ca7f030
Revert "Merge"
Door3Dev/HRI-Umbraco,mstodd/Umbraco-CMS,TimoPerplex/Umbraco-CMS,NikRimington/Umbraco-CMS,timothyleerussell/Umbraco-CMS,m0wo/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,gavinfaux/Umbraco-CMS,countrywide/Umbraco-CMS,gkonings/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,zidad/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,VDBBjorn/Umbraco-CMS,umbraco/Umbraco-CMS,Pyuuma/Umbraco-CMS,AzarinSergey/Umbraco-CMS,bjarnef/Umbraco-CMS,lingxyd/Umbraco-CMS,hfloyd/Umbraco-CMS,Door3Dev/HRI-Umbraco,neilgaietto/Umbraco-CMS,iahdevelop/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,iahdevelop/Umbraco-CMS,romanlytvyn/Umbraco-CMS,mittonp/Umbraco-CMS,Door3Dev/HRI-Umbraco,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS,gkonings/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,lars-erik/Umbraco-CMS,Phosworks/Umbraco-CMS,Khamull/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,engern/Umbraco-CMS,marcemarc/Umbraco-CMS,kasperhhk/Umbraco-CMS,robertjf/Umbraco-CMS,nvisage-gf/Umbraco-CMS,madsoulswe/Umbraco-CMS,dawoe/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,aaronpowell/Umbraco-CMS,tcmorris/Umbraco-CMS,gregoriusxu/Umbraco-CMS,AzarinSergey/Umbraco-CMS,AzarinSergey/Umbraco-CMS,ordepdev/Umbraco-CMS,Tronhus/Umbraco-CMS,NikRimington/Umbraco-CMS,mattbrailsford/Umbraco-CMS,Spijkerboer/Umbraco-CMS,aadfPT/Umbraco-CMS,romanlytvyn/Umbraco-CMS,gregoriusxu/Umbraco-CMS,KevinJump/Umbraco-CMS,lars-erik/Umbraco-CMS,m0wo/Umbraco-CMS,Pyuuma/Umbraco-CMS,markoliver288/Umbraco-CMS,gkonings/Umbraco-CMS,AzarinSergey/Umbraco-CMS,Khamull/Umbraco-CMS,madsoulswe/Umbraco-CMS,lars-erik/Umbraco-CMS,m0wo/Umbraco-CMS,rajendra1809/Umbraco-CMS,mstodd/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,kasperhhk/Umbraco-CMS,aaronpowell/Umbraco-CMS,rasmusfjord/Umbraco-CMS,KevinJump/Umbraco-CMS,nvisage-gf/Umbraco-CMS,qizhiyu/Umbraco-CMS,robertjf/Umbraco-CMS,Door3Dev/HRI-Umbraco,Spijkerboer/Umbraco-CMS,Tronhus/Umbraco-CMS,yannisgu/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,ordepdev/Umbraco-CMS,rajendra1809/Umbraco-CMS,rasmuseeg/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,mittonp/Umbraco-CMS,neilgaietto/Umbraco-CMS,Pyuuma/Umbraco-CMS,ehornbostel/Umbraco-CMS,gregoriusxu/Umbraco-CMS,leekelleher/Umbraco-CMS,lingxyd/Umbraco-CMS,romanlytvyn/Umbraco-CMS,Khamull/Umbraco-CMS,timothyleerussell/Umbraco-CMS,kgiszewski/Umbraco-CMS,rasmusfjord/Umbraco-CMS,arknu/Umbraco-CMS,Tronhus/Umbraco-CMS,arvaris/HRI-Umbraco,sargin48/Umbraco-CMS,gavinfaux/Umbraco-CMS,DaveGreasley/Umbraco-CMS,Spijkerboer/Umbraco-CMS,KevinJump/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,markoliver288/Umbraco-CMS,ehornbostel/Umbraco-CMS,Door3Dev/HRI-Umbraco,zidad/Umbraco-CMS,timothyleerussell/Umbraco-CMS,TimoPerplex/Umbraco-CMS,engern/Umbraco-CMS,Khamull/Umbraco-CMS,abryukhov/Umbraco-CMS,dawoe/Umbraco-CMS,qizhiyu/Umbraco-CMS,arknu/Umbraco-CMS,ordepdev/Umbraco-CMS,abryukhov/Umbraco-CMS,aadfPT/Umbraco-CMS,ehornbostel/Umbraco-CMS,iahdevelop/Umbraco-CMS,rasmuseeg/Umbraco-CMS,rustyswayne/Umbraco-CMS,madsoulswe/Umbraco-CMS,Tronhus/Umbraco-CMS,Phosworks/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,robertjf/Umbraco-CMS,DaveGreasley/Umbraco-CMS,arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,AzarinSergey/Umbraco-CMS,christopherbauer/Umbraco-CMS,jchurchley/Umbraco-CMS,rasmuseeg/Umbraco-CMS,corsjune/Umbraco-CMS,gavinfaux/Umbraco-CMS,zidad/Umbraco-CMS,zidad/Umbraco-CMS,marcemarc/Umbraco-CMS,VDBBjorn/Umbraco-CMS,umbraco/Umbraco-CMS,zidad/Umbraco-CMS,sargin48/Umbraco-CMS,mittonp/Umbraco-CMS,TimoPerplex/Umbraco-CMS,ordepdev/Umbraco-CMS,marcemarc/Umbraco-CMS,yannisgu/Umbraco-CMS,iahdevelop/Umbraco-CMS,rustyswayne/Umbraco-CMS,yannisgu/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,nvisage-gf/Umbraco-CMS,mstodd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,Spijkerboer/Umbraco-CMS,WebCentrum/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,rasmusfjord/Umbraco-CMS,lingxyd/Umbraco-CMS,engern/Umbraco-CMS,kasperhhk/Umbraco-CMS,mittonp/Umbraco-CMS,ordepdev/Umbraco-CMS,WebCentrum/Umbraco-CMS,sargin48/Umbraco-CMS,tcmorris/Umbraco-CMS,robertjf/Umbraco-CMS,neilgaietto/Umbraco-CMS,sargin48/Umbraco-CMS,timothyleerussell/Umbraco-CMS,gavinfaux/Umbraco-CMS,hfloyd/Umbraco-CMS,ehornbostel/Umbraco-CMS,TimoPerplex/Umbraco-CMS,Tronhus/Umbraco-CMS,VDBBjorn/Umbraco-CMS,VDBBjorn/Umbraco-CMS,christopherbauer/Umbraco-CMS,mstodd/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,abryukhov/Umbraco-CMS,base33/Umbraco-CMS,sargin48/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,m0wo/Umbraco-CMS,mattbrailsford/Umbraco-CMS,kasperhhk/Umbraco-CMS,countrywide/Umbraco-CMS,base33/Umbraco-CMS,WebCentrum/Umbraco-CMS,engern/Umbraco-CMS,leekelleher/Umbraco-CMS,lingxyd/Umbraco-CMS,leekelleher/Umbraco-CMS,neilgaietto/Umbraco-CMS,engern/Umbraco-CMS,Phosworks/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,Phosworks/Umbraco-CMS,markoliver288/Umbraco-CMS,tcmorris/Umbraco-CMS,nvisage-gf/Umbraco-CMS,m0wo/Umbraco-CMS,markoliver288/Umbraco-CMS,DaveGreasley/Umbraco-CMS,nvisage-gf/Umbraco-CMS,gkonings/Umbraco-CMS,countrywide/Umbraco-CMS,markoliver288/Umbraco-CMS,mstodd/Umbraco-CMS,rustyswayne/Umbraco-CMS,corsjune/Umbraco-CMS,romanlytvyn/Umbraco-CMS,qizhiyu/Umbraco-CMS,corsjune/Umbraco-CMS,kgiszewski/Umbraco-CMS,rustyswayne/Umbraco-CMS,jchurchley/Umbraco-CMS,NikRimington/Umbraco-CMS,gregoriusxu/Umbraco-CMS,leekelleher/Umbraco-CMS,christopherbauer/Umbraco-CMS,kasperhhk/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,corsjune/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,Pyuuma/Umbraco-CMS,gavinfaux/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,TimoPerplex/Umbraco-CMS,iahdevelop/Umbraco-CMS,qizhiyu/Umbraco-CMS,yannisgu/Umbraco-CMS,umbraco/Umbraco-CMS,gregoriusxu/Umbraco-CMS,hfloyd/Umbraco-CMS,DaveGreasley/Umbraco-CMS,Phosworks/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,tompipe/Umbraco-CMS,lingxyd/Umbraco-CMS,lars-erik/Umbraco-CMS,arvaris/HRI-Umbraco,nul800sebastiaan/Umbraco-CMS,qizhiyu/Umbraco-CMS,jchurchley/Umbraco-CMS,abjerner/Umbraco-CMS,countrywide/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,neilgaietto/Umbraco-CMS,tompipe/Umbraco-CMS,rajendra1809/Umbraco-CMS,rustyswayne/Umbraco-CMS,Khamull/Umbraco-CMS,Spijkerboer/Umbraco-CMS,markoliver288/Umbraco-CMS,arvaris/HRI-Umbraco,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,mittonp/Umbraco-CMS,kgiszewski/Umbraco-CMS,aadfPT/Umbraco-CMS,countrywide/Umbraco-CMS,arknu/Umbraco-CMS,rajendra1809/Umbraco-CMS,aaronpowell/Umbraco-CMS,leekelleher/Umbraco-CMS,christopherbauer/Umbraco-CMS,dawoe/Umbraco-CMS,lars-erik/Umbraco-CMS,yannisgu/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,DaveGreasley/Umbraco-CMS,Pyuuma/Umbraco-CMS,rajendra1809/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,ehornbostel/Umbraco-CMS,bjarnef/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,romanlytvyn/Umbraco-CMS,tompipe/Umbraco-CMS,corsjune/Umbraco-CMS,christopherbauer/Umbraco-CMS,VDBBjorn/Umbraco-CMS,base33/Umbraco-CMS,mattbrailsford/Umbraco-CMS,gkonings/Umbraco-CMS,arvaris/HRI-Umbraco,tcmorris/Umbraco-CMS,rasmusfjord/Umbraco-CMS,timothyleerussell/Umbraco-CMS,rasmusfjord/Umbraco-CMS,bjarnef/Umbraco-CMS
src/Umbraco.Core/Models/Membership/IMembershipUser.cs
src/Umbraco.Core/Models/Membership/IMembershipUser.cs
using System; using System.Collections.Generic; using Umbraco.Core.Models.EntityBase; namespace Umbraco.Core.Models.Membership { public interface IMembershipUser : IAggregateRoot { object ProviderUserKey { get; set; } string Username { get; set; } string Email { get; set; } /// <summary> /// Gets or sets the raw password value /// </summary> string RawPasswordValue { get; set; } string PasswordQuestion { get; set; } /// <summary> /// Gets or sets the raw password answer value /// </summary> string RawPasswordAnswerValue { get; set; } string Comments { get; set; } bool IsApproved { get; set; } bool IsLockedOut { get; set; } DateTime LastLoginDate { get; set; } DateTime LastPasswordChangeDate { get; set; } DateTime LastLockoutDate { get; set; } /// <summary> /// Gets or sets the number of failed password attempts. /// This is the number of times the password was entered incorrectly upon login. /// </summary> /// <remarks> /// Alias: umbracoMemberFailedPasswordAttempts /// Part of the standard properties collection. /// </remarks> int FailedPasswordAttempts { get; set; } //object ProfileId { get; set; } //IEnumerable<object> Groups { get; set; } } }
mit
C#
98b2a216124266eba9d4110cf755710302ee8fdd
Create test.cs
comopra/choirs-submit,comopra/choirs-submit
test.cs
test.cs
import System.Collections;
mit
C#
99209625b02ef9e37dee36684d0b0bf8c4fed65c
Create API.cs
myuulius/omega-kawaii-animeDB,myuulius/omega-kawaii-animeDB
API.cs
API.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using unirest_net; namespace kawaii_animedb { class API { public void GetAPIData(string key, string RequestUrl) { unirest_net.http.HttpResponse<string> request = unirest_net.http.Unirest.get(RequestUrl).header("X-Mashape-Key", key).asString(); Console.WriteLine(request.Body); } } }
bsd-2-clause
C#
52e3b4714e850d5602a496df88467f51356ed519
Create CullingGroupExample.cs
UnityCommunity/UnityLibrary
Assets/Scripts/Docs/UnityEngine/CullingGroupExample.cs
Assets/Scripts/Docs/UnityEngine/CullingGroupExample.cs
// gets nearby objects using CullingGroup // Assign this script to some gameobject, that the distance is measured from using UnityEngine; namespace UnityLibrary { public class CullingGroupExample : MonoBehaviour { // just some dummy prefab to spawn (use default sphere for example) public GameObject prefab; // distance to search objects from public float searchDistance = 3; int objectCount = 5000; // collection of objects Renderer[] objects; CullingGroup cullGroup; BoundingSphere[] bounds; void Start() { // create culling group cullGroup = new CullingGroup(); cullGroup.targetCamera = Camera.main; // measure distance to our transform cullGroup.SetDistanceReferencePoint(transform); // search distance "bands" starts from 0, so index=0 is from 0 to searchDistance cullGroup.SetBoundingDistances(new float[] { searchDistance, float.PositiveInfinity }); bounds = new BoundingSphere[objectCount]; // spam random objects objects = new Renderer[objectCount]; for (int i = 0; i < objectCount; i++) { var pos = Random.insideUnitCircle * 30; var go = Instantiate(prefab, pos, Quaternion.identity); objects[i] = go.GetComponent<Renderer>(); // collect bounds for objects var b = new BoundingSphere(); b.position = go.transform.position; // get simple radius..works for our sphere b.radius = go.GetComponent<MeshFilter>().mesh.bounds.extents.x; bounds[i] = b; } // set bounds that we track cullGroup.SetBoundingSpheres(bounds); cullGroup.SetBoundingSphereCount(objects.Length); // subscribe to event cullGroup.onStateChanged += StateChanged; } // object state has changed in culling group void StateChanged(CullingGroupEvent e) { // if we are in distance band index 0, that is between 0 to searchDistance if (e.currentDistance == 0) { objects[e.index].material.color = Color.green; } else // too far, set color to red { objects[e.index].material.color = Color.red; } } // cleanup private void OnDestroy() { cullGroup.onStateChanged -= StateChanged; cullGroup.Dispose(); cullGroup = null; } } }
mit
C#
c3c5a817ae5e0954cb82c0e711da5f399f8d9c42
Add Console abstraction for test suites
tsolarin/readline,tsolarin/readline
test/ReadLine.Tests/Abstractions/Console2.cs
test/ReadLine.Tests/Abstractions/Console2.cs
using Internal.ReadLine.Abstractions; using System; namespace ReadLine.Tests.Abstractions { internal class Console2 : IConsole { public int CursorLeft => _cursorLeft; public int CursorTop => _cursorTop; public int BufferWidth => _bufferWidth; public int BufferHeight => _bufferHeight; private int _cursorLeft; private int _cursorTop; private int _bufferWidth; private int _bufferHeight; public Console2() { _cursorLeft = 0; _cursorTop = 0; _bufferWidth = 100; _bufferHeight = 100; } public void SetBufferSize(int width, int height) { _bufferWidth = width; _bufferHeight = height; } public void SetCursorPosition(int left, int top) { _cursorLeft = left; _cursorTop = top; } public void Write(string value) { _cursorLeft += value.Length; } public void WriteLine(string value) { _cursorLeft += value.Length; } } }
mit
C#
b8e51979f9a3fa33aff4d163767b501b0a0c7490
Add Default controller
ozlevka/bootsrapmvc4
bootstrapgames/Controllers/DefaultController.cs
bootstrapgames/Controllers/DefaultController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace bootstrapgames.Controllers { public class DefaultController : Controller { // // GET: /Default/ public ActionResult Index() { return View(); } } }
mit
C#
218c5deed74bd0fa87a7f64d730b3f701f7d2811
Add gas mixture tests
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14
Content.IntegrationTests/Tests/Atmos/GasMixtureTest.cs
Content.IntegrationTests/Tests/Atmos/GasMixtureTest.cs
using System.Threading.Tasks; using Content.Server.Atmos; using Content.Shared.Atmos; using NUnit.Framework; namespace Content.IntegrationTests.Tests.Atmos { [TestFixture] [TestOf(typeof(GasMixture))] public class GasMixtureTest : ContentIntegrationTest { [Test] public async Task TestMerge() { var server = StartServerDummyTicker(); server.Assert(() => { var a = new GasMixture(10f); var b = new GasMixture(10f); a.AdjustMoles(Gas.Oxygen, 50); b.AdjustMoles(Gas.Nitrogen, 50); // a now has 50 moles of oxygen Assert.That(a.TotalMoles, Is.EqualTo(50)); Assert.That(a.GetMoles(Gas.Oxygen), Is.EqualTo(50)); // b now has 50 moles of nitrogen Assert.That(b.TotalMoles, Is.EqualTo(50)); Assert.That(b.GetMoles(Gas.Nitrogen), Is.EqualTo(50)); b.Merge(a); // b now has its contents and the contents of a Assert.That(b.TotalMoles, Is.EqualTo(100)); Assert.That(b.GetMoles(Gas.Oxygen), Is.EqualTo(50)); Assert.That(b.GetMoles(Gas.Nitrogen), Is.EqualTo(50)); // a should be the same, however. Assert.That(a.TotalMoles, Is.EqualTo(50)); Assert.That(a.GetMoles(Gas.Oxygen), Is.EqualTo(50)); }); await server.WaitIdleAsync(); } [Test] [TestCase(0.5f)] [TestCase(0.25f)] [TestCase(0.75f)] [TestCase(1f)] [TestCase(0f)] public async Task RemoveRatio(float ratio) { var server = StartServerDummyTicker(); server.Assert(() => { var a = new GasMixture(10f); a.AdjustMoles(Gas.Oxygen, 100); a.AdjustMoles(Gas.Nitrogen, 100); var origTotal = a.TotalMoles; // we remove moles from the mixture with a ratio. var b = a.RemoveRatio(ratio); // check that the amount of moles in the original and the new mixture are correct. Assert.That(b.TotalMoles, Is.EqualTo(origTotal * ratio)); Assert.That(a.TotalMoles, Is.EqualTo(origTotal - b.TotalMoles)); Assert.That(b.GetMoles(Gas.Oxygen), Is.EqualTo(100 * ratio)); Assert.That(b.GetMoles(Gas.Nitrogen), Is.EqualTo(100 * ratio)); Assert.That(a.GetMoles(Gas.Oxygen), Is.EqualTo(100 - b.GetMoles(Gas.Oxygen))); Assert.That(a.GetMoles(Gas.Nitrogen), Is.EqualTo(100 - b.GetMoles(Gas.Nitrogen))); }); await server.WaitIdleAsync(); } } }
mit
C#
1a653a2e1576e6e785b6dcb195326125941006ff
Add AuthCmd.
0x2aff/WoWCore
AuthServer/Opcodes/AuthCmd.cs
AuthServer/Opcodes/AuthCmd.cs
namespace WoWCore.AuthServer.Opcodes { public enum AuthCmd : byte { LogonChallenge = 0x00, LogonProof = 0x01, ReconnectChallenge = 0x02, ReconnectProof = 0x03, Realmlist = 0x10 } }
mit
C#
a7c8ba866248e17b80f2d94dc2064d3eb891b297
Create Program.cs
Kivitoe/Web-Status
src/Program.cs
src/Program.cs
using System; using System.Windows.Forms; namespace Web_Stats { /// <summary> /// Class with program entry point. /// </summary> internal sealed class Program { /// <summary> /// Program entry point. /// </summary> [STAThread] private static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } } }
mit
C#
121e10cbfc4e5af048c0f86475100f2dcee759c2
Add test for changing data type (Thanks @prankaty )
igitur/ClosedXML,b0bi79/ClosedXML,ClosedXML/ClosedXML
ClosedXML_Tests/Excel/Cells/DataTypeTests.cs
ClosedXML_Tests/Excel/Cells/DataTypeTests.cs
using ClosedXML.Excel; using NUnit.Framework; using System; namespace ClosedXML_Tests.Excel.Cells { [TestFixture] public class DataTypeTests { [Test] public void ConvertNonNumericTextToNumberThrowsException() { using (var wb = new XLWorkbook()) { var ws = wb.Worksheets.Add("Sheet1"); var c = ws.Cell("A1"); c.Value = "ABC123"; Assert.Throws<ArgumentException>(() => c.DataType = XLDataType.Number); } } } }
mit
C#
88705c24933c2e4b17a469a0c0f1cacd172ce2b5
Create AssemblyInfo.cs
wieslawsoltes/MatrixPanAndZoomDemo,wieslawsoltes/PanAndZoom,PanAndZoom/PanAndZoom,PanAndZoom/PanAndZoom,wieslawsoltes/PanAndZoom
src/PandAndZoom/Properties/AssemblyInfo.cs
src/PandAndZoom/Properties/AssemblyInfo.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.Resources; using System.Reflection; [assembly: AssemblyTitle("PanAndZoom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("PanAndZoom")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
mit
C#
493038e5bd16086092adc0ca407884635dfd0274
Create Models/DatabaseModels/Dewey Class.
Programazing/Open-School-Library,Programazing/Open-School-Library
src/Open-School-Library/Models/DatabaseModels/Dewey.cs
src/Open-School-Library/Models/DatabaseModels/Dewey.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Open_School_Library.Models.DatabaseModels { public class Dewey { public int DeweyID { get; set; } public float Number { get; set; } public string Name { get; set; } } }
mit
C#
c67bc8904db4758268247539741e5b26e43666f6
Test for the behaviour of responder cancellation (#1263)
micdenny/EasyNetQ,EasyNetQ/EasyNetQ
Source/EasyNetQ.IntegrationTests/Rpc/When_request_and_respond_inflight_during_shutdown.cs
Source/EasyNetQ.IntegrationTests/Rpc/When_request_and_respond_inflight_during_shutdown.cs
using System; using System.Threading; using System.Threading.Tasks; using Shouldly; using Xunit; namespace EasyNetQ.IntegrationTests.Rpc { [Collection("RabbitMQ")] public class When_request_and_respond_in_flight_during_shutdown : IDisposable { private readonly IBus bus; public When_request_and_respond_in_flight_during_shutdown(RabbitMQFixture fixture) { bus = RabbitHutch.CreateBus($"host={fixture.Host};prefetchCount=1;timeout=-1"); } [Fact] public async Task Should_receive_cancellation() { using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10)); var requestArrived = new ManualResetEventSlim(false); var responder = await bus.Rpc.RespondAsync<Request, Response>( async (r, c) => { requestArrived.Set(); await Task.Delay(TimeSpan.FromSeconds(2), c); return new Response(r.Id); }, _ => { }, cts.Token ); var requestTask = bus.Rpc.RequestAsync<Request, Response>(new Request(42), cts.Token); requestArrived.Wait(cts.Token); Task.Run(() => responder.Dispose(), cts.Token); await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await requestTask); cts.IsCancellationRequested.ShouldBeTrue(); } public void Dispose() => bus.Dispose(); } }
mit
C#
46781ad9082ccea3aab7950095238003269cbaad
Add basic benchmarks for Is and Class selectors.
wieslawsoltes/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,Perspex/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,akrisiun/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia
tests/Avalonia.Benchmarks/Styling/SelectorBenchmark.cs
tests/Avalonia.Benchmarks/Styling/SelectorBenchmark.cs
using Avalonia.Controls; using Avalonia.Styling; using BenchmarkDotNet.Attributes; namespace Avalonia.Benchmarks.Styling { [MemoryDiagnoser] public class SelectorBenchmark { private readonly Control _notMatchingControl; private readonly Calendar _matchingControl; private readonly Selector _isCalendarSelector; private readonly Selector _classSelector; public SelectorBenchmark() { _notMatchingControl = new Control(); _matchingControl = new Calendar(); const string className = "selector-class"; _matchingControl.Classes.Add(className); _isCalendarSelector = Selectors.Is<Calendar>(null); _classSelector = Selectors.Class(null, className); } [Benchmark] public SelectorMatch IsSelector_NoMatch() { return _isCalendarSelector.Match(_notMatchingControl); } [Benchmark] public SelectorMatch IsSelector_Match() { return _isCalendarSelector.Match(_matchingControl); } [Benchmark] public SelectorMatch ClassSelector_NoMatch() { return _classSelector.Match(_notMatchingControl); } [Benchmark] public SelectorMatch ClassSelector_Match() { return _classSelector.Match(_matchingControl); } } }
mit
C#
be1bb45811e06c28c1a9ec36e4679f745106fa31
Add type to represent range in a text file
daviwil/PSScriptAnalyzer,dlwyatt/PSScriptAnalyzer,PowerShell/PSScriptAnalyzer
Engine/Range.cs
Engine/Range.cs
using System; namespace Microsoft.Windows.PowerShell.ScriptAnalyzer { public class Range { public Position Start { get; } public Position End { get; } public Range(Position start, Position end) { if (start > end) { throw new ArgumentException("start position cannot be before end position."); } Start = new Position(start); End = new Position(end); } public Range(int startLineNumber, int startColumnNumber, int endLineNumber, int endColumnNumber) : this( new Position(startLineNumber, startColumnNumber), new Position(endLineNumber, endColumnNumber)) { } public Range(Range range) { if (range == null) { throw new ArgumentNullException(nameof(range)); } Start = new Position(range.Start); End = new Position(range.End); } public Range Shift(int lineDelta, int columnDelta) { var newStart = Start.Shift(lineDelta, columnDelta); var newEnd = End.Shift(lineDelta, Start.Line == End.Line ? columnDelta : 0); return new Range(newStart, newEnd); } public static Range Normalize(Range refRange, Range range) { if (refRange == null) { throw new ArgumentNullException(nameof(refRange)); } if (range == null) { throw new ArgumentNullException(nameof(range)); } if (refRange.Start > range.Start) { throw new ArgumentException("reference range should start before range"); } return range.Shift( 1 - refRange.Start.Line, range.Start.Line == refRange.Start.Line ? 1 - refRange.Start.Column : 0); } } }
mit
C#
fbd51209d515c466e6d81bcf0f17770328c9a748
Create Program.cs
HartmanDev/WimP
Demo/Program.cs
Demo/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace PathFinder { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }
mit
C#
21d1e185cf7843010ee3671d138f7f6609fcb95f
Add test for try disease adding (#10563)
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.IntegrationTests/Tests/Disease/TryAddDisease.cs
Content.IntegrationTests/Tests/Disease/TryAddDisease.cs
using System.Threading.Tasks; using Content.Server.Disease; using Content.Shared.Disease; using NUnit.Framework; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Prototypes; namespace Content.IntegrationTests.Tests.Disease; [TestFixture] [TestOf(typeof(DiseaseSystem))] public sealed class DeviceNetworkTest { [Test] public async Task AddAllDiseases() { await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true}); var server = pairTracker.Pair.Server; var testMap = await PoolManager.CreateTestMap(pairTracker); await server.WaitPost(() => { var protoManager = IoCManager.Resolve<IPrototypeManager>(); var entManager = IoCManager.Resolve<IEntityManager>(); var entSysManager = IoCManager.Resolve<IEntitySystemManager>(); var diseaseSystem = entSysManager.GetEntitySystem<DiseaseSystem>(); var sickEntity = entManager.SpawnEntity("MobHuman", testMap.GridCoords); foreach (var diseaseProto in protoManager.EnumeratePrototypes<DiseasePrototype>()) { diseaseSystem.TryAddDisease(sickEntity, diseaseProto); } }); } }
mit
C#
f6aa28dbcb365e4ba5fc591ff5de397a7e2f75a0
increment the version
dominiqa/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,smithab/azure-sdk-for-net,vhamine/azure-sdk-for-net,alextolp/azure-sdk-for-net,shutchings/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,shuainie/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,Nilambari/azure-sdk-for-net,pinwang81/azure-sdk-for-net,hyonholee/azure-sdk-for-net,mihymel/azure-sdk-for-net,nacaspi/azure-sdk-for-net,djyou/azure-sdk-for-net,hallihan/azure-sdk-for-net,bgold09/azure-sdk-for-net,hyonholee/azure-sdk-for-net,rohmano/azure-sdk-for-net,gubookgu/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,shutchings/azure-sdk-for-net,dasha91/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,shutchings/azure-sdk-for-net,juvchan/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,pilor/azure-sdk-for-net,nacaspi/azure-sdk-for-net,shipram/azure-sdk-for-net,atpham256/azure-sdk-for-net,shuainie/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,samtoubia/azure-sdk-for-net,ogail/azure-sdk-for-net,rohmano/azure-sdk-for-net,relmer/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,pomortaz/azure-sdk-for-net,nathannfan/azure-sdk-for-net,namratab/azure-sdk-for-net,jamestao/azure-sdk-for-net,juvchan/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,btasdoven/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,tpeplow/azure-sdk-for-net,nathannfan/azure-sdk-for-net,pinwang81/azure-sdk-for-net,Nilambari/azure-sdk-for-net,travismc1/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,dominiqa/azure-sdk-for-net,ogail/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,akromm/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,AzCiS/azure-sdk-for-net,shixiaoyu/azure-sdk-for-net,jamestao/azure-sdk-for-net,vladca/azure-sdk-for-net,marcoippel/azure-sdk-for-net,mihymel/azure-sdk-for-net,arijitt/azure-sdk-for-net,pattipaka/azure-sdk-for-net,relmer/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,kagamsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,robertla/azure-sdk-for-net,pattipaka/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,lygasch/azure-sdk-for-net,r22016/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,nemanja88/azure-sdk-for-net,djyou/azure-sdk-for-net,robertla/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,hyonholee/azure-sdk-for-net,oburlacu/azure-sdk-for-net,oburlacu/azure-sdk-for-net,kagamsft/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,djyou/azure-sdk-for-net,smithab/azure-sdk-for-net,markcowl/azure-sdk-for-net,nathannfan/azure-sdk-for-net,olydis/azure-sdk-for-net,lygasch/azure-sdk-for-net,mumou/azure-sdk-for-net,enavro/azure-sdk-for-net,begoldsm/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,hovsepm/azure-sdk-for-net,yoreddy/azure-sdk-for-net,scottrille/azure-sdk-for-net,pilor/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,oaastest/azure-sdk-for-net,samtoubia/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,enavro/azure-sdk-for-net,vhamine/azure-sdk-for-net,ogail/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,makhdumi/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,alextolp/azure-sdk-for-net,zaevans/azure-sdk-for-net,smithab/azure-sdk-for-net,shuagarw/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,jtlibing/azure-sdk-for-net,stankovski/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,hallihan/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,shuagarw/azure-sdk-for-net,r22016/azure-sdk-for-net,guiling/azure-sdk-for-net,pattipaka/azure-sdk-for-net,makhdumi/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,djoelz/azure-sdk-for-net,amarzavery/azure-sdk-for-net,begoldsm/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,peshen/azure-sdk-for-net,shuagarw/azure-sdk-for-net,dasha91/azure-sdk-for-net,samtoubia/azure-sdk-for-net,mabsimms/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,yoreddy/azure-sdk-for-net,mabsimms/azure-sdk-for-net,dasha91/azure-sdk-for-net,rohmano/azure-sdk-for-net,arijitt/azure-sdk-for-net,btasdoven/azure-sdk-for-net,oburlacu/azure-sdk-for-net,cwickham3/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,pankajsn/azure-sdk-for-net,AuxMon/azure-sdk-for-net,msfcolombo/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,cwickham3/azure-sdk-for-net,jamestao/azure-sdk-for-net,vladca/azure-sdk-for-net,amarzavery/azure-sdk-for-net,zaevans/azure-sdk-for-net,alextolp/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,stankovski/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,jtlibing/azure-sdk-for-net,xindzhan/azure-sdk-for-net,ailn/azure-sdk-for-net,djoelz/azure-sdk-for-net,relmer/azure-sdk-for-net,AzCiS/azure-sdk-for-net,AuxMon/azure-sdk-for-net,tpeplow/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,pinwang81/azure-sdk-for-net,oaastest/azure-sdk-for-net,makhdumi/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,mumou/azure-sdk-for-net,abhing/azure-sdk-for-net,dominiqa/azure-sdk-for-net,yoreddy/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,cwickham3/azure-sdk-for-net,atpham256/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,namratab/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,AuxMon/azure-sdk-for-net,gubookgu/azure-sdk-for-net,naveedaz/azure-sdk-for-net,jasper-schneider/azure-sdk-for-net,shipram/azure-sdk-for-net,tonytang-microsoft-com/azure-sdk-for-net,guiling/azure-sdk-for-net,juvchan/azure-sdk-for-net,bgold09/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,pomortaz/azure-sdk-for-net,robertla/azure-sdk-for-net,abhing/azure-sdk-for-net,scottrille/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,Matt-Westphal/azure-sdk-for-net,nemanja88/azure-sdk-for-net,akromm/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,guiling/azure-sdk-for-net,tpeplow/azure-sdk-for-net,atpham256/azure-sdk-for-net,vladca/azure-sdk-for-net,ailn/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,avijitgupta/azure-sdk-for-net,pomortaz/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,Nilambari/azure-sdk-for-net,amarzavery/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,herveyw/azure-sdk-for-net,olydis/azure-sdk-for-net,DeepakRajendranMsft/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,naveedaz/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,oaastest/azure-sdk-for-net,vivsriaus/azure-sdk-for-net,namratab/azure-sdk-for-net,yitao-zhang/azure-sdk-for-net,peshen/azure-sdk-for-net,hovsepm/azure-sdk-for-net,hovsepm/azure-sdk-for-net,pankajsn/azure-sdk-for-net,felixcho-msft/azure-sdk-for-net,xindzhan/azure-sdk-for-net,peshen/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,jamestao/azure-sdk-for-net,olydis/azure-sdk-for-net,divyakgupta/azure-sdk-for-net,abhing/azure-sdk-for-net,herveyw/azure-sdk-for-net,jianghaolu/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,hyonholee/azure-sdk-for-net,lygasch/azure-sdk-for-net,xindzhan/azure-sdk-for-net,shipram/azure-sdk-for-net,pankajsn/azure-sdk-for-net,samtoubia/azure-sdk-for-net,herveyw/azure-sdk-for-net,gubookgu/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,marcoippel/azure-sdk-for-net,bgold09/azure-sdk-for-net,AzCiS/azure-sdk-for-net,naveedaz/azure-sdk-for-net,jtlibing/azure-sdk-for-net,SpotLabsNET/azure-sdk-for-net,btasdoven/azure-sdk-for-net,yadavbdev/azure-sdk-for-net,r22016/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,kagamsft/azure-sdk-for-net,shixiaoyu/azure-sdk-for-net,mihymel/azure-sdk-for-net,enavro/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,marcoippel/azure-sdk-for-net,hyonholee/azure-sdk-for-net,ailn/azure-sdk-for-net,pilor/azure-sdk-for-net,begoldsm/azure-sdk-for-net,mabsimms/azure-sdk-for-net,scottrille/azure-sdk-for-net,zaevans/azure-sdk-for-net,akromm/azure-sdk-for-net,nemanja88/azure-sdk-for-net,MabOneSdk/azure-sdk-for-net
src/WebSiteManagement/Properties/AssemblyInfo.cs
src/WebSiteManagement/Properties/AssemblyInfo.cs
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Windows Azure Web Sites Management Library")] [assembly: AssemblyDescription("Provides management functionality for Windows Azure Web Sites.")] [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.3.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Windows Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Windows Azure Web Sites Management Library")] [assembly: AssemblyDescription("Provides management functionality for Windows Azure Web Sites.")] [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.2.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Windows Azure .NET SDK")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")]
apache-2.0
C#
f7f241f8ce10b2dbae569cde15a37658db319f62
add mkzip class
qiniu/csharp-sdk,fengyhack/csharp-sdk
Qiniu/PFOP/Mkzip.cs
Qiniu/PFOP/Mkzip.cs
using Qiniu.Auth; using System; using System.Collections.Generic; using System.Linq; using System.Text; using Qiniu.RS; using Qiniu.RPC; using Qiniu.Conf; using Qiniu.Util; using Newtonsoft.Json; namespace Qiniu.PFOP { public class Mkzip { /// <summary> /// 多文件压缩存储为用户提供了批量文件的压缩存储功能 /// POST /pfop/ HTTP/1.1 /// Host: api.qiniu.com /// Content-Type: application/x-www-form-urlencoded /// Authorization: <AccessToken> /// bucket = <bucket> /// mkzip/<mode> /// /url/<Base64EncodedURL> /// /alias/<Base64EncodedAlias> /// /url/<Base64EncodedURL> /// ... /// </summary> public String doMkzip(String bucket, String existKey, String newFileName, String[] urls, string pipeline) { if (bucket == null || string.IsNullOrEmpty(existKey) || string.IsNullOrEmpty(newFileName) || urls.Length < 0 || pipeline == null) { throw new Exception("params error"); } String entryURI = bucket + ":" + newFileName; String urlString = ""; for (int i = 0; i < urls.Length; i++) { String urlEntry = "/url/" + Qiniu.Util.Base64URLSafe.ToBase64URLSafe(urls[i]); urlString += urlEntry; } String fop = System.Web.HttpUtility.UrlEncode("mkzip/1" + urlString + "|saveas/" + Qiniu.Util.Base64URLSafe.ToBase64URLSafe(entryURI)); string body = string.Format("bucket={0}&key={1}&fops={2}&pipeline={3}", bucket, existKey, fop, pipeline); System.Text.Encoding curEncoding = System.Text.Encoding.UTF8; QiniuAuthClient authClient = new QiniuAuthClient(); CallRet ret = authClient.CallWithBinary(Config.API_HOST + "/pfop/", "application/x-www-form-urlencoded", StreamEx.ToStream(body), body.Length); if (ret.OK) { try { PersistentId pid = JsonConvert.DeserializeObject<PersistentId>(ret.Response); return pid.persistentId; } catch (Exception e) { throw e; } } else { throw new Exception(ret.Response); } } } }
mit
C#
1fb11caf58e2f1dafdfaf7ebb5b9ea32507843f0
Create RepeatNumPattern.cs
Zephyr-Koo/sololearn-challenge
RepeatNumPattern.cs
RepeatNumPattern.cs
using System; using System.Collections.Generic; using System.Linq; // https://www.sololearn.com/Discuss/696268/?ref=app namespace SoloLearn { class Program { const int MAX = 4; static void Main(string[] zephyr_koo) { Enumerable.Range(1, MAX) .SelectMany(n => Enumerable.Repeat(n, n)).ToList() .ForEach(n => Console.Write(n)); } } }
apache-2.0
C#
b5bb9c8c8b7a069d66a391c7c7ad2d39683f8814
Add waveform benchmark
ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework
osu.Framework.Benchmarks/BenchmarkWaveform.cs
osu.Framework.Benchmarks/BenchmarkWaveform.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; using System.IO; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using ManagedBass; using NUnit.Framework; using osu.Framework.Audio.Track; using osu.Framework.IO.Stores; using osu.Framework.Tests.Visual; namespace osu.Framework.Benchmarks { [MemoryDiagnoser] public class BenchmarkWaveform : BenchmarkTest { private Stream data = null!; private Waveform preloadedWaveform = null!; public override void SetUp() { base.SetUp(); Bass.Init(); var store = new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(FrameworkTestScene).Assembly), "Resources"); data = store.GetStream("Tracks/sample-track.mp3"); Debug.Assert(data != null); preloadedWaveform = new Waveform(data); // wait for load preloadedWaveform.GetPoints(); } [Benchmark] [Test] public async Task TestCreate() { var waveform = new Waveform(data); var originalPoints = await waveform.GetPointsAsync().ConfigureAwait(false); Debug.Assert(originalPoints.Length > 0); } [Arguments(1024)] [TestCase(1024)] [Arguments(32768)] [TestCase(32768)] [Benchmark] public async Task TestResample(int size) { var resampled = await preloadedWaveform.GenerateResampledAsync(size).ConfigureAwait(false); var resampledPoints = await resampled.GetPointsAsync().ConfigureAwait(false); Debug.Assert(resampledPoints.Length > 0); } } }
mit
C#
0fb4b544a58262897b20ea2d3ac589b38e195606
Update AggregateSource/Repository.cs
yreynhout/AggregateSource,ashic/AggregateSource,alexeyzimarev/AggregateSource
AggregateSource/Repository.cs
AggregateSource/Repository.cs
using System; namespace AggregateSource { public abstract class Repository<TAggregateRoot> : IRepository<TAggregateRoot> where TAggregateRoot : AggregateRootEntity { readonly UnitOfWork _unitOfWork; protected Repository(UnitOfWork unitOfWork) { if (unitOfWork == null) throw new ArgumentNullException("unitOfWork"); _unitOfWork = unitOfWork; } protected UnitOfWork UnitOfWork { get { return _unitOfWork; } } public TAggregateRoot Get(Guid id) { TAggregateRoot root; if (!TryGet(id, out root)) throw new AggregateNotFoundException(id, typeof(TAggregateRoot)); return root; } public bool TryGet(Guid id, out TAggregateRoot root) { Aggregate aggregate; if (UnitOfWork.TryGet(id, out aggregate)) { root = (TAggregateRoot)aggregate.Root; return true; } if (!TryReadAggregate(id, out aggregate)) { root = null; return false; } UnitOfWork.Attach(aggregate); root = (TAggregateRoot)aggregate.Root; return true; } public void Add(Guid id, TAggregateRoot root) { UnitOfWork.Attach(CreateAggregate(id, root)); } protected abstract bool TryReadAggregate(Guid id, out Aggregate aggregate); protected abstract Aggregate CreateAggregate(Guid id, TAggregateRoot root); } }
using System; namespace AggregateSource { public abstract class Repository<TAggregateRoot> : IRepository<TAggregateRoot> where TAggregateRoot : AggregateRootEntity { readonly UnitOfWork _unitOfWork; protected Repository(UnitOfWork unitOfWork) { if (unitOfWork == null) throw new ArgumentNullException("unitOfWork"); _unitOfWork = unitOfWork; } protected UnitOfWork UnitOfWork { get { return _unitOfWork; } } public TAggregateRoot Get(Guid id) { TAggregateRoot root; if (!TryGet(id, out root)) throw new AggregateNotFoundException(id, typeof(TAggregateRoot)); return root; } public bool TryGet(Guid id, out TAggregateRoot root) { Aggregate aggregate; if (UnitOfWork.TryGet(id, out aggregate)) { root = (TAggregateRoot)aggregate.Root; return true; } if (!TryReadAggregate(id, out aggregate)) { root = null; return false; } UnitOfWork.Attach(aggregate); root = (TAggregateRoot)aggregate.Root; return true; } public void Add(Guid id, TAggregateRoot root) { UnitOfWork.Attach(CreateAggregate(id, root)); } protected abstract bool TryReadAggregate(Guid id, out Aggregate aggregate); protected abstract Aggregate CreateAggregate(Guid id, TAggregateRoot root); } //public class VersionedAggregateReader<TAggregateRoot> : // IAggregateReader<TAggregateRoot>, // IAggregateFactory<TAggregateRoot> // where TAggregateRoot : AggregateRootEntity{ // readonly Func<TAggregateRoot> _rootFactory; // public VersionedAggregateReader (Func<TAggregateRoot> aggregateRootFactory) { // if (aggregateRootFactory == null) throw new ArgumentNullException("aggregateRootFactory"); // _rootFactory = aggregateRootFactory; // } // public Aggregate Read(Guid id) { // var root = _rootFactory(); // root.Initialize(...); // return new VersionedAggregate(id, version, root); // } // public Aggregate Create(Guid id, TAggregateRoot root) { // return new VersionedAggregate(id); // } //} //public class VersionedAggregate : Aggregate { // public static readonly int InitialVersion = 0; // public VersionedAggregate(Guid id, int version, AggregateRootEntity root) : base(id, version, root) { // } //} }
bsd-3-clause
C#
e32f62db5bdf473579ee062a67d7c765fb95e2ae
Add missing file
johnneijzen/osu,peppy/osu-new,peppy/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,EVAST9919/osu,ppy/osu,ppy/osu,UselessToucan/osu,2yangk23/osu,EVAST9919/osu,NeoAdonis/osu,ZLima12/osu,ZLima12/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,johnneijzen/osu
osu.Game.Tests/Visual/UserInterface/OsuGridTestScene.cs
osu.Game.Tests/Visual/UserInterface/OsuGridTestScene.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.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; namespace osu.Game.Tests.Visual.UserInterface { /// <summary> /// An abstract test case which exposes small cells arranged in a grid. /// Useful for displaying multiple configurations of a tested component at a glance. /// </summary> public abstract class OsuGridTestScene : OsuTestScene { private readonly Drawable[,] cells; /// <summary> /// The amount of rows in the grid. /// </summary> protected readonly int Rows; /// <summary> /// The amount of columns in the grid. /// </summary> protected readonly int Cols; /// <summary> /// Constructs a grid test case with the given dimensions. /// </summary> protected OsuGridTestScene(int rows, int cols) { Rows = rows; Cols = cols; GridContainer testContainer; Add(testContainer = new GridContainer { RelativeSizeAxes = Axes.Both }); cells = new Drawable[rows, cols]; for (int r = 0; r < rows; r++) for (int c = 0; c < cols; c++) cells[r, c] = new Container { RelativeSizeAxes = Axes.Both }; testContainer.Content = cells.ToJagged(); } protected Container Cell(int index) => (Container)cells[index / Cols, index % Cols]; protected Container Cell(int row, int col) => (Container)cells[row, col]; } }
mit
C#
3258a2ad9a35ad8e96e872332d36079d707bd0db
Add Node.cs
ouraspnet/HanLP.NET
src/HanLP.Net/Collection/Trie/Bintrie/Node.cs
src/HanLP.Net/Collection/Trie/Bintrie/Node.cs
using System; namespace HanLP.Net.Collection.Trie.Bintrie { public class Node<T> : BaseNode<T> { public Node() { } public Node(char c, Status status, T value) { _c = c; NodeStatus = status; Value = value; } public override BaseNode<T> GetChild(char c) { if (_child == null) return null; int index = Array.BinarySearch(_child, c); if (index < 0) return null; return _child[index]; } protected override bool AddChild(BaseNode<T> node) { var add = false; if (_child == null) { _child = new BaseNode<T>[0]; } int index = Array.BinarySearch(_child, node); if (index >= 0) { var target = _child[index]; switch (node.NodeStatus) { case Status.UNDEFINED_0: if (target.NodeStatus != Status.NOT_WORD_1) { target.NodeStatus = Status.NOT_WORD_1; target.Value = default(T); add = true; } break; case Status.NOT_WORD_1: if (target.NodeStatus == Status.WORD_END_3) { target.NodeStatus = Status.WORD_MIDDLE_2; } break; case Status.WORD_END_3: if (target.NodeStatus != Status.WORD_END_3) { target.NodeStatus = Status.WORD_MIDDLE_2; } if (target.Value == null) { add = true; } target.Value = node.Value; break; } } else { BaseNode<T>[] newChild = new BaseNode<T>[_child.Length + 1]; int insert = -(index + 1); Array.Copy(_child, 0, newChild, 0, insert); Array.Copy(_child, insert, newChild, insert + 1, _child.Length - insert); newChild[insert] = node; _child = newChild; add = true; } return add; } } }
apache-2.0
C#
211fb6e5236ce55d72670fe3f05a834c68bb2668
Add unimplemented SmartMeterReader
jeroen-corsius/smart-meter
SmartMeter.Business/SmartMeterReader.cs
SmartMeter.Business/SmartMeterReader.cs
using System; namespace SmartMeter.Business { public class SmartMeterReader { public string Read() { throw new NotImplementedException(); } } }
mit
C#
4b5f4cd03cf91c58d2c8f203c18549147bbac233
Add coloredstring tests
Thraka/SadConsole
Tests/SadConsole.Tests/ColoredString.cs
Tests/SadConsole.Tests/ColoredString.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using SadRogue.Primitives; namespace SadConsole.Tests { [TestClass] public class ColoredString { [TestMethod] public void CombineStringNormal() { var str1 = new SadConsole.ColoredString("string 1", Color.Green, Color.Yellow); var str2 = "string 2"; SadConsole.ColoredString result = str1 + str2; Assert.IsTrue(result[7].Matches(str1[7]), "ColoredGlyph should match"); Assert.IsTrue(result[str1.Length + 3].Glyph == str2[3], "Glyph should match"); Assert.IsTrue(result[str1.Length - 1].Background == result[str1.Length + 3].Background, "Background should match"); } [TestMethod] public void CombineStringReversed() { var str1 = new SadConsole.ColoredString("string 1", Color.Green, Color.Yellow); var str2 = "string 2"; SadConsole.ColoredString result = str2 + str1; Assert.AreEqual(result[7].Glyph, str2[7], "Glyph should match"); Assert.IsTrue(result[str2.Length + 3].Matches(str1[3]), "ColoredGlyph should match"); Assert.IsFalse(result[str1.Length - 1].Background == result[str2.Length + 3].Background, "Background shouldn't match"); } [TestMethod] public void EmptyCombine() { var str1 = new SadConsole.ColoredString("", Color.Green, Color.Yellow); var str2 = ""; SadConsole.ColoredString result = str2 + str1; Assert.IsTrue(result.Length == 0, "empty + empty should have 0 length"); str2 = "test"; result = str2 + str1; Assert.IsTrue(result.Length == str2.Length, "empty + Colored should have correct length"); str1 = new SadConsole.ColoredString("test2", Color.Green, Color.Yellow); str2 = ""; result = str1 + str2; Assert.IsTrue(result.Length == str1.Length, "Colored + empty should have correct length"); Assert.IsTrue(result[2].Matches(str1[2]), "Colored + empty should match on glyph"); } } }
mit
C#
ba458ef13a388ec8cca7d4637944bee012eb6833
Create audio source controller component
bartlomiejwolk/AnimationPathAnimator
AudioSourceController/AudioSourceController.cs
AudioSourceController/AudioSourceController.cs
using UnityEngine; using System.Collections; namespace ATP.AnimationPathTools.AudioSourceControllerComponent { public class AudioSourceController : MonoBehaviour { private void Start() { } private void Update() { } } }
mit
C#
e384332dedaf639357a560ed29e1997c304273ef
Create Render.cs
zelbo/Number-Guessing
Render.cs
Render.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace NumberGuessing { partial class Program { static void Render() { // blank slate Console.Clear(); switch (gameState) { case GameState.Initialize: // debug //Console.WriteLine(gameState.ToString()); // debugging only MyDebug(); break; case GameState.Guess: Console.WriteLine("Guess a number from {0} to {1}, Q to quit", myNumberMin, myNumberMax); Console.WriteLine(myResult.rankMessage); MyDebug(); break; case GameState.Win: Console.WriteLine("You win!"); break; case GameState.Exit: // debug MyDebug(); break; default: errorMessage = "Invalid game state during render."; break; } } } }
mit
C#
0bfa6fa975e5bb3e0510b2c71d9e62416f17bbf2
Implement UprightUnscaledContainer
peppy/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu
osu.Game/Graphics/Containers/UprightContainer.cs
osu.Game/Graphics/Containers/UprightContainer.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.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Layout; namespace osu.Game.Graphics.Containers { /// <summary> /// A container that prevents itself and its children from getting rotated, scaled or flipped with its Parent. /// </summary> public class UprightUnscaledContainer : Container { public UprightUnscaledContainer() { AddLayout(layout); } private LayoutValue layout = new LayoutValue(Invalidation.DrawInfo); protected override void Update() { base.Update(); if (!layout.IsValid) { Extensions.DrawableExtensions.KeepUprightAndUnscaled(this); layout.Validate(); } } } }
mit
C#
2733885d4798300de6ac6b870586031852a2df36
Add C# 7.0 Expression Body advanced example
devlights/try-csharp
TryCSharp.Samples/CSharp7/MoreExpressionBodiedMembers.cs
TryCSharp.Samples/CSharp7/MoreExpressionBodiedMembers.cs
using TryCSharp.Common; namespace TryCSharp.Samples.CSharp7 { [Sample] public class MoreExpressionBodiedMembers : IExecutable { class Data { private string _value; public Data(string val) => this.Value = val; public string UpperCaseValue => this.Value.ToUpper(); // ReSharper disable once ConvertToAutoProperty public string Value { get => this._value; private set => this._value = value; } public string ToLowerValue() => this.Value.ToLower(); } public void Execute() { // C# 6.0 にて Expression Body が導入されたが // C# 7.0 にて、新たに // - コンストラクタ // - read/write プロパティ // - ファイナライザ // でも利用できるようなった var data = new Data("hello world"); Output.WriteLine($"{data.Value}-{data.UpperCaseValue}-{data.ToLowerValue()}"); } } }
mit
C#
0a6e37ae8cd42de31621b484596cd04c1e1a373a
Create Ext.cs
UnstableMutex/NLog.MongoDB
NLog.MongoDB/Ext.cs
NLog.MongoDB/Ext.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace NLog.MongoDB { public static class Ext { public static void WriteAppStarted(this Logger logger, Version appVersion = null) { if (appVersion == null) { logger.Info("App started."); } else { logger.Info("App started. Version {0}", appVersion); } } public static void WriteAppExit(this Logger logger, Version appVersion = null) { if (appVersion == null) { logger.Info("App exit."); } else { logger.Info("App exit. Version {0}", appVersion); } } } }
mit
C#
5f211f865d99b79884cac163277725a185b1512f
Create MongoTargetExpireAfter.cs
UnstableMutex/NLog.MongoDB
MongoTargetExpireAfter.cs
MongoTargetExpireAfter.cs
using System; using System.Linq; using MongoDB.Bson; using MongoDB.Driver; using MongoDB.Driver.Builders; using NLog.Common; using NLog.Config; using NLog.Targets; namespace NLog.MongoDB { [Target("MongoDBExpireAfter")] public class MongoTargetExpireAfter : Target { private MongoCollection<BsonDocument> _coll; public byte ExceptionRecursionLevel { get; set; } public int Days { get; set; } public string AppName { get; set; } [RequiredParameter] public string ConnectionString { get; set; } public string DatabaseName { get; set; } private string CollectionName { get; set; } public MongoTargetExpireAfter() { Days = 5; ExceptionRecursionLevel = 2; DatabaseName = "Logs"; AppName = "Application"; } long MB(long count) { return (long)(count * Math.Pow(1024, 2)); } protected override void InitializeTarget() { if (_coll == null) { IndexKeysBuilder b = new IndexKeysBuilder(); IndexOptionsBuilder ob = new IndexOptionsBuilder(); ob = ob.SetTimeToLive(TimeSpan.FromDays(Days)); b = b.Ascending("CreatedAt"); CollectionName = AppName + "Log"; var db = new MongoClient(ConnectionString).GetServer().GetDatabase(DatabaseName); if (!db.CollectionExists(CollectionName)) { db.CreateCollection(CollectionName); _coll = db.GetCollection(CollectionName); _coll.CreateIndex(b, ob); } _coll = db.GetCollection(CollectionName); } } protected override void Write(AsyncLogEventInfo[] logEvents) { var docs = logEvents.Select(l => GetDocFromLogEventInfo(l.LogEvent)); _coll.InsertBatch(docs); } protected override void Write(LogEventInfo logEvent) { var doc = GetDocFromLogEventInfo(logEvent); _coll.Save(doc); } private BsonDocument GetDocFromLogEventInfo(LogEventInfo logEvent) { var doc = new BsonDocument(); doc.Add("Level", logEvent.Level.ToString()); doc.Add("UserName", Environment.UserName); doc.Add("WKS", Environment.MachineName); DateTime nowformongo = DateTime.Now.Add(DateTime.Now - DateTime.Now.ToUniversalTime()); doc.Add("LocalDate", nowformongo); doc.Add("UTCDate", DateTime.Now.ToUniversalTime()); doc.Add("CreatedAt", DateTime.Now); doc.Add("Message", logEvent.FormattedMessage); doc.Add("AppName", AppName); if (logEvent.Exception != null) { doc.Add("Exception", GetException(logEvent.Exception)); } return doc; } BsonDocument GetException<T>(T ex) where T : Exception { return GetException(ex, ExceptionRecursionLevel); } BsonDocument GetException<T>(T ex, byte level) where T : Exception { var doc = new BsonDocument(); AddStringProperties(ex, doc); doc.Add("TargetSite", ex.TargetSite.Name); doc.Add("exType", ex.GetType().FullName); if (ex.TargetSite.DeclaringType != null) { doc.Add("ClassName", ex.TargetSite.DeclaringType.FullName); } if (ex.InnerException != null && level > 0) { doc.Add("InnerException", GetException(ex.InnerException, (byte)(level - 1))); } return doc; } private void AddStringProperties(Exception exception, BsonDocument doc) { var props = exception.GetType().GetProperties().Where(x => x.PropertyType == typeof(string)); foreach (var pi in props) { string s = (string)pi.GetValue(exception); doc.Add(pi.Name, s); } } } }
mit
C#
74c145c1eef7beebdf5ddab8641c0addc8ab7f78
Add tick event listener only once in SyncController
ikkentim/SampSharp,Seprum/SampSharp,ikkentim/SampSharp,Seprum/SampSharp,Seprum/SampSharp,Seprum/SampSharp,ikkentim/SampSharp
src/SampSharp.GameMode/Controllers/SyncController.cs
src/SampSharp.GameMode/Controllers/SyncController.cs
// SampSharp // Copyright 2015 Tim Potze // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Threading; using SampSharp.GameMode.Tools; namespace SampSharp.GameMode.Controllers { /// <summary> /// A controller processing sync requests. /// </summary> public sealed class SyncController : IEventListener { private static bool _waiting; /// <summary> /// Gets the main thread. /// </summary> public static Thread MainThread { get; private set; } /// <summary> /// Registers the events this SyncController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public void RegisterEvents(BaseMode gameMode) { MainThread = Thread.CurrentThread; gameMode.Tick += _gameMode_Tick; gameMode.Exited += (sender, args) => { foreach (var t in Sync.SyncTask.All) { t.Dispose(); } }; } /// <summary> /// Start waiting for a tick to sync all resync requests. /// </summary> public static void Start() { _waiting = true; } private static void _gameMode_Tick(object sender, EventArgs e) { if (!_waiting) return; foreach (var t in Sync.SyncTask.All) { t.Run(); t.Dispose(); } _waiting = false; } } }
// SampSharp // Copyright 2015 Tim Potze // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Threading; using SampSharp.GameMode.Tools; namespace SampSharp.GameMode.Controllers { /// <summary> /// A controller processing sync requests. /// </summary> public sealed class SyncController : IEventListener { private static BaseMode _gameMode; private static bool _waiting; /// <summary> /// Gets the main thread. /// </summary> public static Thread MainThread { get; private set; } /// <summary> /// Registers the events this SyncController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public void RegisterEvents(BaseMode gameMode) { _gameMode = gameMode; MainThread = Thread.CurrentThread; gameMode.Exited += (sender, args) => { foreach (var t in Sync.SyncTask.All) { t.Dispose(); } }; if (_waiting) { _gameMode.Tick += _gameMode_Tick; } } /// <summary> /// Start waiting for a tick to sync all resync requests. /// </summary> public static void Start() { if (!_waiting) { _waiting = true; if (_gameMode != null) _gameMode.Tick += _gameMode_Tick; } } private static void _gameMode_Tick(object sender, EventArgs e) { foreach (var t in Sync.SyncTask.All) { t.Run(); t.Dispose(); } _waiting = false; _gameMode.Tick -= _gameMode_Tick; } } }
apache-2.0
C#
94e05827106beb6b7b3b57f58ee24f3e5451e4fb
add test cases for issue #113
esskar/Serialize.Linq
src/Serialize.Linq.Tests/Issues/Issue113.cs
src/Serialize.Linq.Tests/Issues/Issue113.cs
using System; using System.Diagnostics; using System.Linq.Expressions; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; using Serialize.Linq.Serializers; namespace Serialize.Linq.Tests.Issues { // https://github.com/esskar/Serialize.Linq/issues/113 [TestClass] public class Issue113 { [TestMethod] public void AllowVariableInsideTryCatch() { var tc = new TestClass(); tc.VariableInsideTryCatch("foo"); } [TestMethod] public async Task AllowVariableInsideTryCatchAsync() { var tc = new TestClass(); await tc.VariableInsideTryCatchAsync("foo"); } [TestMethod] public void AllowConstInsideTryCatch() { var tc = new TestClass(); tc.ConstInsideTryCatch("foo"); } [TestMethod] public async Task AllowConstInsideTryCatchAsync() { var tc = new TestClass(); await tc.ConstInsideTryCatchAsync("foo"); } public class TestClass { public void VariableInsideTryCatch(string productId) { try { var userId = "12313"; DoSerialization<ProductTest>(x => x.UserId == userId && x.ProductId == productId); } catch (Exception ex) { Assert.Fail("Exception thrown: {0}", ex); } } public async Task VariableInsideTryCatchAsync(string productId) { await Task.Yield(); try { var userId = "12313"; DoSerialization<ProductTest>(x => x.UserId == userId && x.ProductId == productId); } catch (Exception ex) { Assert.Fail("Exception thrown: {0}", ex); } } public void ConstInsideTryCatch(string productId) { try { const string userId = "12313"; DoSerialization<ProductTest>(x => x.UserId == userId && x.ProductId == productId); } catch (Exception ex) { Assert.Fail("Exception thrown: {0}", ex); } } public async Task ConstInsideTryCatchAsync(string productId) { await Task.Yield(); try { const string userId = "12313"; DoSerialization<ProductTest>(x => x.UserId == userId && x.ProductId == productId); } catch (Exception ex) { Assert.Fail("Exception thrown: {0}", ex); } } private static void DoSerialization<T>(Expression<Func<T, bool>> predicate) { var expressionSerializer = new ExpressionSerializer(new JsonSerializer()); expressionSerializer.SerializeText(predicate); } } public class ProductTest { public string ProductId { get; set; } public string UserId { get; set; } } public class UserTest { public string Email { get; set; } public string UserId { get; set; } } } }
mit
C#
37baf8dadc492180aa050f726ab1a9557ffe44e1
Update IRowReader TRow constraint
yck1509/dnlib,Arthur2e5/dnlib,0xd4d/dnlib,modulexcite/dnlib,jorik041/dnlib,picrap/dnlib,ZixiangBoy/dnlib,ilkerhalil/dnlib,kiootic/dnlib
src/DotNet/MD/IRowReaders.cs
src/DotNet/MD/IRowReaders.cs
namespace dot10.DotNet.MD { /// <summary> /// Reads metadata table columns /// </summary> public interface IColumnReader { /// <summary> /// Reads a column /// </summary> /// <param name="table">The table to read from</param> /// <param name="rid">Table row id</param> /// <param name="column">The column to read</param> /// <param name="value">Result</param> /// <returns><c>true</c> if <paramref name="value"/> was updated, <c>false</c> if /// the column should be read from the original table.</returns> bool ReadColumn(MDTable table, uint rid, ColumnInfo column, out uint value); } /// <summary> /// Reads table rows /// </summary> /// <typeparam name="TRow">Raw row</typeparam> public interface IRowReader<TRow> where TRow : class, IRawRow { /// <summary> /// Reads a table row /// </summary> /// <param name="rid">Row id</param> /// <returns>The table row or <c>null</c> if its row should be read from the original /// table</returns> TRow ReadRow(uint rid); } }
namespace dot10.DotNet.MD { /// <summary> /// Reads metadata table columns /// </summary> public interface IColumnReader { /// <summary> /// Reads a column /// </summary> /// <param name="table">The table to read from</param> /// <param name="rid">Table row id</param> /// <param name="column">The column to read</param> /// <param name="value">Result</param> /// <returns><c>true</c> if <paramref name="value"/> was updated, <c>false</c> if /// the column should be read from the original table.</returns> bool ReadColumn(MDTable table, uint rid, ColumnInfo column, out uint value); } /// <summary> /// Reads table rows /// </summary> public interface IRowReader<T> where T : class { /// <summary> /// Reads a table row /// </summary> /// <param name="rid">Row id</param> /// <returns>The table row or <c>null</c> if its row should be read from the original /// table</returns> T ReadRow(uint rid); } }
mit
C#
24f55fbbdc34ac27ccf840ae4b14e11ff29cd2dc
Create TextureCreator.cs
scmcom/unitycode
TextureCreator.cs
TextureCreator.cs
using UnityEngine; [RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))] public class TextureCreator : MonoBehaviour { [Range(2, 512)] public int resolution = 256; public float frequency = 1f; [Range(1, 8)] public int octaves = 1; [Range(1f, 4f)] public float lacunarity = 2f; [Range(0f, 1f)] public float persistence = 0.5f; [Range(1, 3)] public int dimensions = 3; public NoiseMethodType type; public Gradient coloring; private Texture2D texture; private void OnEnable () { if (texture == null) { texture = new Texture2D(resolution, resolution, TextureFormat.RGB24, true); texture.name = "Procedural Texture"; texture.wrapMode = TextureWrapMode.Clamp; texture.filterMode = FilterMode.Trilinear; texture.anisoLevel = 9; GetComponent<MeshRenderer>().material.mainTexture = texture; } FillTexture(); } private void Update () { if (transform.hasChanged) { transform.hasChanged = false; FillTexture(); } } public void FillTexture () { if (texture.width != resolution) { texture.Resize(resolution, resolution); } Vector3 point00 = transform.TransformPoint(new Vector3(-0.5f,-0.5f)); Vector3 point10 = transform.TransformPoint(new Vector3( 0.5f,-0.5f)); Vector3 point01 = transform.TransformPoint(new Vector3(-0.5f, 0.5f)); Vector3 point11 = transform.TransformPoint(new Vector3( 0.5f, 0.5f)); NoiseMethod method = Noise.methods[(int)type][dimensions - 1]; float stepSize = 1f / resolution; for (int y = 0; y < resolution; y++) { Vector3 point0 = Vector3.Lerp(point00, point01, (y + 0.5f) * stepSize); Vector3 point1 = Vector3.Lerp(point10, point11, (y + 0.5f) * stepSize); for (int x = 0; x < resolution; x++) { Vector3 point = Vector3.Lerp(point0, point1, (x + 0.5f) * stepSize); float sample = Noise.Sum(method, point, frequency, octaves, lacunarity, persistence).value; if (type != NoiseMethodType.Value) { sample = sample * 0.5f + 0.5f; } texture.SetPixel(x, y, coloring.Evaluate(sample)); } } texture.Apply(); } }
mit
C#
d0efecfc9cff723d92a7e9289842737152e6dc61
Add `RulesetStore` for use where realm is not present (ie. other projects)
peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu
osu.Game/Rulesets/AssemblyRulesetStore.cs
osu.Game/Rulesets/AssemblyRulesetStore.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Platform; #nullable enable namespace osu.Game.Rulesets { public class AssemblyRulesetStore : RulesetStore { public override IEnumerable<RulesetInfo> AvailableRulesets => availableRulesets; private readonly List<RulesetInfo> availableRulesets = new List<RulesetInfo>(); public AssemblyRulesetStore(Storage? storage = null) : base(storage) { List<Ruleset> instances = LoadedAssemblies.Values .Select(r => Activator.CreateInstance(r) as Ruleset) .Where(r => r != null) .Select(r => r.AsNonNull()) .ToList(); // add all legacy rulesets first to ensure they have exclusive choice of primary key. foreach (var r in instances.Where(r => r is ILegacyRuleset)) availableRulesets.Add(new RulesetInfo(r.RulesetInfo.ShortName, r.RulesetInfo.Name, r.RulesetInfo.InstantiationInfo, r.RulesetInfo.OnlineID)); } } }
mit
C#
b10b5c05a7aaacb3ea2c103a784f1542ffdce998
Create GCVWR.cs
SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming
Kattis-Solutions/GCVWR.cs
Kattis-Solutions/GCVWR.cs
using System; namespace GCVWR { class Program { static void Main(string[] args) { int g, t, n; string[] sarr; sarr = Console.ReadLine().Split(' '); g = int.Parse(sarr[0]); t = int.Parse(sarr[1]); sarr = Console.ReadLine().Split(' '); int tot = 0; for(int i = 0; i < sarr.Length; i++) { tot += int.Parse(sarr[i]); } int maxi = (90 * (g - t) / 100) - tot; Console.WriteLine(maxi); } } }
mit
C#
55c9984be610c98e0062a7b9582b287833476e53
Add Event class (WIP)
HelloFax/hellosign-dotnet-sdk
HelloSign/Models/Event.cs
HelloSign/Models/Event.cs
using System.Collections.Generic; namespace HelloSign { /// <summary> /// Representation of a HelloSign Event. /// </summary> public class Event<T> { public int? EventTime { get; set; } public string EventType { get; set; } public string EventHash { get; set; } public Dictionary<string, string> EventMetadata { get; set; } public T Item { get; set; } } }
mit
C#
f5c4c901284d6a3dc06fc2c54253a9f7f1ea57b6
test script
senips/FitnesseTutorial,senips/FitnesseTutorial
TestControlFixtures/TestControlFixtures/TestScript.cs
TestControlFixtures/TestControlFixtures/TestScript.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Data.Linq; namespace Testcontrol { public class TestScript { private IList<Instruction> mInstructions = new List<Instruction>(); public IList<Instruction> Instructions { get { return mInstructions; } } public void LoadScript(string fileName) { var lines = System.IO.File.ReadAllLines(fileName); foreach (var line in lines) { mInstructions.Add(new Instruction(line)); } } } public class Instruction { private String msript; private String mSearchableStepName; private IList<String> parameters; public Instruction(String script) { msript = script; mSearchableStepName = script; } private void parse() { if (parameters !=null) return; parameters = new List<String>(); MatchCollection matches = Regex.Matches(msript, "\\\"(.*?)\\\""); for (int i = 0; i < matches.Count;i++) { var match = matches[i]; parameters.Add(match.Value.Replace("\"", "")); mSearchableStepName = mSearchableStepName.Replace(match.Value, "{"+i+"}"); } } public IList<String> Parameters { get { parse(); return parameters; } } public String getSetpName() { parse(); return mSearchableStepName; } } }
mit
C#
20dda2ea4a70b3d63d960a037437ee67f95adb67
Fix for partial trust environments Assembly.GetExecutingAssembly() cannot be used in Partial trust environments Also linux type paths report file:// and not file:/// so substring(8) should not be used
chenxizhang/Simple.Data.Mysql,Vidarls/Simple.Data.Mysql,Vidarls/Simple.Data.Mysql,chenxizhang/Simple.Data.Mysql
Src/Simple.Data.Mysql/MysqlConnectorHelper.cs
Src/Simple.Data.Mysql/MysqlConnectorHelper.cs
using System; using System.Data; using System.Data.Common; using System.IO; using System.Reflection; namespace Simple.Data.Mysql { public static class MysqlConnectorHelper { private static DbProviderFactory _dbFactory; private static DbProviderFactory DbFactory { get { if (_dbFactory == null) _dbFactory = GetDbFactory(); return _dbFactory; } } public static IDbConnection CreateConnection(string connectionString) { var connection = DbFactory.CreateConnection(); connection.ConnectionString = connectionString; return connection; } public static DbDataAdapter CreateDataAdapter(string sqlCommand, IDbConnection connection) { var adapter = DbFactory.CreateDataAdapter(); var command = (DbCommand)connection.CreateCommand(); command.CommandText = sqlCommand; adapter.SelectCommand = command; return adapter; } private static DbProviderFactory GetDbFactory() { var thisAssembly = typeof(MysqlSchemaProvider).Assembly; var path = thisAssembly.CodeBase.Replace("file:///", "").Replace("file://", "//"); path = Path.GetDirectoryName(path); if (path == null) throw new ArgumentException("Unrecognised assemblyFile."); var mysqlAssembly = Assembly.LoadFrom(Path.Combine(path, "MySql.Data.dll")); var mysqlDbFactoryType = mysqlAssembly.GetType("MySql.Data.MySqlClient.MySqlClientFactory"); return (DbProviderFactory)Activator.CreateInstance(mysqlDbFactoryType); } } }
using System; using System.Data; using System.Data.Common; using System.IO; using System.Reflection; namespace Simple.Data.Mysql { public static class MysqlConnectorHelper { private static DbProviderFactory _dbFactory; private static DbProviderFactory DbFactory { get { if (_dbFactory == null) _dbFactory = GetDbFactory(); return _dbFactory; } } public static IDbConnection CreateConnection(string connectionString) { var connection = DbFactory.CreateConnection(); connection.ConnectionString = connectionString; return connection; } public static DbDataAdapter CreateDataAdapter(string sqlCommand, IDbConnection connection) { var adapter = DbFactory.CreateDataAdapter(); var command = (DbCommand)connection.CreateCommand(); command.CommandText = sqlCommand; adapter.SelectCommand = command; return adapter; } private static DbProviderFactory GetDbFactory() { var mysqlAssembly = Assembly.LoadFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.Substring(8)), "MySql.Data.dll")); var mysqlDbFactoryType = mysqlAssembly.GetType("MySql.Data.MySqlClient.MySqlClientFactory"); return (DbProviderFactory) Activator.CreateInstance(mysqlDbFactoryType); } } }
mit
C#
b6a5d4e76d22a31e01d997a7e3e220844d0ddcef
Add Incoming grain call filter extensions for ISiloBuilder (#5466)
pherbel/orleans,hoopsomuah/orleans,ElanHasson/orleans,veikkoeeva/orleans,benjaminpetit/orleans,waynemunro/orleans,waynemunro/orleans,hoopsomuah/orleans,jthelin/orleans,ibondy/orleans,yevhen/orleans,yevhen/orleans,pherbel/orleans,galvesribeiro/orleans,sergeybykov/orleans,ReubenBond/orleans,Liversage/orleans,dotnet/orleans,sergeybykov/orleans,amccool/orleans,galvesribeiro/orleans,ibondy/orleans,Liversage/orleans,amccool/orleans,amccool/orleans,ElanHasson/orleans,dotnet/orleans,Liversage/orleans,jason-bragg/orleans
src/Orleans.Runtime/Hosting/GrainCallFilterExtensions.cs
src/Orleans.Runtime/Hosting/GrainCallFilterExtensions.cs
namespace Orleans.Hosting { public static class GrainCallFilterExtensions { /// <summary> /// Adds an <see cref="IIncomingGrainCallFilter"/> to the filter pipeline. /// </summary> /// <param name="builder">The builder.</param> /// <param name="filter">The filter.</param> /// <returns>The builder.</returns> public static ISiloBuilder AddIncomingGrainCallFilter(this ISiloBuilder builder, IIncomingGrainCallFilter filter) { return builder.ConfigureServices(services => services.AddIncomingGrainCallFilter(filter)); } /// <summary> /// Adds an <see cref="IIncomingGrainCallFilter"/> to the filter pipeline. /// </summary> /// <typeparam name="TImplementation">The filter implementation type.</typeparam> /// <param name="builder">The builder.</param> /// <returns>The builder.</returns> public static ISiloBuilder AddIncomingGrainCallFilter<TImplementation>(this ISiloBuilder builder) where TImplementation : class, IIncomingGrainCallFilter { return builder.ConfigureServices(services => services.AddIncomingGrainCallFilter<TImplementation>()); } /// <summary> /// Adds an <see cref="IOutgoingGrainCallFilter"/> to the filter pipeline via a delegate. /// </summary> /// <param name="builder">The builder.</param> /// <param name="filter">The filter.</param> /// <returns>The builder.</returns> public static ISiloBuilder AddIncomingGrainCallFilter(this ISiloBuilder builder, IncomingGrainCallFilterDelegate filter) { return builder.ConfigureServices(services => services.AddIncomingGrainCallFilter(filter)); } /// <summary> /// Adds an <see cref="IOutgoingGrainCallFilter"/> to the filter pipeline. /// </summary> /// <param name="builder">The builder.</param> /// <param name="filter">The filter.</param> /// <returns>The builder.</returns> public static ISiloBuilder AddOutgoingGrainCallFilter(this ISiloBuilder builder, IOutgoingGrainCallFilter filter) { return builder.ConfigureServices(services => services.AddOutgoingGrainCallFilter(filter)); } /// <summary> /// Adds an <see cref="IOutgoingGrainCallFilter"/> to the filter pipeline. /// </summary> /// <typeparam name="TImplementation">The filter implementation type.</typeparam> /// <param name="builder">The builder.</param> /// <returns>The builder.</returns> public static ISiloBuilder AddOutgoingGrainCallFilter<TImplementation>(this ISiloBuilder builder) where TImplementation : class, IOutgoingGrainCallFilter { return builder.ConfigureServices(services => services.AddOutgoingGrainCallFilter<TImplementation>()); } /// <summary> /// Adds an <see cref="IOutgoingGrainCallFilter"/> to the filter pipeline via a delegate. /// </summary> /// <param name="builder">The builder.</param> /// <param name="filter">The filter.</param> /// <returns>The builder.</returns> public static ISiloBuilder AddOutgoingGrainCallFilter(this ISiloBuilder builder, OutgoingGrainCallFilterDelegate filter) { return builder.ConfigureServices(services => services.AddOutgoingGrainCallFilter(filter)); } } }
mit
C#
927f8dd0f1c56fa9a0121e53c6063e6f8375289c
Add GenericNullable in valid code.
DotNetAnalyzers/WpfAnalyzers
ValidCode/DependencyProperties/GenericNullable.cs
ValidCode/DependencyProperties/GenericNullable.cs
// ReSharper disable All namespace ValidCode.DependencyProperties { using System.Windows; public class GenericNullable<T> : FrameworkElement where T : struct { /// <summary>Identifies the <see cref="Value"/> dependency property.</summary> public static readonly DependencyProperty ValueProperty = DependencyProperty.Register( nameof(Value), typeof(T?), typeof(GenericNullable<T>), new PropertyMetadata(default(T?), OnValueChanged)); public T? Value { get { return (T?)this.GetValue(ValueProperty); } set { this.SetValue(ValueProperty, value); } } private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.OldValue is T oldValue) { } if (e.NewValue is T newValue) { } } } }
mit
C#
4f2353387049f95993ad5882336b244411e7cd87
Create LanguagesApiController.cs
letsbelopez/asp.net-snippets,letsbelopez/asp.net-snippets
LanguagesApiController.cs
LanguagesApiController.cs
using Sabio.Web.Domain; using Sabio.Web.Models.Requests; using Sabio.Web.Models.Responses; using Sabio.Web.Services; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; namespace Sabio.Web.Controllers.Api { [RoutePrefix("api/languages")] public class LanguagesApiController : ApiController { private ILanguageService _languageService; public LanguagesApiController() { } public LanguagesApiController(ILanguageService languageService) { _languageService = languageService; } [Route, HttpPost] public HttpResponseMessage Insert(LanguageAddRequest model) { if (ModelState.IsValid) { int id = _languageService.Insert(model); ItemResponse<int> response = new ItemResponse<int>(); response.Item = id; return Request.CreateResponse(response); } else { return Request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } } [Route("{id:int}"), HttpPut] public HttpResponseMessage Update(LanguageUpdateRequest model, int id) { if (ModelState.IsValid) { _languageService.Update(model); return Request.CreateResponse(new SuccessResponse()); } else { return Request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } } [Route("{id:int}"), HttpGet] public HttpResponseMessage GetOne(int id) { if (ModelState.IsValid) { Language model = _languageService.GetOne(id); ItemResponse<Language> response = new ItemResponse<Language>(); response.Item = model; return Request.CreateResponse(response); } else { return Request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } } [Route, HttpGet] public HttpResponseMessage SelectAll() { try { List<Language> list = _languageService.GetLanguages(); ItemsResponse<Language> response = new ItemsResponse<Language>(); response.Items = list; return Request.CreateResponse(response); } catch (Exception ex) { var response = new ErrorResponse(ex.Message); return Request.CreateResponse(response); } } [Route("{id:int}"), HttpDelete] public HttpResponseMessage Delete(int id) { if (ModelState.IsValid) { _languageService.Delete(id); return Request.CreateResponse(new SuccessResponse()); } else { return Request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } } } }
mit
C#
002ffba563c566cc890fbdc9a8068ace07c4fa1f
Add missing AssemblyInfo.cs for Tasks project.
kzu/SemanticGit
src/Tasks/Properties/AssemblyInfo.cs
src/Tasks/Properties/AssemblyInfo.cs
 // 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: System.Reflection.AssemblyTitle("Tasks")] [assembly: System.Reflection.AssemblyProduct("Tasks")]
apache-2.0
C#
bea888ca036154ca9ab36093a1edda33cbd067b8
Create Answer.cs
Si-143/Application-and-Web-Development
Answer.cs
Answer.cs
public class Answer { int QuestionId; string answer; public int QuestionID { get { return QuestionId; } set { QuestionId = value; } } public string Answers { get { return answer; } set { answer = value; } } public Answer(int id, string ans) { QuestionId = id; answer = ans; } } }
mit
C#
0ad288075c9e2e6fbbff9e4efe6d3b497d775c88
Add WSAData definition
JeremyKuhne/WInterop,JeremyKuhne/WInterop,JeremyKuhne/WInterop,JeremyKuhne/WInterop
src/WInterop.Desktop/Network/Native/WSAData.cs
src/WInterop.Desktop/Network/Native/WSAData.cs
// ------------------------ // WInterop Framework // ------------------------ // Copyright (c) Jeremy W. Kuhne. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Runtime.InteropServices; namespace WInterop.Network.Native { /// <summary> /// <see cref="https://docs.microsoft.com/windows/win32/api/winsock/ns-winsock-wsadata"/> /// </summary> /// <remarks> /// This is an awkward struct to represent as the layout changes depending on the architecture. /// While the union approach isn't technically correct, it give the correct layout and be slightly /// larger on 64 bit as the "32 bit" version won't align it's pointer tightly. /// </remarks> public unsafe struct WSAData { private const int WSADESCRIPTION_LEN = 256; private const int WSASYS_STATUS_LEN = 128; public UnionType Union; // It doesn't really matter which union arm we hit for the versions. public ushort wVersion => Union.WSAData64.wVersion; public ushort wHighVersion => Union.WSAData32.wHighVersion; public ReadOnlySpan<char> szDescription { get { char* description; if (Environment.Is64BitProcess) { fixed (char* c = Union.WSAData64.szDescription) { description = c; } } else { fixed (char* c = Union.WSAData32.szDescription) { description = c; } } return new ReadOnlySpan<char>(description, WSADESCRIPTION_LEN).SliceAtNull(); } } public ReadOnlySpan<char> szSystemStatus { get { char* description; if (Environment.Is64BitProcess) { fixed (char* c = Union.WSAData64.szSystemStatus) { description = c; } } else { fixed (char* c = Union.WSAData32.szSystemStatus) { description = c; } } return new ReadOnlySpan<char>(description, WSASYS_STATUS_LEN).SliceAtNull(); } } [StructLayout(LayoutKind.Explicit)] public struct UnionType { [FieldOffset(0)] public WSAData64 WSAData64; [FieldOffset(0)] public WSAData32 WSAData32; } public struct WSAData64 { public ushort wVersion; public ushort wHighVersion; public ushort iMaxSockets; public ushort iMaxUdpDg; public IntPtr lpVendorInfo; public fixed char szDescription[WSADESCRIPTION_LEN + 1]; public fixed char szSystemStatus[WSASYS_STATUS_LEN + 1]; } public struct WSAData32 { public ushort wVersion; public ushort wHighVersion; public fixed char szDescription[WSADESCRIPTION_LEN + 1]; public fixed char szSystemStatus[WSASYS_STATUS_LEN + 1]; public ushort iMaxSockets; public ushort iMaxUdpDg; public IntPtr lpVendorInfo; } } }
mit
C#
0fc07023fe5fe8ad5a37c22b721d105c012d4c5f
Add IAutoReservationService
mweibel/mste-testat
AutoReservation.Service.Wcf/IAutoReservationService.cs
AutoReservation.Service.Wcf/IAutoReservationService.cs
using AutoReservation.Common.DataTransferObjects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AutoReservation.Service.Wcf { interface IAutoReservationService { public List<DtoBase> findAll(); public DtoBase findOne(int id); public DtoBase insert(DtoBase entry); public DtoBase update(DtoBase entry); public bool delete(DtoBase entry); } }
mit
C#
c4d7ddfbc4c6892ddb6aace2020236bfac3073ae
add missing file
steven-r/stream-import
Stream.Importer.Excel/ExcelImporter.cs
Stream.Importer.Excel/ExcelImporter.cs
using System; using System.Collections.Generic; using System.Linq; using OfficeOpenXml; using StreamImporter.Base; namespace StreamImporter.Excel { public class ExcelImporter : ImporterBase { #region Fields protected bool HasHeader; private object[] _data; protected readonly ExcelWorksheet Sheet; private int _rowNum = 1; #endregion #region constructors public ExcelImporter(ExcelWorksheet worksheet) { Sheet = worksheet; } public ExcelImporter(ExcelWorksheet worksheet, bool hasHeader) : this(worksheet) { HasHeader = hasHeader; } #endregion public override object GetValue(int i) { if (_data == null) { throw new InvalidOperationException("No data available"); } return _data[i]; } /// <exception cref="InvalidOperationException">Cannot read from closed stream</exception> /// <exception cref="InvalidOperationException">Cannot start reading if columns are not defined until now.</exception> public override bool Read() { if (Sheet == null) { throw new InvalidOperationException("Cannot read from closed stream"); } if ((ColumnDefinitions == null || !ColumnDefinitions.Any())) { throw new InvalidOperationException("Cannot start reading if columns are not defined until now."); } if (Sheet.Dimension.End.Row < _rowNum) { // EOF return false; } List<object> lineData = new List<object>(FieldCount); for (int i = 1; i <= FieldCount; i++) { lineData.Add(Sheet.GetValue(_rowNum, i)); } _rowNum++; SetData(lineData.Take(FieldCount).ToArray()); return true; } public virtual void SetData(object[] data) { _data = data; } /// <exception cref="InvalidOperationException">Could not determine headers</exception> public override void SetupColumns() { if (!HasHeader) { return; } List<string> headerFields = ReadHeaderLine(); if (headerFields == null) { throw new InvalidOperationException("Could not determine headers"); } foreach (string field in headerFields) { AddColumnDefinition<string>(field); } _rowNum++; } public override int FieldCount { get { return ColumnDefinitions != null ? ColumnDefinitions.Count() : 0; } } protected List<string> ReadHeaderLine() { List<string> lineData = new List<string>(FieldCount); bool done = false; int col = 1; while (!done) { object header = Sheet.GetValue(_rowNum, col++); if (header == null || string.IsNullOrWhiteSpace(header.ToString())) { done = true; } else { lineData.Add(header.ToString()); } } return lineData; } #region Utility functions public void SetHeader(bool hasHeader) { HasHeader = true; } #endregion } }
mit
C#
4c22cce456e78b110bdf2d31be9a0f4464f626d6
Create Network.cs
Quadrat1c/OpJinx
Epoch/Network/Network.cs
Epoch/Network/Network.cs
using System; using System.Collections.Generic; using System.Linq; namespace Epoch.Network { public class Network { #region -- Properties -- public double LearnRate { get; set; } public double Momentum { get; set; } public List<Neuron> InputLayer { get; set; } public List<Neuron> HiddenLayer { get; set; } public List<Neuron> OutputLayer { get; set; } #endregion #region -- Globals -- private static readonly Random Random = new Random(); #endregion #region -- Constructor -- public Network(int inputSize, int hiddenSize, int outputSize, double? learnRate = null, double? momentum = null) { LearnRate = learnRate ?? .4; Momentum = momentum ?? .9; InputLayer = new List<Neuron>(); HiddenLayer = new List<Neuron>(); OutputLayer = new List<Neuron>(); for (var i = 0; i < inputSize; i++) InputLayer.Add(new Neuron()); for (var i = 0; i < hiddenSize; i++) HiddenLayer.Add(new Neuron(InputLayer)); for (var i = 0; i < outputSize; i++) OutputLayer.Add(new Neuron(HiddenLayer)); } #endregion #region -- Training -- public void Train(List<DataSet> dataSets, int numEpochs) { for (var i = 0; i < numEpochs; i++) { foreach (var dataSet in dataSets) { ForwardPropagate(dataSet.Values); BackPropagate(dataSet.Targets); } } } public void Train(List<DataSet> dataSets, double minimumError) { var error = 1.0; var numEpochs = 0; while (error > minimumError && numEpochs < int.MaxValue) { var errors = new List<double>(); foreach (var dataSet in dataSets) { ForwardPropagate(dataSet.Values); BackPropagate(dataSet.Targets); errors.Add(CalculateError(dataSet.Targets)); } error = errors.Average(); numEpochs++; } } private void ForwardPropagate(params double[] inputs) { var i = 0; InputLayer.ForEach(a => a.Value = inputs[i++]); HiddenLayer.ForEach(a => a.CalculateValue()); OutputLayer.ForEach(a => a.CalculateValue()); } private void BackPropagate(params double[] targets) { var i = 0; OutputLayer.ForEach(a => a.CalculateGradient(targets[i++])); HiddenLayer.ForEach(a => a.CalculateGradient()); HiddenLayer.ForEach(a => a.UpdateWeights(LearnRate, Momentum)); OutputLayer.ForEach(a => a.UpdateWeights(LearnRate, Momentum)); } public double[] Compute(params double[] inputs) { ForwardPropagate(inputs); return OutputLayer.Select(a => a.Value).ToArray(); } private double CalculateError(params double[] targets) { var i = 0; return OutputLayer.Sum(a => Math.Abs(a.CalculateError(targets[i++]))); } #endregion #region -- Helpers -- public static double GetRandom() { return 2 * Random.NextDouble() - 1; } #endregion } #region -- Enum -- public enum TrainingType { Epoch, MinimumError } #endregion }
mit
C#
20c779affa4de0a9c349d01160c190ae1e4f7efc
Add PaintTile.cs
DeathCradle/Terraria-s-Dedicated-Server-Mod,DeathCradle/Terraria-s-Dedicated-Server-Mod,DeathCradle/Terraria-s-Dedicated-Server-Mod,DeathCradle/Terraria-s-Dedicated-Server-Mod
Core/PluginHooks/PaintTile.cs
Core/PluginHooks/PaintTile.cs
using OTA.Plugin; namespace TDSM.Core.Plugin.Hooks { public static partial class TDSMHookArgs { public struct PaintTile { public int X { get; set; } public int Y { get; set; } public byte Colour { get; set; } } } public static partial class TDSMHookPoints { public static readonly HookPoint<TDSMHookArgs.PaintTile> PaintTile = new HookPoint<TDSMHookArgs.PaintTile>(); } }
mit
C#
916e442ee498ede35549e1a84646ca57caf8a24f
Fix errors in log caused by no prevalues beind selected.
Khamull/Umbraco-CMS,ehornbostel/Umbraco-CMS,base33/Umbraco-CMS,hfloyd/Umbraco-CMS,iahdevelop/Umbraco-CMS,qizhiyu/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,Tronhus/Umbraco-CMS,mattbrailsford/Umbraco-CMS,umbraco/Umbraco-CMS,gavinfaux/Umbraco-CMS,dawoe/Umbraco-CMS,gregoriusxu/Umbraco-CMS,NikRimington/Umbraco-CMS,mittonp/Umbraco-CMS,romanlytvyn/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,mattbrailsford/Umbraco-CMS,yannisgu/Umbraco-CMS,Spijkerboer/Umbraco-CMS,romanlytvyn/Umbraco-CMS,Pyuuma/Umbraco-CMS,leekelleher/Umbraco-CMS,romanlytvyn/Umbraco-CMS,neilgaietto/Umbraco-CMS,christopherbauer/Umbraco-CMS,tompipe/Umbraco-CMS,rasmusfjord/Umbraco-CMS,ordepdev/Umbraco-CMS,rasmusfjord/Umbraco-CMS,arvaris/HRI-Umbraco,arknu/Umbraco-CMS,lars-erik/Umbraco-CMS,leekelleher/Umbraco-CMS,nvisage-gf/Umbraco-CMS,bjarnef/Umbraco-CMS,corsjune/Umbraco-CMS,nvisage-gf/Umbraco-CMS,Door3Dev/HRI-Umbraco,MicrosoftEdge/Umbraco-CMS,lingxyd/Umbraco-CMS,tompipe/Umbraco-CMS,ordepdev/Umbraco-CMS,kasperhhk/Umbraco-CMS,wtct/Umbraco-CMS,AzarinSergey/Umbraco-CMS,WebCentrum/Umbraco-CMS,madsoulswe/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,WebCentrum/Umbraco-CMS,AndyButland/Umbraco-CMS,hfloyd/Umbraco-CMS,mittonp/Umbraco-CMS,Door3Dev/HRI-Umbraco,ordepdev/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,neilgaietto/Umbraco-CMS,dawoe/Umbraco-CMS,Phosworks/Umbraco-CMS,countrywide/Umbraco-CMS,arvaris/HRI-Umbraco,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,Myster/Umbraco-CMS,nvisage-gf/Umbraco-CMS,mittonp/Umbraco-CMS,gkonings/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,lingxyd/Umbraco-CMS,rajendra1809/Umbraco-CMS,AndyButland/Umbraco-CMS,DaveGreasley/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,sargin48/Umbraco-CMS,gavinfaux/Umbraco-CMS,abryukhov/Umbraco-CMS,gregoriusxu/Umbraco-CMS,lingxyd/Umbraco-CMS,countrywide/Umbraco-CMS,markoliver288/Umbraco-CMS,rustyswayne/Umbraco-CMS,mstodd/Umbraco-CMS,rustyswayne/Umbraco-CMS,engern/Umbraco-CMS,AzarinSergey/Umbraco-CMS,Khamull/Umbraco-CMS,NikRimington/Umbraco-CMS,jchurchley/Umbraco-CMS,AzarinSergey/Umbraco-CMS,jchurchley/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,AndyButland/Umbraco-CMS,kgiszewski/Umbraco-CMS,corsjune/Umbraco-CMS,lars-erik/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,zidad/Umbraco-CMS,marcemarc/Umbraco-CMS,corsjune/Umbraco-CMS,Myster/Umbraco-CMS,Pyuuma/Umbraco-CMS,iahdevelop/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,jchurchley/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,qizhiyu/Umbraco-CMS,christopherbauer/Umbraco-CMS,aaronpowell/Umbraco-CMS,iahdevelop/Umbraco-CMS,Phosworks/Umbraco-CMS,TimoPerplex/Umbraco-CMS,TimoPerplex/Umbraco-CMS,Door3Dev/HRI-Umbraco,neilgaietto/Umbraco-CMS,VDBBjorn/Umbraco-CMS,DaveGreasley/Umbraco-CMS,kasperhhk/Umbraco-CMS,VDBBjorn/Umbraco-CMS,Door3Dev/HRI-Umbraco,markoliver288/Umbraco-CMS,Pyuuma/Umbraco-CMS,gkonings/Umbraco-CMS,abryukhov/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Pyuuma/Umbraco-CMS,gregoriusxu/Umbraco-CMS,AndyButland/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,Tronhus/Umbraco-CMS,leekelleher/Umbraco-CMS,dampee/Umbraco-CMS,engern/Umbraco-CMS,KevinJump/Umbraco-CMS,dampee/Umbraco-CMS,rustyswayne/Umbraco-CMS,tcmorris/Umbraco-CMS,abryukhov/Umbraco-CMS,tcmorris/Umbraco-CMS,ehornbostel/Umbraco-CMS,kgiszewski/Umbraco-CMS,leekelleher/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,gregoriusxu/Umbraco-CMS,AzarinSergey/Umbraco-CMS,dawoe/Umbraco-CMS,TimoPerplex/Umbraco-CMS,gkonings/Umbraco-CMS,Spijkerboer/Umbraco-CMS,iahdevelop/Umbraco-CMS,rajendra1809/Umbraco-CMS,m0wo/Umbraco-CMS,mstodd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,rajendra1809/Umbraco-CMS,romanlytvyn/Umbraco-CMS,arknu/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,WebCentrum/Umbraco-CMS,Phosworks/Umbraco-CMS,engern/Umbraco-CMS,dampee/Umbraco-CMS,arknu/Umbraco-CMS,aadfPT/Umbraco-CMS,nvisage-gf/Umbraco-CMS,wtct/Umbraco-CMS,neilgaietto/Umbraco-CMS,gkonings/Umbraco-CMS,m0wo/Umbraco-CMS,markoliver288/Umbraco-CMS,qizhiyu/Umbraco-CMS,sargin48/Umbraco-CMS,abjerner/Umbraco-CMS,Khamull/Umbraco-CMS,countrywide/Umbraco-CMS,rajendra1809/Umbraco-CMS,KevinJump/Umbraco-CMS,aadfPT/Umbraco-CMS,arvaris/HRI-Umbraco,rasmuseeg/Umbraco-CMS,Pyuuma/Umbraco-CMS,AzarinSergey/Umbraco-CMS,hfloyd/Umbraco-CMS,Myster/Umbraco-CMS,lars-erik/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,robertjf/Umbraco-CMS,Phosworks/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,AndyButland/Umbraco-CMS,lingxyd/Umbraco-CMS,NikRimington/Umbraco-CMS,neilgaietto/Umbraco-CMS,rasmuseeg/Umbraco-CMS,Phosworks/Umbraco-CMS,VDBBjorn/Umbraco-CMS,Tronhus/Umbraco-CMS,bjarnef/Umbraco-CMS,DaveGreasley/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,ordepdev/Umbraco-CMS,bjarnef/Umbraco-CMS,christopherbauer/Umbraco-CMS,abjerner/Umbraco-CMS,countrywide/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,DaveGreasley/Umbraco-CMS,qizhiyu/Umbraco-CMS,mstodd/Umbraco-CMS,wtct/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,marcemarc/Umbraco-CMS,mittonp/Umbraco-CMS,VDBBjorn/Umbraco-CMS,abjerner/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,countrywide/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,base33/Umbraco-CMS,timothyleerussell/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,markoliver288/Umbraco-CMS,kasperhhk/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,gavinfaux/Umbraco-CMS,dampee/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,gavinfaux/Umbraco-CMS,rasmuseeg/Umbraco-CMS,sargin48/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,leekelleher/Umbraco-CMS,Spijkerboer/Umbraco-CMS,yannisgu/Umbraco-CMS,Spijkerboer/Umbraco-CMS,bjarnef/Umbraco-CMS,tompipe/Umbraco-CMS,DaveGreasley/Umbraco-CMS,gavinfaux/Umbraco-CMS,robertjf/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,yannisgu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,Myster/Umbraco-CMS,lingxyd/Umbraco-CMS,KevinJump/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,corsjune/Umbraco-CMS,ehornbostel/Umbraco-CMS,m0wo/Umbraco-CMS,timothyleerussell/Umbraco-CMS,ehornbostel/Umbraco-CMS,mittonp/Umbraco-CMS,yannisgu/Umbraco-CMS,rustyswayne/Umbraco-CMS,aaronpowell/Umbraco-CMS,zidad/Umbraco-CMS,dawoe/Umbraco-CMS,VDBBjorn/Umbraco-CMS,aadfPT/Umbraco-CMS,mattbrailsford/Umbraco-CMS,marcemarc/Umbraco-CMS,m0wo/Umbraco-CMS,rasmusfjord/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Khamull/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,lars-erik/Umbraco-CMS,Myster/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,madsoulswe/Umbraco-CMS,zidad/Umbraco-CMS,rajendra1809/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,yannisgu/Umbraco-CMS,markoliver288/Umbraco-CMS,madsoulswe/Umbraco-CMS,wtct/Umbraco-CMS,TimoPerplex/Umbraco-CMS,Door3Dev/HRI-Umbraco,christopherbauer/Umbraco-CMS,engern/Umbraco-CMS,kasperhhk/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,engern/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,hfloyd/Umbraco-CMS,timothyleerussell/Umbraco-CMS,romanlytvyn/Umbraco-CMS,wtct/Umbraco-CMS,iahdevelop/Umbraco-CMS,sargin48/Umbraco-CMS,qizhiyu/Umbraco-CMS,robertjf/Umbraco-CMS,kasperhhk/Umbraco-CMS,Khamull/Umbraco-CMS,base33/Umbraco-CMS,sargin48/Umbraco-CMS,gregoriusxu/Umbraco-CMS,mstodd/Umbraco-CMS,hfloyd/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,zidad/Umbraco-CMS,Tronhus/Umbraco-CMS,corsjune/Umbraco-CMS,aaronpowell/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,m0wo/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,rustyswayne/Umbraco-CMS,timothyleerussell/Umbraco-CMS,gkonings/Umbraco-CMS,ehornbostel/Umbraco-CMS,marcemarc/Umbraco-CMS,Tronhus/Umbraco-CMS,lars-erik/Umbraco-CMS,dampee/Umbraco-CMS,ordepdev/Umbraco-CMS,TimoPerplex/Umbraco-CMS,christopherbauer/Umbraco-CMS,markoliver288/Umbraco-CMS,nvisage-gf/Umbraco-CMS,arvaris/HRI-Umbraco,timothyleerussell/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,umbraco/Umbraco-CMS,kgiszewski/Umbraco-CMS,mstodd/Umbraco-CMS,zidad/Umbraco-CMS
src/umbraco.editorControls/DefaultDataKeyValue.cs
src/umbraco.editorControls/DefaultDataKeyValue.cs
using System; using umbraco.DataLayer; namespace umbraco.editorControls { /// <summary> /// Summary description for cms.businesslogic.datatype.DefaultDataKeyValue. /// </summary> public class DefaultDataKeyValue : cms.businesslogic.datatype.DefaultData { public DefaultDataKeyValue(cms.businesslogic.datatype.BaseDataType DataType) : base(DataType) {} /// <summary> /// Ov /// </summary> /// <param name="d"></param> /// <returns></returns> public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d) { // Get the value from string v = ""; try { // Don't query if there's nothing to query for.. if (string.IsNullOrWhiteSpace(Value.ToString()) == false) { IRecordsReader dr = SqlHelper.ExecuteReader("Select [value] from cmsDataTypeprevalues where id in (@id)", SqlHelper.CreateParameter("id", Value.ToString())); while (dr.Read()) { if (v.Length == 0) v += dr.GetString("value"); else v += "," + dr.GetString("value"); } dr.Close(); } } catch {} return d.CreateCDataSection(v); } } }
using System; using umbraco.DataLayer; namespace umbraco.editorControls { /// <summary> /// Summary description for cms.businesslogic.datatype.DefaultDataKeyValue. /// </summary> public class DefaultDataKeyValue : cms.businesslogic.datatype.DefaultData { public DefaultDataKeyValue(cms.businesslogic.datatype.BaseDataType DataType) : base(DataType) {} /// <summary> /// Ov /// </summary> /// <param name="d"></param> /// <returns></returns> public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d) { // Get the value from string v = ""; try { IRecordsReader dr = SqlHelper.ExecuteReader("Select [value] from cmsDataTypeprevalues where id in (" + SqlHelper.EscapeString(Value.ToString()) + ")"); while (dr.Read()) { if (v.Length == 0) v += dr.GetString("value"); else v += "," + dr.GetString("value"); } dr.Close(); } catch {} return d.CreateCDataSection(v); } } }
mit
C#
b16bea898bc870533e6efcd8684287bbefd5e898
increment version number in prep for release
SwensenSoftware/im-only-resting,ItsAGeekThing/im-only-resting,nathanwblair/im-only-resting,abhinavwaviz/im-only-resting,MrZANE42/im-only-resting,stephen-swensen/im-only-resting,MrZANE42/im-only-resting,stephen-swensen/im-only-resting,jordanbtucker/im-only-resting,codemonkey493/im-only-resting,nathanwblair/im-only-resting,codemonkey493/im-only-resting,jordanbtucker/im-only-resting,ItsAGeekThing/im-only-resting,abhinavwaviz/im-only-resting,SwensenSoftware/im-only-resting
Ior/Properties/AssemblyInfo.cs
Ior/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("I'm Only Resting")] [assembly: AssemblyDescription("http://code.google.com/p/im-only-resting/")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("I'm Only Resting")] [assembly: AssemblyCopyright("Copyright © Stephen Swensen 2012-2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("42d77ebc-de54-4916-b931-de852d2bacff")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.*")] [assembly: AssemblyFileVersion("1.1.0.*")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("I'm Only Resting")] [assembly: AssemblyDescription("http://code.google.com/p/im-only-resting/")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("I'm Only Resting")] [assembly: AssemblyCopyright("Copyright © Stephen Swensen 2012-2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("42d77ebc-de54-4916-b931-de852d2bacff")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.1.*")] [assembly: AssemblyFileVersion("1.0.1.*")]
apache-2.0
C#
5ba77e85a604c30118fdfe925133adc31173b57e
Implement FakeAsyncQueryableExecuter
aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate
test/Abp.Zero.SampleApp/Linq/FakeAsyncQueryableExecuter.cs
test/Abp.Zero.SampleApp/Linq/FakeAsyncQueryableExecuter.cs
using Abp.Linq; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Abp.Zero.SampleApp.Linq { /// <summary> /// <see cref="FakeAsyncQueryableExecuter"/> <see langword="await"/>s an asynchronous <see cref="Task"/> before executing an operation synchronously. /// This differs from <see cref="NullAsyncQueryableExecuter"/> a.k.a. SyncQueryableExecuter, which actually only executes an operation synchronously. /// This can be used with tests to catch code that does not properly <see langword="await"/> a <see cref="Task"/> in a <see langword="using"/> block. /// </summary> public class FakeAsyncQueryableExecuter : IAsyncQueryableExecuter { public async Task<bool> AnyAsync<T>(IQueryable<T> queryable) { await AsyncTask(); return queryable.Any(); } public int Count<T>(IQueryable<T> queryable) { throw new System.NotImplementedException(); } public async Task<int> CountAsync<T>(IQueryable<T> queryable) { await AsyncTask(); return queryable.Count(); } public T FirstOrDefault<T>(IQueryable<T> queryable) { throw new System.NotImplementedException(); } public async Task<T> FirstOrDefaultAsync<T>(IQueryable<T> queryable) { await AsyncTask(); return queryable.FirstOrDefault(); } public List<T> ToList<T>(IQueryable<T> queryable) { throw new System.NotImplementedException(); } public async Task<List<T>> ToListAsync<T>(IQueryable<T> queryable) { await AsyncTask(); return queryable.ToList(); } private Task AsyncTask() { return Task.Delay(1); // Task.Delay(0) and Task.CompletedTask are synchronous } } }
mit
C#
ea52fc5ecf756085b240e5ef5b4caaed678a9464
Create PointInTime.cs
Flavoured/UE4_CODE_DUMP,Flavoured/UE4_CODE_DUMP,Flavoured/UE4_CODE_DUMP
RewindComponent/PointInTime.cs
RewindComponent/PointInTime.cs
/* Created by Brackeys https://github.com/Brackeys/Rewind-Time */ using UnityEngine; public class PointInTime { public Vector3 position; public Quaternion rotation; public PointInTime (Vector3 _position, Quaternion _rotation) { position = _position; rotation = _rotation; } }
unlicense
C#
53d60fbd7171d57ffd45c102d385df9b34399be0
Fix #2
LonDC/demos-dotnet
TestViaApi/Collection.cs
TestViaApi/Collection.cs
using System.Collections.Generic; namespace TestViaApi { // This corresponds to the structure of the response to a /1.0/collections GET request public class CollectionList : List<Collection> { } public class Collection { public string collection { get; set; } public int count { get; set; } } }
apache-2.0
C#
1165da576288819aa01c821d270150326ef3681f
Create codingame-Humans_vs_Zombies.cs
israelchen/CodinGame,israelchen/CodinGame
codingame-Humans_vs_Zombies.cs
codingame-Humans_vs_Zombies.cs
using System; using System.Linq; using System.IO; using System.Text; using System.Collections; using System.Collections.Generic; /** * Save humans, destroy zombies! **/ struct ZombieToHuman { public int HumanId; public int ZombieId; public int Distance; public int TurnsToReach; } struct AshToHuman { public int HumanId; public int Distance; public int TurnsToReach; } struct Zombie { public int X; public int Y; public int NextX; public int NextY; } struct Human { public int X; public int Y; } class Player { private static int CalcDistance(int x1, int y1, int x2, int y2) { // d = sqrt( sqr(x2-x1) + sqr(y2 - y1) ) return (int)Math.Sqrt(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2)); } static void Main(string[] args) { string[] inputs; // game loop while (true) { var humans = new Dictionary<int, Human>(); var zombies = new Dictionary<int, Zombie>(); inputs = Console.ReadLine().Split(' '); int x = int.Parse(inputs[0]); int y = int.Parse(inputs[1]); int humanCount = int.Parse(Console.ReadLine()); for (int i = 0; i < humanCount; i++) { inputs = Console.ReadLine().Split(' '); int humanId = int.Parse(inputs[0]); int humanX = int.Parse(inputs[1]); int humanY = int.Parse(inputs[2]); humans.Add(humanId, new Human { X = humanX, Y = humanY, }); } int zombieCount = int.Parse(Console.ReadLine()); for (int i = 0; i < zombieCount; i++) { inputs = Console.ReadLine().Split(' '); int zombieId = int.Parse(inputs[0]); int zombieX = int.Parse(inputs[1]); int zombieY = int.Parse(inputs[2]); int zombieXNext = int.Parse(inputs[3]); int zombieYNext = int.Parse(inputs[4]); zombies.Add(zombieId, new Zombie { X = zombieX, Y = zombieY, NextX = zombieXNext, NextY = zombieYNext, }); } var zombiesToHumans = new List<ZombieToHuman>(); var ashToHumans = new Dictionary<int, AshToHuman>(); foreach (var human in humans) { var distance = CalcDistance(human.Value.X, human.Value.Y, x, y); ashToHumans.Add(human.Key, new AshToHuman { Distance = distance, HumanId = human.Key, TurnsToReach = (distance - 2000) / 1000, }); foreach (var zombie in zombies) { distance = CalcDistance(zombie.Value.X, zombie.Value.Y, human.Value.X, human.Value.Y); zombiesToHumans.Add(new ZombieToHuman { Distance = distance, ZombieId = zombie.Key, HumanId = human.Key, TurnsToReach = (distance - 400) / 400, }); } } var h = zombiesToHumans.OrderBy(zh => zh.TurnsToReach).Where(zh => zh.TurnsToReach >= ashToHumans[zh.HumanId].TurnsToReach).First(); // Write an action using Console.WriteLine() // To debug: Console.Error.WriteLine("Debug messages..."); Console.WriteLine("{0} {1}", zombies[h.ZombieId].NextX, zombies[h.ZombieId].NextY); // Your destination coordinates } } }
mit
C#
affd1dfc6a30466738a1344753ff8140d7be045f
Add AuthoirzationRequriedAttribute
HelloKitty/GladNet2.0,HelloKitty/GladNet2,HelloKitty/GladNet2.0,HelloKitty/GladNet2
src/GladNet.Payload/Attributes/AuthorizationRequiredAttribute.cs
src/GladNet.Payload/Attributes/AuthorizationRequiredAttribute.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GladNet.Payload { /// <summary> /// Metadata to indicate that authorization is needed for the marked payload. /// </summary> [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public class AuthorizationRequiredAttribute : Attribute { } }
bsd-3-clause
C#
19e4f08b6f3e73dde3f808aafa025551ac027d62
Revert "Revert "bullet""
baretata/CSharp2-TeamDevilGame
Bullet/Bullet.cs
Bullet/Bullet.cs
using System; using System.Drawing; namespace DevilInTheSky { class Bullet { public int direction = 0; // move direction (0-up,1-down,2-right,3-left,4-up right,5-up left,6-down right,7-down left public ConsoleColor color = new ConsoleColor(); public Point position = new Point(0, 0); public Bullet(Point position,ConsoleColor color,int direction) { this.position = position; this.color = color; this.direction = direction; } public void moveBullet() { switch (direction) { case 0: { position.Y-=3; break; } case 1: { position.Y+=3; break; } case 2: { position.X += 5; break; } case 3: { position.X -= 5; break; } case 4: { position.Y-=3; position.X+=3; break; } case 5: { position.Y-=3; position.X-=3; break; } case 6: { position.Y+=3; position.X+=3; break; } case 7: { position.Y+=3; position.X-=3; break; } } } public void printBulet() { Console.SetCursorPosition(position.X, position.Y); Console.ForegroundColor=color; Console.Write("#"); } } }
mit
C#
ae76ebcf9f4e2b5b7f0a221ea90a6ef999834fa8
Create FriendlyNumbers.cs
shreeharshas/Algorithms,shreeharshas/hackerrank,shreeharshas/hackerrank,shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/hackerrank,shreeharshas/hackerrank
FriendlyNumbers.cs
FriendlyNumbers.cs
/* For x = 220 and y = 284, the output should be friendly_numbers(x, y) = "Yes". The proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110, which add up to 284; and the proper divisors of 284 are 1, 2, 4, 71 and 142, which add up to 220. Input/Output [time limit] 3000ms (cs) [input] integer x Constraints: 1 ≤ x ≤ 105. [input] integer y Constraints: 1 ≤ y ≤ 105. [output] string "Yes" if x and y are friendly and "No" otherwise. */ string friendly_numbers(int x, int y) { long sum_x = 0L, sum_y = 0L; if(x==0||y==0||x==y) return "No"; List<int> pDivX = GetProperDivisors(x); List<int> pDivY = GetProperDivisors(y); sum_x= pDivX.Sum(i => Convert.ToInt32(i)); sum_y= pDivY.Sum(i => Convert.ToInt32(i)); Console.WriteLine(sum_x+","+sum_y); return (sum_x==y&&sum_y==x?"Yes":"No"); } List<int> GetProperDivisors(int x){ List<int> retVal = new List<int>(); for(int i=1;i<=x/2;i++){ if(x%i==0){ retVal.Add(i); } } return retVal; }
mit
C#
b91dd841f7a0337d336be8d8b451dc82133bcab0
Add Ignore tests
NickCraver/StackExchange.Exceptional,NickCraver/StackExchange.Exceptional
tests/StackExchange.Exceptional.Tests/Ignore.cs
tests/StackExchange.Exceptional.Tests/Ignore.cs
using System; using System.Text.RegularExpressions; using StackExchange.Exceptional.Internal; using StackExchange.Exceptional.Stores; using Xunit; namespace StackExchange.Exceptional.Tests { public class Ignore { [Fact] public void ShouldRecordType() { var settings = new TestSettings(new MemoryErrorStore()); settings.Ignore.Types.Add(typeof(ExcludeType).FullName); Assert.False(new Exception().ShouldBeIgnored(settings)); Assert.True(new ExcludeType().ShouldBeIgnored(settings)); Assert.True(new ExcludeTypeDescendant().ShouldBeIgnored(settings)); Assert.False(new ExcludeType2().ShouldBeIgnored(settings)); } [Fact] public void ShouldRecordMessage() { var settings = new TestSettings(new MemoryErrorStore()); settings.Ignore.Regexes.Add(new Regex("Goobly.*")); Assert.False(new Exception().ShouldBeIgnored(settings)); Assert.False(new Exception("Goo").ShouldBeIgnored(settings)); Assert.True(new Exception("Goobly Woobly").ShouldBeIgnored(settings)); } } #pragma warning disable RCS1194 // Implement exception constructors. public class ExcludeType : Exception { } public class ExcludeTypeDescendant : ExcludeType { } public class ExcludeType2 : Exception { } #pragma warning restore RCS1194 // Implement exception constructors. }
apache-2.0
C#
e9698fe62cae9b5b410085c6de9baa0c7383c1e6
Add index only drawer node
id144/dx11-vvvv,id144/dx11-vvvv,id144/dx11-vvvv
Nodes/VVVV.DX11.Nodes/Nodes/Geometry/AsIndexGeometryNode.cs
Nodes/VVVV.DX11.Nodes/Nodes/Geometry/AsIndexGeometryNode.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel.Composition; using SlimDX; using SlimDX.Direct3D11; using VVVV.PluginInterfaces.V2; using VVVV.PluginInterfaces.V1; using FeralTic.DX11; using FeralTic.DX11.Resources; namespace VVVV.DX11.Nodes { [PluginInfo(Name = "IndexOnlyDrawer", Category = "DX11.Drawer", Version = "", Author = "vux")] public class DX11IndexOnlyDrawerNode : IPluginEvaluate, IDX11ResourceProvider { [Input("Geometry In", CheckIfChanged = true)] protected Pin<DX11Resource<DX11IndexedGeometry>> FInGeom; [Input("Enabled",DefaultValue=1)] protected IDiffSpread<bool> FInEnabled; [Output("Geometry Out")] protected ISpread<DX11Resource<DX11IndexedGeometry>> FOutGeom; bool invalidate = false; public void Evaluate(int SpreadMax) { invalidate = false; if (this.FInGeom.PluginIO.IsConnected) { this.FOutGeom.SliceCount = SpreadMax; for (int i = 0; i < SpreadMax; i++) { if (this.FOutGeom[i] == null) { this.FOutGeom[i] = new DX11Resource<DX11IndexedGeometry>(); } } invalidate = this.FInGeom.IsChanged || this.FInEnabled.IsChanged; if (invalidate) { this.FOutGeom.Stream.IsChanged = true; } } else { this.FOutGeom.SliceCount = 0; } } public void Update(IPluginIO pin, DX11RenderContext context) { Device device = context.Device; for (int i = 0; i < this.FOutGeom.SliceCount; i++) { if (this.FInEnabled[i] && this.FInGeom[i].Contains(context)) { DX11IndexedGeometry v = (DX11IndexedGeometry)this.FInGeom[i][context].ShallowCopy(); DX11PerVertexIndexedDrawer drawer = new DX11PerVertexIndexedDrawer(); v.AssignDrawer(drawer); this.FOutGeom[i][context] = v; } else { this.FOutGeom[i][context] = this.FInGeom[i][context]; } } } public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { //Not ownding resource eg: do nothing } } }
bsd-3-clause
C#
1be4b0cb339124e0dc1409caae9dcf3a899473f6
Add container for non-array results
LordMike/TMDbLib
TMDbLib/Objects/General/SingleResultContainer.cs
TMDbLib/Objects/General/SingleResultContainer.cs
using Newtonsoft.Json; namespace TMDbLib.Objects.General { public class SingleResultContainer<T> { [JsonProperty("id")] public int Id { get; set; } [JsonProperty("results")] public T Results { get; set; } } }
mit
C#
da1a7c7d443a3eece7b820e779e745736d3e7c9f
Add order-credit-marketplace snippet
balanced/balanced-csharp
scenarios/snippets/order-credit-marketplace.cs
scenarios/snippets/order-credit-marketplace.cs
BankAccount bankAccount = Marketplace.Mine.owner_customer.bank_accounts.First(); Dictionary<string, object> payload = new Dictionary<string, object>(); payload.Add("amount", 2000); payload.Add("description", "Credit from order escrow to marketplace bank account"); Credit credit = bankAccount.Credit(payload);
mit
C#
44483298e484bf3ba324a213227d2659df1795c9
Add missing file
countersoft/App-DocStore,countersoft/App-DocStore,countersoft/App-DocStore
App/DocumentModel.cs
App/DocumentModel.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.Mvc; using Countersoft.Gemini.Commons.Dto; using Countersoft.Gemini.Models; namespace DocStore.App { public class DocumentsModel : BaseModel { public List<ProjectDocumentDto> FolderList { get; set; } public bool ReadOnly { get; set; } public IEnumerable<SelectListItem> ProjectList { get; set; } public int SelectedFolder { get; set; } } }
mit
C#
f46e7908dd35a0191c89509ec41a84db499ab4cc
Create ThomasLee.cs
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/ThomasLee.cs
src/Firehose.Web/Authors/ThomasLee.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class ThomasLEe : IAmAMicrosoftMVP { public string FirstName => "Thomas"; public string LastName => "Lee"; public string ShortBioOrTagLine => "Just this guy, living in the UK. Grateful Dead fan, and long time PowerShell Fan. MVP 17 times"; public string StateOrRegion => "Berkshire, UI"; public string EmailAddress => 'DoctorDNS@Gmail.Com; public string TwitterHandle => "DoctorDNS"; public string GravatarHash => "9fac677a9811ddc033b9ec883606031d"; public string GitHubHandle => "DoctorDNS"; public GeoPosition Position => new GeoPosition(51.5566737,-0.6941204); public Uri WebSite => new Uri("https://tfl09.blogspot.com.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://tfl09.blogspot.com/feeds/posts/default/"); } } public string FeedLanguageCode => "en"; } }
mit
C#
87cded5403562c5379f57157a222d6683a4e798c
Create PaintStyle.cs
wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D
src/Draw2D.ViewModels/Style/Core/PaintStyle.cs
src/Draw2D.ViewModels/Style/Core/PaintStyle.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. namespace Draw2D.ViewModels.Style { public enum PaintStyle { Fill = 0, Stroke = 1, StrokeAndFill = 2 } }
mit
C#
b08c88f76617e1d3a20be3e23c2c5b7e3f26606a
Add stubs of DOMDocumentType members
iolevel/peachpie-concept,iolevel/peachpie-concept,iolevel/peachpie-concept,iolevel/peachpie,iolevel/peachpie,peachpiecompiler/peachpie,peachpiecompiler/peachpie,iolevel/peachpie,peachpiecompiler/peachpie
src/Peachpie.Library.XmlDom/DOMDocumentType.cs
src/Peachpie.Library.XmlDom/DOMDocumentType.cs
using System; using System.Collections.Generic; using System.Text; using System.Xml; using Pchp.Core; // TODO: Enable XmlDocumentType and its usage when available (netstandard2.0) namespace Peachpie.Library.XmlDom { [PhpType(PhpTypeAttribute.InheritName)] public class DOMDocumentType : DOMNode { #region Fields and Properties //internal XmlDocumentType XmlDocumentType //{ // get { return (XmlDocumentType)XmlNode; } // set { XmlNode = value; } //} private string _qualifiedName; private string _publicId; private string _systemId; /// <summary> /// Returns the type of the node (<see cref="NodeType.DocumentType"/>). /// </summary> public override int nodeType => (int)NodeType.DocumentType; /// <summary> /// Returns the name of this document type. /// </summary> public string name => this.nodeName; /// <summary> /// Returns a map of the entities declared by this document type. /// </summary> public DOMNamedNodeMap entities { get { //DOMNamedNodeMap map = new DOMNamedNodeMap(); //foreach (XmlNode entity in XmlDocumentType.Entities) //{ // var node = DOMNode.Create(entity); // if (node != null) map.AddNode(node); //} //return map; throw new NotImplementedException(); } } /// <summary> /// Returns a map of the entities declared by this document type. /// </summary> public DOMNamedNodeMap notations { get { //DOMNamedNodeMap map = new DOMNamedNodeMap(); //foreach (XmlNode notation in XmlDocumentType.Notations) //{ // var node = DOMNode.Create(notation); // if (node != null) map.AddNode(node); //} //return map; throw new NotImplementedException(); } } /// <summary> /// Returns the value of the public identifier of this document type. /// </summary> public string publicId => throw new NotImplementedException(); //XmlDocumentType?.PublicId ?? _publicId; /// <summary> /// Gets the value of the system identifier on this document type. /// </summary> public string systemId => throw new NotImplementedException(); //XmlDocumentType?.SystemId ?? _systemId; /// <summary> /// Gets the value of the DTD internal subset on this document type. /// </summary> public string internalSubset => throw new NotImplementedException(); //XmlDocumentType?.InternalSubset; #endregion #region Construction public DOMDocumentType() { } //internal DOMDocumentType(XmlDocumentType/*!*/ xmlDocumentType) //{ // this.XmlDocumentType = xmlDocumentType; //} internal DOMDocumentType(string qualifiedName, string publicId, string systemId) { this._qualifiedName = qualifiedName; this._publicId = publicId; this._systemId = systemId; } protected override DOMNode CloneObjectInternal(bool deepCopyFields) { //if (IsAssociated) return new DOMDocumentType(XmlDocumentType); //else return new DOMDocumentType(this._qualifiedName, this._publicId, this._systemId); throw new NotImplementedException(); } #endregion #region Hierarchy internal override void Associate(XmlDocument document) { //if (!IsAssociated) //{ // XmlDocumentType = document.CreateDocumentType(_qualifiedName, _publicId, _systemId, null); //} throw new NotImplementedException(); } #endregion } }
apache-2.0
C#
55ed3a19206d62c0fe1570030f195de3330ca2ac
Test invalid filter type handling.
bojanrajkovic/pingu
src/Pingu.Tests/FilterTests.cs
src/Pingu.Tests/FilterTests.cs
using System; using Xunit; using Pingu.Filters; namespace Pingu.Tests { public class FilterTests { [Fact] public void Get_filter_throws_for_invalid_filter_type() { var arex = Assert.Throws<ArgumentOutOfRangeException>(() => DefaultFilters.GetFilterForType((FilterType)11)); Assert.Equal("filter", arex.ParamName); } } }
mit
C#
166dab004010b9382fc960dd46f48bde4b0d1549
Create CardView.cs
KennethKr/CardViewButton
CardView.cs
CardView.cs
using System; using System.ComponentModel; using CoreGraphics; using Foundation; using UIKit; namespace XamarinApp.Ios { [Register("CardView"), DesignTimeVisible(true)] public class CardView : UIView { private float cornerRadius; private UIColor shadowColor; private int shadowOffsetHeight; private int shadowOffsetWidth; private float shadowOpacity; [Export("shadowOpacity"), Browsable(true)] public float ShadowOpacity { get { return shadowOpacity; } set { shadowOpacity = value; SetNeedsDisplay(); } } [Export("shadowOffsetWidth"), Browsable(true)] public int ShadowOffsetWidth { get { return shadowOffsetWidth; } set { shadowOffsetWidth = value; SetNeedsDisplay(); } } [Export("shadowOffsetHeight"), Browsable(true)] public int ShadowOffsetHeight { get { return shadowOffsetHeight; } set { shadowOffsetHeight = value; SetNeedsDisplay(); } } [Export("CornerRadius"), Browsable(true)] public float CornerRadius { get { return cornerRadius; } set { cornerRadius = value; SetNeedsDisplay(); } } [Export("ShadowColor"), Browsable(true)] public UIColor ShadowColor { get { return shadowColor; } set { shadowColor = value; SetNeedsDisplay(); } } public CardView() { Initialize(); } public CardView(NSCoder coder) : base(coder) { Initialize(); } protected CardView(NSObjectFlag t) : base(t) { Initialize(); } protected internal CardView(IntPtr handle) : base(handle) { Initialize(); } public CardView(CGRect frame) : base(frame) { Initialize(); } public override void AwakeFromNib() { base.AwakeFromNib(); Initialize(); } private void Initialize() { ShadowColor = UIColor.Black; CornerRadius = 2; ShadowOffsetHeight = 3; ShadowOffsetWidth = 0; ShadowOpacity = 0.5f; } public override void LayoutSubviews() { base.LayoutSubviews(); Layer.CornerRadius = CornerRadius; UIBezierPath bezierPath = UIBezierPath.FromRoundedRect(Bounds, CornerRadius); Layer.MasksToBounds = false; Layer.ShadowColor = ShadowColor.CGColor; Layer.ShadowOffset = new CGSize(shadowOffsetWidth, shadowOffsetHeight); Layer.ShadowOpacity = shadowOpacity; Layer.ShadowPath = bezierPath.CGPath; } } }
mit
C#
ceb22f194b0dcd89294ea494dbc4ae3592d2724d
Create OAFArchiveCommon.cs
shhac/OAFArchive
CSharp/OAFArchiveCommon.cs
CSharp/OAFArchiveCommon.cs
/* * Created by SharpDevelop. * User: Paul * Date: 13/07/2015 * Time: 18:26 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using System.IO; using System.Collections.Generic; namespace OAFArchive { public enum EntryType : byte { File = 0, Directory = 0x35, } public enum HashType : byte { None = 0, CRC32 = 0x01, } public enum CompressionType : byte { None = 0, GZIP = 0x01, } public static class Marker { public static byte[] Open = new byte[12] {0x00, 0x07, 0xFF, 0x3C, 0x49, 0x54, 0x45, 0x4D, 0x3E, 0xFF, 0x7F, 0x08}; public static byte[] Close = new byte[12] {0x07, 0xFF, 0x3C, 0x2F, 0x49, 0x54, 0x45, 0x4D, 0x3E, 0xFF, 0x7F, 0x08}; } public struct OAFFileHeader { public long headerPosition; public int headerSize; public CompressionType hCompression; public string path; public long contentRelativePos; public long contentSize; public long contentFullSize; public CompressionType cCompression; public DateTime? lastModified; public DateTime? created; public int mode; public int userId; public int groupId; public EntryType entryType; public HashType contentHashType; public long contentHash; public HashType headerHashType; public long headerHash; } }
lgpl-2.1
C#
a2906ffbcfe9bff4e8cd62afa3d35d736917b0b9
introduce Case<T>
miraimann/Knuth-Morris-Pratt
KnuthMorrisPratt/KnuthMorrisPratt.Tests/Case.cs
KnuthMorrisPratt/KnuthMorrisPratt.Tests/Case.cs
using System.Collections.Generic; namespace KnuthMorrisPratt.Tests { public class Case<T> { public Case(IEnumerable<T> pattern, IEnumerable<T> sequence) { Pattern = pattern; Sequence = sequence; } public IEnumerable<T> Pattern { get; private set; } public IEnumerable<T> Sequence { get; private set; } } }
mit
C#