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 |
|---|---|---|---|---|---|---|---|---|
7262bfb8fdf4817f648dceaabf4866039cc4e597 | Create MessageBoxScrollable.Designer.cs | HartmanDev/WimP | Demo/MessageBoxScrollable.Designer.cs | Demo/MessageBoxScrollable.Designer.cs | namespace PathFinder
{
partial class MessageBoxScrollable
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(13, 13);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox1.Size = new System.Drawing.Size(635, 319);
this.textBox1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(573, 338);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "Fermer";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// MessageBoxScrollable
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(660, 363);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Name = "MessageBoxScrollable";
this.Text = "MessageBoxScrollable";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
}
}
| mit | C# | |
46ce81a6962b7af919d60c3f789f63b2fa1a59b0 | Create Cmdlets.cs | secabstraction/PowerWalker | Cmdlets.cs | Cmdlets.cs | using System;
using System.Text;
using System.Diagnostics;
using System.Collections.Generic;
using System.Management.Automation;
using PowerWalker.Natives;
namespace PowerWalker
{
//OpenProcess
[Cmdlet(VerbsCommon.Get, "ProcessHandle")]
public class GetProcessHandle : PSCmdlet
{
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
Position = 0,
HelpMessage = "ID of process whose threads will be traced."
)]
[Alias("Pid")]
public int[] Id
{
get { return ProcessIds; }
set { ProcessIds = value; }
}
private int[] ProcessIds;
[Parameter(
Mandatory = true,
Position = 1,
HelpMessage = "Level of access for this process handle."
)]
[Alias("Access")]
[ValidateNotNullOrEmpty]
public ProcessAccess AccessLevel;
protected override void ProcessRecord()
{
// If no process ids are passed to the cmdlet, get handles to all processes.
if (Id == null)
{
// Write the process handle to the pipeline making them available to the next cmdlet.
Process[] Processes = Process.GetProcesses();
foreach (Process p in Processes) {
IntPtr Handle = Kernel32.OpenProcess(AccessLevel, false, (uint)p.Id);
WriteObject(Handle, true);
}
}
else
{
// If process ids are passed to the cmdlet, get a handle to the process.
foreach (int i in Id)
{
IntPtr Handle = Kernel32.OpenProcess(AccessLevel, false, (uint)i);
WriteObject(Handle, true);
}
}
}
}
[Cmdlet(VerbsCommon.Get, "ProcessModules")]
public class GetProcessModules : PSCmdlet { }
//EnumProcessModulesEx
//32, 64, All
[Cmdlet(VerbsCommon.Set, "SymbolPath")]
public class SetSymbolPath : PSCmdlet { }
//http, Microsoft Public
//do more work here...
[Cmdlet(VerbsData.Initialize, "SymbolHandler")]
public class InitializeSymbolHandler : PSCmdlet { }
//SymInit
//SymGetOptions
//SymSetOptions
//SetSymserver
[Cmdlet(VerbsData.Import, "ProcessModules")]
public class ImportProcessModules : PSCmdlet { }
//psapi
//toolhelp32
[Cmdlet(VerbsCommon.Get, "ModuleInformation")]
public class GetModuleInformation : PSCmdlet { }
//SymGetModuleInfo
//GetModuleInfo
[Cmdlet(VerbsCommon.Get, "StackTrace")]
public class GetStackTrace : PSCmdlet
//Addr
//Symbol: name (SymGetSymFromAddr64), undName, undFullName
//Line: Number, filename (both SymGetLineFromAddr64)
//File
{
[Parameter
(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = true,
Position = 0,
HelpMessage = "ID of process whose threads will be traced."
)
]
[Alias("Pid", "p")]
uint ProcessId;
[Parameter
(
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = true,
Position = 1,
HelpMessage = "ID of thread whose stack will be traced."
)
]
[Alias("Tid", "t")]
uint ThreadId;
protected override void BeginProcessing()
{
base.BeginProcessing();
}
protected override void ProcessRecord()
{
base.ProcessRecord();
}
protected override void EndProcessing()
{
base.EndProcessing();
}
}
}
| bsd-3-clause | C# | |
b8e73c49fa44cd3cbde64f39d0f0178cfecaa612 | add NMSBoxes' test in DnnTest | shimat/opencvsharp,shimat/opencvsharp,shimat/opencvsharp | test/OpenCvSharp.Tests/dnn/DnnTest.cs | test/OpenCvSharp.Tests/dnn/DnnTest.cs | using System;
using OpenCvSharp.Dnn;
using Xunit;
namespace OpenCvSharp.Tests.Dnn
{
public class DnnTest : TestBase
{
[Fact]
public void NMSBoxes()
{
var bboxes = new Rect[] {
new Rect(10, 10, 20, 20),
new Rect(100, 100, 20, 20),
new Rect(1000, 1000, 20, 20)
};
var scores = new float[] { 1.0f, 0.1f, 0.6f };
float scoreThreshold = 0.5f;
float nmsThreshold = 0.4f;
CvDnn.NMSBoxes(bboxes, scores, scoreThreshold, nmsThreshold, out var indices);
Assert.Equal(2, indices.Length);
Assert.Equal(0, indices[0]);
Assert.Equal(2, indices[1]);
}
}
}
| apache-2.0 | C# | |
907d4cdab6eb9cdad7d27c3b110c84d27a18fb49 | Implement a class to query supported commands and get their instances. | tparviainen/oscilloscope | SCPI/Commands.cs | SCPI/Commands.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace SCPI
{
public class Commands
{
private Dictionary<string, ICommand> commands = new Dictionary<string, ICommand>();
/// <summary>
/// Creates a list of supported commands in the SCPI assembly
/// </summary>
/// <returns>The names of the supported commands</returns>
public ICollection<string> Names()
{
return SupportedCommands().Select(t => t.Name).ToList();
}
/// <summary>
/// Creates an instance of the requested command (if it does not exist)
/// and returns it to the caller.
/// </summary>
/// <param name="command">Command name</param>
/// <returns>Instance of the requested command</returns>
public ICommand Get(string command)
{
ICommand cmd = null;
if (!commands.TryGetValue(command, out cmd))
{
// Lazy initialization of the command
var typeInfo = SupportedCommands().Where(ti => ti.Name.Equals(command)).Single();
cmd = (ICommand)Activator.CreateInstance(typeInfo.AsType());
commands.Add(command, cmd);
}
return cmd;
}
private static IEnumerable<TypeInfo> SupportedCommands()
{
var assembly = typeof(ICommand).GetTypeInfo().Assembly;
// Supported commands are the ones that implement ICommand interface
var commands = assembly.DefinedTypes.Where(ti => ti.ImplementedInterfaces.Contains(typeof(ICommand)));
return commands;
}
}
}
| mit | C# | |
616082926e42f08e272c090e8a7393ca609d0b9e | Create Exercise_07_-_Check-if-any-#-in-an-array-is-odd_-_created-a-method-or-a-function.cs | jesushilarioh/Questions-and-Exercises-in-C-Sharp | Numbers/Exercise_07_-_Check-if-any-#-in-an-array-is-odd_-_created-a-method-or-a-function.cs | Numbers/Exercise_07_-_Check-if-any-#-in-an-array-is-odd_-_created-a-method-or-a-function.cs | /********************************************************************
*
* 53. Write a C# program to check if an array contains an odd number.
*
* Test Data:
* Original array: [2, 4, 7, 8, 6]
* Check if an array contains an odd number? True
*
* By: Jesus Hilario Hernandez
* Last Updated: October 22th 2017
*
********************************************************************/
using System;
public class Exercise_53
{
public static void Main()
{
/************************
* Jesus' Solution
************************/
var Array1 = new int[] {2, 4, 7, 8, 6};
Console.WriteLine("\nOriginal array: [{0}]", string.Join(", ", Array1));
/*******************************************
* Jesus' Solution After checking response
*******************************************/
Console.WriteLine("Check if an array has on odd number?" + checkIfOdd(Array1));
/**************************
* W3resource's Solution
**************************/
int [] nums = {2, 4, 7, 8, 6};
Console.WriteLine("\nOriginal array: [{0}]", string.Join(", ", nums));
Console.WriteLine("Check if an array contains an odd number? " + even_odd(nums));
}
public static bool even_odd(int[] nums)
{
foreach (var n in nums)
{
if(n % 2 != 0)
return true;
}
return false;
}
/********************************************
* Jesus' Methods After checking response *
********************************************/
public static bool checkIfOdd(int[] arrayNums)
{
foreach(var n in arrayNums)
if (n % 2 != 0)
return true;
return false;
}
}
| mit | C# | |
b9e8494145caaf28f6642b54ffac44fa7f25270a | Print pattern without a loop | Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews | GeeksForGeeks/print_pattern_no_loop.cs | GeeksForGeeks/print_pattern_no_loop.cs | // http://www.geeksforgeeks.org/print-a-pattern-without-using-any-loop/
//
//
// Print a pattern without using any loop
//
// Given a number n, print following pattern without using any loop.
//
// Input: n = 16
// Output: 16, 11, 6, 1, -4, 1, 6, 11, 16
//
// Input: n = 10
// Output: 10, 5, 0, 5, 10
//
using System;
class Program {
static void Print(int i, int m, bool flag) {
Console.Write("{0} ", i);
if (i == m && !flag) {
Console.WriteLine();
return;
}
if (flag) {
Print(i - 5, m, i - 5 > 0);
} else {
Print(i + 5, m, false);
}
}
static void Main() {
Print(16, 16, true);
Print(10, 10, true);
}
}
| mit | C# | |
dec0fe37e00c27870e4ac71954da0531a69ab426 | Add FinishedLaunching() | sakthivelnagarajan/monotouch-samples,iFreedive/monotouch-samples,sakthivelnagarajan/monotouch-samples,andypaul/monotouch-samples,W3SS/monotouch-samples,YOTOV-LIMITED/monotouch-samples,nelzomal/monotouch-samples,hongnguyenpro/monotouch-samples,robinlaide/monotouch-samples,davidrynn/monotouch-samples,YOTOV-LIMITED/monotouch-samples,sakthivelnagarajan/monotouch-samples,W3SS/monotouch-samples,a9upam/monotouch-samples,robinlaide/monotouch-samples,nervevau2/monotouch-samples,a9upam/monotouch-samples,kingyond/monotouch-samples,YOTOV-LIMITED/monotouch-samples,haithemaraissia/monotouch-samples,markradacz/monotouch-samples,hongnguyenpro/monotouch-samples,andypaul/monotouch-samples,haithemaraissia/monotouch-samples,peteryule/monotouch-samples,xamarin/monotouch-samples,haithemaraissia/monotouch-samples,hongnguyenpro/monotouch-samples,a9upam/monotouch-samples,xamarin/monotouch-samples,YOTOV-LIMITED/monotouch-samples,labdogg1003/monotouch-samples,albertoms/monotouch-samples,nelzomal/monotouch-samples,markradacz/monotouch-samples,andypaul/monotouch-samples,sakthivelnagarajan/monotouch-samples,davidrynn/monotouch-samples,peteryule/monotouch-samples,hongnguyenpro/monotouch-samples,haithemaraissia/monotouch-samples,albertoms/monotouch-samples,robinlaide/monotouch-samples,labdogg1003/monotouch-samples,davidrynn/monotouch-samples,markradacz/monotouch-samples,nervevau2/monotouch-samples,labdogg1003/monotouch-samples,labdogg1003/monotouch-samples,peteryule/monotouch-samples,davidrynn/monotouch-samples,nervevau2/monotouch-samples,albertoms/monotouch-samples,iFreedive/monotouch-samples,robinlaide/monotouch-samples,peteryule/monotouch-samples,iFreedive/monotouch-samples,kingyond/monotouch-samples,a9upam/monotouch-samples,nelzomal/monotouch-samples,andypaul/monotouch-samples,nervevau2/monotouch-samples,nelzomal/monotouch-samples,xamarin/monotouch-samples,kingyond/monotouch-samples,W3SS/monotouch-samples | TextKitDemo/TextKitDemo/AppDelegate.cs | TextKitDemo/TextKitDemo/AppDelegate.cs | using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace TextKitDemo
{
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
public override UIWindow Window { get; set; }
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
return true;
}
static void Main (string[] args)
{
UIApplication.Main (args, null, "AppDelegate");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace TextKitDemo
{
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
public override UIWindow Window { get; set; }
static void Main (string[] args)
{
UIApplication.Main (args, null, "AppDelegate");
}
}
}
| mit | C# |
ba8528646bdc3a314b7c187962849b5b824a7315 | Create light.cs | DocTyp/DocTyp.github.io,DocTyp/DocTyp.github.io | src/Syntax/syntaxhighlighter/light.cs | src/Syntax/syntaxhighlighter/light.cs | mit | C# | ||
f0aec7123c68436424666416734a4b2d236d830e | Create ArnaudLegouxMovingAverage.cs | Mendelone/forex_trading,Jay-Jay-D/LeanSTP,Mendelone/forex_trading,tomhunter-gh/Lean,redmeros/Lean,jameschch/Lean,StefanoRaggi/Lean,young-zhang/Lean,kaffeebrauer/Lean,QuantConnect/Lean,Jay-Jay-D/LeanSTP,AlexCatarino/Lean,QuantConnect/Lean,AnshulYADAV007/Lean,Mendelone/forex_trading,andrewhart098/Lean,JKarathiya/Lean,redmeros/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,tomhunter-gh/Lean,kaffeebrauer/Lean,andrewhart098/Lean,Mendelone/forex_trading,tomhunter-gh/Lean,AnshulYADAV007/Lean,kaffeebrauer/Lean,Jay-Jay-D/LeanSTP,tomhunter-gh/Lean,jameschch/Lean,jameschch/Lean,AlexCatarino/Lean,JKarathiya/Lean,StefanoRaggi/Lean,andrewhart098/Lean,JKarathiya/Lean,kaffeebrauer/Lean,young-zhang/Lean,StefanoRaggi/Lean,young-zhang/Lean,AnshulYADAV007/Lean,QuantConnect/Lean,AnshulYADAV007/Lean,AnshulYADAV007/Lean,StefanoRaggi/Lean,redmeros/Lean,andrewhart098/Lean,jameschch/Lean,redmeros/Lean,JKarathiya/Lean,jameschch/Lean,Jay-Jay-D/LeanSTP,QuantConnect/Lean,Jay-Jay-D/LeanSTP,kaffeebrauer/Lean,young-zhang/Lean,AlexCatarino/Lean | Indicators/ArnaudLegouxMovingAverage.cs | Indicators/ArnaudLegouxMovingAverage.cs | apache-2.0 | C# | ||
07a63d2dddb65e574c5646ccbc38de0a6d1f5805 | Add tests for RazorCompile target | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/RazorCompileIntegrationTest.cs | test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/RazorCompileIntegrationTest.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
public class RazorCompileIntegrationTest : MSBuildIntegrationTestBase
{
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task RazorCompile_Success_CompilesAssembly()
{
var result = await DotnetMSBuild("RazorCompile");
Assert.BuildPassed(result);
// RazorGenerate should compile the assembly and pdb.
Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.dll");
Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.pdb");
Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.PrecompiledViews.dll");
Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.PrecompiledViews.pdb");
}
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task RazorCompile_NoopsWithNoFiles()
{
Directory.Delete(Path.Combine(Project.DirectoryPath, "Views"), recursive: true);
var result = await DotnetMSBuild("RazorCompile");
Assert.BuildPassed(result);
// Everything we do should noop - including building the app.
Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.dll");
Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.pdb");
Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.PrecompiledViews.dll");
Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.PrecompiledViews.pdb");
}
}
}
| apache-2.0 | C# | |
404d9c1bf6a46419a378f9230af1f6ea5141253a | Create collision.cs | vvoid-inc/VoidEngine,thakyZ/VoidEngine | VoidEngine/collision.cs | VoidEngine/collision.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
namespace VoidEngine
{
public class Collision
{
public struct MapSegment
{
public Point point1;
public Point point2;
public MapSegment(Point a, Point b)
{
point1 = a;
point2 = b;
}
public Vector2 getVector()
{
return new Vector2(point2.X - point1.X, point2.Y - point1.Y);
}
public Rectangle collisionRect()
{
return new Rectangle(Math.Min(point1.X, point2.X), Math.Min(point1.Y, point2.Y), Math.Abs(point1.X - point2.X), Math.Abs(point1.Y - point2.Y));
}
}
public static float magnitude(Vector2 vector)
{
return (float)Math.Sqrt(vector.X * vector.X - vector.Y * vector.Y);
}
public static Vector2 vectorNormal(Vector2 vector)
{
return new Vector2(-vector.Y, vector.X);
}
public static Vector2 unitVector(Vector2 vector)
{
return new Vector2(vector.X / magnitude(vector), vector.Y / magnitude(vector));
}
public static float dotProduct(Vector2 unitVector, Vector2 vector)
{
return unitVector.X * vector.X + unitVector.Y * vector.Y;
}
public static Vector2 reflectedVector(Vector2 vector, Vector2 reflectVector)
{
Vector2 normal = vectorNormal(reflectVector);
float coeficient = -2 * (dotProduct(vector, normal) / magnitude(normal) * magnitude(normal));
Vector2 r;
r.X = vector.X + coeficient * normal.X;
r.Y = vector.Y + coeficient * normal.Y;
return r;
}
}
}
| mit | C# | |
6e70ab1743e51cca5ec7b2ade197edd2c812214b | Add basic Span<T> test | KrzysztofCwalina/coreclr,KrzysztofCwalina/coreclr,KrzysztofCwalina/coreclr,KrzysztofCwalina/coreclr,KrzysztofCwalina/coreclr,KrzysztofCwalina/coreclr,KrzysztofCwalina/coreclr | tests/src/CoreMangLib/system/span/BasicSpanTest.cs | tests/src/CoreMangLib/system/span/BasicSpanTest.cs | using System;
using System.Collections.Generic;
class My
{
static int Sum(Span<int> span)
{
int sum = 0;
for (int i = 0; i < span.Length; i++)
sum += span[i];
return sum;
}
static void Main()
{
int[] a = new int[] { 1, 2, 3 };
Span<int> span = new Span<int>(a);
Console.WriteLine(Sum(span).ToString());
Span<int> slice = span.Slice(1, 2);
Console.WriteLine(Sum(slice).ToString());
}
}
| mit | C# | |
73babf6232bc217936ca0fb969dd68f6d765e3bb | Add a EurekaClientService for use by ConfigServer client | SteelToeOSS/Discovery,SteelToeOSS/Discovery,SteelToeOSS/Discovery | src/Steeltoe.Discovery.EurekaBase/EurekaClientService.cs | src/Steeltoe.Discovery.EurekaBase/EurekaClientService.cs | // Copyright 2017 the original author or authors.
//
// 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 Microsoft.Extensions.Logging;
using Steeltoe.Common.Discovery;
using Steeltoe.Discovery.Eureka.AppInfo;
using Steeltoe.Discovery.Eureka.Transport;
using System.Collections.Generic;
namespace Steeltoe.Discovery.Eureka
{
public static class EurekaClientService
{
public static IList<IServiceInstance> GetInstances(string eurekaServerUri, string serviceId, ILoggerFactory logFactory = null)
{
EurekaClientConfig config = new EurekaClientConfig()
{
ShouldFetchRegistry = true,
ShouldRegisterWithEureka = false,
EurekaServerServiceUrls = eurekaServerUri
};
var client = new LookupClient(config, null, logFactory);
return client.GetInstances(serviceId);
}
public static IList<string> GetServices(string eurekaServerUri, ILoggerFactory logFactory = null)
{
EurekaClientConfig config = new EurekaClientConfig()
{
ShouldFetchRegistry = true,
ShouldRegisterWithEureka = false,
EurekaServerServiceUrls = eurekaServerUri
};
var client = new LookupClient(config, null, logFactory);
return client.GetServices();
}
internal class LookupClient : DiscoveryClient
{
public LookupClient(IEurekaClientConfig clientConfig, IEurekaHttpClient httpClient = null, ILoggerFactory logFactory = null)
: base(clientConfig, httpClient, logFactory)
{
if (_cacheRefreshTimer != null)
{
_cacheRefreshTimer.Dispose();
_cacheRefreshTimer = null;
}
}
public IList<IServiceInstance> GetInstances(string serviceId)
{
IList<InstanceInfo> infos = GetInstancesByVipAddress(serviceId, false);
List<IServiceInstance> instances = new List<IServiceInstance>();
foreach (InstanceInfo info in infos)
{
_logger?.LogDebug($"GetInstances returning: {info}");
instances.Add(new EurekaServiceInstance(info));
}
return instances;
}
public IList<string> GetServices()
{
Applications applications = Applications;
if (applications == null)
{
return new List<string>();
}
IList<Application> registered = applications.GetRegisteredApplications();
List<string> names = new List<string>();
foreach (Application app in registered)
{
if (app.Instances.Count == 0)
{
continue;
}
names.Add(app.Name.ToLowerInvariant());
}
return names;
}
}
}
}
| apache-2.0 | C# | |
1de91191f1eb49f8c00fb7c73a9a02c1a66fdece | Create positive tests for getting values from nested environments | escamilla/squirrel | test/test-library/EnvironmentTests.cs | test/test-library/EnvironmentTests.cs | using Xunit;
using Squirrel;
using Squirrel.Nodes;
namespace Tests
{
public class EnvironmentTests
{
private static readonly string TestVariableName = "x";
private static readonly INode TestVariableValue = new IntegerNode(1);
[Fact]
public void TestGetValueFromCurrentEnvironment() {
var environment = new Environment();
environment.Put(TestVariableName, TestVariableValue);
Assert.Equal(TestVariableValue, environment.Get(TestVariableName));
}
[Fact]
public void TestGetValueFromParentEnvironment() {
var parentEnvironment = new Environment();
var childEnvironment = new Environment(parentEnvironment);
parentEnvironment.Put(TestVariableName, TestVariableValue);
Assert.Equal(TestVariableValue, childEnvironment.Get(TestVariableName));
}
[Fact]
public void TestGetValueFromGrandparentEnvironment() {
var grandparentEnvironment = new Environment();
var parentEnvironment = new Environment(grandparentEnvironment);
var childEnvironment = new Environment(parentEnvironment);
grandparentEnvironment.Put(TestVariableName, TestVariableValue);
Assert.Equal(TestVariableValue, childEnvironment.Get(TestVariableName));
}
}
}
| mit | C# | |
a8260257e9bede6cbcad46ad60c77af0cd4bd7f3 | add sample code to draw stroked text | jingwood/d2dlib,jingwood/d2dlib,jingwood/d2dlib | src/Examples/SampleCode/StrokedText.cs | src/Examples/SampleCode/StrokedText.cs | /*
* MIT License
*
* Copyright (c) 2009-2021 Jingwood, unvell.com. All right reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace unvell.D2DLib.Examples.SampleCode
{
public partial class StrokedText : ExampleForm
{
public StrokedText()
{
Text = "Stroked Text Drawing - d2dlib Examples";
BackColor = Color.White;
}
D2DPathGeometry path;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
path = this.Device.CreateTextPathGeometry("Hello World", "Arial", 36, D2DFontWeight.ExtraBold);
}
protected override void OnRender(D2DGraphics g)
{
base.OnRender(g);
var rect = new D2DRect(100, 20, 400, 20);
g.TranslateTransform(100, 100);
g.FillPath(this.path, D2DColor.Yellow);
g.DrawPath(this.path, D2DColor.Blue, 3);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
this.path?.Dispose();
}
}
}
| mit | C# | |
549ac20f074a273e9cf54f07f7efe71b774a5f12 | test it works | Pondidum/Stronk,Pondidum/Stronk | src/Stronk.Tests/Validation/LambdaValidatorTests.cs | src/Stronk.Tests/Validation/LambdaValidatorTests.cs | using System;
using Shouldly;
using Stronk.Validation;
using Xunit;
namespace Stronk.Tests.Validation
{
public class LambdaValidatorTests
{
[Theory]
[InlineData(typeof(Target), true)]
[InlineData(typeof(TargetChild), true)]
[InlineData(typeof(OtherTarget), false)]
public void CanValidate_checks_type_properly(Type type, bool works)
{
var validator = new LambdaValidator(typeof(Target), target => { });
var method = validator.GetType().GetMethod(nameof(validator.CanValidate)).MakeGenericMethod(type);
var result = (bool)method.Invoke(validator, new object[0]);
result.ShouldBe(works, $"validator.CanValidate<{type.Name}>().ShouldBe({works});");
}
[Theory]
[InlineData(typeof(Target))]
[InlineData(typeof(TargetChild))]
public void Validation_works_when_inherited(Type type)
{
var wasCalled = false;
var validator = new LambdaValidator(type, target => wasCalled = true);
validator.Validate(new TargetChild { Parent = 10 });
wasCalled.ShouldBe(true);
}
private class Target
{
public int Parent { get; set; }
}
private class TargetChild : Target
{
public int Child { get; set; }
}
private class OtherTarget
{
}
}
}
| lgpl-2.1 | C# | |
6bddd653c13fbd4aff6ccba9a9600319a3a0cbf9 | Create a tool for importing Whitebox *.dep files | pergerch/DotSpatial,donogst/DotSpatial,DotSpatial/DotSpatial,DotSpatial/DotSpatial,JasminMarinelli/DotSpatial,bdgza/DotSpatial,CGX-GROUP/DotSpatial,bdgza/DotSpatial,swsglobal/DotSpatial,swsglobal/DotSpatial,pedwik/DotSpatial,donogst/DotSpatial,bdgza/DotSpatial,donogst/DotSpatial,pergerch/DotSpatial,CGX-GROUP/DotSpatial,JasminMarinelli/DotSpatial,pedwik/DotSpatial,swsglobal/DotSpatial,CGX-GROUP/DotSpatial,DotSpatial/DotSpatial,JasminMarinelli/DotSpatial,pedwik/DotSpatial,pergerch/DotSpatial | DotSpatial.Tools/ImportWhiteboxRaster.cs | DotSpatial.Tools/ImportWhiteboxRaster.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DotSpatial.Tools
{
class ImportWhiteboxRaster
{
}
}
| mit | C# | |
e81e5af8102114dd574eeaaef1463e7937a97747 | Fix BotAuthentication documentation issue | dr-em/BotBuilder,mmatkow/BotBuilder,stevengum97/BotBuilder,mmatkow/BotBuilder,msft-shahins/BotBuilder,stevengum97/BotBuilder,dr-em/BotBuilder,stevengum97/BotBuilder,dr-em/BotBuilder,yakumo/BotBuilder,stevengum97/BotBuilder,xiangyan99/BotBuilder,dr-em/BotBuilder,xiangyan99/BotBuilder,xiangyan99/BotBuilder,xiangyan99/BotBuilder,yakumo/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,mmatkow/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,mmatkow/BotBuilder,msft-shahins/BotBuilder | CSharp/Documentation/Conventions.cs | CSharp/Documentation/Conventions.cs | namespace Microsoft.Bot.Builder.Connector
{
/**
\page connectormisc Conventions & Security
\section serialization Class library vs. Serialization Conventions
All of the objects described use lower-camel casing on the wire. The C# libraries use
strongly typed names that are pascal cased. Our documentation sometimes will use one or the
other but they are interchangeable.
| **C# property** | wire serialization | javascript name |
| ----------------| ------------------ | --------------- |
| ReplyToId | replyToId | replyToId |
\subsection exampleserialization Example serialization
~~~{.json}
{
"type": "message",
"conversation": {
"Id": "GZxAXM39a6jdG0n2HQF5TEYL1vGgTG853w2259xn5VhGfs"
},
"timestamp": "2016-03-22T04:19:11.2100568Z",
"channelid": "skype",
"text": "You said:test",
"attachments": [],
"from": {
"name": "Test Bot",
"id": "MyTestBot",
},
"recipient": {
"name": "tom",
"id": "1hi3dbQ94Kddb",
},
"locale": "en-Us",
"replyToId": "7TvTPn87HlZ",
"entities": [],
}
~~~
\section securing Securing your bot
Developers should ensure that their bot's endpoint can only be called by the %Bot %Connector.
To do this you should
- Configure your endpoint to only use HTTPS
- Use the %Bot Framework SDK's authentication: MicrosoftAppId Password: MicrosoftAppPassword
\subsection botauthattributes BotAuthentication Attribute
To make it easy for our C# developers we have created an attribute which does this for your method or controller.
To use with the AppId and AppSecret coming from the web.config
~~~{.cs}
[BotAuthentication]
public class MessagesController : ApiController
{
}
~~~
Or you can pass in the appId appSecret to the attribute directly:
~~~{.cs}
[BotAuthentication(MicrosoftAppId = "_MicrosoftappId_")]
public class MessagesController : ApiController
{
}
~~~
**/
}
| namespace Microsoft.Bot.Builder.Connector
{
/**
\page connectormisc Conventions & Security
\section serialization Class library vs. Serialization Conventions
All of the objects described use lower-camel casing on the wire. The C# libraries use
strongly typed names that are pascal cased. Our documentation sometimes will use one or the
other but they are interchangeable.
| **C# property** | wire serialization | javascript name |
| ----------------| ------------------ | --------------- |
| ReplyToId | replyToId | replyToId |
\subsection exampleserialization Example serialization
~~~{.json}
{
"type": "message",
"conversation": {
"Id": "GZxAXM39a6jdG0n2HQF5TEYL1vGgTG853w2259xn5VhGfs"
},
"timestamp": "2016-03-22T04:19:11.2100568Z",
"channelid": "skype",
"text": "You said:test",
"attachments": [],
"from": {
"name": "Test Bot",
"id": "MyTestBot",
},
"recipient": {
"name": "tom",
"id": "1hi3dbQ94Kddb",
},
"locale": "en-Us",
"replyToId": "7TvTPn87HlZ",
"entities": [],
}
~~~
\section securing Securing your bot
Developers should ensure that their bot's endpoint can only be called by the %Bot %Connector.
To do this you should
- Configure your endpoint to only use HTTPS
- Use the %Bot Framework SDK's authentication: MicrosoftAppId Password: MicrosoftAppPassword
\subsection botauthattributes BotAuthentication Attribute
To make it easy for our C# developers we have created an attribute which does this for your method or controller.
To use with the AppId and AppSecret coming from the web.config
~~~{.cs}
[BotAuthentication()]
public class MessagesController : ApiController
{
}
~~~
Or you can pass in the appId appSecret to the attribute directly:
~~~{.cs}
[BotAuthentication(MicrosoftAppId="_MicrosoftappId_", MicrosoftAppPassword="_MicrosoftappPassword_")]
public class MessagesController : ApiController
{
}
~~~
**/
}
| mit | C# |
a2146a4a2c68902f87687f1929f4b964db7b6902 | Add Feature model | Mataniko/IV-Play | Data/Models/Feature.cs | Data/Models/Feature.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace IV_Play.Data.Models
{
public class Feature
{
[XmlAttribute]
public string type { get; set; }
[XmlAttribute]
public string status { get; set; }
[XmlAttribute]
public string overall { get; set; }
}
}
| mit | C# | |
3667300f2d49f36437cd5fd0055e83f6bf5c84c4 | Add LayoutVersion tests | whampson/bft-spec,whampson/cascara | Cascara.Tests/Src/LayoutVersionTests.cs | Cascara.Tests/Src/LayoutVersionTests.cs | using WHampson.Cascara;
using Xunit;
using Xunit.Abstractions;
namespace Cascara.Tests
{
public class LayoutVersionTests : CascaraTestFramework
{
public LayoutVersionTests(ITestOutputHelper output)
: base(output)
{
}
[Theory]
[InlineData(1, 0, 0, 1, 0, 0, false, false, true, true, true, 0)]
[InlineData(1, 0, 1, 1, 0, 1, false, false, true, true, true, 0)]
[InlineData(1, 1, 0, 1, 1, 0, false, false, true, true, true, 0)]
[InlineData(1, 1, 1, 1, 1, 1, false, false, true, true, true, 0)]
[InlineData(1, 0, 1, 1, 0, 0, false, true, false, true, false, -1)]
[InlineData(1, 1, 0, 1, 0, 0, false, true, false, true, false, -1)]
[InlineData(1, 1, 1, 1, 0, 0, false, true, false, true, false, -1)]
[InlineData(2, 0, 0, 1, 0, 0, false, true, false, true, false, -1)]
[InlineData(2, 1, 0, 1, 0, 0, false, true, false, true, false, -1)]
[InlineData(2, 1, 1, 1, 0, 0, false, true, false, true, false, -1)]
[InlineData(1, 0, 0, 1, 0, 1, true, false, true, false, false, 1)]
[InlineData(1, 0, 0, 1, 1, 0, true, false, true, false, false, 1)]
[InlineData(1, 0, 0, 1, 1, 1, true, false, true, false, false, 1)]
[InlineData(1, 0, 0, 2, 0, 0, true, false, true, false, false, 1)]
[InlineData(1, 0, 0, 2, 1, 0, true, false, true, false, false, 1)]
[InlineData(1, 0, 0, 2, 1, 1, true, false, true, false, false, 1)]
public void Comparison(int majorA, int minorA, int patchA, int majorB, int minorB, int patchB,
bool expectedLT, bool expectedGT, bool expectedLE, bool expectedGE, bool expectedEQ,
int expectedCompareTo)
{
// Arrange
LayoutVersion verA = new LayoutVersion(majorA, minorA, patchA);
LayoutVersion verB = new LayoutVersion(majorB, minorB, patchB);
// Act
bool lt = verA < verB;
bool gt = verA > verB;
bool le = verA <= verB;
bool ge = verA >= verB;
bool eq1 = verA == verB;
bool eq2 = verB == verA;
bool eq3 = !(verA != verB);
bool eq4 = !(verB != verA);
int compareTo = verA.CompareTo(verB);
// Assert
Assert.Equal(lt, expectedLT);
Assert.Equal(gt, expectedGT);
Assert.Equal(le, expectedLE);
Assert.Equal(ge, expectedGE);
Assert.Equal(eq1, expectedEQ);
Assert.Equal(eq2, expectedEQ);
Assert.Equal(eq3, expectedEQ);
Assert.Equal(eq4, expectedEQ);
Assert.Equal(compareTo, expectedCompareTo);
}
}
}
| mit | C# | |
ba0b1797778db9aab639adb118928e0826c0aae3 | Create QuitButton.cs | jon-lad/Battlefleet-Gothic | MainMenu/QuitButton.cs | MainMenu/QuitButton.cs | using UnityEngine;
using System.Collections;
public class QuitButton : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnMouseOver(){
renderer.material.color = new Color32(212,11,57, 255);
}
void OnMouseExit(){
renderer.material.color = new Color(1 -(214 / 255),1 - (185 / 255),1 -(167 / 255));
}
void OnMouseDown(){
Application.Quit ();
}
}
| mit | C# | |
898cb84db89aa579f3dfc3a400f5a4da6d8e4ecf | Update All.Clear method to use ClearBufferMask enum instead of uint | a9upam/monotouch-samples,nervevau2/monotouch-samples,robinlaide/monotouch-samples,davidrynn/monotouch-samples,peteryule/monotouch-samples,YOTOV-LIMITED/monotouch-samples,markradacz/monotouch-samples,W3SS/monotouch-samples,peteryule/monotouch-samples,robinlaide/monotouch-samples,iFreedive/monotouch-samples,sakthivelnagarajan/monotouch-samples,W3SS/monotouch-samples,davidrynn/monotouch-samples,nelzomal/monotouch-samples,hongnguyenpro/monotouch-samples,andypaul/monotouch-samples,andypaul/monotouch-samples,nervevau2/monotouch-samples,nelzomal/monotouch-samples,labdogg1003/monotouch-samples,nervevau2/monotouch-samples,haithemaraissia/monotouch-samples,markradacz/monotouch-samples,nervevau2/monotouch-samples,robinlaide/monotouch-samples,albertoms/monotouch-samples,davidrynn/monotouch-samples,labdogg1003/monotouch-samples,labdogg1003/monotouch-samples,andypaul/monotouch-samples,kingyond/monotouch-samples,sakthivelnagarajan/monotouch-samples,iFreedive/monotouch-samples,nelzomal/monotouch-samples,peteryule/monotouch-samples,hongnguyenpro/monotouch-samples,YOTOV-LIMITED/monotouch-samples,andypaul/monotouch-samples,iFreedive/monotouch-samples,peteryule/monotouch-samples,YOTOV-LIMITED/monotouch-samples,haithemaraissia/monotouch-samples,sakthivelnagarajan/monotouch-samples,haithemaraissia/monotouch-samples,markradacz/monotouch-samples,hongnguyenpro/monotouch-samples,xamarin/monotouch-samples,YOTOV-LIMITED/monotouch-samples,davidrynn/monotouch-samples,a9upam/monotouch-samples,kingyond/monotouch-samples,sakthivelnagarajan/monotouch-samples,hongnguyenpro/monotouch-samples,a9upam/monotouch-samples,xamarin/monotouch-samples,albertoms/monotouch-samples,albertoms/monotouch-samples,haithemaraissia/monotouch-samples,robinlaide/monotouch-samples,a9upam/monotouch-samples,nelzomal/monotouch-samples,labdogg1003/monotouch-samples,kingyond/monotouch-samples,xamarin/monotouch-samples,W3SS/monotouch-samples | OpenGLESSample-GameView/EAGLView.cs | OpenGLESSample-GameView/EAGLView.cs | using System;
using OpenTK.Platform.iPhoneOS;
using Foundation;
using ObjCRuntime;
using CoreAnimation;
using OpenTK;
using OpenGLES;
using OpenTK.Graphics.ES11;
namespace OpenGLESSampleGameView
{
public partial class EAGLView : iPhoneOSGameView
{
[Export ("layerClass")]
static Class LayerClass()
{
return iPhoneOSGameView.GetLayerClass ();
}
[Export ("initWithCoder:")]
public EAGLView (NSCoder coder) : base (coder)
{
LayerRetainsBacking = false;
LayerColorFormat = EAGLColorFormat.RGBA8;
ContextRenderingApi = EAGLRenderingAPI.OpenGLES1;
}
protected override void ConfigureLayer(CAEAGLLayer eaglLayer)
{
eaglLayer.Opaque = true;
}
protected override void OnRenderFrame(FrameEventArgs e)
{
base.OnRenderFrame (e);
float[] squareVertices = {
-0.5f, -0.5f,
0.5f, -0.5f,
-0.5f, 0.5f,
0.5f, 0.5f,
};
byte[] squareColors = {
255, 255, 0, 255,
0, 255, 255, 255,
0, 0, 0, 0,
255, 0, 255, 255,
};
MakeCurrent();
GL.Viewport (0, 0, Size.Width, Size.Height);
GL.MatrixMode (All.Projection);
GL.LoadIdentity ();
GL.Ortho (-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
GL.MatrixMode (All.Modelview);
GL.Rotate (3.0f, 0.0f, 0.0f, 1.0f);
GL.ClearColor (0.5f, 0.5f, 0.5f, 1.0f);
GL.Clear (ClearBufferMask.ColorBufferBit);
GL.VertexPointer (2, All.Float, 0, squareVertices);
GL.EnableClientState (All.VertexArray);
GL.ColorPointer (4, All.UnsignedByte, 0, squareColors);
GL.EnableClientState (All.ColorArray);
GL.DrawArrays (All.TriangleStrip, 0, 4);
SwapBuffers();
}
}
} | using System;
using OpenTK.Platform.iPhoneOS;
using Foundation;
using ObjCRuntime;
using CoreAnimation;
using OpenTK;
using OpenGLES;
using OpenTK.Graphics.ES11;
namespace OpenGLESSampleGameView
{
public partial class EAGLView : iPhoneOSGameView
{
[Export ("layerClass")]
static Class LayerClass()
{
return iPhoneOSGameView.GetLayerClass ();
}
[Export ("initWithCoder:")]
public EAGLView (NSCoder coder) : base (coder)
{
LayerRetainsBacking = false;
LayerColorFormat = EAGLColorFormat.RGBA8;
ContextRenderingApi = EAGLRenderingAPI.OpenGLES1;
}
protected override void ConfigureLayer(CAEAGLLayer eaglLayer)
{
eaglLayer.Opaque = true;
}
protected override void OnRenderFrame(FrameEventArgs e)
{
base.OnRenderFrame (e);
float[] squareVertices = {
-0.5f, -0.5f,
0.5f, -0.5f,
-0.5f, 0.5f,
0.5f, 0.5f,
};
byte[] squareColors = {
255, 255, 0, 255,
0, 255, 255, 255,
0, 0, 0, 0,
255, 0, 255, 255,
};
MakeCurrent();
GL.Viewport (0, 0, Size.Width, Size.Height);
GL.MatrixMode (All.Projection);
GL.LoadIdentity ();
GL.Ortho (-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
GL.MatrixMode (All.Modelview);
GL.Rotate (3.0f, 0.0f, 0.0f, 1.0f);
GL.ClearColor (0.5f, 0.5f, 0.5f, 1.0f);
GL.Clear ((uint) All.ColorBufferBit);
GL.VertexPointer (2, All.Float, 0, squareVertices);
GL.EnableClientState (All.VertexArray);
GL.ColorPointer (4, All.UnsignedByte, 0, squareColors);
GL.EnableClientState (All.ColorArray);
GL.DrawArrays (All.TriangleStrip, 0, 4);
SwapBuffers();
}
}
} | mit | C# |
f803d9107fa8b11b6da366466e57ea3d02d38710 | Create Problem491.cs | fireheadmx/ProjectEuler,fireheadmx/ProjectEuler | Problems/Problem491.cs | Problems/Problem491.cs | using System;
using System.Collections.Generic;
using System.Numerics;
using System.Text;
using System.IO;
namespace ProjectEuler.Problems
{
class Problem491
{
public static void Run()
{
DateTime start = DateTime.Now;
int[] dblpan = {1, 0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9};
//int[] dblpan = { 4,0,5,6,1,8,1,7,7,0,3,8,2,3,5,6,4,9,2,9 };
BigInteger counter = 0;
do {
// Alternating sum of the number, left to right
int altSum = dblpan[0] - dblpan[1] +
dblpan[2] - dblpan[3] + dblpan[4] - dblpan[5] +
dblpan[6] - dblpan[7] + dblpan[8] - dblpan[9] +
dblpan[10] - dblpan[11] + dblpan[12] - dblpan[13] +
dblpan[14] - dblpan[15] + dblpan[16] - dblpan[17] +
dblpan[18] - dblpan[19];
if (altSum % 11 == 0)
{
/*
// Divisible by 11
Console.WriteLine("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}{16}{17}{18}{19}",
dblpan[0], dblpan[1], dblpan[2], dblpan[3], dblpan[4], dblpan[5],
dblpan[6], dblpan[7], dblpan[8], dblpan[9], dblpan[10], dblpan[11],
dblpan[12], dblpan[13], dblpan[14], dblpan[15], dblpan[16], dblpan[17],
dblpan[18], dblpan[19]);
*/
counter++;
}
}
while(Permutation.NextPermutation(dblpan));
using (StreamWriter sw = new StreamWriter("Output/p491.txt", true))
{
DateTime end = DateTime.Now;
sw.WriteLine("Total: {0}", counter);
sw.WriteLine("Time: {0}h, {1}m, {2}s", (start - end).TotalHours, (start - end).Minutes, (start - end).Seconds);
}
Console.WriteLine("Total: {0}", counter);
Console.ReadLine();
}
}
}
| mit | C# | |
5330a8cf5be619c78f2bebd48327b18e786d1a96 | Add tests for Sha512 class | ektrah/nsec | tests/Algorithms/Sha512Tests.cs | tests/Algorithms/Sha512Tests.cs | using System;
using NSec.Cryptography;
using Xunit;
namespace NSec.Tests.Algorithms
{
public static class Sha512Tests
{
public static readonly string HashOfEmpty = "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e";
[Fact]
public static void HashEmpty()
{
var a = new Sha512();
var expected = HashOfEmpty.DecodeHex();
var actual = a.Hash(ReadOnlySpan<byte>.Empty);
Assert.Equal(a.DefaultHashSize, actual.Length);
Assert.Equal(expected, actual);
}
[Theory]
[InlineData(32)]
[InlineData(41)]
[InlineData(53)]
[InlineData(61)]
[InlineData(64)]
public static void HashEmptyWithSize(int hashSize)
{
var a = new Sha512();
var expected = HashOfEmpty.DecodeHex().Slice(0, hashSize);
var actual = a.Hash(ReadOnlySpan<byte>.Empty, hashSize);
Assert.Equal(hashSize, actual.Length);
Assert.Equal(expected, actual);
}
[Theory]
[InlineData(32)]
[InlineData(41)]
[InlineData(53)]
[InlineData(61)]
[InlineData(64)]
public static void HashEmptyWithSpan(int hashSize)
{
var a = new Sha512();
var expected = HashOfEmpty.DecodeHex().Slice(0, hashSize);
var actual = new byte[hashSize];
a.Hash(ReadOnlySpan<byte>.Empty, actual);
Assert.Equal(expected, actual);
}
}
}
| mit | C# | |
f21263bec559708e2a1fe3aa5641d71d75bc2f18 | Define a Void type comparable to System.Void, but one that can be used when the compiler does not allow you to use System.Void, such as for return types or generic type arguments. | plioi/parsley | src/Parsley/Void.cs | src/Parsley/Void.cs | namespace Parsley;
/// <summary>
/// Represents a void type, since `System.Void` is not valid everywhere a type name
/// is required, such as for return types or generic type arguments.
/// </summary>
public readonly struct Void
{
static readonly Void _value;
public static ref readonly Void Value => ref _value;
}
| mit | C# | |
fd40c98b707d99741d574f436f075d930daec1dc | Add unit tests for PointND. | KernelA/EOptimization-library | EOptimizationTests/Math/PointNDTests.cs | EOptimizationTests/Math/PointNDTests.cs | namespace EOpt.Math.Tests
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
using EOpt.Math;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
[TestClass()]
public class PointNDTests
{
[TestMethod()]
public void PointNDConstrTest4()
{
PointND point = new PointND(12, 5);
bool error = false;
foreach (double item in point.Coordinates)
{
if (item != 12)
error = true;
}
Assert.IsTrue(!error && point.Dimension == 5);
}
[TestMethod()]
public void PointNDConstrTest5()
{
double[] x = new double[4] { 45, 56, 8, 10 };
PointND point = new PointND(x);
Assert.IsTrue(point.Coordinates.SequenceEqual(x) && point.Dimension == 4);
}
[TestMethod()]
public void EqualsTest()
{
PointND a = new PointND(2, 3);
PointND b = new PointND(21, 4);
PointND c = a.Clone();
Assert.IsTrue(a.Equals(c) && !a.Equals(b));
}
[TestMethod()]
public void CloneTest()
{
PointND p1, p2;
p1 = new PointND(1, 2);
p2 = p1.Clone();
Assert.IsTrue(p1.Equals(p2));
}
[TestMethod()]
public void ToStringTest()
{
PointND p1 = new PointND(90, 2);
Assert.IsNotNull(p1.ToString());
}
}
} | mit | C# | |
98f06e6e987c81ac271d292fc8fdd47108b7e4fd | Create problem019.cs | mvdiener/project_euler,mvdiener/project_euler | CSharp/problem019.cs | CSharp/problem019.cs | //You are given the following information, but you may prefer to do some research for yourself.
//1 Jan 1900 was a Monday.
//Thirty days has September,
//April, June and November.
//All the rest have thirty-one,
//Saving February alone,
//Which has twenty-eight, rain or shine.
//And on leap years, twenty-nine.
//A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.
//How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?
using System;
using System.Collections.Generic;
namespace Problem019
{
class MainClass
{
public static void Main()
{
Console.WriteLine(FindAllFirstSundays());
}
private static int FindAllFirstSundays()
{
int startingDay = 2;
int firstSundayCount = 0;
Dictionary<string, int> sundayObject = new Dictionary<string, int>();
for (int year = 1901; year <= 2000; year++)
{
sundayObject = FindFirstSundaysInYear(startingDay, year);
firstSundayCount += sundayObject["FirstSundayCount"];
startingDay = sundayObject["StartingDay"];
}
return firstSundayCount;
}
public static Dictionary<string, int> FindFirstSundaysInYear(int startingDay, int year)
{
bool isLeapYear = IsLeapYear(year);
List<int> daysInMonths = new List<int>(new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31});
int firstSundayCount = 0;
foreach (var month in daysInMonths)
{
if (isLeapYear && month == 28)
{
startingDay = (startingDay + 29) % 7;
}
else
{
startingDay = (startingDay + month) % 7;
}
if (startingDay == 0) firstSundayCount += 1;
}
Dictionary<string, int> sundayObject = new Dictionary<string, int>();
sundayObject["FirstSundayCount"] = firstSundayCount;
sundayObject["StartingDay"] = startingDay;
return sundayObject;
}
public static bool IsLeapYear(int year)
{
if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
{
return true;
}
else
{
return false;
}
}
}
}
| mit | C# | |
3058d792929b6088c262b8226f846bdfe6c0d36a | set up for lore skill | LiamKenneth/MIM,LiamKenneth/ArchaicQuest,LiamKenneth/ArchaicQuest,LiamKenneth/ArchaicQuest,LiamKenneth/MIM,LiamKenneth/ArchaicQuest,LiamKenneth/MIM | MIMWebClient/Core/Player/Skills/Lore.cs | MIMWebClient/Core/Player/Skills/Lore.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MIMWebClient.Core.Events;
namespace MIMWebClient.Core.Player.Skills
{
using System.Runtime.CompilerServices;
using MIMWebClient.Core.PlayerSetup;
using MIMWebClient.Core.Room;
public class Lore: Skill
{
public static Skill LoreSkill { get; set; }
public static Skill LoreAb()
{
if (LoreSkill != null)
{
return LoreSkill;
}
else
{
var skill = new Skill
{
Name = "Lore",
CoolDown = 0,
Delay = 0,
LevelObtained = 1,
Proficiency = 1,
MaxProficiency = 95,
Passive = true,
UsableFromStatus = "Standing",
Syntax = "Lore",
MovesCost = 10,
HelpText = new Help()
{
HelpText = "Lore help text",
DateUpdated = new DateTime().ToShortDateString()
}
};
LoreSkill = skill;
}
return LoreSkill;
}
public static void DoLore(IHubContext context, PlayerSetup.Player player, string item)
{
//Check if player has spell
var hasSkill = Skill.CheckPlayerHasSkill(player, LoreAb().Name);
if (hasSkill == false)
{
context.SendToClient("You don't know that skill.", player.HubGuid);
return;
}
var canDoSkill = Skill.CanDoSkill(player);
if (!canDoSkill)
{
return;
}
if (string.IsNullOrEmpty(item))
{
context.SendToClient("You need to specify an item.", player.HubGuid);
return;
}
var hasItem = player.Inventory.FirstOrDefault(x => x.name.Contains(item));
if (hasItem == null)
{
context.SendToClient("You don't have such an item.", player.HubGuid);
return;
}
var chanceOfSuccess = Helpers.Rand(1, 100);
var skill = player.Skills.FirstOrDefault(x => x.Name.Equals("Lore"));
var skillProf = skill.Proficiency;
if (skillProf >= chanceOfSuccess)
{
//Itme stats
HubContext.Instance.SendToClient(" ", player.HubGuid);
Score.UpdateUiAffects(player);
Score.ReturnScoreUI(player);
}
else
{
//something random
HubContext.Instance.SendToClient(" .", player.HubGuid);
Score.ReturnScoreUI(player);
}
}
}
}
| mit | C# | |
b775ff2a37ed3dd22a144fe3fa3c8804516c19c2 | Add AssemblyInfo and set CLSCompliant to true | Kingloo/GB-Live | src/AssemblyInfo.cs | src/AssemblyInfo.cs | using System;
[assembly:CLSCompliant(true)] | unlicense | C# | |
8cc3bef52a07d94b57c34e05183a298983ad842d | Create CameraUtility.cs | efruchter/UnityUtilities | CameraUtility.cs | CameraUtility.cs | public class static CameraUtility
{
// Generate a projection matrix such that the near clip plane is aligned with an arbitrary transform.
protected static Matrix4x4 GetObliqueMatrix(this Camera inPortalCamera, Transform inClipPlane)
{
Vector4 clipPlaneWorldSpace = new Vector4(inClipPlane.forward.x, inClipPlane.forward.y, inClipPlane.forward.z, Vector3.Dot(inClipPlane.position, -inClipPlane.forward));
Vector4 clipPlaneCameraSpace = Matrix4x4.Transpose(Matrix4x4.Inverse(inPortalCamera.worldToCameraMatrix)) * clipPlaneWorldSpace;
return inPortalCamera.CalculateObliqueMatrix(clipPlaneCameraSpace);
}
}
| mit | C# | |
564782786ea85143fc55b0487c720493ed7182b1 | Add lost files | B1naryStudio/Azimuth,B1naryStudio/Azimuth | Azimuth/Infrastructure/UserCredential.cs | Azimuth/Infrastructure/UserCredential.cs | namespace Azimuth.Infrastructure
{
public class UserCredential
{
public string SocialNetworkId { get; set; }
public string SocialNetworkName { get; set; }
public string AccessToken { get; set; }
public string AccessTokenSecret { get; set; }
public string AccessTokenExpiresIn { get; set; }
public string ConsumerKey { get; set; }
public string ConsumerSecret { get; set; }
public string Email { get; set; }
}
} | mit | C# | |
e624a8964af3cc26f7a9536126dd932a3bc0fda6 | add ExceptionTest | shimat/opencvsharp,shimat/opencvsharp,shimat/opencvsharp | test/OpenCvSharp.Tests/ExceptionTest.cs | test/OpenCvSharp.Tests/ExceptionTest.cs | using System;
using Xunit;
namespace OpenCvSharp.Tests
{
// ReSharper disable InconsistentNaming
public class ExceptionTest : TestBase
{
[Fact]
public void RedirectError()
{
using var img = new Mat(3, 3, MatType.CV_8UC1);
var ex = Assert.Throws<OpenCVException>(() =>
{
Cv2.GaussianBlur(img, img, new Size(2, 2), 1);
});
Assert.StartsWith("ksize.width > 0", ex.ErrMsg);
Assert.NotEmpty(ex.FileName);
Assert.NotEmpty(ex.FuncName);
Assert.True(ex.Line > 0);
Assert.Equal(ErrorCode.StsAssert, ex.Status);
}
}
} | apache-2.0 | C# | |
056faefc8ec5df32be8605903bac4e08f4ed3177 | Add basic Mime | ViveportSoftware/vita_core_csharp,ViveportSoftware/vita_core_csharp | source/Htc.Vita.Core/Net/Mime.cs | source/Htc.Vita.Core/Net/Mime.cs | using System.ComponentModel;
namespace Htc.Vita.Core.Net
{
/// <summary>
/// Class Mime.
/// </summary>
public static class Mime
{
/// <summary>
/// Enum ContentType
/// </summary>
public enum ContentType
{
/// <summary>
/// application/octet-stream
/// </summary>
[Description("application/octet-stream")]
Application_OctetStream,
/// <summary>
/// application/json
/// </summary>
[Description("application/json")]
Application_Json,
/// <summary>
/// application/x-www-form-urlencoded
/// </summary>
[Description("application/x-www-form-urlencoded")]
Application_XWwwFormUrlencoded,
/// <summary>
/// text/plain
/// </summary>
[Description("text/plain")]
Text_Plain,
/// <summary>
/// Any content type
/// </summary>
[Description("*/*")]
Any_Any,
/// <summary>
/// image/vnd.microsoft.icon
/// </summary>
[Description("image/vnd.microsoft.icon")]
Image_VndMicrosoftIcon,
/// <summary>
/// image/x-icon
/// </summary>
[Description("image/x-icon")]
Image_XIcon
}
}
}
| mit | C# | |
952c975b0499e3c07c68c1c84d6af3f097875df3 | add staticticController | Eskat0n/Wotstat,Eskat0n/Wotstat,Eskat0n/Wotstat | sources/Wotstat.Application/Statistics/StatisticController.cs | sources/Wotstat.Application/Statistics/StatisticController.cs | namespace Wotstat.Application.Statistics
{
using System.Web.Mvc;
public class StatisticController : Controller
{
public ActionResult Index()
{
return View();
}
}
} | mit | C# | |
52165289fe0bba9fa5e47cff06aad74e4ff7e2bd | Add SubdirectoryHandler for injecting a subdirectory into gRPC calls (#882) | grpc/grpc-dotnet,grpc/grpc-dotnet,grpc/grpc-dotnet,grpc/grpc-dotnet | test/Grpc.Net.Client.Tests/SubdirectoryHandlerTests.cs | test/Grpc.Net.Client.Tests/SubdirectoryHandlerTests.cs | #region Copyright notice and license
// Copyright 2019 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
using System;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Greet;
using Grpc.Core;
using Grpc.Net.Client.Tests.Infrastructure;
using Grpc.Tests.Shared;
using NUnit.Framework;
namespace Grpc.Net.Client.Tests
{
[TestFixture]
public class SubdirectoryHandlerTests
{
[Test]
public async Task AsyncUnaryCall_SubdirectoryHandlerConfigured_RequestUriChanged()
{
// Arrange
HttpRequestMessage? httpRequestMessage = null;
var handler = TestHttpMessageHandler.Create(async r =>
{
httpRequestMessage = r;
var reply = new HelloReply
{
Message = "Hello world"
};
var streamContent = await ClientTestHelpers.CreateResponseContent(reply).DefaultTimeout();
return ResponseUtils.CreateResponse(HttpStatusCode.OK, streamContent);
});
var httpClient = new HttpClient(new SubdirectoryHandler(handler, "/TestSubdirectory"));
httpClient.BaseAddress = new Uri("https://localhost");
var invoker = HttpClientCallInvokerFactory.Create(httpClient);
// Act
var rs = await invoker.AsyncUnaryCall<HelloRequest, HelloReply>(ClientTestHelpers.ServiceMethod, string.Empty, new CallOptions(), new HelloRequest());
// Assert
Assert.AreEqual("Hello world", rs.Message);
Assert.IsNotNull(httpRequestMessage);
Assert.AreEqual(new Version(2, 0), httpRequestMessage!.Version);
Assert.AreEqual(HttpMethod.Post, httpRequestMessage.Method);
Assert.AreEqual(new Uri("https://localhost/TestSubdirectory/ServiceName/MethodName"), httpRequestMessage.RequestUri);
}
/// <summary>
/// A delegating handler that will add a subdirectory to the URI of gRPC requests.
/// </summary>
public class SubdirectoryHandler : DelegatingHandler
{
private readonly string _subdirectory;
public SubdirectoryHandler(HttpMessageHandler innerHandler, string subdirectory) : base(innerHandler)
{
_subdirectory = subdirectory;
}
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var url = $"{request.RequestUri.Scheme}://{request.RequestUri.Host}{_subdirectory}{request.RequestUri.AbsolutePath}";
request.RequestUri = new Uri(url, UriKind.Absolute);
return base.SendAsync(request, cancellationToken);
}
}
}
}
| apache-2.0 | C# | |
1ed09020114be0a074df2ee90b35711cd5df5cc8 | Update bot builder assembly version | dr-em/BotBuilder,mmatkow/BotBuilder,Clairety/ConnectMe,mmatkow/BotBuilder,msft-shahins/BotBuilder,stevengum97/BotBuilder,Clairety/ConnectMe,xiangyan99/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,xiangyan99/BotBuilder,stevengum97/BotBuilder,msft-shahins/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,mmatkow/BotBuilder,stevengum97/BotBuilder,dr-em/BotBuilder,Clairety/ConnectMe,stevengum97/BotBuilder,yakumo/BotBuilder,xiangyan99/BotBuilder,dr-em/BotBuilder,mmatkow/BotBuilder,xiangyan99/BotBuilder,yakumo/BotBuilder,dr-em/BotBuilder,Clairety/ConnectMe | CSharp/Library/Properties/AssemblyInfo.cs | CSharp/Library/Properties/AssemblyInfo.cs | using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Bot.Builder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Bot Builder")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.13.1.0")]
[assembly: AssemblyFileVersion("1.13.1.0")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]
[assembly: NeutralResourcesLanguage("en")]
| using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Bot.Builder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Bot Builder")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.13.0.0")]
[assembly: AssemblyFileVersion("1.13.0.0")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]
[assembly: NeutralResourcesLanguage("en")]
| mit | C# |
61f0a2417ceb5ff623682b86360413e4fcdaabd3 | Update Encouragements.cs | paritoshmmmec/Encourage,Haacked/Encourage | EncouragePackage/Encouragements.cs | EncouragePackage/Encouragements.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
namespace Haack.Encourage
{
[Export(typeof(IEncouragements))]
public class Encouragements : IEncouragements
{
static readonly Random random = new Random();
readonly List<string> encouragements = new List<string>
{
"Nice Job!",
"Way to go!",
"Wow, nice change!",
"So good!"
};
public string GetRandomEncouragement()
{
int randomIndex = random.Next(0, encouragements.Count);
return encouragements[randomIndex];
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
namespace Haack.Encourage
{
[Export(typeof(IEncouragements))]
public class Encouragements : IEncouragements
{
static readonly Random random = new Random();
readonly List<string> encouragements = new List<string>
{
"Nice Job!",
"Way to go!",
"Wow, nice change!",
"So good!"
};
public string GetRandomEncouragement()
{
int randomIndex = random.Next(0, encouragements.Count - 1);
return encouragements[randomIndex];
}
}
}
| mit | C# |
da81741c9340d283e95c29fe54eef78969e9fb0f | Update version for next release | adamcaudill/libsodium-net,deckar01/libsodium-net,bitbeans/libsodium-net,bitbeans/libsodium-net,fraga/libsodium-net,tabrath/libsodium-core,fraga/libsodium-net,adamcaudill/libsodium-net,BurningEnlightenment/libsodium-net,BurningEnlightenment/libsodium-net,deckar01/libsodium-net | libsodium-net/Properties/AssemblyInfo.cs | libsodium-net/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("libsodium-net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Adam Caudill")]
[assembly: AssemblyProduct("libsodium-net")]
[assembly: AssemblyCopyright("Copyright © Adam Caudill 2013 - 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bac54bf6-5a39-4ab5-90f1-746a9d6b06f4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyFileVersion("0.4.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("libsodium-net")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Adam Caudill")]
[assembly: AssemblyProduct("libsodium-net")]
[assembly: AssemblyCopyright("Copyright © Adam Caudill 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("bac54bf6-5a39-4ab5-90f1-746a9d6b06f4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.0.0")]
[assembly: AssemblyFileVersion("0.3.0.0")]
| mit | C# |
e9c69dc5c3d00fb40d628771e8879cff23eaa4c1 | add CompressionOption | JesseQin/npoi,akrisiun/npoi,antony-liu/npoi,xl1/npoi,stuartwmurray/npoi,Yijtx/npoi,jcridev/npoi,vinod1988/npoi,tkalubi/npoi-1,tonyqus/npoi | ooxml/openxml4Net/OPC/CompressionOption.cs | ooxml/openxml4Net/OPC/CompressionOption.cs | using System;
using System.Collections.Generic;
using System.Text;
using ICSharpCode.SharpZipLib.Zip.Compression;
namespace NPOI.OpenXml4Net.OPC
{
public enum CompressionOption : int
{
Fast = Deflater.BEST_SPEED,
Maximum = Deflater.BEST_COMPRESSION,
Normal = Deflater.DEFAULT_COMPRESSION,
NotCompressed = Deflater.NO_COMPRESSION
}
}
| apache-2.0 | C# | |
ce8ea1245b27795b20826ae61044b770c422c65f | Add smoke tests for settings. | nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke | source/Nuke.Common.Tests/SettingsTest.cs | source/Nuke.Common.Tests/SettingsTest.cs | // Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.IO;
using System.Linq;
using FluentAssertions;
using Nuke.Common.Tools.MSBuild;
using Nuke.Common.Tools.OpenCover;
using Nuke.Common.Tools.Xunit2;
using Nuke.Core.IO;
using Nuke.Core.Tooling;
using Xunit;
namespace Nuke.Common.Tests
{
public class SettingsTest
{
private static PathConstruction.AbsolutePath RootDirectory
=> (PathConstruction.AbsolutePath) Directory.GetCurrentDirectory() / ".." / ".." / ".." / ".." / "..";
private static void Assert<T> (Configure<T> configurator, string arguments)
where T : ToolSettings, new()
{
configurator.Invoke(new T()).GetArguments().RenderForOutput().Should().Be(arguments);
}
[Fact]
public void TestMSBuild ()
{
var projectFile = RootDirectory / "source" / "Nuke.Common" / "Nuke.Common.csproj";
var solutionFile = RootDirectory / "Nuke.sln";
Assert<MSBuildSettings>(x => x
.SetProjectFile(projectFile)
.SetTargetPlatform(MSBuildTargetPlatform.MSIL)
.SetConfiguration("Release")
.EnableNoLogo(),
$"{projectFile} /nologo /property:Platform=AnyCPU /property:Configuration=Release");
Assert<MSBuildSettings>(x => x
.SetProjectFile(solutionFile)
.SetTargetPlatform(MSBuildTargetPlatform.MSIL)
.ToggleRunCodeAnalysis(),
$"{solutionFile} /property:Platform=\"Any CPU\" /property:RunCodeAnalysis=True");
}
[Fact]
public void TestXunit2 ()
{
Assert<Xunit2Settings>(x => x
.AddTargetAssemblies("A.csproj")
.AddTargetAssemblyWithConfigs("B.csproj", "D.config", "new folder\\E.config"),
"A.csproj B.csproj D.config B.csproj \"new folder\\E.config\"");
Assert<Xunit2Settings>(x => x
.SetResultPath("new folder\\data.xml"),
"-Xml \"new folder\\data.xml\"");
Assert<Xunit2Settings>(x => x
.SetResultPath("new folder\\data.xml", ResultFormat.HTML)
.EnableDiagnostics(),
"-diagnostics -HTML \"new folder\\data.xml\"");
}
[Fact]
public void TestOpenCover ()
{
var projectFile = RootDirectory / "source" / "Nuke.Common" / "Nuke.Common.csproj";
Assert<OpenCoverSettings>(x => x
.SetTargetPath(projectFile)
.AddFilters("+[*]*", "-[xunit.*]*", "-[NUnit.*]*")
.SetTargetArguments("-diagnostics -HTML \"new folder\\data.xml\""),
$"-target:{projectFile} -targetargs:\"-diagnostics -HTML \\\"new folder\\data.xml\\\"\" -filter:\"+[*]* -[xunit.*]* -[NUnit.*]*\"");
}
}
}
| mit | C# | |
994ff5a6f352e5dd0432eab46db926420261d7ff | Create /Models/DatabaseModels/Teacher Class. | Programazing/Open-School-Library,Programazing/Open-School-Library | src/Open-School-Library/Models/DatabaseModels/Teacher.cs | src/Open-School-Library/Models/DatabaseModels/Teacher.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Open_School_Library.Models.DatabaseModels
{
public class Teacher
{
public int TeacherID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public int Grade { get; set; }
}
}
| mit | C# | |
b633960614030aa8c53f2976b64bd7a6491c7d10 | Create Common.cs | zelbo/Number-Guessing | Common.cs | Common.cs | namespace NumberGuessing
{
public enum GameState { Initialize, Guess, Win, Lose, Exit }
public enum Difficulty { Low = 1, Medium = 10, High = 100 }
public enum Rating { Correct = 0, Close = 2, Off = 4, WayOff = 5 }
public enum MyKeys
{
Escape, Enter,
NumberKey_1, NumberKey_2, NumberKey_3, NumberKey_4, NumberKey_5,
NumberKey_6, NumberKey_7, NumberKey_8, NumberKey_9, NumberKey_0,
ArrowUp, ArrowDown, ArrowLeft, ArrowRight
}
}
| mit | C# | |
94f43a4338b1b86d9a56893501548cee76ef4420 | Switch over setup commands from using query class | ZocDoc/ZocMon,modulexcite/ZocMon,ZocDoc/ZocMon,modulexcite/ZocMon,modulexcite/ZocMon,ZocDoc/ZocMon | ZocMon/ZocMon/ZocMonLib/Framework/StorageCommandsSetupSqlServer.cs | ZocMon/ZocMon/ZocMonLib/Framework/StorageCommandsSetupSqlServer.cs | using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using ZocMonLib;
namespace ZocMonLib
{
public class StorageCommandsSetupSqlServer : IStorageCommandsSetup
{
public virtual IEnumerable<ReduceLevel> SelectAllReduceLevels(IDbConnection conn)
{
const string sql = @"SELECT * FROM ReduceLevel";
return DatabaseSqlHelper.Query<ReduceLevel>(conn, sql);
}
public virtual IEnumerable<MonitorConfig> SelectAllMonitorConfigs(IDbConnection conn)
{
const string sql = @"SELECT * FROM MonitorConfig";
return DatabaseSqlHelper.Query<MonitorConfig>(conn, sql);
}
}
} | using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using ZocMonLib;
namespace ZocMonLib
{
public class StorageCommandsSetupSqlServer : IStorageCommandsSetup
{
public virtual IEnumerable<ReduceLevel> SelectAllReduceLevels(IDbConnection conn)
{
return DatabaseSqlHelper.CreateListWithConnection<ReduceLevel>(conn, StorageCommandsSqlServerQuery.ReduceLevelSql);
}
public virtual IEnumerable<MonitorConfig> SelectAllMonitorConfigs(IDbConnection conn)
{
return DatabaseSqlHelper.CreateListWithConnection<MonitorConfig>(conn, StorageCommandsSqlServerQuery.MonitorConfigSql);
}
}
} | apache-2.0 | C# |
bf36eb9d98892631372604291deb822decc6d6cd | Add code for wrapping synchronous code in a task. #108 | StephenCleary/AsyncEx | src/Nito.AsyncEx.Tasks/TaskHelper.cs | src/Nito.AsyncEx.Tasks/TaskHelper.cs | using System;
using System.Threading.Tasks;
namespace Nito.AsyncEx
{
/// <summary>
/// Helper methods for working with tasks.
/// </summary>
public static class TaskHelper
{
/// <summary>
/// Executes a delegate synchronously, and captures its result in a task. The returned task is already completed.
/// </summary>
/// <param name="func">The delegate to execute synchronously.</param>
#pragma warning disable 1998
public static async Task ExecuteAsTask(Action func)
#pragma warning restore 1998
{
func();
}
/// <summary>
/// Executes a delegate synchronously, and captures its result in a task. The returned task is already completed.
/// </summary>
/// <param name="func">The delegate to execute synchronously.</param>
#pragma warning disable 1998
public static async Task<T> ExecuteAsTask<T>(Func<T> func)
#pragma warning restore 1998
{
return func();
}
}
}
| mit | C# | |
afaf4fa343c32e6b3cf4aadb56329bdad156f68a | Create GuidoOliveira.cs | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/GuidoOliveira.cs | src/Firehose.Web/Authors/GuidoOliveira.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 GuidoOliveira : IAmAMicrosoftMVP
{
public string FirstName => "Guido";
public string LastName => "Oliveira";
public string ShortBioOrTagLine => "Automation Engineer, Microsoft Azure Architect, Microsoft MVP,.";
public string StateOrRegion => "Sao Paulo, BR";
public string EmailAddress => string.Empty;
public string TwitterHandle => "_Guido_Oliveira";
public string GravatarHash => "c1246cb9e45ce18ade58f0a99ec0a106";
public string GitHubHandle => "guidooliveira";
public GeoPosition Position => new GeoPosition(23.4543,46.5337);
public Uri WebSite => new Uri("https://www.guidooliveira.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://www.guidooliveira.com/feed/"); }
}
}
}
| mit | C# | |
d770631fe0ecac9389c183ea183b43f7f496bec0 | Use public Result.ValueComparer rather than internal equality comparer instance. | Rolstenhouse/sarif-sdk,kschecht/sarif-sdk,kschecht/sarif-sdk,kschecht/sarif-sdk,kschecht/sarif-sdk,kschecht/sarif-sdk,kschecht/sarif-sdk,Rolstenhouse/sarif-sdk,Rolstenhouse/sarif-sdk,Rolstenhouse/sarif-sdk,kschecht/sarif-sdk,Rolstenhouse/sarif-sdk,Rolstenhouse/sarif-sdk,Rolstenhouse/sarif-sdk | src/Sarif/Readers/ResultDiffingVisitor.cs | src/Sarif/Readers/ResultDiffingVisitor.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
namespace Microsoft.CodeAnalysis.Sarif.Readers
{
public class ResultDiffingVisitor : SarifRewritingVisitor
{
public ResultDiffingVisitor(SarifLog sarifLog)
{
this.AbsentResults = new HashSet<Result>(Result.ValueComparer);
this.SharedResults = new HashSet<Result>(Result.ValueComparer);
this.NewResults = new HashSet<Result>(Result.ValueComparer);
VisitSarifLog(sarifLog);
}
public HashSet<Result> NewResults { get; set; }
public HashSet<Result> AbsentResults { get; set; }
public HashSet<Result> SharedResults { get; set; }
public override Result VisitResult(Result node)
{
this.NewResults.Add(node);
return node;
}
public bool Diff(IEnumerable<Result> actual)
{
this.AbsentResults = this.SharedResults;
this.SharedResults = new HashSet<Result>(Result.ValueComparer);
foreach (Result result in this.NewResults)
{
this.AbsentResults.Add(result);
}
this.NewResults.Clear();
if (actual != null)
{
foreach (Result result in actual)
{
if (this.AbsentResults.Contains(result))
{
this.SharedResults.Add(result);
this.AbsentResults.Remove(result);
}
else
{
this.NewResults.Add(result);
}
}
}
return
this.AbsentResults.Count == 0 &&
this.NewResults.Count == 0;
}
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
namespace Microsoft.CodeAnalysis.Sarif.Readers
{
public class ResultDiffingVisitor : SarifRewritingVisitor
{
public ResultDiffingVisitor(SarifLog sarifLog)
{
this.AbsentResults = new HashSet<Result>(ResultEqualityComparer.Instance);
this.SharedResults = new HashSet<Result>(ResultEqualityComparer.Instance);
this.NewResults = new HashSet<Result>(ResultEqualityComparer.Instance);
VisitSarifLog(sarifLog);
}
public HashSet<Result> NewResults { get; set; }
public HashSet<Result> AbsentResults { get; set; }
public HashSet<Result> SharedResults { get; set; }
public override Result VisitResult(Result node)
{
this.NewResults.Add(node);
return node;
}
public bool Diff(IEnumerable<Result> actual)
{
this.AbsentResults = this.SharedResults;
this.SharedResults = new HashSet<Result>(ResultEqualityComparer.Instance);
foreach (Result result in this.NewResults)
{
this.AbsentResults.Add(result);
}
this.NewResults.Clear();
if (actual != null)
{
foreach (Result result in actual)
{
if (this.AbsentResults.Contains(result))
{
this.SharedResults.Add(result);
this.AbsentResults.Remove(result);
}
else
{
this.NewResults.Add(result);
}
}
}
return
this.AbsentResults.Count == 0 &&
this.NewResults.Count == 0;
}
}
}
| mit | C# |
917dba7b4220965f5f05424a45b0d3916f3ce814 | Add missing file for ping command test. | qhris/DiabloSpeech,qhris/DiabloSpeech | tests/Twitch/PingCommandProcessorTest.cs | tests/Twitch/PingCommandProcessorTest.cs | using DiabloSpeech.Business.Twitch;
using DiabloSpeech.Business.Twitch.Processors;
using NUnit.Framework;
using tests.Twitch.Mocks;
namespace tests.Twitch
{
public class PingCommandProcessorTest
{
PingCommandProcessor processor;
TwitchConnectionMock connection;
TwitchMessageData MessageData =>
new TwitchMessageData();
[SetUp]
public void InitializeTest()
{
processor = new PingCommandProcessor();
connection = new TwitchConnectionMock("test", "#test");
}
[Test]
public void PingCommandThrowsWithoutConnection()
{
Assert.That(() => processor.Process(null, MessageData), Throws.ArgumentNullException);
}
[Test]
public void PingCommandSendPongAndFlushes()
{
processor.Process(connection, MessageData);
Assert.That(connection.FiredCommands.Count, Is.EqualTo(2));
Assert.That(connection.FiredCommands[0], Is.EqualTo("PONG"));
Assert.That(connection.FiredCommands[1], Is.EqualTo("__FLUSH"));
}
}
}
| mit | C# | |
93ffd49f65fe60b213c027d68a6be7b24f024ed5 | Add the missing IProvider. | Deathspike/mangarack.cs,Deathspike/mangarack.cs | MangaRack.Provider/Interfaces/IProvider.cs | MangaRack.Provider/Interfaces/IProvider.cs | // ======================================================================
// This source code form is subject to the terms of the Mozilla Public
// License, version 2.0. If a copy of the MPL was not distributed with
// this file, you can obtain one at http://mozilla.org/MPL/2.0/.
// ======================================================================
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using MangaRack.Provider.Contracts;
namespace MangaRack.Provider.Interfaces
{
[ContractClass(typeof (IProviderContract))]
public interface IProvider
{
#region Methods
ISeries Open(string location);
Task<IEnumerable<ISeries>> SearchAsync(string input);
#endregion
#region Properties
string Location { get; }
#endregion
}
} | mpl-2.0 | C# | |
c4a44140299bdd60dbf941682d710e26b8797c70 | Add utilities to convert from C# to Lua types | taylor001/crown,dbartolini/crown,taylor001/crown,taylor001/crown,dbartolini/crown,galek/crown,mikymod/crown,galek/crown,mikymod/crown,dbartolini/crown,taylor001/crown,mikymod/crown,dbartolini/crown,galek/crown,galek/crown,mikymod/crown | tools/core/Lua.cs | tools/core/Lua.cs | /*
* Copyright (c) 2012-2016 Daniele Bartolini and individual contributors.
* License: https://github.com/taylor001/crown/blob/master/LICENSE
*/
using System;
namespace Crown
{
/// <summary>
/// Functions to encode C# types to Lua.
/// </summary>
public static class Lua
{
public static string FromBool(bool b)
{
return b == true ? "true" : "false";
}
public static string FromVector2(Vector2 v)
{
return string.Format("Vector2({0}, {1})", v.x, v.y);
}
public static string FromVector3(Vector3 v)
{
return string.Format("Vector3({0}, {1}, {2})", v.x, v.y, v.z);
}
public static string FromQuaternion(Quaternion q)
{
return string.Format("Quaternion.from_elements({0}, {1}, {2}, {3})", q.x, q.y, q.z, q.w);
}
}
}
| mit | C# | |
cdc9fcd45dbc3c4f9dedf97894864b426f6b3d05 | Add bindings for CapsFilter | gstreamer-sharp/gstreamer-sharp,GStreamer/gstreamer-sharp,gstreamer-sharp/gstreamer-sharp,GStreamer/gstreamer-sharp,gstreamer-sharp/gstreamer-sharp,Forage/gstreamer-sharp,freedesktop-unofficial-mirror/gstreamer__gstreamer-sharp,freedesktop-unofficial-mirror/gstreamer__gstreamer-sharp,Forage/gstreamer-sharp,freedesktop-unofficial-mirror/gstreamer__gstreamer-sharp,GStreamer/gstreamer-sharp,Forage/gstreamer-sharp,Forage/gstreamer-sharp | gstreamer-sharp/coreplugins/CapsFilter.cs | gstreamer-sharp/coreplugins/CapsFilter.cs | //
// CapsFilter.cs: capsfilter element bindings
//
// Authors:
// Maarten Bosmans <mkbosmans@gmail.com>
//
using System;
namespace Gst.CorePlugins
{
[GTypeName("GstCapsFilter")]
public class CapsFilter : Element
{
public CapsFilter(IntPtr raw) : base(raw)
{
}
public static CapsFilter Make(string name)
{
return ElementFactory.Make("capsfilter", name) as CapsFilter;
}
[GLib.Property("caps")]
public Gst.Caps Caps {
get {
GLib.Value val = GetProperty("caps");
Gst.Caps caps = (Gst.Caps)val.Val;
val.Dispose();
return caps;
}
set {
GLib.Value val = new GLib.Value(value);
SetProperty("caps", val);
val.Dispose();
}
}
}
}
| lgpl-2.1 | C# | |
02b79907a5cddf9ff9e4da72777392640b7a0f39 | Add test covering ThreadedTaskScheduler shutdown | EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,smoogipooo/osu-framework | osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.cs | osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.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.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.Threading;
namespace osu.Framework.Tests.Threading
{
[TestFixture]
public class ThreadedTaskSchedulerTest
{
/// <summary>
/// On disposal, <see cref="ThreadedTaskScheduler"/> does a blocking shutdown sequence.
/// This asserts all outstanding tasks are run before the shutdown completes.
/// </summary>
[Test]
public void EnsureThreadedTaskSchedulerProcessesBeforeDispose()
{
int runCount = 0;
const int target_count = 128;
using (var taskScheduler = new ThreadedTaskScheduler(4, "test"))
{
for (int i = 0; i < target_count; i++)
{
Task.Factory.StartNew(() =>
{
Interlocked.Increment(ref runCount);
Thread.Sleep(100);
}, default, TaskCreationOptions.HideScheduler, taskScheduler);
}
}
Assert.AreEqual(target_count, runCount);
}
}
}
| mit | C# | |
07ebeeed66f1132907adc6840872d9d8ba9ee688 | Add debug utilities to sleep-wait and busy-wait for a given duration | virtuallynaked/virtually-naked,virtuallynaked/virtually-naked | Viewer/src/common/DebugUtilities.cs | Viewer/src/common/DebugUtilities.cs | using System.Diagnostics;
using System.Threading;
static class DebugUtilities {
public static void Burn(long ms) {
Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < ms) {
}
}
public static void Sleep(long ms) {
Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < ms) {
Thread.Yield();
}
}
}
| mit | C# | |
368a979173ea7002a16c9d9812e5e40fcd189603 | Add test coverage | ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework | osu.Framework.Tests/Audio/SampleBassTest.cs | osu.Framework.Tests/Audio/SampleBassTest.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.Threading;
using ManagedBass;
using NUnit.Framework;
using osu.Framework.Audio.Sample;
using osu.Framework.Development;
using osu.Framework.IO.Stores;
using osu.Framework.Threading;
namespace osu.Framework.Tests.Audio
{
[TestFixture]
public class SampleBassTest
{
private DllResourceStore resources;
private SampleBass sample;
private SampleChannelBass channel;
[SetUp]
public void Setup()
{
// Initialize bass with no audio to make sure the test remains consistent even if there is no audio device.
Bass.Init(0);
resources = new DllResourceStore(typeof(TrackBassTest).Assembly);
sample = new SampleBass(resources.Get("Resources.Tracks.sample-track.mp3"));
channel = new SampleChannelBass(sample, channel => { });
updateSample();
}
[TearDown]
public void Teardown()
{
Bass.Free();
}
[Test]
public void TestStart()
{
channel.Play();
updateSample();
Thread.Sleep(50);
updateSample();
Assert.IsTrue(channel.Playing);
}
[Test]
public void TestStop()
{
channel.Play();
updateSample();
channel.Stop();
updateSample();
Assert.IsFalse(channel.Playing);
}
[Test]
public void TestStopBeforeLoadFinished()
{
channel.Play();
channel.Stop();
updateSample();
Assert.IsFalse(channel.Playing);
}
private void updateSample() => runOnAudioThread(() =>
{
sample.Update();
channel.Update();
});
/// <summary>
/// Certain actions are invoked on the audio thread.
/// Here we simulate this process on a correctly named thread to avoid endless blocking.
/// </summary>
/// <param name="action">The action to perform.</param>
private void runOnAudioThread(Action action)
{
var resetEvent = new ManualResetEvent(false);
new Thread(() =>
{
ThreadSafety.IsAudioThread = true;
action();
resetEvent.Set();
})
{
Name = GameThread.PrefixedThreadNameFor("Audio")
}.Start();
if (!resetEvent.WaitOne(TimeSpan.FromSeconds(10)))
throw new TimeoutException();
}
}
}
| mit | C# | |
900ca7912c34270187d56cd6478454083f1d5b98 | Create GenreIndexViewModel. | Programazing/Open-School-Library,Programazing/Open-School-Library | src/Open-School-Library/Models/GenreViewModels/GenreIndexViewModel.cs | src/Open-School-Library/Models/GenreViewModels/GenreIndexViewModel.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Open_School_Library.Models.GenreViewModels
{
public class GenreIndexViewModel
{
public int GenreId { get; set; }
public string Name { get; set; }
}
}
| mit | C# | |
64049f2d0b3d17a7d7a662c0b20d55c3059c6337 | Add missing FileComponent.cs file | Drenn1/LynnaLab,Drenn1/LynnaLab | LynnaLab/Core/FileComponent.cs | LynnaLab/Core/FileComponent.cs | using System;
using System.Drawing;
using System.Collections.Generic;
namespace LynnaLab
{
public abstract class FileComponent {
protected List<int> spacing;
public bool EndsLine {get; set;} // True if a newline comes after this data
// True if it's an internally-made object, not to be written back to
// the file
public bool Fake {get; set;}
public FileComponent(IList<int> spacing) {
EndsLine = true;
Fake = false;
if (spacing != null)
this.spacing = new List<int>(spacing);
}
// Returns a string representing the given space value
protected string GetSpacing(int spaces) {
string s = "";
while (spaces > 0) {
s += ' ';
spaces--;
}
while (spaces < 0) {
s += '\t';
spaces++;
}
return s;
}
public abstract string GetString();
}
public class StringFileComponent : FileComponent {
string str;
public StringFileComponent(string s, IList<int> spacing) : base(spacing) {
str = s;
if (this.spacing == null)
this.spacing = new List<int>();
while (this.spacing.Count < 2)
this.spacing.Add(0);
}
public override string GetString() {
return GetSpacing(spacing[0]) + str + GetSpacing(spacing[1]);
}
}
}
| mit | C# | |
b97039970111ba4a5d6c6282525aa38255701fb0 | Add message type to blob trigger. | brendankowitz/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,Azure/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,Azure/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk | src/Microsoft.Azure.WebJobs.Host/Blobs/Listeners/BlobTriggerMessage.cs | src/Microsoft.Azure.WebJobs.Host/Blobs/Listeners/BlobTriggerMessage.cs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.WindowsAzure.Storage.Blob;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Microsoft.Azure.WebJobs.Host.Blobs.Listeners
{
internal class BlobTriggerMessage
{
public string Type { get { return "BlobTrigger"; } }
public string FunctionId { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
public BlobType BlobType { get; set; }
public string ContainerName { get; set; }
public string BlobName { get; set; }
public string ETag { get; set; }
}
}
| // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.WindowsAzure.Storage.Blob;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Microsoft.Azure.WebJobs.Host.Blobs.Listeners
{
internal class BlobTriggerMessage
{
public string FunctionId { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
public BlobType BlobType { get; set; }
public string ContainerName { get; set; }
public string BlobName { get; set; }
public string ETag { get; set; }
}
}
| mit | C# |
ba60264f03caf71c68b7a26f58db314439973ad6 | Create ServiceCollectionExtensions.cs | tiksn/TIKSN-Framework | TIKSN.Framework.Core/DependencyInjection/ServiceCollectionExtensions.cs | TIKSN.Framework.Core/DependencyInjection/ServiceCollectionExtensions.cs | using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using TIKSN.FileSystem;
namespace TIKSN.DependencyInjection
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddFrameworkPlatform(this IServiceCollection services)
{
services.AddFrameworkCore();
services.TryAddSingleton<IKnownFolders, KnownFolders>();
return services;
}
}
} | mit | C# | |
2133a19c513f679c54c49b2a7c5ddee87ad29f28 | Add StreamTextSource2 | StevenLiekens/TextFx,StevenLiekens/Txt | src/Txt.Core/StreamTextSource2.cs | src/Txt.Core/StreamTextSource2.cs | using System;
using System.IO;
using System.Text;
using JetBrains.Annotations;
namespace Txt.Core
{
public class StreamTextSource2 : TextSource2
{
private readonly BinaryReader reader;
private bool disposed;
public StreamTextSource2([NotNull] Stream input, int capacity = 2048)
: base(capacity)
{
if (input == null)
{
throw new ArgumentNullException(nameof(input));
}
reader = new BinaryReader(input);
}
public StreamTextSource2([NotNull] Stream input, [NotNull] Encoding encoding, int capacity = 2048)
: base(capacity)
{
if (input == null)
{
throw new ArgumentNullException(nameof(input));
}
if (encoding == null)
{
throw new ArgumentNullException(nameof(encoding));
}
reader = new BinaryReader(input, encoding);
}
public StreamTextSource2(
[NotNull] Stream input,
[NotNull] Encoding encoding,
bool leaveOpen,
int capacity = 2048)
: base(capacity)
{
if (input == null)
{
throw new ArgumentNullException(nameof(input));
}
if (encoding == null)
{
throw new ArgumentNullException(nameof(encoding));
}
reader = new BinaryReader(input, encoding, leaveOpen);
}
protected override void Dispose(bool disposing)
{
if (disposed)
{
return;
}
if (disposing)
{
reader.Dispose();
}
base.Dispose(disposing);
}
protected override int ReadImpl(char[] buffer, int startIndex, int maxCount)
{
return reader.Read(buffer, startIndex, maxCount);
}
}
}
| mit | C# | |
6715b81fd039e4c8d2b0f937b1383d16296f83ca | Enable Get Element Property tests in Edge | asashour/selenium,asolntsev/selenium,Ardesco/selenium,asashour/selenium,joshmgrant/selenium,valfirst/selenium,5hawnknight/selenium,joshbruning/selenium,chrisblock/selenium,joshbruning/selenium,SeleniumHQ/selenium,Dude-X/selenium,valfirst/selenium,lmtierney/selenium,SeleniumHQ/selenium,joshmgrant/selenium,SeleniumHQ/selenium,oddui/selenium,krmahadevan/selenium,jsakamoto/selenium,Ardesco/selenium,oddui/selenium,titusfortner/selenium,5hawnknight/selenium,HtmlUnit/selenium,valfirst/selenium,titusfortner/selenium,HtmlUnit/selenium,joshmgrant/selenium,lmtierney/selenium,5hawnknight/selenium,HtmlUnit/selenium,Ardesco/selenium,asolntsev/selenium,5hawnknight/selenium,titusfortner/selenium,HtmlUnit/selenium,oddui/selenium,titusfortner/selenium,5hawnknight/selenium,davehunt/selenium,valfirst/selenium,krmahadevan/selenium,SeleniumHQ/selenium,Ardesco/selenium,jsakamoto/selenium,Dude-X/selenium,Dude-X/selenium,titusfortner/selenium,asashour/selenium,5hawnknight/selenium,titusfortner/selenium,jsakamoto/selenium,titusfortner/selenium,davehunt/selenium,lmtierney/selenium,chrisblock/selenium,lmtierney/selenium,lmtierney/selenium,Dude-X/selenium,valfirst/selenium,titusfortner/selenium,asolntsev/selenium,joshmgrant/selenium,SeleniumHQ/selenium,HtmlUnit/selenium,joshbruning/selenium,asolntsev/selenium,asashour/selenium,Dude-X/selenium,lmtierney/selenium,asashour/selenium,5hawnknight/selenium,chrisblock/selenium,asolntsev/selenium,chrisblock/selenium,asashour/selenium,HtmlUnit/selenium,valfirst/selenium,jsakamoto/selenium,lmtierney/selenium,davehunt/selenium,joshmgrant/selenium,joshbruning/selenium,joshmgrant/selenium,Ardesco/selenium,HtmlUnit/selenium,joshmgrant/selenium,twalpole/selenium,oddui/selenium,twalpole/selenium,HtmlUnit/selenium,twalpole/selenium,joshmgrant/selenium,krmahadevan/selenium,chrisblock/selenium,twalpole/selenium,krmahadevan/selenium,chrisblock/selenium,oddui/selenium,SeleniumHQ/selenium,joshmgrant/selenium,SeleniumHQ/selenium,Ardesco/selenium,joshmgrant/selenium,twalpole/selenium,jsakamoto/selenium,joshmgrant/selenium,lmtierney/selenium,Dude-X/selenium,Dude-X/selenium,titusfortner/selenium,asolntsev/selenium,davehunt/selenium,davehunt/selenium,chrisblock/selenium,valfirst/selenium,davehunt/selenium,chrisblock/selenium,oddui/selenium,twalpole/selenium,asolntsev/selenium,5hawnknight/selenium,titusfortner/selenium,valfirst/selenium,valfirst/selenium,asolntsev/selenium,asashour/selenium,titusfortner/selenium,asolntsev/selenium,Ardesco/selenium,davehunt/selenium,joshbruning/selenium,jsakamoto/selenium,davehunt/selenium,krmahadevan/selenium,SeleniumHQ/selenium,joshbruning/selenium,krmahadevan/selenium,SeleniumHQ/selenium,joshbruning/selenium,Dude-X/selenium,oddui/selenium,Dude-X/selenium,oddui/selenium,krmahadevan/selenium,krmahadevan/selenium,krmahadevan/selenium,twalpole/selenium,asashour/selenium,twalpole/selenium,valfirst/selenium,SeleniumHQ/selenium,oddui/selenium,jsakamoto/selenium,lmtierney/selenium,joshbruning/selenium,chrisblock/selenium,HtmlUnit/selenium,jsakamoto/selenium,joshbruning/selenium,HtmlUnit/selenium,Ardesco/selenium,twalpole/selenium,jsakamoto/selenium,5hawnknight/selenium,davehunt/selenium,SeleniumHQ/selenium,asashour/selenium,valfirst/selenium,Ardesco/selenium | dotnet/test/common/ElementPropertyTest.cs | dotnet/test/common/ElementPropertyTest.cs | using System;
using System.Collections.Generic;
using NUnit.Framework;
using System.Collections.ObjectModel;
using OpenQA.Selenium.Environment;
namespace OpenQA.Selenium
{
[TestFixture]
public class ElementPropertyTest : DriverTestFixture
{
[Test]
[IgnoreBrowser(Browser.Chrome, "Chrome does not support get element property command")]
[IgnoreBrowser(Browser.Opera)]
[IgnoreBrowser(Browser.Remote)]
[IgnoreBrowser(Browser.Safari)]
public void ShouldReturnNullWhenGettingTheValueOfAPropertyThatIsNotListed()
{
driver.Url = simpleTestPage;
IWebElement head = driver.FindElement(By.XPath("/html"));
string attribute = head.GetProperty("cheese");
Assert.IsNull(attribute);
}
[Test]
[IgnoreBrowser(Browser.Chrome, "Chrome does not support get element property command")]
[IgnoreBrowser(Browser.Opera)]
[IgnoreBrowser(Browser.Remote)]
[IgnoreBrowser(Browser.Safari)]
public void CanRetrieveTheCurrentValueOfAProperty()
{
driver.Url = formsPage;
IWebElement element = driver.FindElement(By.Id("working"));
Assert.AreEqual(string.Empty, element.GetProperty("value"));
element.SendKeys("hello world");
Assert.AreEqual("hello world", element.GetProperty("value"));
}
}
}
| using System;
using System.Collections.Generic;
using NUnit.Framework;
using System.Collections.ObjectModel;
using OpenQA.Selenium.Environment;
namespace OpenQA.Selenium
{
[TestFixture]
public class ElementPropertyTest : DriverTestFixture
{
[Test]
[IgnoreBrowser(Browser.Edge)]
[IgnoreBrowser(Browser.Chrome, "Chrome does not support get element property command")]
[IgnoreBrowser(Browser.Opera)]
[IgnoreBrowser(Browser.Remote)]
[IgnoreBrowser(Browser.Safari)]
public void ShouldReturnNullWhenGettingTheValueOfAPropertyThatIsNotListed()
{
driver.Url = simpleTestPage;
IWebElement head = driver.FindElement(By.XPath("/html"));
string attribute = head.GetProperty("cheese");
Assert.IsNull(attribute);
}
[Test]
[IgnoreBrowser(Browser.Edge)]
[IgnoreBrowser(Browser.Chrome, "Chrome does not support get element property command")]
[IgnoreBrowser(Browser.Opera)]
[IgnoreBrowser(Browser.Remote)]
[IgnoreBrowser(Browser.Safari)]
public void CanRetrieveTheCurrentValueOfAProperty()
{
driver.Url = formsPage;
IWebElement element = driver.FindElement(By.Id("working"));
Assert.AreEqual(string.Empty, element.GetProperty("value"));
element.SendKeys("hello world");
Assert.AreEqual("hello world", element.GetProperty("value"));
}
}
}
| apache-2.0 | C# |
7df4b0c5b0f216fa43a83efc164e93c7ae0d1303 | Fix merge issues | MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS | src/Package/Impl/Sql/Commands/PublishSProcOptionsCommand.cs | src/Package/Impl/Sql/Commands/PublishSProcOptionsCommand.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.R.Package.Commands;
using Microsoft.VisualStudio.R.Package.ProjectSystem;
using Microsoft.VisualStudio.R.Package.Shell;
using Microsoft.VisualStudio.R.Package.Sql.Publish;
using Microsoft.VisualStudio.R.Package.ProjectSystem.Configuration;
using System.Threading.Tasks;
using Microsoft.Common.Core.Shell;
using Microsoft.R.Components.Sql.Publish;
#if VS14
using Microsoft.VisualStudio.ProjectSystem.Designers;
using Microsoft.VisualStudio.ProjectSystem.Utilities;
#endif
namespace Microsoft.VisualStudio.R.Package.Sql {
[ExportCommandGroup("AD87578C-B324-44DC-A12A-B01A6ED5C6E3")]
[AppliesTo(ProjectConstants.RtvsProjectCapability)]
internal sealed class PublishSProcOptionsCommand : IAsyncCommandGroupHandler {
private readonly IApplicationShell _appShell;
private readonly IProjectSystemServices _pss;
private readonly IProjectConfigurationSettingsProvider _pcsp;
private readonly IDacPackageServicesProvider _dacServicesProvider;
[ImportingConstructor]
public PublishSProcOptionsCommand(IApplicationShell appShell, IProjectSystemServices pss, IProjectConfigurationSettingsProvider pcsp, IDacPackageServicesProvider dacServicesProvider) {
_appShell = appShell;
_pss = pss;
_pcsp = pcsp;
_dacServicesProvider = dacServicesProvider;
}
public Task<CommandStatusResult> GetCommandStatusAsync(IImmutableSet<IProjectTree> nodes, long commandId, bool focused, string commandText, CommandStatus progressiveStatus) {
if (commandId == RPackageCommandId.icmdPublishSProcOptions) {
return Task.FromResult(new CommandStatusResult(true, commandText, CommandStatus.Enabled | CommandStatus.Supported));
}
return Task.FromResult(CommandStatusResult.Unhandled);
}
public async Task<bool> TryHandleCommandAsync(IImmutableSet<IProjectTree> nodes, long commandId, bool focused, long commandExecuteOptions, IntPtr variantArgIn, IntPtr variantArgOut) {
if (commandId == RPackageCommandId.icmdPublishSProcOptions) {
if (_dacServicesProvider.GetDacPackageServices(showMessage: true) != null) {
var dlg = await SqlPublshOptionsDialog.CreateAsync(_appShell, _pss, _pcsp);
await _appShell.SwitchToMainThreadAsync();
dlg.ShowModal();
}
return true;
}
return false;
}
}
}
| // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.R.Package.Commands;
using Microsoft.VisualStudio.R.Package.ProjectSystem;
using Microsoft.VisualStudio.R.Package.Shell;
using Microsoft.VisualStudio.R.Package.Sql.Publish;
using Microsoft.VisualStudio.R.Package.ProjectSystem.Configuration;
using System.Threading.Tasks;
using Microsoft.R.Components.Sql.Publish;
using Microsoft.R.Components.Extensions;
#if VS14
using Microsoft.VisualStudio.ProjectSystem.Designers;
using Microsoft.VisualStudio.ProjectSystem.Utilities;
#endif
namespace Microsoft.VisualStudio.R.Package.Sql {
[ExportCommandGroup("AD87578C-B324-44DC-A12A-B01A6ED5C6E3")]
[AppliesTo(ProjectConstants.RtvsProjectCapability)]
internal sealed class PublishSProcOptionsCommand : IAsyncCommandGroupHandler {
private readonly IApplicationShell _appShell;
private readonly IProjectSystemServices _pss;
private readonly IProjectConfigurationSettingsProvider _pcsp;
private readonly IDacPackageServicesProvider _dacServicesProvider;
[ImportingConstructor]
public PublishSProcOptionsCommand(IApplicationShell appShell, IProjectSystemServices pss, IProjectConfigurationSettingsProvider pcsp, IDacPackageServicesProvider dacServicesProvider) {
_appShell = appShell;
_pss = pss;
_pcsp = pcsp;
_dacServicesProvider = dacServicesProvider;
}
public Task<CommandStatusResult> GetCommandStatusAsync(IImmutableSet<IProjectTree> nodes, long commandId, bool focused, string commandText, CommandStatus progressiveStatus) {
if (commandId == RPackageCommandId.icmdPublishSProcOptions) {
return Task.FromResult(new CommandStatusResult(true, commandText, CommandStatus.Enabled | CommandStatus.Supported));
}
return Task.FromResult(CommandStatusResult.Unhandled);
}
public async Task<bool> TryHandleCommandAsync(IImmutableSet<IProjectTree> nodes, long commandId, bool focused, long commandExecuteOptions, IntPtr variantArgIn, IntPtr variantArgOut) {
if (commandId == RPackageCommandId.icmdPublishSProcOptions) {
if (_dacServicesProvider.GetDacPackageServices(showMessage: true) != null) {
var dlg = await SqlPublshOptionsDialog.CreateAsync(_appShell, _pss, _pcsp);
await _appShell.SwitchToMainThreadAsync();
dlg.ShowModal();
}
return true;
}
return false;
}
}
}
| mit | C# |
f98e96e45b22b3b34e56543f2249d43e62585d5f | Add osu!-specific enum for confine mouse mode | UselessToucan/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu-new,smoogipooo/osu,ppy/osu,peppy/osu,UselessToucan/osu,ppy/osu,ppy/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu | osu.Game/Input/OsuConfineMouseMode.cs | osu.Game/Input/OsuConfineMouseMode.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.ComponentModel;
using osu.Framework.Input;
namespace osu.Game.Input
{
/// <summary>
/// Determines the situations in which the mouse cursor should be confined to the window.
/// Expands upon <see cref="ConfineMouseMode"/> by providing the option to confine during gameplay.
/// </summary>
public enum OsuConfineMouseMode
{
/// <summary>
/// The mouse cursor will be free to move outside the game window.
/// </summary>
Never,
/// <summary>
/// The mouse cursor will be locked to the window bounds while in fullscreen mode.
/// </summary>
Fullscreen,
/// <summary>
/// The mouse cursor will be locked to the window bounds during gameplay,
/// but may otherwise move freely.
/// </summary>
[Description("During Gameplay")]
DuringGameplay,
/// <summary>
/// The mouse cursor will always be locked to the window bounds while the game has focus.
/// </summary>
Always
}
}
| mit | C# | |
ccc45ad1f629686e757afe27f7839d864a6462a1 | Add encoding types | coolya/logv.http | SimpleHttpServerExtensions/EncodingType.cs | SimpleHttpServerExtensions/EncodingType.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimpleHttpServer
{
public enum EncodingType
{
Plain, Deflate, Gzip
}
}
| apache-2.0 | C# | |
eb665426c9ee5ba1d844c872482690ffec27923c | Change mobile client to use DefaultsController instead of GetwayController | azure-appservice-samples/ContosoMoments,azure-appservice-samples/ContosoMoments,azure-appservice-samples/ContosoMoments,lindydonna/ContosoMoments,azure-appservice-samples/ContosoMoments,azure-appservice-samples/ContosoMoments,lindydonna/ContosoMoments,lindydonna/ContosoMoments,lindydonna/ContosoMoments,lindydonna/ContosoMoments | src/Mobile/ContosoMoments/Helpers/Utils.cs | src/Mobile/ContosoMoments/Helpers/Utils.cs | using System.Threading.Tasks;
using ContosoMoments.Models;
using Xamarin.Forms;
using System;
namespace ContosoMoments
{
public class ResizeRequest
{
public string Id { get; set; }
public string BlobName { get; set; }
}
public class ActivityIndicatorScope : IDisposable
{
private bool showIndicator;
private ActivityIndicator indicator;
public ActivityIndicatorScope(ActivityIndicator indicator, bool showIndicator)
{
this.indicator = indicator;
this.showIndicator = showIndicator;
SetIndicatorActivity(showIndicator);
}
private void SetIndicatorActivity(bool isActive)
{
this.indicator.IsVisible = isActive;
this.indicator.IsRunning = isActive;
}
public void Dispose()
{
SetIndicatorActivity(false);
}
}
public static class Utils
{
public static bool IsOnline()
{
var networkConnection = DependencyService.Get<INetworkConnection>();
networkConnection.CheckNetworkConnection();
return networkConnection.IsConnected;
}
public static async Task<bool> SiteIsOnline()
{
bool retVal = true;
try {
var res = await App.MobileService.InvokeApiAsync<string>("Defaults", System.Net.Http.HttpMethod.Get, null);
if (res == null) {
retVal = false;
}
}
catch (Exception)
{
retVal = false;
}
return retVal;
}
}
}
| using System.Threading.Tasks;
using ContosoMoments.Models;
using Xamarin.Forms;
using System;
namespace ContosoMoments
{
public class ResizeRequest
{
public string Id { get; set; }
public string BlobName { get; set; }
}
public class ActivityIndicatorScope : IDisposable
{
private bool showIndicator;
private ActivityIndicator indicator;
public ActivityIndicatorScope(ActivityIndicator indicator, bool showIndicator)
{
this.indicator = indicator;
this.showIndicator = showIndicator;
SetIndicatorActivity(showIndicator);
}
private void SetIndicatorActivity(bool isActive)
{
this.indicator.IsVisible = isActive;
this.indicator.IsRunning = isActive;
}
public void Dispose()
{
SetIndicatorActivity(false);
}
}
public static class Utils
{
public static bool IsOnline()
{
var networkConnection = DependencyService.Get<INetworkConnection>();
networkConnection.CheckNetworkConnection();
return networkConnection.IsConnected;
}
public static async Task<bool> SiteIsOnline()
{
bool retVal = true;
try {
var res = await App.MobileService.InvokeApiAsync<string>("Getway", System.Net.Http.HttpMethod.Get, null);
if (res == null && res.Length == 0) {
retVal = false;
}
}
catch //(Exception ex)
{
retVal = false;
}
return retVal;
}
}
}
| mit | C# |
49790a4b93b6c76a87afd235972d4019b4eeb42b | Add design-time generated proxy for C# tests | Moq/moq | test/Moq.Tests/Proxies/ICalculatorProxy.cs | test/Moq.Tests/Proxies/ICalculatorProxy.cs | using Moq.Proxy;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;
using Moq.Sdk;
namespace Proxies
{
[CompilerGenerated]
public partial class ICalculatorProxy : ICalculator, IProxy, IMocked
{
public int? this[string name] { get => pipeline.Execute<int?>(new MethodInvocation(this, MethodBase.GetCurrentMethod(), name)); set => pipeline.Execute(new MethodInvocation(this, MethodBase.GetCurrentMethod(), name, value)); }
public bool IsOn => pipeline.Execute<bool>(new MethodInvocation(this, MethodBase.GetCurrentMethod()));
public CalculatorMode Mode { get => pipeline.Execute<CalculatorMode>(new MethodInvocation(this, MethodBase.GetCurrentMethod())); set => pipeline.Execute(new MethodInvocation(this, MethodBase.GetCurrentMethod(), value)); }
public int Add(int x, int y) => pipeline.Execute<int>(new MethodInvocation(this, MethodBase.GetCurrentMethod(), x, y));
public int Add(int x, int y, int z) => pipeline.Execute<int>(new MethodInvocation(this, MethodBase.GetCurrentMethod(), x, y, z));
public void Clear(string name) => pipeline.Execute(new MethodInvocation(this, MethodBase.GetCurrentMethod(), name));
public int? Recall(string name) => pipeline.Execute<int?>(new MethodInvocation(this, MethodBase.GetCurrentMethod(), name));
public void Store(string name, int value) => pipeline.Execute(new MethodInvocation(this, MethodBase.GetCurrentMethod(), name, value));
public bool TryAdd(ref int x, ref int y, out int z)
{
z = default(int);
IMethodReturn returns = pipeline.Execute(new MethodInvocation(this, MethodBase.GetCurrentMethod(), x, y, z));
x = (int)returns.Outputs["x"];
y = (int)returns.Outputs["y"];
z = (int)returns.Outputs["z"];
return (bool)returns.ReturnValue;
}
public void TurnOn() => pipeline.Execute(new MethodInvocation(this, MethodBase.GetCurrentMethod()));
public event EventHandler TurnedOn { add => pipeline.Execute<EventHandler>(new MethodInvocation(this, MethodBase.GetCurrentMethod(), value)); remove => pipeline.Execute<EventHandler>(new MethodInvocation(this, MethodBase.GetCurrentMethod(), value)); }
#region IProxy
BehaviorPipeline pipeline = new BehaviorPipeline();
IList<IProxyBehavior> IProxy.Behaviors => pipeline.Behaviors;
#endregion
#region IMocked
IMock mock;
IMock IMocked.Mock => LazyInitializer.EnsureInitialized(ref mock, () => new MockInfo(pipeline.Behaviors));
#endregion
}
} | apache-2.0 | C# | |
76d51b5f002bf7d7dbe3849a4807db6fa239b6eb | Add example to get the Log of a source field. | JoePlant/Ampla-Code-Items | Custom/LogFieldRecordUpdater.cs | Custom/LogFieldRecordUpdater.cs | using Code.Records;
namespace Code.Custom
{
/// <summary>
/// Record Updater that will calculate the log of the source field.
/// </summary>
/// <example>
/// // handle the record changed event
/// new Code.Custom.LogFieldRecordUpdater("Source Field", "Log Field").HandleRecordChanged(eventItem, eventArgs);
/// </example>
public class LogFieldRecordUpdater : RecordUpdater
{
private readonly string logResultField;
private readonly string sourceField;
public LogFieldRecordUpdater(string sourceField, string logResultField)
{
this.sourceField = sourceField;
this.logResultField = logResultField;
}
protected override void OnUpdateNewRecord(IRecord record)
{
}
/// <summary>
/// Called when the record is to be updated
/// </summary>
/// <param name="record">The record.</param>
protected override void OnUpdateRecord(IRecord record)
{
double source = record.GetFieldValue<double>(sourceField, 0);
if (source > 0)
{
double log = System.Math.Log10(source);
record.SetFieldValue<double>(logResultField, log);
}
else
{
TraceError("{0} - Unable to calculate ['{1}'] = Math.Log10({2}) ({2} = {3})", this, logResultField, sourceField, source);
}
}
}
} | mit | C# | |
6c2520f3352c1f28e1ef28fe3e0b2df00a979578 | Make DB flush operation atomic for NTFS | tkellogg/Jump-Location,drmohundro/Jump-Location,drmohundro/Jump-Location | Jump.Location/FileStoreProvider.cs | Jump.Location/FileStoreProvider.cs | using System;
using System.IO;
using System.Linq;
namespace Jump.Location
{
public interface IFileStoreProvider
{
void Save(IDatabase database);
IDatabase Revive();
DateTime LastChangedDate { get; }
}
public class FileStoreUpdatedEventArgs : EventArgs
{
public FileStoreUpdatedEventArgs(IDatabase database)
{
UpdatedDatabase = database;
}
public IDatabase UpdatedDatabase { get; private set; }
}
public delegate void FileStoreUpdated(object sender, FileStoreUpdatedEventArgs args);
class FileStoreProvider : IFileStoreProvider
{
private readonly string path;
private readonly string pathTemp;
private const string TempPrefix = ".tmp";
public FileStoreProvider(string path)
{
this.path = path;
this.pathTemp = path + TempPrefix;
}
public event FileStoreUpdated FileStoreUpdated;
private void OnFileStoreUpdated(object sender, FileStoreUpdatedEventArgs args)
{
if (FileStoreUpdated != null)
FileStoreUpdated(sender, args);
}
public void Save(IDatabase database)
{
var lines = database.Records.Select(record =>
string.Format("{1}\t{0}", record.FullName, record.Weight));
// We can lose all history, if powershell will be closed during operation.
// NTFS guarantees atomic move operation http://stackoverflow.com/questions/774098/atomicity-of-file-move
File.WriteAllLines(pathTemp, lines.ToArray());
File.Move(pathTemp, path);
}
public IDatabase Revive()
{
var db = new Database();
var allLines = File.ReadAllLines(path);
var nonBlankLines = allLines.Where(line => !string.IsNullOrEmpty(line) && line.Trim() != string.Empty);
foreach (var columns in nonBlankLines.Select(line => line.Split('\t')))
{
if (columns == null || columns.Length != 2)
throw new InvalidOperationException("Row of file didn't have 2 columns separated by a tab");
var weight = decimal.Parse(columns[0]);
var record = new Record(columns[1], weight);
db.Add(record);
}
return db;
}
public DateTime LastChangedDate { get { return File.GetLastWriteTime(path); } }
}
}
| using System;
using System.IO;
using System.Linq;
namespace Jump.Location
{
public interface IFileStoreProvider
{
void Save(IDatabase database);
IDatabase Revive();
DateTime LastChangedDate { get; }
}
public class FileStoreUpdatedEventArgs : EventArgs
{
public FileStoreUpdatedEventArgs(IDatabase database)
{
UpdatedDatabase = database;
}
public IDatabase UpdatedDatabase { get; private set; }
}
public delegate void FileStoreUpdated(object sender, FileStoreUpdatedEventArgs args);
class FileStoreProvider : IFileStoreProvider
{
private readonly string path;
public FileStoreProvider(string path)
{
this.path = path;
}
public event FileStoreUpdated FileStoreUpdated;
private void OnFileStoreUpdated(object sender, FileStoreUpdatedEventArgs args)
{
if (FileStoreUpdated != null)
FileStoreUpdated(sender, args);
}
public void Save(IDatabase database)
{
var lines = database.Records.Select(record =>
string.Format("{1}\t{0}", record.FullName, record.Weight));
File.WriteAllLines(path, lines.ToArray());
}
public IDatabase Revive()
{
var db = new Database();
var allLines = File.ReadAllLines(path);
var nonBlankLines = allLines.Where(line => !string.IsNullOrEmpty(line) && line.Trim() != string.Empty);
foreach (var columns in nonBlankLines.Select(line => line.Split('\t')))
{
if (columns == null || columns.Length != 2)
throw new InvalidOperationException("Row of file didn't have 2 columns separated by a tab");
var weight = decimal.Parse(columns[0]);
var record = new Record(columns[1], weight);
db.Add(record);
}
return db;
}
public DateTime LastChangedDate { get { return File.GetLastWriteTime(path); } }
}
}
| mit | C# |
c44d969bb6f62771f16a1126f297fdf6ae41005a | Create TinyMCE.cs | base33/Mentor-Web-Blocks,DaveGreasley/Mentor-Web-Blocks,DaveGreasley/Mentor-Web-Blocks,base33/Mentor-Web-Blocks,DaveGreasley/Mentor-Web-Blocks,base33/Mentor-Web-Blocks,base33/Mentor-Web-Blocks | WebBlocks/WebBlocks/Helpers/TinyMCE.cs | WebBlocks/WebBlocks/Helpers/TinyMCE.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
namespace WebBlocks.Helpers
{
public class TinyMCE
{
public string ReplaceMacroTags(string text)
{
while (FindStartTag(text) > -1)
{
string result = text.Substring(FindStartTag(text), FindEndTag(text) - FindStartTag(text));
text = text.Replace(result, GenerateMacroTag(result));
}
return text;
}
private string GenerateMacroTag(string macroContent)
{
string macroAttr = macroContent.Substring(5, macroContent.IndexOf(">") - 5);
string macroTag = "<?UMBRACO_MACRO ";
System.Collections.Hashtable attributes = ReturnAttributes(macroAttr);
System.Collections.IDictionaryEnumerator ide = attributes.GetEnumerator();
while (ide.MoveNext())
{
if (ide.Key.ToString().IndexOf("umb_") != -1)
{
// Hack to compensate for Firefox adding all attributes as lowercase
string orgKey = ide.Key.ToString();
if (orgKey == "umb_macroalias")
orgKey = "umb_macroAlias";
macroTag += orgKey.Substring(4, orgKey.Length - 4) + "=\"" +
ide.Value.ToString().Replace("\\r\\n", Environment.NewLine) + "\" ";
}
}
macroTag += "/>";
return macroTag;
}
private int FindStartTag(string text)
{
string temp = "";
text = text.ToLower();
if (text.IndexOf("ismacro=\"true\"") > -1)
{
temp = text.Substring(0, text.IndexOf("ismacro=\"true\""));
return temp.LastIndexOf("<");
}
return -1;
}
private int FindEndTag(string text)
{
string find = "<!-- endumbmacro -->";
int endMacroIndex = text.ToLower().IndexOf(find);
string tempText = text.ToLower().Substring(endMacroIndex + find.Length, text.Length - endMacroIndex - find.Length);
int finalEndPos = 0;
while (tempText.Length > 5)
if (tempText.Substring(finalEndPos, 6) == "</div>")
break;
else
finalEndPos++;
return endMacroIndex + find.Length + finalEndPos + 6;
}
private Hashtable ReturnAttributes(String tag)
{
var h = new Hashtable();
foreach (var i in Umbraco.Core.XmlHelper.GetAttributesFromElement(tag))
{
h.Add(i.Key, i.Value);
}
return h;
}
}
}
| mit | C# | |
3d1b2a7fce893dac365887a8a0d73de5443b694c | Add a new parameter to hold all science collection sub-params | Kerbas-ad-astra/Orbital-Science,DMagic1/Orbital-Science | Source/Parameters/DMCompleteParameter.cs | Source/Parameters/DMCompleteParameter.cs | #region license
/* DMagic Orbital Science - DMCompleteParameter
* Parameter To Hold Science Collection Sub-Parameters
*
* Copyright (c) 2014, David Grandy <david.grandy@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Contracts;
using Contracts.Parameters;
using DMagic.Contracts;
namespace DMagic.Parameters
{
public class DMCompleteParameter : ContractParameter
{
private int type;
private int minus;
private int subParamCountToComplete;
public DMCompleteParameter()
{
}
public DMCompleteParameter(int Type, int i)
{
type = Type;
minus = i;
}
public void addToSubParams(ContractParameter cp, string id)
{
AddParameter(cp, id);
subParamCountToComplete = ParameterCount - minus;
}
protected override string GetTitle()
{
if (ParameterCount == subParamCountToComplete)
return "Return or transmit the following experiments:";
else
return string.Format("Return or transmit at least {0} of the following experiments:", subParamCountToComplete);
}
protected override string GetNotes()
{
switch(type)
{
case 0:
return "The following experiments must be returned or transmitted with some science value; if no transmission value is remaining the results must be returned home.";
case 1:
return "The following experiments can be conducted at any time during the contract.";
case 2:
return "An on-screen message will indicate successful collection of data from the following experiments; return or transmit the results to complete each objective.";
case 3:
return "An on-screen message will indicate successful collection of data while near to, or above, the target; return or transmit the results to complete each objective.";
}
return "";
}
protected override void OnRegister()
{
OnStateChange.Add(onParamChange);
}
protected override void OnUnregister()
{
OnStateChange.Remove(onParamChange);
}
protected override void OnSave(ConfigNode node)
{
node.AddValue("Parent_Parameter_Type", string.Format("{0}|{1}", type, subParamCountToComplete));
}
protected override void OnLoad(ConfigNode node)
{
string[] values = node.GetValue("Parent_Parameter_Type").Split('|');
if (!int.TryParse(values[0], out type))
{
DMUtils.Logging("Failed To Load Parent Parameter Variables; Parent Parameter Removed");
this.Unregister();
this.Root.RemoveParameter(this);
return;
}
if (!int.TryParse(values[1], out subParamCountToComplete))
{
DMUtils.Logging("Failed To Load Parent Parameter Variables; Reset To Default");
subParamCountToComplete = 2;
}
}
private int SubParamCompleted()
{
return AllParameters.Where(p => p.State == ParameterState.Complete).Count();
}
private void onParamChange(ContractParameter p, ParameterState state)
{
if (SubParamCompleted() >= subParamCountToComplete)
this.SetComplete();
}
}
}
| bsd-3-clause | C# | |
0845069a2ccdcb66b3b6e35f8e6ef036e6a021ef | Implement unit test for boyer moore | cschen1205/cs-algorithms,cschen1205/cs-algorithms | cs-algorithms/Strings/Search/BoyerMoore.cs | cs-algorithms/Strings/Search/BoyerMoore.cs | using System;
namespace Algorithms.Strings.Search
{
public class BoyerMoore
{
private int[] right;
private const int R = 256;
private int M;
private string pat;
public BoyerMoore(string pat)
{
this.pat = pat;
right = new int[R];
for (int i = 0; i < pat.Length; ++i)
{
right[pat[i]] = i;
}
M = pat.Length;
}
public int Search(string text)
{
int skip = 1;
for (int i = 0; i < text.Length - M; i+=skip)
{
var j;
for (j = M - 1; j >= 0; j--)
{
if (text[i + j] != pat[j])
{
skip = Math.Max(1, j - right[text[i + j]]);
break;
}
}
if (j == -1) return i;
}
return -1;
}
}
} | mit | C# | |
49af142f478da2a94f02da62581257d64895348f | Create AssemblyInfo.cs | Zedohsix/SharpFind | SharpFind/Properties/AssemblyInfo.cs | SharpFind/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("#Find")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Babiker M Babiker")]
[assembly: AssemblyProduct("#Find")]
[assembly: AssemblyCopyright("Copyright © Babiker M Babiker 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("dd2f36f6-6bce-44d7-a9ab-c6d27889018e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# | |
d57bbca0cf3907bf5952a3f668c75783f7f35af6 | create unit test for CalculateLevenshteinDistance | takenet/blip-sdk-csharp | src/Take.Blip.Builder.UnitTests/Models/StringExtensionsTests.cs | src/Take.Blip.Builder.UnitTests/Models/StringExtensionsTests.cs | using Take.Blip.Builder.Models;
using Xunit;
namespace Take.Blip.Builder.UnitTests.Models
{
public class StringExtensionsTests
{
/// <summary>
/// Test cases get from HackerRank: https://www.hackerrank.com/contests/cse-830-homework-3/challenges/edit-distance
/// </summary>
[Theory]
[InlineData("abc", "abc", 0)]
[InlineData("abc", "", 3)]
[InlineData("", "abcd", 4)]
[InlineData("abcde", "abde", 1)]
[InlineData("abde", "abcde", 1)]
[InlineData("abcde", "abxde", 1)]
[InlineData("aaaaaaaaaaaaaaaaaaaaaaaXaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaXaaaaaaaaaaaaaaaaXaaaaaaaaaaaaaaaaaaaaXaaaaaaX", 3)]
[InlineData("aaaaaaaaaaaaaaaaaaaaaaabccccccbaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaabccccccbaaaaaaaaaaaaaaaaaa", 4)]
[InlineData("abc*efghijklm---nopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM+++NOPQRSTU*WXYZ", 8)]
[InlineData("CGICNWFJZOWBDEVORLYOOUHSIPOICMSOQIUBGSDIROYOMJJSLUPVRBNOOPAHMPNGQXHCPSLEYZEYSDGF", "TBYHUADAJRXTDDKWMPYKNQFMGBOXJGNLOGIKTLKVUKREEEVZMTCJVUZSHNRZKGRQOXMBZYGBNDFHDVLM", 74)]
[InlineData("NTBFKWGUYSLYRMMPSXNYXAZNZFJIPJDMNPZNLPEEYEONABFCZEZYVGCJBFMGWKQPTTGJDLKKQYJZYFSL", "PEDWJMTVXVGGCLSTOOQEACZJNOVUYXPQGIRAPHFWAESSZKHKGKUEEGVWZXVFJWLQBUBOJMHLEHGKWYTN", 70)]
[InlineData("RPXZTOSEPHWYBYSOOAKMOOJRSSFHENHDVHOIKVNXMFAEXXTBNPNFPTFGNUPLKDWRSUQYWAUVMNVYJZQL", "MFKSTCDHEPTSMYNDRSNJZOULCCIUXZDCGQZRSRYEODXKNBGBBKSPPCQHJYUSCKMJZBPUBLLXPRCQJYRV", 72)]
public void CalculateLevenshteinDistance_UnitTest(string s, string t, long expected)
{
Assert.Equal(s.CalculateLevenshteinDistance(t), expected);
}
}
}
| apache-2.0 | C# | |
56d866bc8e7105893493f62c4c3aa1c51d058153 | Add CustomAggregateTimings sample | MiniProfiler/dotnet,MiniProfiler/dotnet | samples/Misc/CustomAggregateTimings.cs | samples/Misc/CustomAggregateTimings.cs | using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using StackExchange.Profiling;
namespace Misc
{
public class CustomAggregateTimings
{
public void Example()
{
var profiler = MiniProfiler.StartNew();
var myList = new List<string> { "A", "B", "C", "E" };
using (profiler.Step("Doing a collection of repeated work"))
using (var aggregateTimer1 = profiler.Step("Doing part 1"))
using (var aggregateTimer2 = profiler.Step("Doing part 2"))
{
foreach (var listItem in myList)
{
using (new Timing(profiler, aggregateTimer1, listItem))
{
Method1(listItem);
}
using (new Timing(profiler, aggregateTimer2, listItem))
{
Method2(listItem);
}
}
}
profiler.Stop();
Console.WriteLine(profiler.RenderPlainText());
}
public void Method1(string name)
{
Thread.Sleep(30);
}
public void Method2(string name)
{
Thread.Sleep(60);
}
}
}
| mit | C# | |
67b417f1cc67b9300be43d017ec0f1937f641d8b | Add files via upload | alchemz/ARL_Training | recursive/Fragment.cs | recursive/Fragment.cs | using UnityEngine;
using System.Collections;
public class Fragment : MonoBehaviour {
public Mesh mesh;
public Material material;
private int depth;
public int maxDepth;
public float childScale;
void Start(){
gameObject.AddComponent<MeshFilter> ().mesh = mesh;
gameObject.AddComponent<MeshRenderer>().material = material;
if (depth < maxDepth) {
StartCoroutine(createChild());
}
GetComponent<MeshRenderer> ().material.color =
Color.Lerp (Color.white, Color.yellow, (float)depth/maxDepth);
}
private IEnumerator createChild()
{
for (int i = 0; i < childDirection.Length; i++) {
yield return new WaitForSeconds (1f);
new GameObject ("Child").AddComponent<Fragment> ().initialize (this, i);
}
}
private static Vector3[] childDirection = {
Vector3.up,
Vector3.down,
Vector3.left
};
private static Quaternion[] childOrientation = {
Quaternion.identity,
Quaternion.Euler(0f,0f,90f),
Quaternion.Euler(0f,0f,-90f)
};
private void initialize(Fragment parent, int childIndex){
mesh = parent.mesh;
material = parent.material;
depth = parent.depth + 1;
maxDepth = parent.maxDepth;
transform.parent = parent.transform;
childScale = parent.childScale;
transform.localPosition = childDirection[childIndex]*(0.5f+0.5f*childScale);
transform.localScale = Vector3.one * childScale;
transform.localRotation = childOrientation[childIndex];
}
}
| mit | C# | |
a81fe225f50db13388b04cc7c393f52078743e33 | Fix Android build by adding missing namespace. | jbruening/lidgren-network-gen3,dragutux/lidgren-network-gen3,PowerOfCode/lidgren-network-gen3,lidgren/lidgren-network-gen3,SacWebDeveloper/lidgren-network-gen3,forestrf/lidgren-network-gen3,RainsSoft/lidgren-network-gen3 | Lidgren.Network/Platform/PlatformAndroid.cs | Lidgren.Network/Platform/PlatformAndroid.cs | #if __ANDROID__
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Net;
namespace Lidgren.Network
{
public static partial class NetUtility
{
private static byte[] s_randomMacBytes;
static NetUtility()
{
s_randomMacBytes = new byte[8];
MWCRandom.Instance.NextBytes(s_randomMacBytes);
}
[CLSCompliant(false)]
public static ulong GetPlatformSeed(int seedInc)
{
ulong seed = (ulong)Environment.TickCount + (ulong)seedInc;
return seed ^ ((ulong)(new object().GetHashCode()) << 32);
}
/// <summary>
/// Gets my local IPv4 address (not necessarily external) and subnet mask
/// </summary>
public static IPAddress GetMyAddress(out IPAddress mask)
{
mask = null;
try
{
Android.Net.Wifi.WifiManager wifi = (Android.Net.Wifi.WifiManager)Android.App.Application.Context.GetSystemService(Android.App.Activity.WifiService);
if (!wifi.IsWifiEnabled)
return null;
var dhcp = wifi.DhcpInfo;
int addr = dhcp.IpAddress;
byte[] quads = new byte[4];
for (int k = 0; k < 4; k++)
quads[k] = (byte)((addr >> k * 8) & 0xFF);
return new IPAddress(quads);
}
catch // Catch Access Denied errors
{
return null;
}
}
public static byte[] GetMacAddressBytes()
{
return s_randomMacBytes;
}
public static void Sleep(int milliseconds)
{
System.Threading.Thread.Sleep(milliseconds);
}
public static IPAddress GetBroadcastAddress()
{
return IPAddress.Broadcast;
}
public static IPAddress CreateAddressFromBytes(byte[] bytes)
{
return new IPAddress(bytes);
}
private static readonly SHA1 s_sha = SHA1.Create();
public static byte[] ComputeSHAHash(byte[] bytes, int offset, int count)
{
return s_sha.ComputeHash(bytes, offset, count);
}
}
public static partial class NetTime
{
private static readonly long s_timeInitialized = Environment.TickCount;
/// <summary>
/// Get number of seconds since the application started
/// </summary>
public static double Now { get { return (double)((uint)Environment.TickCount - s_timeInitialized) / 1000.0; } }
}
}
#endif | #if __ANDROID__
using System;
using System.Collections.Generic;
using System.Net;
namespace Lidgren.Network
{
public static partial class NetUtility
{
private static byte[] s_randomMacBytes;
static NetUtility()
{
s_randomMacBytes = new byte[8];
MWCRandom.Instance.NextBytes(s_randomMacBytes);
}
[CLSCompliant(false)]
public static ulong GetPlatformSeed(int seedInc)
{
ulong seed = (ulong)Environment.TickCount + (ulong)seedInc;
return seed ^ ((ulong)(new object().GetHashCode()) << 32);
}
/// <summary>
/// Gets my local IPv4 address (not necessarily external) and subnet mask
/// </summary>
public static IPAddress GetMyAddress(out IPAddress mask)
{
mask = null;
try
{
Android.Net.Wifi.WifiManager wifi = (Android.Net.Wifi.WifiManager)Android.App.Application.Context.GetSystemService(Android.App.Activity.WifiService);
if (!wifi.IsWifiEnabled)
return null;
var dhcp = wifi.DhcpInfo;
int addr = dhcp.IpAddress;
byte[] quads = new byte[4];
for (int k = 0; k < 4; k++)
quads[k] = (byte)((addr >> k * 8) & 0xFF);
return new IPAddress(quads);
}
catch // Catch Access Denied errors
{
return null;
}
}
public static byte[] GetMacAddressBytes()
{
return s_randomMacBytes;
}
public static void Sleep(int milliseconds)
{
System.Threading.Thread.Sleep(milliseconds);
}
public static IPAddress GetBroadcastAddress()
{
return IPAddress.Broadcast;
}
public static IPAddress CreateAddressFromBytes(byte[] bytes)
{
return new IPAddress(bytes);
}
private static readonly SHA1 s_sha = SHA1.Create();
public static byte[] ComputeSHAHash(byte[] bytes, int offset, int count)
{
return s_sha.ComputeHash(bytes, offset, count);
}
}
public static partial class NetTime
{
private static readonly long s_timeInitialized = Environment.TickCount;
/// <summary>
/// Get number of seconds since the application started
/// </summary>
public static double Now { get { return (double)((uint)Environment.TickCount - s_timeInitialized) / 1000.0; } }
}
}
#endif | mit | C# |
f2c8687296cda5da6da3f3de2169f08749e2be1c | Active QEP for nullables. | chtoucas/Narvalo.NET,chtoucas/Narvalo.NET | src/Narvalo.Fx/Applicative/Qullable.cs | src/Narvalo.Fx/Applicative/Qullable.cs | // Copyright (c) Narvalo.Org. All rights reserved. See LICENSE.txt in the project root for license information.
namespace Narvalo.Applicative
{
using System;
using Narvalo;
// Query Expression Pattern for nullables.
public static class Qullable
{
public static TResult? Select<TSource, TResult>(this TSource? @this, Func<TSource, TResult> selector)
where TSource : struct
where TResult : struct
{
Require.NotNull(selector, nameof(selector));
return @this.HasValue ? (TResult?)selector(@this.Value) : null;
}
public static TSource? Where<TSource>(
this TSource? @this,
Func<TSource, bool> predicate)
where TSource : struct
{
Require.NotNull(predicate, nameof(predicate));
return @this.HasValue && predicate(@this.Value) ? @this : null;
}
public static TResult? SelectMany<TSource, TMiddle, TResult>(
this TSource? @this,
Func<TSource, TMiddle?> valueSelector,
Func<TSource, TMiddle, TResult> resultSelector)
where TSource : struct
where TMiddle : struct
where TResult : struct
{
Require.NotNull(valueSelector, nameof(valueSelector));
Require.NotNull(resultSelector, nameof(resultSelector));
if (!@this.HasValue) { return null; }
var middle = valueSelector(@this.Value);
if (!middle.HasValue) { return null; }
return resultSelector(@this.Value, middle.Value);
}
}
}
| bsd-2-clause | C# | |
fbfd0f22d31ad06e9f4a1aa3372c1bdd911fb0bd | Update IOExceptionExtensions.cs | REALTOBIZ/LiteDB,prepare/LiteDB,mbdavid/LiteDB,Skysper/LiteDB,89sos98/LiteDB,icelty/LiteDB,falahati/LiteDB,masterdidoo/LiteDB,prepare/LiteDB,RytisLT/LiteDB,masterdidoo/LiteDB,89sos98/LiteDB,prepare/LiteDB,prepare/LiteDB,RytisLT/LiteDB,falahati/LiteDB,Xicy/LiteDB,guslubudus/LiteDB,tbdbj/LiteDB,kbdavis07/LiteDB | LiteDB/Utils/IOExceptionExtensions.cs | LiteDB/Utils/IOExceptionExtensions.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace LiteDB
{
internal static class IOExceptionExtensions
{
const int ERROR_SHARING_VIOLATION = 32;
const int ERROR_LOCK_VIOLATION = 33;
public static void WaitIfLocked(this IOException ex, int timer)
{
var errorCode = Marshal.GetHRForException(ex) & ((1 << 16) - 1);
if (errorCode == ERROR_SHARING_VIOLATION || errorCode == ERROR_LOCK_VIOLATION)
{
if (timer > 0)
{
Thread.Sleep(timer);
}
}
else
{
throw ex;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace LiteDB
{
internal static class IOExceptionExtensions
{
const int ERROR_SHARING_VIOLATION = 32;
const int ERROR_LOCK_VIOLATION = 33;
public static void WaitIfLocked(this IOException ex, int timer)
{
var errorCode = Marshal.GetHRForException(ex) & ((1 << 16) - 1);
if (errorCode == ERROR_SHARING_VIOLATION || errorCode == ERROR_LOCK_VIOLATION)
{
if (timer > 0)
{
Thread.Sleep(250);
}
}
else
{
throw ex;
}
}
}
}
| mit | C# |
744b8f3c8324376148035dbc22c7ec7a434e275e | Monitor plugin interface | a1ezzz/duplicati,a1ezzz/duplicati,duplicati/duplicati,AndersGron/duplicati,klammbueddel/duplicati,klammbueddel/duplicati,gerco/duplicati,gerco/duplicati,AndersGron/duplicati,agrajaghh/duplicati,AndersGron/duplicati,sitofabi/duplicati,mnaiman/duplicati,gerco/duplicati,sitofabi/duplicati,sitofabi/duplicati,sitofabi/duplicati,duplicati/duplicati,gerco/duplicati,klammbueddel/duplicati,mnaiman/duplicati,AndersGron/duplicati,a1ezzz/duplicati,duplicati/duplicati,mnaiman/duplicati,gerco/duplicati,agrajaghh/duplicati,mnaiman/duplicati,agrajaghh/duplicati,agrajaghh/duplicati,a1ezzz/duplicati,AndersGron/duplicati,klammbueddel/duplicati,agrajaghh/duplicati,a1ezzz/duplicati,duplicati/duplicati,duplicati/duplicati,mnaiman/duplicati,klammbueddel/duplicati,sitofabi/duplicati | Duplicati/Scheduler/Data/IMonitorPlugin.cs | Duplicati/Scheduler/Data/IMonitorPlugin.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Duplicati.Scheduler.Data
{
/// <summary>
/// Plugin interface maintains the monitor data
/// </summary>
public interface IMonitorPlugin
{
/// <summary>
/// Unique name of this plugin (will appear on Scheduler menu)
/// </summary>
string Name { get; }
/// <summary>
/// Update a log entry
/// </summary>
/// <param name="aLogDate">Date</param>
/// <param name="aLogContent">XML content</param>
void UpdateLog(DateTime aLogDate, string aLogContent);
/// <summary>
/// Update the scheduler record
/// </summary>
/// <param name="aScheduler">XML file to load</param>
void UpdateScheduler(string aScheduler);
/// <summary>
/// Update History
/// </summary>
void UpdateHistory(string aHistory);
/// <summary>
/// Dialog Form that configures the monitor
/// </summary>
/// <returns>Dialog Result</returns>
System.Windows.Forms.DialogResult Configure();
}
}
| lgpl-2.1 | C# | |
176f277778c3370304cc8ff6fed051fcd49f1381 | add missing files | mispencer/OmniSharpServer,corngood/omnisharp-server,syl20bnr/omnisharp-server,syl20bnr/omnisharp-server,OmniSharp/omnisharp-server,svermeulen/omnisharp-server,corngood/omnisharp-server,x335/omnisharp-server,x335/omnisharp-server | OmniSharp/Configuration/PathReplacement.cs | OmniSharp/Configuration/PathReplacement.cs | using System.Collections.Generic;
using System.IO;
using System.Reflection;
namespace OmniSharp.Configuration
{
public class ConfigurationLoader
{
private static OmniSharpConfiguration _config = new OmniSharpConfiguration();
public static void Load()
{
string executableLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string configLocation = Path.Combine(executableLocation, "config.json");
var config = File.ReadAllText(configLocation);
_config = new Nancy.Json.JavaScriptSerializer().Deserialize<OmniSharpConfiguration>(config);
}
public static OmniSharpConfiguration Config { get { return _config; }}
}
public class OmniSharpConfiguration
{
public OmniSharpConfiguration()
{
PathReplacements = new List<PathReplacement>();
}
public IEnumerable<PathReplacement> PathReplacements { get; set; }
}
public class PathReplacement
{
public string From { get; set; }
public string To { get; set; }
}
}
| mit | C# | |
fb9d151491c55fa94635628e69385026529f799a | introduce the new SemVersionRange class | maxhauser/semver | Semver/Ranges/SemVersionRange.cs | Semver/Ranges/SemVersionRange.cs | namespace Semver.Ranges
{
/// <summary>
/// A range of <see cref="SemVersion"/> values. A range can have gaps in it and may include only
/// some prerelease versions between included release versions. For a range that cannot have
/// gaps see the <see cref="UnbrokenSemVersionRange"/> class.
/// </summary>
internal class SemVersionRange
{
}
}
| mit | C# | |
bc177477cbb9f08a39481814339f09fbe0180a69 | Make the BuiltinThis test clearer | sander-git/JSIL,sq/JSIL,acourtney2015/JSIL,TukekeSoft/JSIL,Trattpingvin/JSIL,Trattpingvin/JSIL,hach-que/JSIL,FUSEEProjectTeam/JSIL,hach-que/JSIL,FUSEEProjectTeam/JSIL,sander-git/JSIL,mispy/JSIL,dmirmilshteyn/JSIL,acourtney2015/JSIL,volkd/JSIL,mispy/JSIL,antiufo/JSIL,dmirmilshteyn/JSIL,TukekeSoft/JSIL,acourtney2015/JSIL,sander-git/JSIL,TukekeSoft/JSIL,x335/JSIL,mispy/JSIL,Trattpingvin/JSIL,volkd/JSIL,sq/JSIL,volkd/JSIL,dmirmilshteyn/JSIL,volkd/JSIL,x335/JSIL,sq/JSIL,sq/JSIL,Trattpingvin/JSIL,FUSEEProjectTeam/JSIL,antiufo/JSIL,iskiselev/JSIL,sq/JSIL,hach-que/JSIL,FUSEEProjectTeam/JSIL,mispy/JSIL,iskiselev/JSIL,x335/JSIL,FUSEEProjectTeam/JSIL,dmirmilshteyn/JSIL,hach-que/JSIL,iskiselev/JSIL,iskiselev/JSIL,acourtney2015/JSIL,iskiselev/JSIL,hach-que/JSIL,acourtney2015/JSIL,antiufo/JSIL,sander-git/JSIL,sander-git/JSIL,antiufo/JSIL,TukekeSoft/JSIL,x335/JSIL,volkd/JSIL | Tests/SpecialTestCases/IndexBuiltinByName.cs | Tests/SpecialTestCases/IndexBuiltinByName.cs | using System;
using JSIL;
public static class Program {
public static void Main (string[] args) {
const string pri = "pri";
string nt = "nt";
var p = Builtins.Global[pri + nt];
if (p != null)
p("printed");
if (Builtins.Local["p"] != null)
Builtins.Local["p"]("printed again");
var q = Builtins.Global["quit"];
if (q != null)
q();
Console.WriteLine("test");
}
} | using System;
using JSIL;
public static class Program {
public static void Main (string[] args) {
var print = Builtins.Global["pr" + "int"];
if (print != null)
print("printed");
if (Builtins.Local["print"] != null)
Builtins.Local["print"]("printed again");
var quit = Builtins.Global["quit"];
if (quit != null)
quit();
Console.WriteLine("test");
}
} | mit | C# |
c29e173a3816a36f7793a82e437dca0667f43a06 | Add Q260 | txchen/csharp-leet,txchen/csharp-leet | solutions/Q260.cs | solutions/Q260.cs | public class Solution {
public int[] SingleNumber(int[] nums)
{
int xor = 0;
nums.ToList().ForEach(n => xor = xor ^ n);
// xor = a ^ b, find any '1' in the xor
int mask = 1;
while ((mask & xor) == 0)
{
mask = mask << 1;
}
// a or b, one of them, will have '1' at the mask position
int a = 0;
nums.ToList().ForEach(n => {
if ((mask & n) > 0)
{
a = a ^ n;
}
});
return new int[2] { a, xor ^ a };
}
} | mit | C# | |
67383e220f2592fe0aa9577eff528c54782aea6e | add custom attribute for Username validation | KristianMariyanov/VotingSystem,KristianMariyanov/VotingSystem,KristianMariyanov/VotingSystem | VotingSystem.Web/Infrastructure/Filters/UserNameAllowedSymbolsAtribute.cs | VotingSystem.Web/Infrastructure/Filters/UserNameAllowedSymbolsAtribute.cs | namespace VotingSystem.Web.Infrastructure.Filters
{
using System;
using System.ComponentModel.DataAnnotations;
[AttributeUsage(AttributeTargets.Property)]
public sealed class UserNameAllowedSymbolsAttribute : ValidationAttribute
{
private const string AllowedCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
public override bool IsValid(object value)
{
var username = value as string;
return username != null && this.ValidateSymbolsInUsername(username);
}
private bool ValidateSymbolsInUsername(string username)
{
for (int i = 0; i < username.Length; i++)
{
if (!AllowedCharacters.Contains(username[i].ToString()))
{
return false;
}
}
return true;
}
}
} | mit | C# | |
e7dceac15949d1ccf8cec1933c0f721dc7c70c5f | Add ingest object | Aux/NTwitch,Aux/NTwitch | src/NTwitch.Core/Entities/Ingests/IIngest.cs | src/NTwitch.Core/Entities/Ingests/IIngest.cs | namespace NTwitch
{
public interface IIngest : IEntity
{
double Availability { get; }
bool IsDefault { get; }
string Name { get; }
string UrlTemplate { get; }
}
}
| mit | C# | |
e8a2d29b565ffc6525a1432d1a01d629f1ca3c2f | Add Default SponsorsViewModel | jamesmontemagno/code-camp-app | CodeCamp/ViewModels/SponsorsViewModel.cs | CodeCamp/ViewModels/SponsorsViewModel.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeCamp.ViewModels
{
class SponsorsViewModel
{
}
}
| mit | C# | |
a8dc93c4bdb5b1534826cba7cf5c3531730c96c6 | Add more element types | Arthur2e5/dnlib,yck1509/dnlib,0xd4d/dnlib,modulexcite/dnlib,ilkerhalil/dnlib,jorik041/dnlib,ZixiangBoy/dnlib,kiootic/dnlib,picrap/dnlib | dot10/dotNET/ElementType.cs | dot10/dotNET/ElementType.cs | namespace dot10.dotNET {
/// <summary>
/// See CorHdr.h/CorElementType
/// </summary>
public enum ElementType : byte {
/// <summary></summary>
End = 0x00,
/// <summary>System.Void</summary>
Void = 0x01,
/// <summary>System.Boolean</summary>
Boolean = 0x02,
/// <summary>System.Char</summary>
Char = 0x03,
/// <summary>System.SByte</summary>
I1 = 0x04,
/// <summary>System.Byte</summary>
U1 = 0x05,
/// <summary>System.Int16</summary>
I2 = 0x06,
/// <summary>System.UInt16</summary>
U2 = 0x07,
/// <summary>System.Int32</summary>
I4 = 0x08,
/// <summary>System.UInt32</summary>
U4 = 0x09,
/// <summary>System.Int64</summary>
I8 = 0x0A,
/// <summary>System.UInt64</summary>
U8 = 0x0B,
/// <summary>System.Single</summary>
R4 = 0x0C,
/// <summary>System.Double</summary>
R8 = 0x0D,
/// <summary>System.String</summary>
String = 0x0E,
/// <summary></summary>
Ptr = 0x0F,
/// <summary></summary>
ByRef = 0x10,
/// <summary></summary>
ValueType = 0x11,
/// <summary></summary>
Class = 0x12,
/// <summary>Type generic parameter</summary>
Var = 0x13,
/// <summary></summary>
Array = 0x14,
/// <summary></summary>
GenericInst = 0x15,
/// <summary></summary>
TypedByRef = 0x16,
/// <summary></summary>
ValueArray = 0x17,
/// <summary>System.IntPtr</summary>
I = 0x18,
/// <summary>System.UIntPtr</summary>
U = 0x19,
/// <summary>native real</summary>
R = 0x1A,
/// <summary></summary>
FnPtr = 0x1B,
/// <summary>System.Object</summary>
Object = 0x1C,
/// <summary></summary>
SZArray = 0x1D,
/// <summary>Method generic parameter</summary>
MVar = 0x1E,
/// <summary></summary>
CModReqd = 0x1F,
/// <summary></summary>
CModOpt = 0x20,
/// <summary></summary>
Internal = 0x21,
/// <summary></summary>
Module = 0x3F,
/// <summary></summary>
Sentinel = 0x41,
/// <summary></summary>
Pinned = 0x45,
}
}
| namespace dot10.dotNET {
/// <summary>
/// See CorHdr.h/CorElementType
/// </summary>
public enum ElementType : byte {
/// <summary></summary>
End = 0x00,
/// <summary>System.Void</summary>
Void = 0x01,
/// <summary>System.Boolean</summary>
Boolean = 0x02,
/// <summary>System.Char</summary>
Char = 0x03,
/// <summary>System.SByte</summary>
I1 = 0x04,
/// <summary>System.Byte</summary>
U1 = 0x05,
/// <summary>System.Int16</summary>
I2 = 0x06,
/// <summary>System.UInt16</summary>
U2 = 0x07,
/// <summary>System.Int32</summary>
I4 = 0x08,
/// <summary>System.UInt32</summary>
U4 = 0x09,
/// <summary>System.Int64</summary>
I8 = 0x0A,
/// <summary>System.UInt64</summary>
U8 = 0x0B,
/// <summary>System.Single</summary>
R4 = 0x0C,
/// <summary>System.Double</summary>
R8 = 0x0D,
/// <summary>System.String</summary>
String = 0x0E,
/// <summary></summary>
Ptr = 0x0F,
/// <summary></summary>
ByRef = 0x10,
/// <summary></summary>
ValueType = 0x11,
/// <summary></summary>
Class = 0x12,
/// <summary>Type generic parameter</summary>
Var = 0x13,
/// <summary></summary>
Array = 0x14,
/// <summary></summary>
GenericInst = 0x15,
/// <summary></summary>
TypedByRef = 0x16,
/// <summary>System.IntPtr</summary>
I = 0x18,
/// <summary>System.UIntPtr</summary>
U = 0x19,
/// <summary></summary>
FnPtr = 0x1B,
/// <summary>System.Object</summary>
Object = 0x1C,
/// <summary></summary>
SZArray = 0x1D,
/// <summary>Method generic parameter</summary>
MVar = 0x1E,
/// <summary></summary>
CModReqd = 0x1F,
/// <summary></summary>
CModOpt = 0x20,
/// <summary></summary>
Internal = 0x21,
/// <summary></summary>
Modifier = 0x40,
/// <summary></summary>
Sentinel = 0x41,
/// <summary></summary>
Pinned = 0x45,
}
}
| mit | C# |
d3bc50bb30080cc4e8963eb060738b571d5f5d2d | Rename class. | ExRam/ExRam.Gremlinq | src/ExRam.Gremlinq.Providers.WebSocket.AspNet/WebSocketConfiguratorExtensions.cs | src/ExRam.Gremlinq.Providers.WebSocket.AspNet/WebSocketConfiguratorExtensions.cs | using System;
using ExRam.Gremlinq.Providers.WebSocket;
using Gremlin.Net.Driver;
using Microsoft.Extensions.Configuration;
namespace ExRam.Gremlinq.Core.AspNet
{
public static class WebSocketConfiguratorExtensions
{
public static IWebSocketConfigurator Configure(
this IWebSocketConfigurator builder,
IConfiguration configuration)
{
var authenticationSection = configuration.GetSection("Authentication");
var connectionPoolSection = configuration.GetSection("ConnectionPool");
builder = builder
.At(configuration.GetRequiredConfiguration("Uri"))
.ConfigureConnectionPool(connectionPoolSettings =>
{
if (int.TryParse(connectionPoolSection[$"{nameof(ConnectionPoolSettings.MaxInProcessPerConnection)}"], out var maxInProcessPerConnection))
connectionPoolSettings.MaxInProcessPerConnection = maxInProcessPerConnection;
if (int.TryParse(connectionPoolSection[$"{nameof(ConnectionPoolSettings.PoolSize)}"], out var poolSize))
connectionPoolSettings.PoolSize = poolSize;
});
if (configuration["Alias"] is { } alias)
builder = builder.SetAlias(alias);
if (authenticationSection["Username"] is { } username && authenticationSection["Password"] is { } password)
builder = builder.AuthenticateBy(username, password);
if (Enum.TryParse<SerializationFormat>(configuration[$"{nameof(SerializationFormat)}"], out var graphsonVersion))
builder = builder.SetSerializationFormat(graphsonVersion);
return builder;
}
}
}
| mit | C# | |
c313eb143ffa9aa22db7713e946c6fd4d5d50bd5 | test proving that [SetterProperty] works in CoreCLR from base classes. Closes GH-490 | DixonD-git/structuremap,DixonDs/structuremap,DixonDs/structuremap,khellang/structuremap,khellang/structuremap,DixonD-git/structuremap,DixonD-git/structuremap,DixonD-git/structuremap | src/StructureMap.Testing/Bugs/Bug_490_SetterProperty_in_CoreCLR_from_inherited_base.cs | src/StructureMap.Testing/Bugs/Bug_490_SetterProperty_in_CoreCLR_from_inherited_base.cs | using StructureMap.Attributes;
using Xunit;
namespace StructureMap.Testing.Bugs
{
public class Bug_490_SetterProperty_in_CoreCLR_from_inherited_base
{
private Container container;
public Bug_490_SetterProperty_in_CoreCLR_from_inherited_base()
{
container = new Container(_ =>
{
_.For<IMyService>().Use<MyService>();
_.For<MyClass>().Use<MyClass>();
});
}
public interface IMyService { }
public class MyService : IMyService { }
public class BaseClass
{
[SetterProperty]
public IMyService MyServiceInBaseClass { get; set; }
}
public class MyClass : BaseClass
{
[SetterProperty]
public IMyService MyServiceInMyClass { get; set; }
}
[Fact]
public void property_should_be_injected_in_base_class()
{
var myClass = container.GetInstance<MyClass>();
myClass.MyServiceInBaseClass.ShouldNotBeNull();
myClass.MyServiceInMyClass.ShouldNotBeNull();
}
}
} | apache-2.0 | C# | |
00b3fad6d38e6761db697ad58a02ee780796ad7c | Add tests | EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,ZLima12/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,Tom94/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework | osu.Framework.Tests/IO/TestDesktopStorage.cs | osu.Framework.Tests/IO/TestDesktopStorage.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.IO;
using NUnit.Framework;
using osu.Framework.Platform;
namespace osu.Framework.Tests.IO
{
[TestFixture]
public class TestDesktopStorage
{
[Test]
public void TestRelativePaths()
{
var guid = new Guid().ToString();
var storage = new DesktopStorage(guid, null);
var basePath = storage.GetFullPath(string.Empty);
Assert.IsTrue(basePath.EndsWith(guid));
Assert.Throws<ArgumentException>(() => storage.GetFullPath("../"));
Assert.Throws<ArgumentException>(() => storage.GetFullPath(".."));
Assert.Throws<ArgumentException>(() => storage.GetFullPath("./../"));
Assert.AreEqual(Path.GetFullPath(Path.Combine(basePath, "sub", "test")) + Path.DirectorySeparatorChar, storage.GetFullPath("sub/test/"));
Assert.AreEqual(Path.GetFullPath(Path.Combine(basePath, "sub", "test")), storage.GetFullPath("sub/test"));
storage.DeleteDirectory(string.Empty);
}
}
}
| mit | C# | |
268b70bac728eb46a331f3ef9aadc79aa31330fa | Add missing file | alanmcgovern/gitymcgitface | libgitface/GitClientExtensions.cs | libgitface/GitClientExtensions.cs | using System;
using System.Threading.Tasks;
using System.Diagnostics;
namespace libgitface
{
public static class GitClientExtensions
{
public static async Task CreateAndOpenPullRequest (this GitClient client, string branchName, string titleText, string bodyText, bool openPrInBrowser = true)
{
var prUrl = await client.CreatePullRequest (branchName, titleText, bodyText);
if (openPrInBrowser)
new OpenUrlAction { Url = prUrl }.Execute ();
}
}
}
| mit | C# | |
d923841de465ca83fd7ba96ef3ad3c278bb1852f | add attribute for marking components | structurizr/dotnet | Structurizr.Annotations/ComponentAttribute.cs | Structurizr.Annotations/ComponentAttribute.cs | using System;
namespace Structurizr.Annotations
{
/// <summary>
/// Specifies that the attributed type class or interface can be considered to be a "component".
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
public sealed class ComponentAttribute : Attribute
{
/// <summary>
/// Gets or sets a description of the component.
/// </summary>
/// <value>A description of the component.</value>
public string Description { get; set; } = String.Empty;
/// <summary>
/// Gets or sets a description of the technology used to implement the component.
/// </summary>
/// <value>A description of the technology used to implement the component.</value>
public string Technology { get; set; } = String.Empty;
/// <summary>
/// Initializes a new instance of the <see cref="ComponentAttribute"/> class.
/// </summary>
public ComponentAttribute() {}
}
}
| apache-2.0 | C# | |
dbfc5b20a9e8336a038c48bd2a31cb79d675becd | add missing file | india-rose/webservice-collection,india-rose/webservice-collection | WebAPI.Common/Responses/VersionResponse.cs | WebAPI.Common/Responses/VersionResponse.cs | using System;
namespace WebAPI.Common.Responses
{
public class VersionResponse
{
public long Version { get; set; }
public DateTime Date { get; set; }
public VersionResponse()
{
}
public VersionResponse(long version, DateTime date)
{
Version = version;
Date = date;
}
}
}
| mit | C# | |
e5143f210780d9296490a5a8936ea65af29a1232 | Create exemplo_lista_encadeada.cs | matheuslessarodrigues/TPJ1-3003-2017 | lista-encadeada/exemplo_lista_encadeada.cs | lista-encadeada/exemplo_lista_encadeada.cs | using System;
public class Player
{
public string name;
public Player next = null;
public Player( string name )
{
this.name = name;
}
}
namespace ListaEncadeada
{
internal class Program
{
private static void Main( string[] args )
{
Player player1 = new Player("John");
Player player2 = new Player("Paul");
Player player3 = new Player( "George" );
Player player4 = new Player( "Ringo" );
player1.next = player2;
player2.next = player3;
player3.next = player4;
// Iterando na lista
Player currentElement = player1;
while( currentElement != null )
{
Console.WriteLine( "Passei por um Player de nome {0}", currentElement.name );
currentElement = currentElement.next;
}
Console.WriteLine( "Acabou a lista" );
}
}
}
| mit | C# | |
43b7ea34d08b9ddc8f3cd664c37c3bd56bbe50a0 | Add UuidVersion enum | AlexArchive/Validator | Validator/UuidVersion.cs | Validator/UuidVersion.cs | namespace Validator
{
public enum UuidVersion
{
Any = 0,
Three = 3,
Four = 4,
Five = 5
}
}
| mit | C# | |
c9423f7c6c282928f26199e067453c774b6fd7a9 | apply overwrite fragments (#2419) | dotnet/docfx,dotnet/docfx,dotnet/docfx,superyyrrzz/docfx,superyyrrzz/docfx,superyyrrzz/docfx | src/Microsoft.DocAsCode.Build.SchemaDriven/ApplyOverwriteFragments.cs | src/Microsoft.DocAsCode.Build.SchemaDriven/ApplyOverwriteFragments.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.DocAsCode.Build.SchemaDriven
{
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using Microsoft.DocAsCode.Build.Common;
using Microsoft.DocAsCode.Common;
using Microsoft.DocAsCode.Plugins;
[Export(nameof(SchemaDrivenDocumentProcessor), typeof(IDocumentBuildStep))]
public class ApplyOverwriteFragments : BaseDocumentBuildStep, ISupportIncrementalBuildStep
{
public override string Name => nameof(ApplyOverwriteFragments);
public override int BuildOrder => 0x08;
public virtual void Build(FileModel model, IHostService host)
{
var overwriteApplier = new OverwriteApplier(host, OverwriteModelType.MarkdownFragments);
var overwriteDocumentModels = model.MarkdownFragmentsModel?.Content as List<OverwriteDocumentModel>;
if (overwriteDocumentModels == null)
{
return;
}
var schema = model.Properties.Schema as DocumentSchema;
using (new LoggerFileScope(model.LocalPathFromRoot))
{
foreach (var overwriteDocumentModel in overwriteDocumentModels)
{
var uidDefiniton = model.Uids.Where(s => s.Name == overwriteDocumentModel.Uid).ToList();
if (uidDefiniton.Count == 0)
{
Logger.LogWarning($"Unable to find UidDefinition for Uid {overwriteDocumentModel.Uid}");
}
if (uidDefiniton.Count > 1)
{
Logger.LogWarning($"There are more than one UidDefinitions found for Uid {overwriteDocumentModel.Uid} in lines {string.Join(", ", uidDefiniton.Select(uid => uid.Line).ToList())}");
}
var ud = uidDefiniton[0];
var jsonPointer = new JsonPointer(ud.Path).GetParentPointer();
var schemaForCurrentUid = jsonPointer.FindSchema(schema);
var source = jsonPointer.GetValue(model.Content);
overwriteApplier.MergeContentWithOverwrite(ref source, overwriteDocumentModel.Metadata, ud.Name, string.Empty, schemaForCurrentUid);
}
// 1. Validate schema after the merge
((SchemaDrivenDocumentProcessor)host.Processor).SchemaValidator.Validate(model.Content);
// 2. Re-export xrefspec after the merge
overwriteApplier.UpdateXrefSpec(model, schema);
}
}
#region ISupportIncrementalBuildStep Members
public bool CanIncrementalBuild(FileAndType fileAndType) => true;
public string GetIncrementalContextHash() => null;
public IEnumerable<DependencyType> GetDependencyTypesToRegister() => null;
#endregion
}
}
| mit | C# | |
2d4787f07aca3d0c7c2dd32571701d5edb403029 | Reduce the size of the keys in the generics migrator. This finally fixes the long standing issue of it failing to create the table on linux sometimes. Thanks go to Hippo_Finesmith for helping find the issue with this :). | TechplexEngineer/Aurora-Sim,TechplexEngineer/Aurora-Sim,TechplexEngineer/Aurora-Sim,TechplexEngineer/Aurora-Sim | Aurora/DataManager/Migration/Migrators/Generics/GenericsMigrator_4.cs | Aurora/DataManager/Migration/Migrators/Generics/GenericsMigrator_4.cs | /*
* Copyright (c) Contributors, http://aurora-sim.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Aurora-Sim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using C5;
using Aurora.Framework;
namespace Aurora.DataManager.Migration.Migrators
{
public class GenericsMigrator_4 : Migrator
{
public GenericsMigrator_4()
{
Version = new Version(0, 0, 4);
MigrationName = "Generics";
schema = new List<Rec<string, ColumnDefinition[]>>();
AddSchema("generics", ColDefs(
ColDef ("OwnerID", ColumnTypes.String36, true),
ColDef ("Type", ColumnTypes.String64, true),
ColDef("Key", ColumnTypes.String64, true),
ColDef ("Value", ColumnTypes.LongText)
));
}
protected override void DoCreateDefaults(IDataConnector genericData)
{
EnsureAllTablesInSchemaExist(genericData);
}
protected override bool DoValidate(IDataConnector genericData)
{
return TestThatAllTablesValidate(genericData);
}
protected override void DoMigrate(IDataConnector genericData)
{
DoCreateDefaults(genericData);
}
protected override void DoPrepareRestorePoint(IDataConnector genericData)
{
CopyAllTablesToTempVersions(genericData);
}
}
}
| bsd-3-clause | C# | |
308ec6a491a051e029e9fd3d2ee30fa03cd080bf | add extension method for mania skin config retrieval | NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu-new,peppy/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu | osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigExtensions.cs | osu.Game.Rulesets.Mania/Skinning/ManiaSkinConfigExtensions.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.Bindables;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Mania.Skinning
{
public static class ManiaSkinConfigExtensions
{
/// <summary>
/// Retrieve a per-column-count skin configuration.
/// </summary>
/// <param name="skin">The skin from which configuration is retrieved.</param>
/// <param name="lookup">The value to retrieve.</param>
/// <param name="index">If not null, denotes the index of the column to which the entry applies.</param>
public static IBindable<T> GetManiaSkinConfig<T>(this ISkin skin, LegacyManiaSkinConfigurationLookups lookup, int? index = null)
=> skin.GetConfig<ManiaSkinConfigurationLookup, T>(
new ManiaSkinConfigurationLookup(lookup, index));
}
}
| mit | C# | |
7704c8504a2e21a3d4a3e5afcfec08209801673f | Create Simple-Search.cs | DeanCabral/Code-Snippets | Console/Simple-Search.cs | Console/Simple-Search.cs | class Simple-Search
{
private static int numberOfElements = 0;
static void Main(string[] args)
{
GetUserInput();
}
static void GetUserInput()
{
Console.Write("Input Element Count: ");
numberOfElements = Convert.ToInt32(Console.ReadLine());
GenerateElements();
}
static void GenerateElements()
{
int[] elements = new int[numberOfElements];
Random rand = new Random();
for (int i = 0; i < numberOfElements; i++)
{
elements[i] = rand.Next(1, 51);
}
PrintElements(elements);
}
static void PrintElements(int[] elements)
{
int index = 0;
foreach (int element in elements)
{
Console.WriteLine("Element {0} = {1}", index, elements[index]);
index++;
}
ElementToSearch(elements);
}
static void ElementToSearch(int[] elements)
{
bool foundFlag = false;
int targetElement = -1;
Console.WriteLine();
Console.Write("Find Element: ");
targetElement = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < elements.Length; i++)
{
if (targetElement == elements[i])
{
Console.WriteLine("Found element at index {0}", i);
foundFlag = true;
}
}
if (!foundFlag) Console.WriteLine("Element {0} not found in array.", targetElement);
Console.ReadLine();
}
| mit | C# | |
98906fa961c97baa069136fe7498b05745b85ce0 | Add StatisticsController. | ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton,ZooPin/CK-Glouton | src/CK.Glouton.Web/Controllers/StatisticsController.cs | src/CK.Glouton.Web/Controllers/StatisticsController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CK.Glouton.Lucene;
using Microsoft.AspNetCore.Mvc;
namespace CK.Glouton.Web.Controllers
{
[Route("api/stats")]
public class StatisticsController : Controller
{
LuceneStatistics luceneStatistics;
public StatisticsController()
{
}
}
} | mit | C# | |
8dea191998e901c60b1867bd893bcad44c76e958 | Add a testcase | smoogipoo/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,johnneijzen/osu,EVAST9919/osu,2yangk23/osu,ZLima12/osu,smoogipoo/osu,ppy/osu,peppy/osu,UselessToucan/osu,2yangk23/osu,EVAST9919/osu,peppy/osu,smoogipooo/osu,peppy/osu,ppy/osu,ZLima12/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu-new,smoogipoo/osu | osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs | osu.Game.Tests/Visual/Online/TestSceneGamemodeControl.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Graphics;
using osu.Game.Overlays.Profile.Header.Components;
using osuTK.Graphics;
using System;
using System.Collections.Generic;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneGamemodeControl : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(GamemodeControl),
typeof(GamemodeTabItem),
};
private readonly GamemodeControl control;
public TestSceneGamemodeControl()
{
Child = control = new GamemodeControl
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
AddStep("set osu! as default", () => control.SetDefaultGamemode("osu"));
AddStep("set mania as default", () => control.SetDefaultGamemode("mania"));
AddStep("set taiko as default", () => control.SetDefaultGamemode("taiko"));
AddStep("set catch as default", () => control.SetDefaultGamemode("fruits"));
AddStep("select default gamemode", () => control.SelectDefaultGamemode());
AddStep("set random colour", () => control.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1));
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
control.AccentColour = colours.Seafoam;
}
}
}
| mit | C# | |
987924caab2d48cf07369439e3a61661c89ee2e8 | Add datatypes for OPNsense Objects | fvanroie/PS_OPNsense | Classes/FtpProxy.cs | Classes/FtpProxy.cs | using System;
using System.Management.Automation;
namespace OPNsense.Ftpproxy {
public class Proxy {
#region Parameters
public uint debuglevel { get; set; }
public string description { get; set; }
public bool enabled { get; set; }
public uint idletimeout { get; set; }
public string listenaddress { get; set; }
public uint listenport { get; set; }
public bool logconnections { get; set; }
public uint maxsessions { get; set; }
public string reverseaddress { get; set; }
public uint reverseport { get; set; }
public bool rewritesourceport { get; set; }
public string sourceaddress { get; set; }
#endregion Parameters
public Proxy () {
debuglevel = 5;
description = null;
enabled = true;
idletimeout = 86400;
listenaddress = "127.0.0.1";
listenport = 8021;
logconnections = true;
maxsessions = 100;
reverseaddress = null;
reverseport = 21;
rewritesourceport = true;
sourceaddress = null;
}
public Proxy (
uint Debuglevel,
string Description,
byte Enabled,
uint Idletimeout,
string Listenaddress,
uint Listenport,
byte Logconnections,
uint Maxsessions,
string Reverseaddress,
uint Reverseport,
byte Rewritesourceport,
string Sourceaddress
) {
debuglevel = Debuglevel;
description = Description;
enabled = (Enabled == 0) ? false : true;
idletimeout = Idletimeout;
listenaddress = Listenaddress;
listenport = Listenport;
logconnections = (Logconnections == 0) ? false : true;
maxsessions = Maxsessions;
reverseaddress = Reverseaddress;
reverseport = Reverseport;
rewritesourceport = (Rewritesourceport == 0) ? false : true;
sourceaddress = Sourceaddress;
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.