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 |
|---|---|---|---|---|---|---|---|---|
dc70d74bd7c57c5640b34913b1edbc9b92add8d3
|
Change default sizing
|
jefking/King.Azure.Imaging,jefking/King.Azure.Imaging,jefking/King.Azure.Imaging
|
King.Azure.Imaging/Versions.cs
|
King.Azure.Imaging/Versions.cs
|
namespace King.Azure.Imaging
{
using System.Collections.Generic;
/// <summary>
/// Versions
/// </summary>
public class Versions : IVersions
{
#region Members
/// <summary>
/// Versions
/// </summary>
protected readonly IDictionary<string, IImageVersion> versions = new Dictionary<string, IImageVersion>(3);
#endregion
#region Constructors
/// <summary>
/// Default Constructor
/// </summary>
public Versions()
{
var thumb = new ImageVersion()
{
Width = 100,
};
versions.Add("Thumb", thumb);
var medium = new ImageVersion()
{
Width = 640,
};
versions.Add("Medium", medium);
var large = new ImageVersion()
{
Width = 1280,
};
versions.Add("Large", large);
}
#endregion
#region Properties
/// <summary>
/// Image Versions
/// </summary>
public virtual IDictionary<string, IImageVersion> Images
{
get
{
return this.versions;
}
}
#endregion
}
}
|
namespace King.Azure.Imaging
{
using System.Collections.Generic;
/// <summary>
/// Versions
/// </summary>
public class Versions : IVersions
{
#region Members
/// <summary>
/// Versions
/// </summary>
protected readonly IDictionary<string, IImageVersion> versions = new Dictionary<string, IImageVersion>(3);
#endregion
#region Constructors
/// <summary>
/// Default Constructor
/// </summary>
public Versions()
{
var thumb = new ImageVersion()
{
Width = 100,
};
versions.Add("Thumb", thumb);
var medium = new ImageVersion()
{
Width = 400,
};
versions.Add("Medium", medium);
var large = new ImageVersion()
{
Width = 1900,
};
versions.Add("Large", large);
}
#endregion
#region Properties
/// <summary>
/// Image Versions
/// </summary>
public virtual IDictionary<string, IImageVersion> Images
{
get
{
return this.versions;
}
}
#endregion
}
}
|
mit
|
C#
|
843799e261b9c4bda5f1249ef10557f4c24b0eaa
|
fix to missing stream extension
|
hungweng/MarkerMetro.Unity.WinLegacy,MarkerMetro/MarkerMetro.Unity.WinLegacy
|
MarkerMetro.Unity.WinLegacyUnity/System/MissingExtensions.cs
|
MarkerMetro.Unity.WinLegacyUnity/System/MissingExtensions.cs
|
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Reflection;
using System;
using System.Runtime.InteropServices;
namespace MarkerMetro.Unity.WinLegacy
{
/**
* Helpers for missing functions of classes, turned into extensions instead...
*/
public static class MissingExtensions
{
/**
* Helping Metro convert from System.Format(string,Object) to Windows App Store's System.Format(string,Object[]).
*/
public static string Format(string format, global::System.Object oneParam)
{
return global::System.String.Format(format, new global::System.Object[] { oneParam });
}
/**
* StringBuilder.AppendFormat(arg0,arg1,arg2) isn't implemented on WP8, so use this instead.
*/
public static StringBuilder AppendFormatEx(this StringBuilder sb, string format, global::System.Object arg0, global::System.Object arg1 = null, global::System.Object arg2 = null)
{
return sb.AppendFormat(format, new object[] { arg0, arg1, arg2 });
}
/**
* List<T>.ForEach(Action<T>) isn't implemented on WSA, so use this instead.
*/
public static void ForEach<T>(this List<T> list, Action<T> action)
{
if (action == null)
throw new ArgumentNullException();
foreach (T obj in list)
action(obj);
}
public static string ToShortDateString(this DateTime dateTime)
{
return dateTime.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern);
}
public static string ToLongDateString(this DateTime dateTime)
{
return dateTime.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.LongDatePattern);
}
#if (NETFX_CORE || WINDOWS_PHONE)
public static void Close(this System.IO.Stream stream)
{
stream.Dispose();
}
#endif
}
}
|
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Reflection;
using System;
using System.Runtime.InteropServices;
namespace MarkerMetro.Unity.WinLegacy
{
/**
* Helpers for missing functions of classes, turned into extensions instead...
*/
public static class MissingExtensions
{
/**
* Helping Metro convert from System.Format(string,Object) to Windows App Store's System.Format(string,Object[]).
*/
public static string Format(string format, global::System.Object oneParam)
{
return global::System.String.Format(format, new global::System.Object[] { oneParam });
}
/**
* StringBuilder.AppendFormat(arg0,arg1,arg2) isn't implemented on WP8, so use this instead.
*/
public static StringBuilder AppendFormatEx(this StringBuilder sb, string format, global::System.Object arg0, global::System.Object arg1 = null, global::System.Object arg2 = null)
{
return sb.AppendFormat(format, new object[] { arg0, arg1, arg2 });
}
/**
* List<T>.ForEach(Action<T>) isn't implemented on WSA, so use this instead.
*/
public static void ForEach<T>(this List<T> list, Action<T> action)
{
if (action == null)
throw new ArgumentNullException();
foreach (T obj in list)
action(obj);
}
public static string ToShortDateString(this DateTime dateTime)
{
return dateTime.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern);
}
public static string ToLongDateString(this DateTime dateTime)
{
return dateTime.ToString(System.Globalization.DateTimeFormatInfo.CurrentInfo.LongDatePattern);
}
#if (NETFX_CORE && WINDOWS_PHONE)
public static void Close(this System.IO.Stream stream)
{
stream.Dispose();
}
#endif
}
}
|
mit
|
C#
|
648c2c2847268e9b7828af7ca4cd029c6c210556
|
Update Cert2 data model
|
AshleyPoole/ssllabs-api-wrapper
|
SSLLabsApiWrapper/Models/Response/EndpointSubModels/Cert2.cs
|
SSLLabsApiWrapper/Models/Response/EndpointSubModels/Cert2.cs
|
namespace SSLLabsApiWrapper.Models.Response.EndpointSubModels
{
public class Cert2
{
public string subject { get; set; }
public string label { get; set; }
public object notBefore { get; set; }
public object notAfter { get; set; }
public string issuerSubject { get; set; }
public string issuerLabel { get; set; }
public string sigAlg { get; set; }
public string keyAlg { get; set; }
public int keySize { get; set; }
public int keyStrength { get; set; }
public string raw { get; set; }
}
}
|
namespace SSLLabsApiWrapper.Models.Response.EndpointSubModels
{
public class Cert2
{
public string subject { get; set; }
public string label { get; set; }
public string issuerSubject { get; set; }
public string issuerLabel { get; set; }
public string raw { get; set; }
}
}
|
mit
|
C#
|
c4551273bb6ebbac3d29312f43a5bc233f9577ff
|
Validate args
|
magoswiat/octokit.net,eriawan/octokit.net,SmithAndr/octokit.net,dampir/octokit.net,SLdragon1989/octokit.net,Sarmad93/octokit.net,shiftkey/octokit.net,kdolan/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,SamTheDev/octokit.net,ivandrofly/octokit.net,hitesh97/octokit.net,shana/octokit.net,adamralph/octokit.net,michaKFromParis/octokit.net,darrelmiller/octokit.net,alfhenrik/octokit.net,alfhenrik/octokit.net,khellang/octokit.net,TattsGroup/octokit.net,gabrielweyer/octokit.net,mminns/octokit.net,thedillonb/octokit.net,nsnnnnrn/octokit.net,octokit-net-test-org/octokit.net,hahmed/octokit.net,eriawan/octokit.net,gdziadkiewicz/octokit.net,octokit-net-test-org/octokit.net,octokit/octokit.net,forki/octokit.net,gabrielweyer/octokit.net,editor-tools/octokit.net,hahmed/octokit.net,Sarmad93/octokit.net,bslliw/octokit.net,mminns/octokit.net,chunkychode/octokit.net,dampir/octokit.net,M-Zuber/octokit.net,rlugojr/octokit.net,thedillonb/octokit.net,takumikub/octokit.net,octokit-net-test/octokit.net,editor-tools/octokit.net,M-Zuber/octokit.net,ChrisMissal/octokit.net,shiftkey-tester/octokit.net,shiftkey-tester/octokit.net,fake-organization/octokit.net,daukantas/octokit.net,devkhan/octokit.net,Red-Folder/octokit.net,chunkychode/octokit.net,nsrnnnnn/octokit.net,SamTheDev/octokit.net,octokit/octokit.net,kolbasov/octokit.net,fffej/octokit.net,naveensrinivasan/octokit.net,gdziadkiewicz/octokit.net,khellang/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,ivandrofly/octokit.net,TattsGroup/octokit.net,geek0r/octokit.net,devkhan/octokit.net,shana/octokit.net,rlugojr/octokit.net,cH40z-Lord/octokit.net,shiftkey/octokit.net,dlsteuer/octokit.net,brramos/octokit.net,SmithAndr/octokit.net
|
Octokit/Models/Response/GitIgnoreTemplate.cs
|
Octokit/Models/Response/GitIgnoreTemplate.cs
|
namespace Octokit
{
public class GitIgnoreTemplate
{
public GitIgnoreTemplate(string name, string source)
{
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(source, "source");
Name = name;
Source = source;
}
public GitIgnoreTemplate()
{
}
public string Name { get; protected set; }
public string Source { get; protected set; }
}
}
|
namespace Octokit
{
public class GitIgnoreTemplate
{
public GitIgnoreTemplate(string name, string source)
{
Name = name;
Source = source;
}
public GitIgnoreTemplate()
{
}
public string Name { get; protected set; }
public string Source { get; protected set; }
}
}
|
mit
|
C#
|
8368892b45f105cc4dbeb37b1c5813d109ed9d19
|
Fix #2 - Rename "lazy loading" to "lazy initialization"
|
tparviainen/oscilloscope
|
SCPI.Tests/Commands_Tests.cs
|
SCPI.Tests/Commands_Tests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
namespace SCPI.Tests
{
public class Commands_Tests
{
[Fact]
public void HasSupportedCommands()
{
// Arrange
var commands = new Commands();
// Act
var names = commands.Names();
// Assert
Assert.NotEmpty(names);
}
[Fact]
public void LazyInitializationWorks()
{
// Arrange
var commands = new Commands();
var names = commands.Names();
// Act
var cmd1 = commands.Get(names.ElementAt(0));
var cmd2 = commands.Get(names.ElementAt(0));
// Assert
Assert.Equal(cmd1, cmd2);
}
[Fact]
public void QueryNotSupportedCommand()
{
// Arrange
var commands = new Commands();
// Act
Assert.Throws<InvalidOperationException>(() => commands.Get("NOT_SUPPORTED"));
// Assert
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
namespace SCPI.Tests
{
public class Commands_Tests
{
[Fact]
public void HasSupportedCommands()
{
// Arrange
var commands = new Commands();
// Act
var names = commands.Names();
// Assert
Assert.NotEmpty(names);
}
[Fact]
public void LazyLoadingWorks()
{
// Arrange
var commands = new Commands();
var names = commands.Names();
// Act
var cmd1 = commands.Get(names.ElementAt(0));
var cmd2 = commands.Get(names.ElementAt(0));
// Assert
Assert.Equal(cmd1, cmd2);
}
[Fact]
public void QueryNotSupportedCommand()
{
// Arrange
var commands = new Commands();
// Act
Assert.Throws<InvalidOperationException>(() => commands.Get("NOT_SUPPORTED"));
// Assert
}
}
}
|
mit
|
C#
|
9f7fa01a86da8bc6a70fc117f7094f5abd4dfbfa
|
Fix .NET Native reflection invoke stepping by adding a debugger attribute on MethodInvoker.Invoke
|
gregkalapos/corert,gregkalapos/corert,krytarowski/corert,shrah/corert,gregkalapos/corert,shrah/corert,yizhang82/corert,shrah/corert,yizhang82/corert,krytarowski/corert,tijoytom/corert,yizhang82/corert,botaberg/corert,tijoytom/corert,shrah/corert,krytarowski/corert,botaberg/corert,botaberg/corert,gregkalapos/corert,yizhang82/corert,tijoytom/corert,krytarowski/corert,tijoytom/corert,botaberg/corert
|
src/System.Private.Reflection.Core/src/Internal/Reflection/Core/Execution/MethodInvoker.cs
|
src/System.Private.Reflection.Core/src/Internal/Reflection/Core/Execution/MethodInvoker.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Reflection;
using System.Diagnostics;
using System.Globalization;
using System.Reflection.Runtime.General;
namespace Internal.Reflection.Core.Execution
{
//
// This class polymorphically implements the MethodBase.Invoke() api and its close cousins. MethodInvokers are designed to be built once and cached
// for maximum Invoke() throughput.
//
public abstract class MethodInvoker
{
protected MethodInvoker() { }
[DebuggerGuidedStepThrough]
public Object Invoke(Object thisObject, Object[] arguments, Binder binder, BindingFlags invokeAttr, CultureInfo cultureInfo)
{
BinderBundle binderBundle = binder.ToBinderBundle(invokeAttr, cultureInfo);
Object result = Invoke(thisObject, arguments, binderBundle);
System.Runtime.InteropServices.DebugAnnotations.PreviousCallContainsUserCode();
return result;
}
public abstract Object Invoke(Object thisObject, Object[] arguments, BinderBundle binderBundle);
public abstract Delegate CreateDelegate(RuntimeTypeHandle delegateType, Object target, bool isStatic, bool isVirtual, bool isOpen);
// This property is used to retrieve the target method pointer. It is used by the RuntimeMethodHandle.GetFunctionPointer API
public abstract IntPtr LdFtnResult { get; }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Reflection;
using System.Diagnostics;
using System.Globalization;
using System.Reflection.Runtime.General;
namespace Internal.Reflection.Core.Execution
{
//
// This class polymorphically implements the MethodBase.Invoke() api and its close cousins. MethodInvokers are designed to be built once and cached
// for maximum Invoke() throughput.
//
public abstract class MethodInvoker
{
protected MethodInvoker() { }
public Object Invoke(Object thisObject, Object[] arguments, Binder binder, BindingFlags invokeAttr, CultureInfo cultureInfo)
{
BinderBundle binderBundle = binder.ToBinderBundle(invokeAttr, cultureInfo);
return Invoke(thisObject, arguments, binderBundle);
}
public abstract Object Invoke(Object thisObject, Object[] arguments, BinderBundle binderBundle);
public abstract Delegate CreateDelegate(RuntimeTypeHandle delegateType, Object target, bool isStatic, bool isVirtual, bool isOpen);
// This property is used to retrieve the target method pointer. It is used by the RuntimeMethodHandle.GetFunctionPointer API
public abstract IntPtr LdFtnResult { get; }
}
}
|
mit
|
C#
|
d0e29ca4cecb0a0cced46a68484121070c21592b
|
add license
|
NDark/ndinfrastructure,NDark/ndinfrastructure
|
DotNet/MathTools/MathTools.cs
|
DotNet/MathTools/MathTools.cs
|
/**
MIT License
Copyright (c) 2017 - 2018 NDark
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
public partial class MathTools
{
/**
* http://floating-point-gui.de/errors/comparison/
*/
public static bool RelativeEqual(float a, float b, float _RatioUnderSum )
{
float absA = System.Math.Abs(a);
float absB = System.Math.Abs(b);
float diff = System.Math.Abs(a - b);
if (a == b)
{
// shortcut, handles infinities
return true;
}
else if (a == 0 || b == 0 || diff < float.Epsilon)
{
// a or b is zero or both are extremely close to it
// relative error is less meaningful here
return diff < (_RatioUnderSum * float.Epsilon);
}
else
{
// use relative error
return diff / System.Math.Min( (absA + absB) , float.MaxValue ) < _RatioUnderSum;
}
}
public static bool FloatDigitEqual(float a, float b, float _MinDifference = 0.001f )
{
int aInt = (int) System.Math.Floor( a ) ;
int bInt = (int) System.Math.Floor( b ) ;
if( aInt != bInt )
{
return false ;
}
else
{
float aFloat = a - (float)aInt ;
float bFloat = b - (float)bInt ;
return System.Math.Abs( aFloat - bFloat ) < _MinDifference ;
}
}
}
|
public partial class MathTools
{
/**
* http://floating-point-gui.de/errors/comparison/
*/
public static bool RelativeEqual(float a, float b, float _RatioUnderSum )
{
float absA = System.Math.Abs(a);
float absB = System.Math.Abs(b);
float diff = System.Math.Abs(a - b);
if (a == b)
{
// shortcut, handles infinities
return true;
}
else if (a == 0 || b == 0 || diff < float.Epsilon)
{
// a or b is zero or both are extremely close to it
// relative error is less meaningful here
return diff < (_RatioUnderSum * float.Epsilon);
}
else
{
// use relative error
return diff / System.Math.Min( (absA + absB) , float.MaxValue ) < _RatioUnderSum;
}
}
public static bool FloatDigitEqual(float a, float b, float _MinDifference = 0.001f )
{
int aInt = (int) System.Math.Floor( a ) ;
int bInt = (int) System.Math.Floor( b ) ;
if( aInt != bInt )
{
return false ;
}
else
{
float aFloat = a - (float)aInt ;
float bFloat = b - (float)bInt ;
return System.Math.Abs( aFloat - bFloat ) < _MinDifference ;
}
}
}
|
mit
|
C#
|
674bd4c283cbf17656f0bf035c30f4324000f103
|
Update view for Home/Index
|
aliencube/ReCaptcha.NET,aliencube/ReCaptcha.NET,aliencube/ReCaptcha.NET
|
SourceCodes/02_Apps/ReCaptcha.Wrapper.WebApp/Views/Home/Index.cshtml
|
SourceCodes/02_Apps/ReCaptcha.Wrapper.WebApp/Views/Home/Index.cshtml
|
@using Aliencube.ReCaptcha.Wrapper.Mvc
@model Aliencube.ReCaptcha.Wrapper.WebApp.Models.HomeIndexViewModel
@{
ViewBag.Title = "Index";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm(MVC.Home.ActionNames.Index, MVC.Home.Name, FormMethod.Post))
{
<div class="form-group">
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name, new Dictionary<string, object>() {{"class", "form-control"}})
</div>
@Html.ReCaptcha(new Dictionary<string, object>() { { "class", "form-group" } }, new ReCaptchaParameters() { SiteKey = Model.SiteKey })
<input class="btn btn-default" type="submit" name="Submit" />
}
@if (IsPost)
{
<div>
<ul>
<li>Success: @Model.Success</li>
@if (@Model.ErrorCodes != null && @Model.ErrorCodes.Any())
{
<li>
ErrorCodes:
<ul>
@foreach (var errorCode in Model.ErrorCodes)
{
<li>@errorCode</li>
}
</ul>
</li>
}
<li>ErorCodes: @Model.ErrorCodes</li>
</ul>
</div>
}
@section Scripts
{
@Html.ReCaptchaApiJs(Model.ApiUrl, JsRenderingOptions.Async | JsRenderingOptions.Defer)
}
|
@using Aliencube.ReCaptcha.Wrapper.Mvc
@model Aliencube.ReCaptcha.Wrapper.WebApp.Models.HomeIndexViewModel
@{
ViewBag.Title = "Index";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm(MVC.Home.ActionNames.Index, MVC.Home.Name, FormMethod.Post))
{
<div class="form-group">
@Html.LabelFor(m => m.Name)
@Html.TextBoxFor(m => m.Name, new Dictionary<string, object>() {{"class", "form-control"}})
</div>
@Html.ReCaptcha(new Dictionary<string, object>() { { "class", "form-group" }, { "data-sitekey", Model.SiteKey } })
<input class="btn btn-default" type="submit" name="Submit" />
}
@if (IsPost)
{
<div>
<ul>
<li>Success: @Model.Success</li>
@if (@Model.ErrorCodes != null && @Model.ErrorCodes.Any())
{
<li>
ErrorCodes:
<ul>
@foreach (var errorCode in Model.ErrorCodes)
{
<li>@errorCode</li>
}
</ul>
</li>
}
<li>ErorCodes: @Model.ErrorCodes</li>
</ul>
</div>
}
@section Scripts
{
@Html.ReCaptchaApiJs(Model.ApiUrl, JsRenderingOptions.Async | JsRenderingOptions.Defer)
}
|
mit
|
C#
|
3a48f42a904f77067e68a8295b81b07c5b44c1ce
|
Update TestHelpers to support running under NCrunch
|
kthompson/csharp-glob,kthompson/glob,kthompson/glob
|
test/Glob.Tests/TestHelpers.cs
|
test/Glob.Tests/TestHelpers.cs
|
using System;
using System.IO;
using System.Text;
using Microsoft.DotNet.PlatformAbstractions;
namespace GlobExpressions.Tests
{
public static class TestHelpers
{
private static readonly string NCrunchSourceRoot = Environment.GetEnvironmentVariable("NCrunch") == "1"
? Path.GetDirectoryName(Environment.GetEnvironmentVariable("NCrunch.OriginalSolutionPath"))
: null;
public static readonly string SourceRoot = Environment.GetEnvironmentVariable("APPVEYOR_BUILD_FOLDER")
?? NCrunchSourceRoot
?? Path.Combine("..", "..", "..", "..", "..");
public static readonly string FileSystemRoot =
RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows ? "c:\\" : "/";
}
}
|
using System;
using System.IO;
using System.Text;
using Microsoft.DotNet.PlatformAbstractions;
namespace GlobExpressions.Tests
{
public static class TestHelpers
{
public static readonly string SourceRoot = Environment.GetEnvironmentVariable("APPVEYOR_BUILD_FOLDER") ?? Path.Combine("..", "..", "..", "..", "..");
public static readonly string FileSystemRoot =
RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows ? "c:\\" : "/";
}
}
|
mit
|
C#
|
37be3c1db1299dcf4aea493ce74104e6c6159bbc
|
Change Azure.Identity tracing namespace to Microsoft.AAD (#11857)
|
stankovski/azure-sdk-for-net,markcowl/azure-sdk-for-net,hyonholee/azure-sdk-for-net,hyonholee/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,stankovski/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,hyonholee/azure-sdk-for-net,hyonholee/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,hyonholee/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net
|
sdk/identity/Azure.Identity/src/Properties/AssemblyInfo.cs
|
sdk/identity/Azure.Identity/src/Properties/AssemblyInfo.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.Extensions.Azure.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
[assembly: InternalsVisibleTo("Azure.Identity.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.AAD")]
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.Extensions.Azure.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
[assembly: InternalsVisibleTo("Azure.Identity.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.ManagedIdentity")]
|
mit
|
C#
|
ed2d9749b339f8db6454007f5246f47f772fda80
|
Update BaseGalleryViewModel.cs
|
FormsCommunityToolkit/FormsCommunityToolkit
|
samples/XCT.Sample/ViewModels/Base/BaseGalleryViewModel.cs
|
samples/XCT.Sample/ViewModels/Base/BaseGalleryViewModel.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Input;
using Xamarin.CommunityToolkit.Sample.Models;
namespace Xamarin.CommunityToolkit.Sample.ViewModels
{
public abstract class BaseGalleryViewModel : BaseViewModel
{
public BaseGalleryViewModel()
{
Filter();
FilterCommand = CommandFactory.Create(Filter);
}
public IReadOnlyList<SectionModel> Items { get; }
public ICommand FilterCommand { get; }
public string FilterValue { private get; set; }
protected abstract IEnumerable<SectionModel> CreateItems();
void Filter()
{
FilterValue ??= string.Empty;
FilteredItems = Items.Where(item => item.Title.IndexOf(FilterValue, StringComparison.InvariantCultureIgnoreCase) >= 0);
OnPropertyChanged(nameof(FilteredItems));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Input;
using Xamarin.CommunityToolkit.Sample.Models;
namespace Xamarin.CommunityToolkit.Sample.ViewModels
{
public abstract class BaseGalleryViewModel : BaseViewModel
{
public BaseGalleryViewModel()
{
Filter();
FilterCommand = CommandFactory.Create(Filter);
}
public ICommand FilterCommand => filterCommand ??= new Command(Filter);
public IReadOnlyList<SectionModel> Items { get; }
public ICommand FilterCommand { get; }
public string FilterValue { private get; set; }
protected abstract IEnumerable<SectionModel> CreateItems();
void Filter()
{
FilterValue ??= string.Empty;
FilteredItems = Items.Where(item => item.Title.IndexOf(FilterValue, StringComparison.InvariantCultureIgnoreCase) >= 0);
OnPropertyChanged(nameof(FilteredItems));
}
}
}
|
mit
|
C#
|
7de90a513bf59b28fa32af176fef5cd1e6a401b8
|
Add bing map keys with fake default
|
DanieleScipioni/TestApp
|
TestAppUWP/Samples/Map/MapServiceSettings.cs
|
TestAppUWP/Samples/Map/MapServiceSettings.cs
|
namespace TestAppUWP.Samples.Map
{
public class MapServiceSettings
{
public static string Token = string.Empty;
}
}
|
namespace TestAppUWP.Samples.Map
{
public class MapServiceSettings
{
public static string Token="Pippo";
}
}
|
mit
|
C#
|
1dc3dd696e5e3a81932239e3bbf4dfc70ee09f80
|
Update Feature1.cs
|
ThomasKV/GitTest1
|
ConsoleApp1/ConsoleApp1/Feature1.cs
|
ConsoleApp1/ConsoleApp1/Feature1.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Feature1
{
int _x;
Feature1(int x)
{
_x=x;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Feature1
{
Feature1()
{
}
}
}
|
mit
|
C#
|
233b63bdd229bc935dfef769d3c162766378b95c
|
Remove obsolete Linux build architectures on 2019.2+
|
Chaser324/unity-build
|
Editor/Build/Platform/BuildLinux.cs
|
Editor/Build/Platform/BuildLinux.cs
|
using UnityEditor;
namespace SuperSystems.UnityBuild
{
[System.Serializable]
public class BuildLinux : BuildPlatform
{
#region Constants
private const string _name = "Linux";
private const string _dataDirNameFormat = "{0}_Data";
private const BuildTargetGroup _targetGroup = BuildTargetGroup.Standalone;
#endregion
public BuildLinux()
{
enabled = false;
Init();
}
public override void Init()
{
platformName = _name;
dataDirNameFormat = _dataDirNameFormat;
targetGroup = _targetGroup;
if (architectures == null || architectures.Length == 0)
{
architectures = new BuildArchitecture[] {
new BuildArchitecture(BuildTarget.StandaloneLinux64, "Linux x64", false, "{0}.x86_64"),
#if !UNITY_2019_2_OR_NEWER
new BuildArchitecture(BuildTarget.StandaloneLinuxUniversal, "Linux Universal", true, "{0}"),
new BuildArchitecture(BuildTarget.StandaloneLinux, "Linux x86", false, "{0}.x86"),
#endif
};
#if UNITY_2018_3_OR_NEWER
architectures[0].enabled = true;
#endif
#if UNITY_2018_3_OR_NEWER && !UNITY_2019_2_OR_NEWER
architectures[1].enabled = false;
#endif
}
}
}
}
|
using UnityEditor;
namespace SuperSystems.UnityBuild
{
[System.Serializable]
public class BuildLinux : BuildPlatform
{
#region Constants
private const string _name = "Linux";
private const string _dataDirNameFormat = "{0}_Data";
private const BuildTargetGroup _targetGroup = BuildTargetGroup.Standalone;
#endregion
public BuildLinux()
{
enabled = false;
Init();
}
public override void Init()
{
platformName = _name;
dataDirNameFormat = _dataDirNameFormat;
targetGroup = _targetGroup;
if (architectures == null || architectures.Length == 0)
{
architectures = new BuildArchitecture[] {
new BuildArchitecture(BuildTarget.StandaloneLinuxUniversal, "Linux Universal", true, "{0}"),
new BuildArchitecture(BuildTarget.StandaloneLinux, "Linux x86", false, "{0}.x86"),
new BuildArchitecture(BuildTarget.StandaloneLinux64, "Linux x64", false, "{0}.x86_64")
};
#if UNITY_2018_3_OR_NEWER
architectures[0].enabled = false;
architectures[2].enabled = true;
#endif
}
}
}
}
|
mit
|
C#
|
ee580a842273e103a4da95ee514ef9543b93bf40
|
Simplify code.
|
orthoxerox/roslyn,jasonmalinowski/roslyn,davkean/roslyn,mavasani/roslyn,bartdesmet/roslyn,tmat/roslyn,agocke/roslyn,mmitche/roslyn,tmeschter/roslyn,mmitche/roslyn,VSadov/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,physhi/roslyn,AlekseyTs/roslyn,pdelvo/roslyn,paulvanbrenk/roslyn,jcouv/roslyn,mattscheffer/roslyn,lorcanmooney/roslyn,kelltrick/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,physhi/roslyn,jcouv/roslyn,sharwell/roslyn,CaptainHayashi/roslyn,gafter/roslyn,aelij/roslyn,panopticoncentral/roslyn,brettfo/roslyn,CaptainHayashi/roslyn,drognanar/roslyn,bkoelman/roslyn,kelltrick/roslyn,kelltrick/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,tmeschter/roslyn,nguerrera/roslyn,jasonmalinowski/roslyn,mattwar/roslyn,wvdd007/roslyn,orthoxerox/roslyn,mavasani/roslyn,srivatsn/roslyn,dotnet/roslyn,ErikSchierboom/roslyn,AlekseyTs/roslyn,mattwar/roslyn,weltkante/roslyn,xasx/roslyn,nguerrera/roslyn,OmarTawfik/roslyn,MattWindsor91/roslyn,DustinCampbell/roslyn,MattWindsor91/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,lorcanmooney/roslyn,sharwell/roslyn,srivatsn/roslyn,jmarolf/roslyn,tvand7093/roslyn,abock/roslyn,xasx/roslyn,dotnet/roslyn,dpoeschl/roslyn,AmadeusW/roslyn,eriawan/roslyn,KevinRansom/roslyn,MattWindsor91/roslyn,khyperia/roslyn,srivatsn/roslyn,AmadeusW/roslyn,xasx/roslyn,cston/roslyn,OmarTawfik/roslyn,CyrusNajmabadi/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,bkoelman/roslyn,reaction1989/roslyn,VSadov/roslyn,abock/roslyn,AmadeusW/roslyn,wvdd007/roslyn,diryboy/roslyn,diryboy/roslyn,Giftednewt/roslyn,aelij/roslyn,tmat/roslyn,TyOverby/roslyn,swaroop-sridhar/roslyn,ErikSchierboom/roslyn,genlu/roslyn,orthoxerox/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,cston/roslyn,jamesqo/roslyn,drognanar/roslyn,Hosch250/roslyn,AnthonyDGreen/roslyn,khyperia/roslyn,pdelvo/roslyn,OmarTawfik/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,KirillOsenkov/roslyn,robinsedlaczek/roslyn,dpoeschl/roslyn,Hosch250/roslyn,ErikSchierboom/roslyn,tmat/roslyn,khyperia/roslyn,diryboy/roslyn,reaction1989/roslyn,CaptainHayashi/roslyn,jkotas/roslyn,amcasey/roslyn,eriawan/roslyn,cston/roslyn,jamesqo/roslyn,agocke/roslyn,MichalStrehovsky/roslyn,yeaicc/roslyn,davkean/roslyn,shyamnamboodiripad/roslyn,brettfo/roslyn,DustinCampbell/roslyn,tvand7093/roslyn,mattscheffer/roslyn,AnthonyDGreen/roslyn,panopticoncentral/roslyn,stephentoub/roslyn,jmarolf/roslyn,heejaechang/roslyn,drognanar/roslyn,TyOverby/roslyn,KevinRansom/roslyn,gafter/roslyn,mattwar/roslyn,DustinCampbell/roslyn,davkean/roslyn,CyrusNajmabadi/roslyn,genlu/roslyn,jcouv/roslyn,heejaechang/roslyn,tvand7093/roslyn,dpoeschl/roslyn,robinsedlaczek/roslyn,stephentoub/roslyn,mavasani/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,Hosch250/roslyn,bkoelman/roslyn,panopticoncentral/roslyn,Giftednewt/roslyn,AnthonyDGreen/roslyn,swaroop-sridhar/roslyn,jamesqo/roslyn,paulvanbrenk/roslyn,MichalStrehovsky/roslyn,KirillOsenkov/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,gafter/roslyn,tannergooding/roslyn,lorcanmooney/roslyn,Giftednewt/roslyn,mmitche/roslyn,yeaicc/roslyn,CyrusNajmabadi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,swaroop-sridhar/roslyn,paulvanbrenk/roslyn,brettfo/roslyn,amcasey/roslyn,agocke/roslyn,MattWindsor91/roslyn,mattscheffer/roslyn,jkotas/roslyn,aelij/roslyn,reaction1989/roslyn,VSadov/roslyn,physhi/roslyn,abock/roslyn,TyOverby/roslyn,eriawan/roslyn,jmarolf/roslyn,jkotas/roslyn,robinsedlaczek/roslyn,yeaicc/roslyn,dotnet/roslyn,MichalStrehovsky/roslyn,nguerrera/roslyn,stephentoub/roslyn,genlu/roslyn,KevinRansom/roslyn,sharwell/roslyn,tmeschter/roslyn,pdelvo/roslyn,amcasey/roslyn
|
src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpDefaultExpressionReducer.Rewriter.cs
|
src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpDefaultExpressionReducer.Rewriter.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Options;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Simplification
{
internal partial class CSharpDefaultExpressionReducer
{
private class Rewriter : AbstractReductionRewriter
{
public Rewriter(ObjectPool<IReductionRewriter> pool)
: base(pool)
{
_simplifyDefaultExpression = SimplifyDefaultExpression;
}
private readonly Func<DefaultExpressionSyntax, SemanticModel, OptionSet, CancellationToken, SyntaxNode> _simplifyDefaultExpression;
private SyntaxNode SimplifyDefaultExpression(
DefaultExpressionSyntax node,
SemanticModel semanticModel,
OptionSet optionSet,
CancellationToken cancellationToken)
{
if (optionSet.GetOption(CSharpCodeStyleOptions.PreferDefaultLiteral).Value &&
((CSharpParseOptions)ParseOptions).LanguageVersion >= LanguageVersion.CSharp7_1 &&
node.CanReplaceWithDefaultLiteral(semanticModel, cancellationToken))
{
return SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression)
.WithTriviaFrom(node);
}
return node;
}
public override SyntaxNode VisitDefaultExpression(DefaultExpressionSyntax node)
{
return SimplifyNode(
node,
newNode: base.VisitDefaultExpression(node),
parentNode: node.Parent,
simplifier: _simplifyDefaultExpression);
}
}
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Options;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Simplification
{
internal partial class CSharpDefaultExpressionReducer
{
private class Rewriter : AbstractReductionRewriter
{
public Rewriter(ObjectPool<IReductionRewriter> pool)
: base(pool)
{
_simplifyDefaultExpression = SimplifyDefaultExpression;
}
private readonly Func<DefaultExpressionSyntax, SemanticModel, OptionSet, CancellationToken, SyntaxNode> _simplifyDefaultExpression;
private SyntaxNode SimplifyDefaultExpression(
DefaultExpressionSyntax node,
SemanticModel semanticModel,
OptionSet optionSet,
CancellationToken cancellationToken)
{
if (optionSet.GetOption(CSharpCodeStyleOptions.PreferDefaultLiteral).Value &&
node.CanReplaceWithDefaultLiteral(semanticModel, cancellationToken) &&
((CSharpParseOptions)ParseOptions).LanguageVersion >= LanguageVersion.CSharp7_1)
{
return SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression)
.WithTriviaFrom(node);
}
return node;
}
public override SyntaxNode VisitDefaultExpression(DefaultExpressionSyntax node)
{
return SimplifyNode(
node,
newNode: base.VisitDefaultExpression(node),
parentNode: node.Parent,
simplifier: _simplifyDefaultExpression);
}
}
}
}
|
mit
|
C#
|
65574ca81fef2784fd3b1e54232d807943057e73
|
set utc time zone handling when converting objects
|
Picturepark/Picturepark.SDK.DotNet
|
src/Picturepark.SDK.V1.Contract/Partials/ListItemDetail.cs
|
src/Picturepark.SDK.V1.Contract/Partials/ListItemDetail.cs
|
using Newtonsoft.Json.Linq;
using System;
using Newtonsoft.Json;
namespace Picturepark.SDK.V1.Contract
{
public partial class ListItemDetail
{
/// <summary>Converts the content of a list item detail to the given type.</summary>
/// <typeparam name="T">The content type.</typeparam>
/// <returns>The converted content.</returns>
public T ConvertTo<T>()
{
return Content is T
? (T)Content
: ((JObject)Content).ToObject<T>(
new JsonSerializer
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc
});
}
}
}
|
using Newtonsoft.Json.Linq;
using System;
namespace Picturepark.SDK.V1.Contract
{
public partial class ListItemDetail
{
/// <summary>Converts the content of a list item detail to the given type.</summary>
/// <typeparam name="T">The content type.</typeparam>
/// <returns>The converted content.</returns>
public T ConvertTo<T>()
{
return Content is T ? (T)Content : ((JObject)Content).ToObject<T>();
}
}
}
|
mit
|
C#
|
3a891950df88187f58aebbb9b8fd3670c9c35ca3
|
Remove useless code.
|
xistoso/CppSharp,ktopouzi/CppSharp,txdv/CppSharp,ktopouzi/CppSharp,u255436/CppSharp,ddobrev/CppSharp,imazen/CppSharp,inordertotest/CppSharp,zillemarco/CppSharp,SonyaSa/CppSharp,xistoso/CppSharp,SonyaSa/CppSharp,KonajuGames/CppSharp,zillemarco/CppSharp,mono/CppSharp,mono/CppSharp,xistoso/CppSharp,SonyaSa/CppSharp,u255436/CppSharp,KonajuGames/CppSharp,nalkaro/CppSharp,imazen/CppSharp,Samana/CppSharp,inordertotest/CppSharp,ktopouzi/CppSharp,mohtamohit/CppSharp,mydogisbox/CppSharp,nalkaro/CppSharp,zillemarco/CppSharp,Samana/CppSharp,ktopouzi/CppSharp,KonajuGames/CppSharp,nalkaro/CppSharp,ddobrev/CppSharp,genuinelucifer/CppSharp,imazen/CppSharp,mohtamohit/CppSharp,xistoso/CppSharp,mono/CppSharp,mydogisbox/CppSharp,mono/CppSharp,txdv/CppSharp,txdv/CppSharp,genuinelucifer/CppSharp,genuinelucifer/CppSharp,nalkaro/CppSharp,SonyaSa/CppSharp,u255436/CppSharp,ddobrev/CppSharp,zillemarco/CppSharp,Samana/CppSharp,inordertotest/CppSharp,ktopouzi/CppSharp,Samana/CppSharp,KonajuGames/CppSharp,mydogisbox/CppSharp,txdv/CppSharp,mohtamohit/CppSharp,txdv/CppSharp,imazen/CppSharp,inordertotest/CppSharp,xistoso/CppSharp,genuinelucifer/CppSharp,mohtamohit/CppSharp,nalkaro/CppSharp,SonyaSa/CppSharp,ddobrev/CppSharp,mydogisbox/CppSharp,genuinelucifer/CppSharp,imazen/CppSharp,mohtamohit/CppSharp,zillemarco/CppSharp,ddobrev/CppSharp,Samana/CppSharp,mydogisbox/CppSharp,KonajuGames/CppSharp,mono/CppSharp,u255436/CppSharp,u255436/CppSharp,inordertotest/CppSharp,mono/CppSharp
|
tests/Basic/Basic.cs
|
tests/Basic/Basic.cs
|
using CppSharp.AST;
using CppSharp.Generators;
using CppSharp.Utils;
namespace CppSharp.Tests
{
public class Basic : LibraryTest
{
public Basic(GeneratorKind kind)
: base("Basic", kind)
{
}
public override void SetupPasses(Driver driver)
{
if (driver.Options.IsCSharpGenerator)
{
driver.Options.GenerateAbstractImpls = true;
}
}
public override void Preprocess(Driver driver, ASTContext lib)
{
lib.SetClassAsValueType("Bar");
lib.SetClassAsValueType("Bar2");
lib.SetMethodParameterUsage("Hello", "TestPrimitiveOut", 1, ParameterUsage.Out);
lib.SetMethodParameterUsage("Hello", "TestPrimitiveOutRef", 1, ParameterUsage.Out);
}
public static void Main(string[] args)
{
ConsoleDriver.Run(new Basic(GeneratorKind.CLI));
ConsoleDriver.Run(new Basic(GeneratorKind.CSharp));
}
}
}
|
using System;
using System.IO;
using CppSharp.AST;
using CppSharp.Generators;
using CppSharp.Utils;
namespace CppSharp.Tests
{
public class Basic : LibraryTest
{
public Basic(GeneratorKind kind)
: base("Basic", kind)
{
}
public override void SetupPasses(Driver driver)
{
if (driver.Options.IsCSharpGenerator)
{
driver.Options.GenerateAbstractImpls = true;
}
}
public override void Preprocess(Driver driver, ASTContext lib)
{
lib.SetClassAsValueType("Bar");
lib.SetClassAsValueType("Bar2");
lib.SetMethodParameterUsage("Hello", "TestPrimitiveOut", 1, ParameterUsage.Out);
lib.SetMethodParameterUsage("Hello", "TestPrimitiveOutRef", 1, ParameterUsage.Out);
}
public static void Main(string[] args)
{
Console.WriteLine(Directory.GetCurrentDirectory());
ConsoleDriver.Run(new Basic(GeneratorKind.CLI));
ConsoleDriver.Run(new Basic(GeneratorKind.CSharp));
}
}
}
|
mit
|
C#
|
784f2e2c37556660f87a435ec31004d2b453af7e
|
refactor IO add frame class fix whitespace input
|
nerai/CMenu
|
src/ConsoleMenu/IO.cs
|
src/ConsoleMenu/IO.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleMenu
{
public static class IO
{
private class Frame
{
public IEnumerator<string> E;
public Frame (IEnumerable<string> source)
{
E = source.GetEnumerator ();
}
}
private static readonly Stack<Frame> _Frames = new Stack<Frame> ();
static IO ()
{
AddInput (DefaultInputSource ());
}
public static string QueryInput ()
{
for (; ; ) {
var f = _Frames.Peek ();
while (!f.E.MoveNext ()) {
_Frames.Pop ();
f = _Frames.Peek ();
}
var input = f.E.Current;
if (!string.IsNullOrWhiteSpace (input)) {
return input;
}
}
}
private static IEnumerable<string> DefaultInputSource ()
{
for (; ; ) {
yield return Console.ReadLine ();
}
}
public static void AddInput (IEnumerable<string> source)
{
_Frames.Push (new Frame (source));
}
public static void ImmediateInput (string source)
{
AddInput (new string[] { source });
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleMenu
{
public static class IO
{
private static readonly Stack<IEnumerator<string>> _Frames = new Stack<IEnumerator<string>> ();
static IO ()
{
AddInput (DefaultInputSource ());
}
public static string QueryInput ()
{
var f = _Frames.Peek ();
while (!f.MoveNext ()) {
_Frames.Pop ();
f = _Frames.Peek ();
}
return f.Current;
}
private static IEnumerable<string> DefaultInputSource ()
{
for (; ; ) {
yield return Console.ReadLine ();
}
}
public static void AddInput (IEnumerable<string> source)
{
_Frames.Push (source.GetEnumerator ());
}
public static void ImmediateInput (string source)
{
AddInput (new string[] { source });
}
}
}
|
mit
|
C#
|
fdc877008a0b782394d4082e089b6625568201f6
|
fix typo
|
marihachi/MSharp
|
src/MSharp/Misskey.cs
|
src/MSharp/Misskey.cs
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MSharp.Core;
using MSharp.Core.Utility;
namespace MSharp
{
/// <summary>
/// リクエストメソッドの種類を表します
/// </summary>
public enum MethodType
{
GET,
POST
}
public class Misskey
{
public string AppKey { private set; get; }
public string UserKey { private set; get; }
public string UserId { private set; get; }
private string AuthenticationSessionKey { set; get; }
public Misskey(string appKey)
{
this.AppKey = appKey;
}
public Misskey(
string appKey,
string userKey,
string userId)
{
this.AppKey = appKey;
this.UserKey = userKey;
this.UserId = userId;
}
public async Task StartAuthorize()
{
var res = await new MisskeyRequest(this, MethodType.GET, "https://api.misskey.xyz/sauth/get-authentication-session-key").Request();
var json = Json.Parse(res);
if (json != null)
this.AuthenticationSessionKey = json.AuthenticationSessionKey;
else
throw new RequestException("AuthenticationSessionKey の取得に失敗しました。");
try
{
System.Diagnostics.Process.Start("https://api.misskey.xyz/authorize@" + this.AuthenticationSessionKey);
}
catch (Exception ex)
{
throw new RequestException("アプリ連携ページの表示に失敗しました。", ex);
}
}
public async Task<Misskey> AuthorizePIN(string pinCode)
{
var ret = await new MisskeyRequest(this, MethodType.GET, "sauth/get-user-key",
new Dictionary<string, string> {
{ "authentication-session-key", this.AuthenticationSessionKey },
{ "pin-code", pinCode}
}).Request();
var json = Json.Parse(ret);
return new Misskey(this.AppKey, (string)json.userKey, (string)json.userId);
}
public async Task<string> Request(
MethodType method,
string endPoint,
Dictionary<string, string> parameters = null,
string baseUrl = null)
{
return await new MisskeyRequest(this, method, endPoint, parameters, baseUrl).Request();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MSharp.Core;
using MSharp.Core.Utility;
namespace MSharp
{
/// <summary>
/// リクエストメソッドの種類を表します
/// </summary>
public enum MethodType
{
GET,
POST
}
public class Misskey
{
public string AppKey { private set; get; }
public string UserKey { private set; get; }
public string UserId { private set; get; }
private string AuthenticationSessionKey { set; get; }
public Misskey(string appKey)
{
this.AppKey = appKey;
}
public Misskey(
string appKey,
string userKey,
string userId)
{
this.AppKey = appKey;
this.UserKey = userKey;
this.UserId = userId;
}
public async Task StartAuthorize()
{
var res = await new MisskeyRequest(this, MethodType.GET, "https://api.misskey.xyz/sauth/get-authentication-session-key").Request();
var json = Json.Parse(res);
if (json != null)
this.AuthenticationSessionKey = json.AuthenticationSessionKey;
else
throw new RequestException("AuthenticationSessionKey の取得に失敗しました。");
try
{
System.Diagnostics.Process.Start("https://api.misskey.xyz/authorize@" + this.AuthenticationSessionKey);
}
catch (Exception ex)
{
throw new RequestException("アプリ連携ページの表示に失敗しました。", ex);
}
}
public async Task<Misskey> AuthorizePIN(string pinCode)
{
var ret = await new MisskeyRequest(this, MethodType.GET, "sauth/get-user-key",
new Dictionary<string, string> {
{ "authentication-session-key", AuthenticationSessionKey },
{ "pin-code", pinCode}
}).Request();
var json = Json.Parse(ret);
return new Misskey(this.AppKey, (string)json.userKey, (string)json.userId);
}
public async Task<string> Request(
MethodType method,
string endPoint,
Dictionary<string, string> parameters = null,
string baseUrl = null)
{
return await new MisskeyRequest(this, method, endPoint, parameters, baseUrl).Request();
}
}
}
|
mit
|
C#
|
b368a66a97aec12e17b4d08a3956d6bef00c873d
|
Mark CharEnumerator as [Serializable] (dotnet/coreclr#11124)
|
tijoytom/corert,botaberg/corert,gregkalapos/corert,shrah/corert,tijoytom/corert,gregkalapos/corert,shrah/corert,botaberg/corert,krytarowski/corert,yizhang82/corert,krytarowski/corert,yizhang82/corert,krytarowski/corert,gregkalapos/corert,yizhang82/corert,botaberg/corert,yizhang82/corert,tijoytom/corert,shrah/corert,botaberg/corert,tijoytom/corert,gregkalapos/corert,krytarowski/corert,shrah/corert
|
src/System.Private.CoreLib/shared/System/CharEnumerator.cs
|
src/System.Private.CoreLib/shared/System/CharEnumerator.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*============================================================
**
**
**
** Purpose: Enumerates the characters on a string. skips range
** checks.
**
**
============================================================*/
using System.Collections;
using System.Collections.Generic;
namespace System
{
[Serializable]
public sealed class CharEnumerator : IEnumerator, IEnumerator<char>, IDisposable, ICloneable
{
private String _str;
private int _index;
private char _currentElement;
internal CharEnumerator(String str)
{
_str = str;
_index = -1;
}
public object Clone()
{
return MemberwiseClone();
}
public bool MoveNext()
{
if (_index < (_str.Length - 1))
{
_index++;
_currentElement = _str[_index];
return true;
}
else
_index = _str.Length;
return false;
}
public void Dispose()
{
if (_str != null)
_index = _str.Length;
_str = null;
}
Object IEnumerator.Current
{
get { return Current; }
}
public char Current
{
get
{
if (_index == -1)
throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted);
if (_index >= _str.Length)
throw new InvalidOperationException(SR.InvalidOperation_EnumEnded);
return _currentElement;
}
}
public void Reset()
{
_currentElement = (char)0;
_index = -1;
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*============================================================
**
**
**
** Purpose: Enumerates the characters on a string. skips range
** checks.
**
**
============================================================*/
using System.Collections;
using System.Collections.Generic;
namespace System
{
public sealed class CharEnumerator : IEnumerator, IEnumerator<char>, IDisposable, ICloneable
{
private String _str;
private int _index;
private char _currentElement;
internal CharEnumerator(String str)
{
_str = str;
_index = -1;
}
public object Clone()
{
return MemberwiseClone();
}
public bool MoveNext()
{
if (_index < (_str.Length - 1))
{
_index++;
_currentElement = _str[_index];
return true;
}
else
_index = _str.Length;
return false;
}
public void Dispose()
{
if (_str != null)
_index = _str.Length;
_str = null;
}
Object IEnumerator.Current
{
get { return Current; }
}
public char Current
{
get
{
if (_index == -1)
throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted);
if (_index >= _str.Length)
throw new InvalidOperationException(SR.InvalidOperation_EnumEnded);
return _currentElement;
}
}
public void Reset()
{
_currentElement = (char)0;
_index = -1;
}
}
}
|
mit
|
C#
|
c51931f134701dd3bf0ae0b46aaeb51bddbd768a
|
Set up client, settings, logging, and connection
|
Iwuh/Wycademy
|
Wycademy/Wycademy/Program.cs
|
Wycademy/Wycademy/Program.cs
|
using Discord;
using Discord.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Wycademy
{
class Program
{
//Call Start() so that the bot runs in a non static method
static void Main(string[] args) => new Program().Start();
private DiscordClient _client;
public void Start()
{
//Set basic settings
_client = new DiscordClient(x =>
{
x.AppName = "Wycademy";
x.LogLevel = LogSeverity.Info;
x.LogHandler = Log;
})
.UsingCommands(x =>
{
x.PrefixChar = '<';
x.HelpMode = HelpMode.Private;
});
//Set up message logging
_client.MessageReceived += (s, e) =>
{
if (e.Message.IsAuthor)
{
_client.Log.Info(">>Message", $"{((e.Server != null) ? e.Server.Name : "Private")}/#{((!e.Channel.IsPrivate) ? e.Channel.Name : "")} by {e.User.Name}");
}
else if (!e.Message.IsAuthor)
{
_client.Log.Info("<<Message", $"{((e.Server != null) ? e.Server.Name : "Private")}/#{((!e.Channel.IsPrivate) ? e.Channel.Name : "")} by {e.User.Name}");
}
};
//Bot token is stored in an environment variable so that nobody sees it when I push to GitHub :D
string token = Environment.GetEnvironmentVariable("WYCADEMY_TOKEN", EnvironmentVariableTarget.User);
//Connect to all guilds that the bot is part of and then block until the bot is manually exited.
_client.ExecuteAndWait(async () =>
{
await _client.Connect(token);
});
}
//Whenever we log data, this method is called.
private void Log(object sender, LogMessageEventArgs e)
{
Console.WriteLine($"[{e.Severity}] [{e.Source}] {e.Message}");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Wycademy
{
class Program
{
static void Main(string[] args)
{
}
}
}
|
mit
|
C#
|
4c4834df7dfbe61734c5054744e0f6349066c18d
|
Fix typo in comment
|
MarimerLLC/csla,rockfordlhotka/csla,MarimerLLC/csla,rockfordlhotka/csla,rockfordlhotka/csla,MarimerLLC/csla
|
Source/Csla.Blazor.WebAssembly/ConfigurationExtensions.cs
|
Source/Csla.Blazor.WebAssembly/ConfigurationExtensions.cs
|
//-----------------------------------------------------------------------
// <copyright file="BlazorWasmConfigurationExtensions.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>Implement extension methods for .NET Core configuration</summary>
//-----------------------------------------------------------------------
using Csla.Blazor;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Csla.Configuration
{
/// <summary>
/// Implement extension methods for Blazor WebAssembly
/// </summary>
public static class BlazorWasmConfigurationExtensions
{
/// <summary>
/// Registers services necessary for Blazor WebAssembly.
/// </summary>
/// <param name="config">CslaConfiguration object</param>
/// <returns></returns>
public static CslaOptions AddBlazorWebAssembly(this CslaOptions config)
{
config.Services.TryAddTransient(typeof(ViewModel<>), typeof(ViewModel<>));
config.Services.TryAddScoped<IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
config.Services.TryAddScoped<IAuthorizationHandler, CslaPermissionsHandler>();
config.Services.TryAddScoped(typeof(Csla.Core.IContextManager), typeof(Csla.Blazor.WebAssembly.ApplicationContextManager));
Csla.Channels.Http.HttpProxy.UseTextSerialization = true;
return config;
}
}
}
|
//-----------------------------------------------------------------------
// <copyright file="BlazorWasmConfigurationExtensions.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>Implement extension methods for .NET Core configuration</summary>
//-----------------------------------------------------------------------
using Csla.Blazor;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Csla.Configuration
{
/// <summary>
/// Implement extension methods for Blazor WebAssembly
/// </summary>
public static class BlazorWasmConfigurationExtensions
{
/// <summary>
/// Registers services necessary for Windows Forms
/// </summary>
/// <param name="config">CslaConfiguration object</param>
/// <returns></returns>
public static CslaOptions AddBlazorWebAssembly(this CslaOptions config)
{
config.Services.TryAddTransient(typeof(ViewModel<>), typeof(ViewModel<>));
config.Services.TryAddScoped<IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
config.Services.TryAddScoped<IAuthorizationHandler, CslaPermissionsHandler>();
config.Services.TryAddScoped(typeof(Csla.Core.IContextManager), typeof(Csla.Blazor.WebAssembly.ApplicationContextManager));
Csla.Channels.Http.HttpProxy.UseTextSerialization = true;
return config;
}
}
}
|
mit
|
C#
|
d89ab07e5b41285869ab7cd207c74defbae7af46
|
Use CombineLatest instead of Zip
|
asarium/FSOLauncher
|
UI/WPF/Modules/UI.WPF.Modules.Installation/ViewModels/Installation/InstallationItemParent.cs
|
UI/WPF/Modules/UI.WPF.Modules.Installation/ViewModels/Installation/InstallationItemParent.cs
|
#region Usings
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using ReactiveUI;
#endregion
namespace UI.WPF.Modules.Installation.ViewModels.Installation
{
public class InstallationItemParent : InstallationItem
{
public InstallationItemParent(string title, IEnumerable<InstallationItem> children)
{
Title = title;
Children = children.ToList();
Children.Select(x => x.ProgressObservable).CombineLatest().Select(list => list.Average()).BindTo(this, x => x.Progress);
Children.Select(x => x.IndeterminateObservable).CombineLatest().Select(list => list.All(b => b)).BindTo(this, x => x.Indeterminate);
OperationMessage = null;
CancellationTokenSource = new CancellationTokenSource();
CancellationTokenSource.Token.Register(() =>
{
foreach (var installationItem in Children.Where(installationItem => !installationItem.CancellationTokenSource.IsCancellationRequested)
)
{
installationItem.CancellationTokenSource.Cancel();
}
});
}
public IEnumerable<InstallationItem> Children { get; private set; }
#region Overrides of InstallationItem
public override Task Install()
{
return Task.WhenAll(Children.Select(x => x.Install()));
}
#endregion
}
}
|
#region Usings
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using ReactiveUI;
#endregion
namespace UI.WPF.Modules.Installation.ViewModels.Installation
{
public class InstallationItemParent : InstallationItem
{
public InstallationItemParent(string title, IEnumerable<InstallationItem> children)
{
Title = title;
Children = children.ToList();
Children.Select(x => x.ProgressObservable).Zip().Select(list => list.Average()).BindTo(this, x => x.Progress);
Children.Select(x => x.IndeterminateObservable).Zip().Select(list => list.All(b => b)).BindTo(this, x => x.Indeterminate);
OperationMessage = null;
CancellationTokenSource = new CancellationTokenSource();
CancellationTokenSource.Token.Register(() =>
{
foreach (var installationItem in Children.Where(installationItem => !installationItem.CancellationTokenSource.IsCancellationRequested)
)
{
installationItem.CancellationTokenSource.Cancel();
}
});
}
public IEnumerable<InstallationItem> Children { get; private set; }
#region Overrides of InstallationItem
public override Task Install()
{
return Task.WhenAll(Children.Select(x => x.Install()));
}
#endregion
}
}
|
mit
|
C#
|
074aada746453d998f69530b922f5146b6d1b8d9
|
add index5
|
kotikov1994/BlogAdd
|
TemplateTest1/TemplateTest1/Controllers/HomeController.cs
|
TemplateTest1/TemplateTest1/Controllers/HomeController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TemplateTest1.Models;
namespace TemplateTest1.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
var model = new ArticleModel();
return View( model);
}
public ActionResult Index1()
{
var model = new ArticleModel();
return View(model);
}
public ActionResult Index2()
{
var model = new ArticleModel();
return View(model);
}
public ActionResult Index3()
{
var model = new ArticleModel();
return View(model);
}
public ActionResult Index4()
{
var model = new ArticleModel();
return View(model);
}
public ActionResult Index5()
{
var model = new ArticleModel();
return View(model);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TemplateTest1.Models;
namespace TemplateTest1.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
var model = new ArticleModel();
return View( model);
}
public ActionResult Index1()
{
var model = new ArticleModel();
return View(model);
}
public ActionResult Index2()
{
var model = new ArticleModel();
return View(model);
}
public ActionResult Index3()
{
var model = new ArticleModel();
return View(model);
}
public ActionResult Index4()
{
var model = new ArticleModel();
return View(model);
}
}
}
|
mit
|
C#
|
abb5dcf678607c7e7347f07ea37fbc4850bbdddb
|
Fix null-refing testcase
|
ZLima12/osu,johnneijzen/osu,Nabile-Rahmani/osu,ppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,naoey/osu,NeoAdonis/osu,UselessToucan/osu,2yangk23/osu,smoogipoo/osu,EVAST9919/osu,ZLima12/osu,DrabWeb/osu,DrabWeb/osu,UselessToucan/osu,johnneijzen/osu,ppy/osu,peppy/osu-new,naoey/osu,DrabWeb/osu,peppy/osu,peppy/osu,NeoAdonis/osu,smoogipooo/osu,Frontear/osuKyzer,naoey/osu,EVAST9919/osu,2yangk23/osu,NeoAdonis/osu,UselessToucan/osu
|
osu.Game.Tests/Visual/TestCaseEditorCompose.cs
|
osu.Game.Tests/Visual/TestCaseEditorCompose.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Timing;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit.Screens.Compose;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.Visual
{
[TestFixture]
public class TestCaseEditorCompose : OsuTestCase
{
[BackgroundDependencyLoader]
private void load(OsuGameBase osuGame)
{
osuGame.Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo);
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
var compose = new Compose(clock, clock);
compose.Beatmap.BindTo(osuGame.Beatmap);
Child = compose;
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit.Screens.Compose;
namespace osu.Game.Tests.Visual
{
[TestFixture]
public class TestCaseEditorCompose : OsuTestCase
{
private readonly Random random;
private readonly Compose compose;
public TestCaseEditorCompose()
{
random = new Random(1337);
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
Add(compose = new Compose(clock, clock));
AddStep("Next beatmap", nextBeatmap);
}
private OsuGameBase osuGame;
private BeatmapManager beatmaps;
[BackgroundDependencyLoader]
private void load(OsuGameBase osuGame, BeatmapManager beatmaps)
{
this.osuGame = osuGame;
this.beatmaps = beatmaps;
compose.Beatmap.BindTo(osuGame.Beatmap);
}
private void nextBeatmap()
{
var sets = beatmaps.GetAllUsableBeatmapSets();
if (sets.Count == 0)
return;
var b = sets[random.Next(0, sets.Count)].Beatmaps[0];
osuGame.Beatmap.Value = beatmaps.GetWorkingBeatmap(b);
}
}
}
|
mit
|
C#
|
73ab1b2b21f2eaaf40884d6d674d22c08031bfd7
|
Add pitch randomisation to HoverSounds on-hover sample playback
|
NeoAdonis/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,smoogipooo/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu-new,ppy/osu,peppy/osu,UselessToucan/osu
|
osu.Game/Graphics/UserInterface/HoverSounds.cs
|
osu.Game/Graphics/UserInterface/HoverSounds.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.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
using osu.Framework.Utils;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Adds hover sounds to a drawable.
/// Does not draw anything.
/// </summary>
public class HoverSounds : CompositeDrawable
{
private SampleChannel sampleHover;
/// <summary>
/// Length of debounce for hover sound playback, in milliseconds.
/// </summary>
public double HoverDebounceTime { get; } = 20;
protected readonly HoverSampleSet SampleSet;
private Bindable<double?> lastPlaybackTime;
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
{
SampleSet = sampleSet;
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(AudioManager audio, SessionStatics statics)
{
lastPlaybackTime = statics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime);
sampleHover = audio.Samples.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
}
protected override bool OnHover(HoverEvent e)
{
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
if (enoughTimePassedSinceLastPlayback && sampleHover != null)
{
sampleHover.Frequency.Value = 0.96 + RNG.NextDouble(0.08);
sampleHover.Play();
lastPlaybackTime.Value = Time.Current;
}
return base.OnHover(e);
}
}
public enum HoverSampleSet
{
[Description("")]
Loud,
[Description("-soft")]
Normal,
[Description("-softer")]
Soft
}
}
|
// 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.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// Adds hover sounds to a drawable.
/// Does not draw anything.
/// </summary>
public class HoverSounds : CompositeDrawable
{
private SampleChannel sampleHover;
/// <summary>
/// Length of debounce for hover sound playback, in milliseconds.
/// </summary>
public double HoverDebounceTime { get; } = 20;
protected readonly HoverSampleSet SampleSet;
private Bindable<double?> lastPlaybackTime;
public HoverSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
{
SampleSet = sampleSet;
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(AudioManager audio, SessionStatics statics)
{
lastPlaybackTime = statics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime);
sampleHover = audio.Samples.Get($@"UI/generic-hover{SampleSet.GetDescription()}");
}
protected override bool OnHover(HoverEvent e)
{
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
if (enoughTimePassedSinceLastPlayback)
{
sampleHover?.Play();
lastPlaybackTime.Value = Time.Current;
}
return base.OnHover(e);
}
}
public enum HoverSampleSet
{
[Description("")]
Loud,
[Description("-soft")]
Normal,
[Description("-softer")]
Soft
}
}
|
mit
|
C#
|
85a17ced68c26cc62c1c49b6e9e7604fd5283ed3
|
Fix commit 1d3574ad39f7dceb1f27063df92561492869aedf
|
StockSharp/StockSharp
|
Messages/ProcessSuspendedMessage.cs
|
Messages/ProcessSuspendedMessage.cs
|
namespace StockSharp.Messages
{
using System;
using System.Runtime.Serialization;
/// <summary>
/// Process suspended action.
/// </summary>
[DataContract]
[Serializable]
public class ProcessSuspendedMessage : Message
{
/// <summary>
/// Additional argument.
/// </summary>
[DataMember]
public object Arg { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ProcessSuspendedMessage"/>.
/// </summary>
public ProcessSuspendedMessage()
: base(MessageTypes.ProcessSuspended)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ProcessSuspendedMessage"/>.
/// </summary>
/// <param name="adapter">Adapter.</param>
/// <param name="arg">Additional argument.</param>
public ProcessSuspendedMessage(IMessageAdapter adapter, object arg = default)
: this()
{
this.LoopBack(adapter);
Arg = arg;
}
/// <summary>
/// Create a copy of <see cref="ProcessSuspendedMessage"/>.
/// </summary>
/// <returns>Copy.</returns>
public override Message Clone() => new ProcessSuspendedMessage(Adapter, Arg);
}
}
|
namespace StockSharp.Messages
{
/// <summary>
/// Process suspended action.
/// </summary>
public class ProcessSuspendedMessage : Message
{
/// <summary>
/// Additional argument.
/// </summary>
public object Arg { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ProcessSuspendedMessage"/>.
/// </summary>
/// <param name="adapter">Adapter.</param>
/// <param name="arg">Additional argument.</param>
public ProcessSuspendedMessage(IMessageAdapter adapter, object arg = default)
: base(MessageTypes.ProcessSuspended)
{
this.LoopBack(adapter);
Arg = arg;
}
/// <summary>
/// Create a copy of <see cref="ProcessSuspendedMessage"/>.
/// </summary>
/// <returns>Copy.</returns>
public override Message Clone() => new ProcessSuspendedMessage(Adapter, Arg);
}
}
|
apache-2.0
|
C#
|
3568c5b183a9eb3e5b199938a6a5274509068b0e
|
Adjust tests to MySqlConnector 1.4.0-beta.4.
|
PomeloFoundation/Pomelo.EntityFrameworkCore.MySql,PomeloFoundation/Pomelo.EntityFrameworkCore.MySql
|
test/EFCore.MySql.FunctionalTests/TwoDatabasesMySqlTest.cs
|
test/EFCore.MySql.FunctionalTests/TwoDatabasesMySqlTest.cs
|
using Microsoft.EntityFrameworkCore;
using Pomelo.EntityFrameworkCore.MySql.FunctionalTests.TestUtilities;
using Pomelo.EntityFrameworkCore.MySql.Tests;
using Xunit;
namespace Pomelo.EntityFrameworkCore.MySql.FunctionalTests
{
public class TwoDatabasesMySqlTest : TwoDatabasesTestBase, IClassFixture<MySqlFixture>
{
public TwoDatabasesMySqlTest(MySqlFixture fixture)
: base(fixture)
{
}
protected new MySqlFixture Fixture
=> (MySqlFixture)base.Fixture;
protected override DbContextOptionsBuilder CreateTestOptions(
DbContextOptionsBuilder optionsBuilder, bool withConnectionString = false)
=> withConnectionString
? optionsBuilder.UseMySql(DummyConnectionString, AppConfig.ServerVersion)
: optionsBuilder.UseMySql(AppConfig.ServerVersion);
protected override TwoDatabasesWithDataContext CreateBackingContext(string databaseName)
=> new TwoDatabasesWithDataContext(Fixture.CreateOptions(MySqlTestStore.Create(databaseName)));
protected override string DummyConnectionString { get; } = "Server=localhost;Database=DoesNotExist;Allow User Variables=True;Use Affected Rows=False";
}
}
|
using Microsoft.EntityFrameworkCore;
using Pomelo.EntityFrameworkCore.MySql.FunctionalTests.TestUtilities;
using Pomelo.EntityFrameworkCore.MySql.Tests;
using Xunit;
namespace Pomelo.EntityFrameworkCore.MySql.FunctionalTests
{
public class TwoDatabasesMySqlTest : TwoDatabasesTestBase, IClassFixture<MySqlFixture>
{
public TwoDatabasesMySqlTest(MySqlFixture fixture)
: base(fixture)
{
}
protected new MySqlFixture Fixture
=> (MySqlFixture)base.Fixture;
protected override DbContextOptionsBuilder CreateTestOptions(
DbContextOptionsBuilder optionsBuilder, bool withConnectionString = false)
=> withConnectionString
? optionsBuilder.UseMySql(DummyConnectionString, AppConfig.ServerVersion)
: optionsBuilder.UseMySql(AppConfig.ServerVersion);
protected override TwoDatabasesWithDataContext CreateBackingContext(string databaseName)
=> new TwoDatabasesWithDataContext(Fixture.CreateOptions(MySqlTestStore.Create(databaseName)));
protected override string DummyConnectionString { get; } = "Server=localhost;Database=DoesNotExist;AllowUserVariables=True;Use Affected Rows=False";
}
}
|
mit
|
C#
|
088787e8b79d61981eccc7d8fd2d10af3726bc21
|
Implement ISpan with JsonSyntax.
|
PenguinF/sandra-three
|
Eutherion/Shared/Text/Json/JsonSyntax.cs
|
Eutherion/Shared/Text/Json/JsonSyntax.cs
|
#region License
/*********************************************************************************
* JsonSyntax.cs
*
* Copyright (c) 2004-2019 Henk Nicolai
*
* 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
namespace Eutherion.Text.Json
{
/// <summary>
/// Represents a context sensitive node in an abstract json syntax tree.
/// </summary>
public abstract class JsonSyntax : ISpan
{
/// <summary>
/// Gets the length of the text span corresponding with this node.
/// </summary>
public abstract int Length { get; }
}
}
|
#region License
/*********************************************************************************
* JsonSyntax.cs
*
* Copyright (c) 2004-2019 Henk Nicolai
*
* 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
namespace Eutherion.Text.Json
{
/// <summary>
/// Represents a context sensitive node in an abstract json syntax tree.
/// </summary>
public abstract class JsonSyntax
{
}
}
|
apache-2.0
|
C#
|
e149e07703ab36d91dab2b8235dfc30998ab45b0
|
Fix cross plattform issue with drive info method
|
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
|
src/Arkivverket.Arkade.Core/Util/SystemInfo.cs
|
src/Arkivverket.Arkade.Core/Util/SystemInfo.cs
|
using System;
using System.IO;
using System.Linq;
using Arkivverket.Arkade.Core.Base;
namespace Arkivverket.Arkade.Core.Util
{
public static class SystemInfo
{
public static long GetAvailableDiskSpaceInBytes()
{
return GetAvailableDiskSpaceInBytes(ArkadeProcessingArea.RootDirectory.FullName);
}
public static long GetTotalDiskSpaceInBytes()
{
return GetTotalDiskSpaceInBytes(ArkadeProcessingArea.RootDirectory.FullName);
}
public static long GetAvailableDiskSpaceInBytes(string directory)
{
return GetDirectoryDriveInfo(directory).AvailableFreeSpace;
}
public static long GetTotalDiskSpaceInBytes(string directory)
{
return GetDirectoryDriveInfo(directory).TotalSize;
}
public static string GetDotNetClrVersion()
{
return Environment.Version.ToString();
}
private static DriveInfo GetDirectoryDriveInfo(string directory)
{
string fullyQualifiedDirectoryPath = // TODO: Uncomment below line when on .NET Standard 2.1 (reducing IO)
/*Path.IsPathFullyQualified(directory) ? directory :*/ Path.GetFullPath(directory);
DriveInfo directoryDrive = DriveInfo.GetDrives()
.OrderByDescending(drive => drive.Name.Length)
.First(drive => fullyQualifiedDirectoryPath.StartsWith(drive.Name));
return directoryDrive;
}
}
}
|
using System;
using System.IO;
using Arkivverket.Arkade.Core.Base;
namespace Arkivverket.Arkade.Core.Util
{
public static class SystemInfo
{
public static long GetAvailableDiskSpaceInBytes()
{
return GetAvailableDiskSpaceInBytes(ArkadeProcessingArea.RootDirectory.FullName);
}
public static long GetTotalDiskSpaceInBytes()
{
return GetTotalDiskSpaceInBytes(ArkadeProcessingArea.RootDirectory.FullName);
}
public static long GetAvailableDiskSpaceInBytes(string directory)
{
return GetDirectoryDriveInfo(directory).AvailableFreeSpace;
}
public static long GetTotalDiskSpaceInBytes(string directory)
{
return GetDirectoryDriveInfo(directory).TotalSize;
}
public static string GetDotNetClrVersion()
{
return Environment.Version.ToString();
}
private static DriveInfo GetDirectoryDriveInfo(string directory)
{
string fullyQualifiedPath = Path.GetFullPath(directory);
// TODO: Use below line when on .NET Standard 2.1 (reducing IO)
//string fullyQualifiedPath = Path.IsPathFullyQualified(directory) ? directory : Path.GetFullPath(directory);
string directoryPathRoot = Path.GetPathRoot(fullyQualifiedPath);
return new DriveInfo(directoryPathRoot);
}
}
}
|
agpl-3.0
|
C#
|
8e541d8b20a3b3baac6e950482fe52a1b643f71f
|
Add version to test mock settings
|
dukemiller/anime-downloader
|
anime-downloader.Tests/Services/MockXmlSettingsService.cs
|
anime-downloader.Tests/Services/MockXmlSettingsService.cs
|
using System;
using System.Collections.Generic;
using anime_downloader.Models;
using anime_downloader.Models.Configurations;
using anime_downloader.Services.Interfaces;
namespace anime_downloader.Tests.Services
{
public class MockXmlSettingsService: ISettingsService
{
public PathConfiguration PathConfig { get; set; } = new PathConfiguration();
public FlagConfiguration FlagConfig { get; set; } = new FlagConfiguration();
public MyAnimeListConfiguration MyAnimeListConfig { get; set; } = new MyAnimeListConfiguration();
public VersionCheck Version { get; set; }
public string SortBy { get; set; } = "";
public string FilterBy { get; set; } = "";
public List<string> Subgroups { get; set; } = new List<string>();
public List<Anime> Animes { get; set; } = new List<Anime>();
public bool CrucialDirectoriesExist() => true;
public void Save() {}
public DateTime UpdateCheckDelay { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using anime_downloader.Models;
using anime_downloader.Models.Configurations;
using anime_downloader.Services.Interfaces;
namespace anime_downloader.Tests.Services
{
public class MockXmlSettingsService: ISettingsService
{
public PathConfiguration PathConfig { get; set; } = new PathConfiguration();
public FlagConfiguration FlagConfig { get; set; } = new FlagConfiguration();
public MyAnimeListConfiguration MyAnimeListConfig { get; set; } = new MyAnimeListConfiguration();
public string SortBy { get; set; } = "";
public string FilterBy { get; set; } = "";
public List<string> Subgroups { get; set; } = new List<string>();
public List<Anime> Animes { get; set; } = new List<Anime>();
public bool CrucialDirectoriesExist() => true;
public void Save() {}
public DateTime UpdateCheckDelay { get; set; }
}
}
|
apache-2.0
|
C#
|
d4a10dc2029197e08083bd2b6561b17972e81a8b
|
Bump minor version number
|
mdsol/Medidata.ZipkinTracerModule
|
src/Medidata.ZipkinTracer.Core/Properties/AssemblyInfo.cs
|
src/Medidata.ZipkinTracer.Core/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("Medidata.ZipkinTracer.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("Medidata Solutions, Inc.")]
[assembly: AssemblyProduct("Medidata.ZipkinTracer.Core")]
[assembly: AssemblyCopyright("Copyright © Medidata Solutions, Inc. 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
// 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("dfbe97d6-8b81-4bee-b2ce-23ef0f4d9953")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: InternalsVisibleTo("Medidata.ZipkinTracer.Core.Test")]
|
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("Medidata.ZipkinTracer.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Medidata Solutions Inc")]
[assembly: AssemblyProduct("Medidata.ZipkinTracer.Core")]
[assembly: AssemblyCopyright("Copyright © Medidata Solutions Inc 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("dfbe97d6-8b81-4bee-b2ce-23ef0f4d9953")]
// 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.5")]
[assembly: AssemblyFileVersion("1.0.5")]
[assembly: AssemblyInformationalVersion("1.0.5")]
[assembly: InternalsVisibleTo("Medidata.ZipkinTracer.Core.Test")]
|
mit
|
C#
|
7bfe95a7de5892d38242eb0d4a045f91fc2bc350
|
Allow all characters for password fields
|
SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers
|
src/SFA.DAS.EmployerUsers.Web/Models/RegisterViewModel.cs
|
src/SFA.DAS.EmployerUsers.Web/Models/RegisterViewModel.cs
|
using System.Web.Mvc;
namespace SFA.DAS.EmployerUsers.Web.Models
{
public class RegisterViewModel :ViewModelBase
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
[AllowHtml]
public string Password { get; set; }
[AllowHtml]
public string ConfirmPassword { get; set; }
public bool HasAcceptedTermsAndConditions { get; set; }
public string ReturnUrl { get; set; }
public string GeneralError => GetErrorMessage("");
public string FirstNameError => GetErrorMessage(nameof(FirstName));
public string LastNameError => GetErrorMessage(nameof(LastName));
public string EmailError => GetErrorMessage(nameof(Email));
public string PasswordError => GetErrorMessage(nameof(Password));
public string ConfirmPasswordError => GetErrorMessage(nameof(ConfirmPassword));
public string HasAcceptedTermsAndConditionsError => GetErrorMessage(nameof(HasAcceptedTermsAndConditions));
}
}
|
namespace SFA.DAS.EmployerUsers.Web.Models
{
public class RegisterViewModel :ViewModelBase
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string Password { get; set; }
public string ConfirmPassword { get; set; }
public bool HasAcceptedTermsAndConditions { get; set; }
public string ReturnUrl { get; set; }
public string GeneralError => GetErrorMessage("");
public string FirstNameError => GetErrorMessage(nameof(FirstName));
public string LastNameError => GetErrorMessage(nameof(LastName));
public string EmailError => GetErrorMessage(nameof(Email));
public string PasswordError => GetErrorMessage(nameof(Password));
public string ConfirmPasswordError => GetErrorMessage(nameof(ConfirmPassword));
public string HasAcceptedTermsAndConditionsError => GetErrorMessage(nameof(HasAcceptedTermsAndConditions));
}
}
|
mit
|
C#
|
1133c6b074f5ae349b1f6c2425bfbf6ca95659c3
|
use in-memory store as default for sample.
|
tangxuehua/equeue,tangxuehua/equeue,Aaron-Liu/equeue,geffzhang/equeue,Aaron-Liu/equeue,tangxuehua/equeue,geffzhang/equeue
|
src/Samples/QuickStart/QuickStart.BrokerServer/Program.cs
|
src/Samples/QuickStart/QuickStart.BrokerServer/Program.cs
|
using System;
using System.Linq;
using ECommon.Autofac;
using ECommon.Components;
using ECommon.Configurations;
using ECommon.JsonNet;
using ECommon.Log4Net;
using EQueue.Broker;
using EQueue.Configurations;
namespace QuickStart.BrokerServer
{
class Program
{
static void Main(string[] args)
{
InitializeEQueue();
BrokerController.Create().Start();
var queueService = ObjectContainer.Resolve<IQueueService>();
if (!queueService.GetAllTopics().Contains("SampleTopic"))
{
queueService.CreateTopic("SampleTopic", 4);
}
Console.ReadLine();
}
static void InitializeEQueue()
{
Configuration
.Create()
.UseAutofac()
.RegisterCommonComponents()
.UseLog4Net()
.UseJsonNet()
.RegisterEQueueComponents();
}
}
}
|
using System;
using System.Linq;
using ECommon.Autofac;
using ECommon.Components;
using ECommon.Configurations;
using ECommon.JsonNet;
using ECommon.Log4Net;
using EQueue.Broker;
using EQueue.Configurations;
namespace QuickStart.BrokerServer
{
class Program
{
static void Main(string[] args)
{
InitializeEQueue();
BrokerController.Create().Start();
var queueService = ObjectContainer.Resolve<IQueueService>();
if (!queueService.GetAllTopics().Contains("SampleTopic"))
{
queueService.CreateTopic("SampleTopic", 4);
}
Console.ReadLine();
}
static void InitializeEQueue()
{
var connectionString = @"Data Source=(localdb)\Projects;Integrated Security=true;Initial Catalog=EQueue;Connect Timeout=30;Min Pool Size=10;Max Pool Size=100";
var queueStoreSetting = new SqlServerQueueStoreSetting
{
ConnectionString = connectionString
};
var messageStoreSetting = new SqlServerMessageStoreSetting
{
ConnectionString = connectionString,
DeleteMessageHourOfDay = -1,
DeleteMessageInterval = 1000 * 30
};
var offsetManagerSetting = new SqlServerOffsetManagerSetting
{
ConnectionString = connectionString
};
Configuration
.Create()
.UseAutofac()
.RegisterCommonComponents()
.UseLog4Net()
.UseJsonNet()
.RegisterEQueueComponents()
.UseSqlServerQueueStore(queueStoreSetting)
.UseSqlServerMessageStore(messageStoreSetting)
.UseSqlServerOffsetManager(offsetManagerSetting);
}
}
}
|
mit
|
C#
|
f2bf7288e9c4645814d036e174fb79912ca7604f
|
删除Senparc.Weixin.MP.AppStore.WeixinSex枚举,合并到Senparc.Weixin.Enums.WeixinSex
|
lishewen/WeiXinMPSDK,mc7246/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,lishewen/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,mc7246/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,mc7246/WeiXinMPSDK,lishewen/WeiXinMPSDK
|
src/Senparc.Weixin.MP/Senparc.Weixin.MP/AppStore/Enums.cs
|
src/Senparc.Weixin.MP/Senparc.Weixin.MP/AppStore/Enums.cs
|
#region Apache License Version 2.0
/*----------------------------------------------------------------
Copyright 2018 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd.
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.
Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md
----------------------------------------------------------------*/
#endregion Apache License Version 2.0
/*----------------------------------------------------------------
Copyright (C) 2018 Senparc
文件名:Enums.cs
文件功能描述:返回结果枚举类型
创建标识:Senparc - 20150319
----------------------------------------------------------------*/
namespace Senparc.Weixin.MP.AppStore
{
/// <summary>
/// P2P返回结果类型
/// </summary>
public enum AppResultKind
{
成功 = 0,
账户验证失败 = -1000,
账户被停用 = -2000,
账户被停用_尚未通过审核 = -2001,
账户被停用_已关闭 = -2002,
账户被停用_状态异常 = -2003,
包含违法信息 = -3000,
执行过程发生异常 = -4000,
执行过程发生异常_API地址错误 = -4001,
执行过程发生异常_积分不足 = -4002,
操作用户信息失败 = -5000,
操作用户信息失败_用户不存在 = -5001,
}
///// <summary>
///// 性别
///// </summary>
//public enum WeixinSex
//{
// 未设置 = 0,
// 男 = 1,
// 女 = 2,
//}
}
|
#region Apache License Version 2.0
/*----------------------------------------------------------------
Copyright 2018 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd.
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.
Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md
----------------------------------------------------------------*/
#endregion Apache License Version 2.0
/*----------------------------------------------------------------
Copyright (C) 2018 Senparc
文件名:Enums.cs
文件功能描述:返回结果枚举类型
创建标识:Senparc - 20150319
----------------------------------------------------------------*/
namespace Senparc.Weixin.MP.AppStore
{
/// <summary>
/// P2P返回结果类型
/// </summary>
public enum AppResultKind
{
成功 = 0,
账户验证失败 = -1000,
账户被停用 = -2000,
账户被停用_尚未通过审核 = -2001,
账户被停用_已关闭 = -2002,
账户被停用_状态异常 = -2003,
包含违法信息 = -3000,
执行过程发生异常 = -4000,
执行过程发生异常_API地址错误 = -4001,
执行过程发生异常_积分不足 = -4002,
操作用户信息失败 = -5000,
操作用户信息失败_用户不存在 = -5001,
}
/// <summary>
/// 性别
/// </summary>
public enum WeixinSex
{
未设置 = 0,
男 = 1,
女 = 2,
}
}
|
apache-2.0
|
C#
|
1b08ea3be24985c624d5f0a2e19460549ad2893e
|
Load levels with SceneManager instead of Application for Unity 5.3+
|
loicteixeira/gj-unity-api
|
Assets/Tests/Load/LoadTest.cs
|
Assets/Tests/Load/LoadTest.cs
|
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class LoadTest : MonoBehaviour
{
public void SignInButtonClicked()
{
GameJolt.UI.Manager.Instance.ShowSignIn((bool success) => {
if (success)
{
Debug.Log("Logged In");
}
else
{
Debug.Log("Dismissed");
}
});
}
public void IsSignedInButtonClicked() {
bool isSignedIn = GameJolt.API.Manager.Instance.CurrentUser != null;
if (isSignedIn) {
Debug.Log("Signed In");
}
else {
Debug.Log("Not Signed In");
}
}
public void LoadSceneButtonClicked(string sceneName) {
Debug.Log("Loading Scene " + sceneName);
#if UNITY_5_0 || UNITY_5_1 || UNITY_5_2
Application.LoadLevel(sceneName);
#else
UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName);
#endif
}
}
|
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class LoadTest : MonoBehaviour
{
public void SignInButtonClicked()
{
GameJolt.UI.Manager.Instance.ShowSignIn((bool success) => {
if (success)
{
Debug.Log("Logged In");
}
else
{
Debug.Log("Dismissed");
}
});
}
public void IsSignedInButtonClicked() {
bool isSignedIn = GameJolt.API.Manager.Instance.CurrentUser != null;
if (isSignedIn) {
Debug.Log("Signed In");
}
else {
Debug.Log("Not Signed In");
}
}
public void LoadSceneButtonClicked(string sceneName) {
Debug.Log("Loading Scene " + sceneName);
Application.LoadLevel(sceneName);
}
}
|
mit
|
C#
|
edda8fd76f56226d11f65cc9b6bb9f10ecb49b58
|
tweak email sender headers
|
ninianne98/CarrotCakeCMS,ninianne98/CarrotCakeCMS,ninianne98/CarrotCakeCMS
|
CMSBaseClasses/EmailSender.cs
|
CMSBaseClasses/EmailSender.cs
|
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Net;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Carrotware.CMS.UI.Base {
public class EmailSender {
public Dictionary<string, string> ContentPlaceholders { get; set; }
private string CurrentDLLVersion {
get { return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); }
}
public string Recepient { get; set; }
public Control WebControl { get; set; }
public string TemplateFile { get; set; }
public string Subject { get; set; }
public string From { get; set; }
public string Body { get; set; }
public bool IsHTML { get; set; }
public static string SmtpSender { get { return ConfigurationManager.AppSettings["CarrotSenderEmail"].ToString(); } }
public static string SmtpHost { get { return ConfigurationManager.AppSettings["CarrotSmtpHost"].ToString(); } }
public static string SmtpPassword { get { return ConfigurationManager.AppSettings["CarrotSmtpPassword"].ToString(); } }
public static string SmtpUsername { get { return ConfigurationManager.AppSettings["CarrotSmtpEmail"].ToString(); } }
public EmailSender() {
ContentPlaceholders = new Dictionary<string, string>();
}
public void SendMail() {
MailDefinition mailDefinition = new MailDefinition {
BodyFileName = TemplateFile,
From = From,
Subject = Subject,
IsBodyHtml = IsHTML
};
if (!string.IsNullOrEmpty(TemplateFile)) {
string sFullFilePath = HttpContext.Current.Server.MapPath(TemplateFile);
if (File.Exists(sFullFilePath)) {
using (StreamReader sr = new StreamReader(sFullFilePath)) {
Body = sr.ReadToEnd();
}
}
}
MailMessage mailMessage = null;
if (!string.IsNullOrEmpty(Body)) {
mailMessage = mailDefinition.CreateMailMessage(Recepient, ContentPlaceholders, Body, WebControl);
} else {
mailMessage = mailDefinition.CreateMailMessage(Recepient, ContentPlaceholders, WebControl);
}
mailMessage.Priority = MailPriority.Normal;
mailMessage.Headers.Add("X-Application", "CarrotCake CMS " + CurrentDLLVersion);
mailMessage.Headers.Add("X-Originating-IP", HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString());
SmtpClient client = new SmtpClient();
if (!string.IsNullOrEmpty(SmtpPassword)) {
client.Credentials = new NetworkCredential(SmtpUsername, SmtpPassword);
} else {
client.Credentials = new NetworkCredential();
}
client.Send(mailMessage);
}
}
}
|
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Net;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Carrotware.CMS.UI.Base {
public class EmailSender {
public Dictionary<string, string> ContentPlaceholders { get; set; }
public string Recepient { get; set; }
public Control WebControl { get; set; }
public string TemplateFile { get; set; }
public string Subject { get; set; }
public string From { get; set; }
public string Body { get; set; }
public bool IsHTML { get; set; }
public static string SmtpSender { get { return ConfigurationManager.AppSettings["CarrotSenderEmail"].ToString(); } }
public static string SmtpHost { get { return ConfigurationManager.AppSettings["CarrotSmtpHost"].ToString(); } }
public static string SmtpPassword { get { return ConfigurationManager.AppSettings["CarrotSmtpPassword"].ToString(); } }
public static string SmtpUsername { get { return ConfigurationManager.AppSettings["CarrotSmtpEmail"].ToString(); } }
public EmailSender() {
ContentPlaceholders = new Dictionary<string, string>();
}
public void SendMail() {
MailDefinition mailDefinition = new MailDefinition {
BodyFileName = TemplateFile,
From = From,
Subject = Subject,
IsBodyHtml = IsHTML
};
if (!string.IsNullOrEmpty(TemplateFile)) {
string sFullFilePath = HttpContext.Current.Server.MapPath(TemplateFile);
if (File.Exists(sFullFilePath)) {
using (StreamReader sr = new StreamReader(sFullFilePath)) {
Body = sr.ReadToEnd();
}
}
}
MailMessage mailMessage = null;
if (!string.IsNullOrEmpty(Body)) {
mailMessage = mailDefinition.CreateMailMessage(Recepient, ContentPlaceholders, Body, WebControl);
} else {
mailMessage = mailDefinition.CreateMailMessage(Recepient, ContentPlaceholders, WebControl);
}
SmtpClient client = new SmtpClient();
if (!string.IsNullOrEmpty(SmtpPassword)) {
client.Credentials = new NetworkCredential(SmtpUsername, SmtpPassword);
} else {
client.Credentials = new NetworkCredential();
}
client.Send(mailMessage);
}
}
}
|
mit
|
C#
|
e038ae482035f5e5586eff035b5efc1b830000bf
|
fix variantize (#9348)
|
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
|
Content.Server/Administration/Commands/VariantizeCommand.cs
|
Content.Server/Administration/Commands/VariantizeCommand.cs
|
using Content.Shared.Administration;
using Content.Shared.Maps;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Random;
namespace Content.Server.Administration.Commands;
[AdminCommand(AdminFlags.Mapping)]
public sealed class VariantizeCommand : IConsoleCommand
{
public string Command => "variantize";
public string Description => Loc.GetString("variantize-command-description");
public string Help => Loc.GetString("variantize-command-help-text");
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
return;
}
var entMan = IoCManager.Resolve<IEntityManager>();
var random = IoCManager.Resolve<IRobustRandom>();
if (!EntityUid.TryParse(args[0], out var euid))
{
shell.WriteError($"Failed to parse euid '{args[0]}'.");
return;
}
if (!entMan.TryGetComponent(euid, out IMapGridComponent? gridComp))
{
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return;
}
foreach (var tile in gridComp.Grid.GetAllTiles())
{
var def = tile.GetContentTileDefinition();
var newTile = new Tile(tile.Tile.TypeId, tile.Tile.Flags, random.Pick(def.PlacementVariants));
gridComp.Grid.SetTile(tile.GridIndices, newTile);
}
}
}
|
using Content.Shared.Administration;
using Content.Shared.Maps;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Random;
namespace Content.Server.Administration.Commands;
[AdminCommand(AdminFlags.Mapping)]
public sealed class VariantizeCommand : IConsoleCommand
{
public string Command => "variantize";
public string Description => Loc.GetString("variantize-command-description");
public string Help => Loc.GetString("variantize-command-help-text");
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
return;
}
var entMan = IoCManager.Resolve<IEntityManager>();
var random = IoCManager.Resolve<IRobustRandom>();
if (EntityUid.TryParse(args[0], out var euid))
{
shell.WriteError($"Failed to parse euid '{args[0]}'.");
return;
}
if (!entMan.TryGetComponent(euid, out IMapGridComponent? gridComp))
{
shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
return;
}
foreach (var tile in gridComp.Grid.GetAllTiles())
{
var def = tile.GetContentTileDefinition();
var newTile = new Tile(tile.Tile.TypeId, tile.Tile.Flags, random.Pick(def.PlacementVariants));
gridComp.Grid.SetTile(tile.GridIndices, newTile);
}
}
}
|
mit
|
C#
|
1599ab78fb606afd22797ed20a4d241ec245df16
|
Fix namespace
|
charlenni/Mapsui,charlenni/Mapsui
|
Mapsui/Extensions/ByteArrayExtensions.cs
|
Mapsui/Extensions/ByteArrayExtensions.cs
|
using System.Text;
namespace Mapsui.Extensions;
/// <summary> Byte Array Extensions </summary>
public static class ByteArrayExtensions
{
/// <summary> true if is Xml </summary>
/// <param name="buffer">buffer</param>
/// <returns>true if is xml</returns>
public static bool IsXml(this byte[] buffer)
{
if (buffer.Length == 0)
{
return false;
}
if (Encoding.UTF8.GetString(buffer, 0, 1).ToLowerInvariant().Equals("<"))
{
return true;
}
return false;
}
/// <summary> true if is Xml </summary>
/// <param name="buffer">buffer</param>
/// <returns>true if is xml</returns>
public static bool IsSkp(this byte[] buffer)
{
if (buffer.Length == 0)
{
return false;
}
if (Encoding.UTF8.GetString(buffer, 0, 4).ToLowerInvariant().Equals("skia"))
{
return true;
}
return false;
}
}
|
using System.Text;
/// <summary> Byte Array Extensions </summary>
public static class ByteArrayExtensions
{
/// <summary> true if is Xml </summary>
/// <param name="buffer">buffer</param>
/// <returns>true if is xml</returns>
public static bool IsXml(this byte[] buffer)
{
if (buffer.Length == 0)
{
return false;
}
if (Encoding.UTF8.GetString(buffer, 0, 1).ToLowerInvariant().Equals("<"))
{
return true;
}
return false;
}
/// <summary> true if is Xml </summary>
/// <param name="buffer">buffer</param>
/// <returns>true if is xml</returns>
public static bool IsSkp(this byte[] buffer)
{
if (buffer.Length == 0)
{
return false;
}
if (Encoding.UTF8.GetString(buffer, 0, 4).ToLowerInvariant().Equals("skia"))
{
return true;
}
return false;
}
}
|
mit
|
C#
|
19b310474274ee5da3387e76550ec890b2dba1b3
|
add EnvironmentVariables dsl
|
Pondidum/Stronk,Pondidum/Stronk
|
src/Stronk/ConfigurationSourcing/Extensions.cs
|
src/Stronk/ConfigurationSourcing/Extensions.cs
|
using Stronk.Dsl;
namespace Stronk.ConfigurationSourcing
{
public static class Extensions
{
public static StronkConfig AppSettings(this SourceExpression self)
{
return self.Source(new AppConfigSource());
}
public static StronkConfig EnvironmentVariables(this SourceExpression self, string prefix = null)
{
return self.Source(new EnvironmentVariableSource(prefix));
}
}
}
|
using Stronk.Dsl;
namespace Stronk.ConfigurationSourcing
{
public static class Extensions
{
public static StronkConfig AppSettings(this SourceExpression self)
{
return self.Source(new AppConfigSource());
}
}
}
|
lgpl-2.1
|
C#
|
f5ae330e4c85fbfcb944c1d4ef0d849204a49f47
|
add browse
|
tparnell8/UntappedWidget,tparnell8/UntappedWidget
|
src/UntappedWidgetGenerator.Web/IndexModule.cs
|
src/UntappedWidgetGenerator.Web/IndexModule.cs
|
using System.Collections.Generic;
using UntappedWidgetGenerator.Model;
namespace UntappedWidgetGenerator.Web
{
using Nancy;
public class IndexModule : NancyModule
{
public IndexModule()
{
Get["/"] = x => { return View["Views/Index/Index.cshtml", "tparnell"]; };
Get["/{username}/browse"] = x => { return View["Views/Index/Index.cshtml", (string)x.username]; };
Get["/{username}"] = parameters =>
{
var info = new UntappedRepository().Get(parameters.username);
return View["Profile", info];
};
}
}
}
|
using System.Collections.Generic;
using UntappedWidgetGenerator.Model;
namespace UntappedWidgetGenerator.Web
{
using Nancy;
public class IndexModule : NancyModule
{
public IndexModule()
{
Get["/"] = x => { return View["Views/Index/Index.cshtml", "tparnell"]; };
Get["/{username}"] = parameters =>
{
var info = new UntappedRepository().Get(parameters.username);
return View["Profile", info];
};
}
}
}
|
mit
|
C#
|
0b8a2bba87004aed98b8de28e9cae02fadf70e7d
|
Add a way to get the list of permanent variables from a set of assignments representing a clause
|
Logicalshift/Reason
|
LogicalShift.Reason/Solvers/PermanentVariableAssignments.cs
|
LogicalShift.Reason/Solvers/PermanentVariableAssignments.cs
|
using LogicalShift.Reason.Api;
using System;
using System.Collections.Generic;
using System.Linq;
namespace LogicalShift.Reason.Solvers
{
/// <summary>
/// Methods for ordering assignments so that permanent variables are ordered first
/// </summary>
/// <remarks>
/// The ordering is arguments, permanent variables, then the rest. Arguments can thus
/// be bound to variables starting from 0 and permanent variables can be bound to the
/// set after the arguments.
/// </remarks>
public static class PermanentVariableAssignments
{
/// <summary>
/// Orders assignments so that the list of 'arguments' is first, followed by any assignments for 'permanent' variables, followed by any remaining assignments
/// </summary>
public static IEnumerable<IAssignmentLiteral> OrderPermanentVariablesFirst(this IEnumerable<IAssignmentLiteral> assignments, int numArguments, IEnumerable<ILiteral> permanentVariables)
{
// Convert the list of permanent variables into a hash set
var isPermanent = permanentVariables as HashSet<ILiteral> ?? new HashSet<ILiteral>(permanentVariables);
// ICollections can be iterated over multiple times
var assignmentCollection = assignments as ICollection<IAssignmentLiteral> ?? assignments.ToArray();
// Perform the ordering
var arguments = assignmentCollection.Take(numArguments);
var remainder = assignmentCollection.Skip(numArguments);
var permanentFirst = remainder.OrderBy(assignment => isPermanent.Contains(assignment.Value) ? 0 : 1);
// Result is arguments followed by the list with the permanent variables first
return arguments.Concat(permanentFirst);
}
/// <summary>
/// Returns the names of the variables that get assigned in a list of assignments
/// </summary>
public static IEnumerable<ILiteral> VariablesAssigned(this IEnumerable<IAssignmentLiteral> assignments)
{
return assignments
.Where(assign => assign.Value.UnificationKey == null)
.Select(assign => assign.Value);
}
/// <summary>
/// Given a list of predicate assignment lists (representing the assignments for the initial predicate and
/// the clauses, in order), finds the names of the 'permanent' variables: that is, the list of variables
/// that are used in more than one clause.
/// </summary>
public static IEnumerable<ILiteral> PermanentVariables(this IEnumerable<PredicateAssignmentList> assignmentLists)
{
// The predicate and the first clause don't have a call between them, so variables used in both places
// aren't considered to be permanent
var usedVariables = new HashSet<ILiteral>();
var permanentVariabels = new HashSet<ILiteral>();
int pos = 0;
foreach (var assignmentList in assignmentLists)
{
var assignmentVariables = VariablesAssigned(assignmentList.Assignments).ToArray();
// After the predicate (pos = 0) and first clause (pos = 1), re-used variables need to be marked as permanent
if (pos > 1)
{
permanentVariabels.UnionWith(assignmentVariables.Where(variable => usedVariables.Contains(variable)));
}
// Mark this set of variables as used
usedVariables.UnionWith(assignmentVariables);
++pos;
}
return permanentVariabels;
}
}
}
|
using LogicalShift.Reason.Api;
using System;
using System.Collections.Generic;
using System.Linq;
namespace LogicalShift.Reason.Solvers
{
/// <summary>
/// Methods for ordering assignments so that permanent variables are ordered first
/// </summary>
/// <remarks>
/// The ordering is arguments, permanent variables, then the rest. Arguments can thus
/// be bound to variables starting from 0 and permanent variables can be bound to the
/// set after the arguments.
/// </remarks>
public static class PermanentVariableAssignments
{
/// <summary>
/// Orders assignments so that the list of 'arguments' is first, followed by any assignments for 'permanent' variables, followed by any remaining assignments
/// </summary>
public static IEnumerable<IAssignmentLiteral> OrderPermanentVariablesFirst(this IEnumerable<IAssignmentLiteral> assignments, int numArguments, IEnumerable<ILiteral> permanentVariables)
{
// Convert the list of permanent variables into a hash set
var isPermanent = permanentVariables as HashSet<ILiteral> ?? new HashSet<ILiteral>(permanentVariables);
// ICollections can be iterated over multiple times
var assignmentCollection = assignments as ICollection<IAssignmentLiteral> ?? assignments.ToArray();
// Perform the ordering
var arguments = assignmentCollection.Take(numArguments);
var remainder = assignmentCollection.Skip(numArguments);
var permanentFirst = remainder.OrderBy(assignment => isPermanent.Contains(assignment.Value) ? 0 : 1);
// Result is arguments followed by the list with the permanent variables first
return arguments.Concat(permanentFirst);
}
}
}
|
apache-2.0
|
C#
|
7f1f38ac73d1438c203c79d8364d897734cd0158
|
update seed data
|
tthiatma/Owpini
|
Owpini.EntityFramework/SeedData/OwpiniDbContextExtension.cs
|
Owpini.EntityFramework/SeedData/OwpiniDbContextExtension.cs
|
using Owpini.Core.Business;
using System;
using System.Collections.Generic;
namespace Owpini.EntityFramework.SeedData
{
public static class OwpiniDbContextExtension
{
public static void EnsureSeedDataForContext(this OwpiniDbContext context)
{
context.Businesses.RemoveRange(context.Businesses);
context.SaveChanges();
var businesses = new List<Business>()
{
new Business{
Id = new Guid("25320c5e-f58a-4b1f-b63a-8ee07a840bdf"),
Name = "Chipotle"
},
new Business{
Id = new Guid("a3749477-f823-4124-aa4a-fc9ad5e79cd6"),
Name = "In n Out"
},
new Business{
Id = new Guid("a3749477-f823-4124-aa4a-fc9ad5e79cd6"),
Name = "Panda Express"
}
};
context.Businesses.AddRange(businesses);
context.SaveChanges();
}
}
}
|
using Owpini.Core.Business;
using System;
using System.Collections.Generic;
namespace Owpini.EntityFramework.SeedData
{
public static class OwpiniDbContextExtension
{
public static void EnsureSeedDataForContext(this OwpiniDbContext context)
{
context.Businesses.RemoveRange(context.Businesses);
context.SaveChanges();
var businesses = new List<Business>()
{
new Business{
Id = new Guid("25320c5e-f58a-4b1f-b63a-8ee07a840bdf"),
Name = "Chipotle"
},
new Business{
Id = new Guid("a3749477-f823-4124-aa4a-fc9ad5e79cd6"),
Name = "In n Out"
}
};
context.Businesses.AddRange(businesses);
context.SaveChanges();
}
}
}
|
apache-2.0
|
C#
|
093bda437de7821b4bfd5bd86c7a8b5903aeedd9
|
fix IEnumerable implementation
|
acple/ParsecSharp
|
ParsecSharp/Data/Internal/Buffer.cs
|
ParsecSharp/Data/Internal/Buffer.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ParsecSharp.Internal
{
public sealed class Buffer<TToken> : IReadOnlyList<TToken>
{
private readonly TToken[] _buffer;
private readonly int _index;
private readonly Lazy<Buffer<TToken>> _next;
public TToken this[int index] => this._buffer[this._index + index];
public int Count { get; }
public Buffer<TToken> Next => this._next.Value;
public Buffer(TToken[] buffer, Func<Buffer<TToken>> next) : this(buffer, 0, buffer.Length, next)
{ }
public Buffer(TToken[] buffer, int index, int length, Func<Buffer<TToken>> next)
{
this._buffer = buffer;
this._index = index;
this.Count = length;
this._next = new Lazy<Buffer<TToken>>(next, false);
}
IEnumerator<TToken> IEnumerable<TToken>.GetEnumerator()
=> new ArraySegment<TToken>(this._buffer, this._index, this.Count).AsEnumerable().GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
=> this.AsEnumerable().GetEnumerator();
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ParsecSharp.Internal
{
public sealed class Buffer<TToken> : IReadOnlyList<TToken>
{
private readonly TToken[] _buffer;
private readonly int _index;
private readonly Lazy<Buffer<TToken>> _next;
public TToken this[int index] => this._buffer[this._index + index];
public int Count { get; }
public Buffer<TToken> Next => this._next.Value;
public Buffer(TToken[] buffer, Func<Buffer<TToken>> next) : this(buffer, 0, buffer.Length, next)
{ }
public Buffer(TToken[] buffer, int index, int length, Func<Buffer<TToken>> next)
{
this._buffer = buffer;
this._index = index;
this.Count = length;
this._next = new Lazy<Buffer<TToken>>(next, false);
}
IEnumerator<TToken> IEnumerable<TToken>.GetEnumerator()
=> new ArraySegment<TToken>(this._buffer, this._index, this.Count).AsEnumerable().GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
=> this._buffer.GetEnumerator();
}
}
|
mit
|
C#
|
8a5c4c361ef6541211092e7aeda2a93d9c6b6bea
|
fix compile error
|
eclaus/docs.particular.net,yuxuac/docs.particular.net,pedroreys/docs.particular.net,WojcikMike/docs.particular.net
|
Snippets/Snippets_5/Errors/ErrorQueueConfigurationSource.cs
|
Snippets/Snippets_5/Errors/ErrorQueueConfigurationSource.cs
|
using NServiceBus.Config;
using NServiceBus.Config.ConfigurationSource;
using System.Configuration;
using NServiceBus;
#region ErrorQueueConfigurationSource
public class ErrorQueueConfigurationSource : IConfigurationSource
{
public T GetConfiguration<T>() where T : class, new()
{
if (typeof(T) == typeof(MessageForwardingInCaseOfFaultConfig))
{
var errorConfig = new MessageForwardingInCaseOfFaultConfig
{
ErrorQueue = "error"
};
return errorConfig as T;
}
// To look at the app.config for other sections that's not defined in this method, otherwise return null.
return ConfigurationManager.GetSection(typeof(T).Name) as T;
}
}
#endregion
public class InjectProvideErrorQueueConfiguration
{
public void Init()
{
BusConfiguration busConfiguration = new BusConfiguration();
#region UseCustomConfigurationSourceForErrorQueueConfig
busConfiguration.CustomConfigurationSource(new ErrorQueueConfigurationSource());
#endregion
}
}
|
using NServiceBus.Config;
using NServiceBus.Config.ConfigurationSource;
using System.Configuration;
using NServiceBus;
#region ErrorQueueConfigurationSource
public class ErrorQueueConfigurationSource : IConfigurationSource
{
public T GetConfiguration<T>() where T : class, new()
{
if (typeof(T) == typeof(MessageForwardingInCaseOfFaultConfig))
{
var errorConfig = new MessageForwardingInCaseOfFaultConfig
{
ErrorQueue = "error"
};
return errorConfig as T;
}
// To look at the app.config for other sections that's not defined in this method, otherwise return null.
return ConfigurationManager.GetSection(typeof(T).Name) as T;
}
}
#endregion
public class InjectProvideErrorQueueConfiguration
{
public void Init()
{
#region UseCustomConfigurationSourceForErrorQueueConfig
Configure.With()
.CustomConfigurationSource(new ErrorQueueConfigurationSource());
#endregion
}
}
|
apache-2.0
|
C#
|
e76e5163ce5ccb59fabbff4bc12f8e0c3de6f210
|
Update SheetLevelInclusion.cs
|
smartsheet-platform/smartsheet-csharp-sdk,smartsheet-platform/smartsheet-csharp-sdk
|
main/Smartsheet/Api/Models/Inclusions/SheetLevelInclusion.cs
|
main/Smartsheet/Api/Models/Inclusions/SheetLevelInclusion.cs
|
// #[license]
// SmartsheetClient SDK for C#
// %%
// Copyright (C) 2014 SmartsheetClient
// %%
// 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.
// %[license]
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;
namespace Smartsheet.Api.Models
{
/// <summary>
/// Represents specific elements to include in a response.
/// </summary>
public enum SheetLevelInclusion
{
/// <summary>
/// Includes sheet-level and row-level discussions.
/// </summary>
DISCUSSIONS,
/// <summary>
/// Includes sheet-level and row-level attachments.
/// </summary>
ATTACHMENTS,
/// <summary>
/// Includes column, row, and cell formatting.
/// </summary>
FORMAT,
/// <summary>
/// Includes column filters and row.filteredOut attribute.
/// </summary>
FILTERS,
/// <summary>
/// Includes column filter definitions
/// </summary>
FILTER_DEFINITIONS,
/// <summary>
/// Includes the owner’s email address and user Id for each sheet.
/// </summary>
OWNER_INFO,
/// <summary>
/// Includes the source object indicating which sheet or template the sheet was created from, if any.
/// </summary>
SOURCE,
/// <summary>
/// Includes a permalink attribute for each row. A row permalink represents a direct link to the row in the Smartsheet application.
/// </summary>
ROW_PERMALINK,
/// <summary>
/// Includes columnType attribute in the row’s cells indicating the type of the column the cell resides in.
/// </summary>
COLUMN_TYPE,
/// <summary>
/// Includes createdBy and modifiedBy attributes on the row, indicating the row’s creator and last modifier.
/// </summary>
ROW_WRITER_INFO,
/// <summary>
/// object representation of cell value
/// </summary>
OBJECT_VALUE,
/// <summary>
/// cross sheet references
/// </summary>
CROSS_SHEET_REFERENCES
}
}
|
// #[license]
// SmartsheetClient SDK for C#
// %%
// Copyright (C) 2014 SmartsheetClient
// %%
// 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.
// %[license]
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;
namespace Smartsheet.Api.Models
{
/// <summary>
/// Represents specific elements to include in a response.
/// </summary>
public enum SheetLevelInclusion
{
/// <summary>
/// Includes sheet-level and row-level discussions.
/// </summary>
DISCUSSIONS,
/// <summary>
/// Includes sheet-level and row-level attachments.
/// </summary>
ATTACHMENTS,
/// <summary>
/// Includes column, row, and cell formatting.
/// </summary>
FORMAT,
/// <summary>
/// Includes column filters, and row.filteredOut attribute.
/// </summary>
FILTERS,
/// <summary>
/// Includes column filter definitions
/// </summary>
FILTER_DEFINITIONS,
/// <summary>
/// Includes the owner’s email address and user ID for each sheet.
/// </summary>
OWNER_INFO,
/// <summary>
/// Includes the source object indicating which sheet or template the sheet was created from, if any.
/// </summary>
SOURCE,
/// <summary>
/// Includes a permalink attribute for each Row. A Row permalink represents a direct link to the Row in the Smartsheet application.
/// </summary>
ROW_PERMALINK,
/// <summary>
/// Includes columnType attribute in the row’s cells indicating the type of the column the cell resides in.
/// </summary>
COLUMN_TYPE,
/// <summary>
/// Includes createdBy and modifiedBy attributes on the row, indicating the row’s creator, and last modifier.
/// </summary>
ROW_WRITER_INFO,
/// <summary>
/// object representation of cell value
/// </summary>
OBJECT_VALUE,
/// <summary>
/// cross sheet references
/// </summary>
CROSS_SHEET_REFERENCES
}
}
|
apache-2.0
|
C#
|
c00e8981befc5805c2a3e0cba307b758cbe86298
|
Add portable pdb table indices.
|
Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver
|
src/AsmResolver.PE/DotNet/Metadata/Tables/TableIndex.cs
|
src/AsmResolver.PE/DotNet/Metadata/Tables/TableIndex.cs
|
// Disable xmldoc warnings
#pragma warning disable 1591
namespace AsmResolver.PE.DotNet.Metadata.Tables
{
/// <summary>
/// Provides members defining all metadata tables that can be present in a tables stream.
/// </summary>
public enum TableIndex : byte
{
Module = 0,
TypeRef = 1,
TypeDef = 2,
FieldPtr = 3,
Field = 4,
MethodPtr = 5,
Method = 6,
ParamPtr = 7,
Param = 8,
InterfaceImpl = 9,
MemberRef = 10,
Constant = 11,
CustomAttribute = 12,
FieldMarshal = 13,
DeclSecurity = 14,
ClassLayout = 15,
FieldLayout = 16,
StandAloneSig = 17,
EventMap = 18,
EventPtr = 19,
Event = 20,
PropertyMap = 21,
PropertyPtr = 22,
Property = 23,
MethodSemantics = 24,
MethodImpl = 25,
ModuleRef = 26,
TypeSpec = 27,
ImplMap = 28,
FieldRva = 29,
EncLog = 30,
EncMap = 31,
Assembly = 32,
AssemblyProcessor = 33,
AssemblyOS = 34,
AssemblyRef = 35,
AssemblyRefProcessor = 36,
AssemblyRefOS = 37,
File = 38,
ExportedType = 39,
ManifestResource = 40,
NestedClass = 41,
GenericParam = 42,
MethodSpec = 43,
GenericParamConstraint = 44,
Document = 0x30,
MethodDebugInformation = 0x31,
LocalScope = 0x32,
LocalVariable = 0x33,
LocalConstant = 0x34,
ImportScope = 0x35,
StateMachineMethod = 0x36,
CustomDebugInformation = 0x37,
Max = CustomDebugInformation + 1,
String = 0x70
}
}
|
// Disable xmldoc warnings
#pragma warning disable 1591
namespace AsmResolver.PE.DotNet.Metadata.Tables
{
/// <summary>
/// Provides members defining all metadata tables that can be present in a tables stream.
/// </summary>
public enum TableIndex : byte
{
Module = 0,
TypeRef = 1,
TypeDef = 2,
FieldPtr = 3,
Field = 4,
MethodPtr = 5,
Method = 6,
ParamPtr = 7,
Param = 8,
InterfaceImpl = 9,
MemberRef = 10,
Constant = 11,
CustomAttribute = 12,
FieldMarshal = 13,
DeclSecurity = 14,
ClassLayout = 15,
FieldLayout = 16,
StandAloneSig = 17,
EventMap = 18,
EventPtr = 19,
Event = 20,
PropertyMap = 21,
PropertyPtr = 22,
Property = 23,
MethodSemantics = 24,
MethodImpl = 25,
ModuleRef = 26,
TypeSpec = 27,
ImplMap = 28,
FieldRva = 29,
EncLog = 30,
EncMap = 31,
Assembly = 32,
AssemblyProcessor = 33,
AssemblyOS = 34,
AssemblyRef = 35,
AssemblyRefProcessor = 36,
AssemblyRefOS = 37,
File = 38,
ExportedType = 39,
ManifestResource = 40,
NestedClass = 41,
GenericParam = 42,
MethodSpec = 43,
GenericParamConstraint = 44,
Max = GenericParamConstraint + 1,
String = 0x70
}
}
|
mit
|
C#
|
d952200fd278b6faeb968e33148ef41f82554cc5
|
Change read/write options to be virtual
|
mjrousos/dotnet-apiport,JJVertical/dotnet-apiport,twsouthwick/dotnet-apiport,JJVertical/dotnet-apiport,twsouthwick/dotnet-apiport,conniey/dotnet-apiport,conniey/dotnet-apiport,Microsoft/dotnet-apiport,conniey/dotnet-apiport,mjrousos/dotnet-apiport,Microsoft/dotnet-apiport,Microsoft/dotnet-apiport
|
src/Microsoft.Fx.Portability/ReadWriteApiPortOptions.cs
|
src/Microsoft.Fx.Portability/ReadWriteApiPortOptions.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Fx.Portability.ObjectModel;
using System.Collections.Generic;
using System.IO;
namespace Microsoft.Fx.Portability
{
/// <summary>
/// Provides an implementation of IApiPortOptions that allows for reading and writing properties
/// </summary>
public class ReadWriteApiPortOptions : IApiPortOptions
{
public ReadWriteApiPortOptions() { }
public ReadWriteApiPortOptions(IApiPortOptions other)
{
BreakingChangeSuppressions = other.BreakingChangeSuppressions;
Description = other.Description;
IgnoredAssemblyFiles = other.IgnoredAssemblyFiles;
InputAssemblies = other.InputAssemblies;
OutputFormats = other.OutputFormats;
RequestFlags = other.RequestFlags;
Targets = other.Targets;
ServiceEndpoint = other.ServiceEndpoint;
InvalidInputFiles = other.InvalidInputFiles;
OutputFileName = other.OutputFileName;
}
public virtual IEnumerable<string> BreakingChangeSuppressions { get; set; }
public virtual string Description { get; set; }
public virtual IEnumerable<string> IgnoredAssemblyFiles { get; set; }
public virtual IEnumerable<FileInfo> InputAssemblies { get; set; }
public virtual IEnumerable<string> InvalidInputFiles { get; set; }
public virtual string OutputFileName { get; set; }
public virtual IEnumerable<string> OutputFormats { get; set; }
public virtual AnalyzeRequestFlags RequestFlags { get; set; }
public virtual string ServiceEndpoint { get; set; }
public virtual IEnumerable<string> Targets { get; set; }
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Fx.Portability.ObjectModel;
using System.Collections.Generic;
using System.IO;
namespace Microsoft.Fx.Portability
{
/// <summary>
/// Provides an implementation of IApiPortOptions that allows for reading and writing properties
/// </summary>
public class ReadWriteApiPortOptions : IApiPortOptions
{
public ReadWriteApiPortOptions() { }
public ReadWriteApiPortOptions(IApiPortOptions other)
{
BreakingChangeSuppressions = other.BreakingChangeSuppressions;
Description = other.Description;
IgnoredAssemblyFiles = other.IgnoredAssemblyFiles;
InputAssemblies = other.InputAssemblies;
OutputFormats = other.OutputFormats;
RequestFlags = other.RequestFlags;
Targets = other.Targets;
ServiceEndpoint = other.ServiceEndpoint;
InvalidInputFiles = other.InvalidInputFiles;
OutputFileName = other.OutputFileName;
}
public IEnumerable<string> BreakingChangeSuppressions { get; set; }
public string Description { get; set; }
public IEnumerable<string> IgnoredAssemblyFiles { get; set; }
public IEnumerable<FileInfo> InputAssemblies { get; set; }
public IEnumerable<string> InvalidInputFiles { get; set; }
public string OutputFileName { get; set; }
public IEnumerable<string> OutputFormats { get; set; }
public AnalyzeRequestFlags RequestFlags { get; set; }
public string ServiceEndpoint { get; set; }
public IEnumerable<string> Targets { get; set; }
}
}
|
mit
|
C#
|
be13801d4a260265b761e26e225ab3b5ea67a0af
|
fix build
|
Picturepark/Picturepark.SDK.DotNet
|
src/Picturepark.SDK.V1.Contract/Partials/ShareDetail.cs
|
src/Picturepark.SDK.V1.Contract/Partials/ShareDetail.cs
|
using System;
using System.Linq;
namespace Picturepark.SDK.V1.Contract
{
public partial class ShareDetail
{
public ShareBasicUpdateRequest AsBasicUpdateRequest(Action<ShareBasicUpdateRequest> update = null)
=> AsUpdateRequest(update);
public ShareEmbedUpdateRequest AsEmbedUpdateRequest(Action<ShareEmbedUpdateRequest> update = null)
=> AsUpdateRequest(update);
private T AsUpdateRequest<T>(Action<T> update = null)
where T : ShareBaseUpdateRequest, new()
{
var result = new T
{
Description = Description,
ExpirationDate = ExpirationDate,
LayerSchemaIds = LayerSchemaIds,
Name = Name,
OutputAccess = OutputAccess,
Contents = ContentSelections.Select(i =>
new ShareContent
{
ContentId = i.Id,
OutputFormatIds = i.Outputs.Select(output => output.OutputFormatId).ToArray()
}).ToArray()
};
update?.Invoke(result);
return result;
}
}
}
|
using System;
using System.Linq;
namespace Picturepark.SDK.V1.Contract
{
public partial class ShareDetail
{
public ShareBasicUpdateRequest AsBasicUpdateRequest(Action<ShareBasicUpdateRequest> update = null)
=> AsUpdateRequest(update);
public ShareEmbedUpdateRequest AsEmbedUpdateRequest(Action<ShareEmbedUpdateRequest> update = null)
=> AsUpdateRequest(update);
private T AsUpdateRequest<T>(Action<T> update = null)
where T : ShareBaseUpdateRequest, new()
{
var result = new T
{
Description = Description,
ExpirationDate = ExpirationDate,
LayerSchemaIds = LayerSchemaIds,
Name = Name,
OutputAccess = OutputAccess,
Contents = ContentSelections.Select(i =>
new ShareContent
{
ContentId = i.Id,
OutputFormatIds = i.Outputs.Select(output => output.OutputFormatId).ToArray()
}).ToArray(),
Template = Template
};
update?.Invoke(result);
return result;
}
}
}
|
mit
|
C#
|
1efcb05f4efeab57480f339eae858db088b544c4
|
Fix .Value() extension methods
|
zpqrtbnk/Zbu.ModelsBuilder,zpqrtbnk/Zbu.ModelsBuilder,zpqrtbnk/Zbu.ModelsBuilder
|
src/Umbraco.ModelsBuilder/PublishedElementExtensions.cs
|
src/Umbraco.ModelsBuilder/PublishedElementExtensions.cs
|
using System;
using System.Linq.Expressions;
using System.Reflection;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.ModelsBuilder;
// same namespace as original Umbraco.Web PublishedElementExtensions
// ReSharper disable once CheckNamespace
namespace Umbraco.Web
{
/// <summary>
/// Provides extension methods to models.
/// </summary>
public static class PublishedElementExtensions
{
/// <summary>
/// Gets the value of a property.
/// </summary>
public static TValue Value<TModel, TValue>(this TModel model, Expression<Func<TModel, TValue>> property, string culture = null, string segment = null, Fallback fallback = default, TValue defaultValue = default)
where TModel : IPublishedElement
{
var alias = GetAlias(model, property);
return model.Value<TValue>(alias, culture, segment, fallback, defaultValue);
}
// fixme that one should be public so ppl can use it
private static string GetAlias<TModel, TValue>(TModel model, Expression<Func<TModel, TValue>> property)
{
if (property.NodeType != ExpressionType.Lambda)
throw new ArgumentException("Not a proper lambda expression (lambda).", nameof(property));
var lambda = (LambdaExpression) property;
var lambdaBody = lambda.Body;
if (lambdaBody.NodeType != ExpressionType.MemberAccess)
throw new ArgumentException("Not a proper lambda expression (body).", nameof(property));
var memberExpression = (MemberExpression) lambdaBody;
if (memberExpression.Expression.NodeType != ExpressionType.Parameter)
throw new ArgumentException("Not a proper lambda expression (member).", nameof(property));
var member = memberExpression.Member;
var attribute = member.GetCustomAttribute<ImplementPropertyTypeAttribute>();
if (attribute == null)
throw new InvalidOperationException("Property is not marked with ImplementPropertyType attribute.");
return attribute.Alias;
}
}
}
|
using System;
using System.Linq.Expressions;
using System.Reflection;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web;
namespace Umbraco.ModelsBuilder
{
/// <summary>
/// Provides extension methods to models.
/// </summary>
public static class PublishedElementExtensions
{
/// <summary>
/// Gets the value of a property.
/// </summary>
public static TValue Value<TModel, TValue>(this TModel model, Expression<Func<TModel, TValue>> property, string culture = ".", string segment = ".")
where TModel : IPublishedElement
{
var alias = GetAlias(model, property);
return model.Value<TValue>(alias, culture, segment);
}
private static string GetAlias<TModel, TValue>(TModel model, Expression<Func<TModel, TValue>> property)
{
if (property.NodeType != ExpressionType.Lambda)
throw new ArgumentException("Not a proper lambda expression (lambda).", nameof(property));
var lambda = (LambdaExpression) property;
var lambdaBody = lambda.Body;
if (lambdaBody.NodeType != ExpressionType.MemberAccess)
throw new ArgumentException("Not a proper lambda expression (body).", nameof(property));
var memberExpression = (MemberExpression) lambdaBody;
if (memberExpression.Expression.NodeType != ExpressionType.Parameter)
throw new ArgumentException("Not a proper lambda expression (member).", nameof(property));
var member = memberExpression.Member;
var attribute = member.GetCustomAttribute<ImplementPropertyTypeAttribute>();
if (attribute == null)
throw new InvalidOperationException("Property is not marked with ImplementPropertyType attribute.");
return attribute.Alias;
}
}
}
|
mit
|
C#
|
836b78e0a585e7787dfe270a0cad57cf33302d91
|
Use a recent timestamp for Asset API smoke test
|
jskeet/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,googleapis/google-cloud-dotnet,googleapis/google-cloud-dotnet,jskeet/google-cloud-dotnet,jskeet/gcloud-dotnet,jskeet/google-cloud-dotnet
|
apis/Google.Cloud.Asset.V1Beta1/Google.Cloud.Asset.V1Beta1.SmokeTests/AssetServiceSmokeTest.cs
|
apis/Google.Cloud.Asset.V1Beta1/Google.Cloud.Asset.V1Beta1.SmokeTests/AssetServiceSmokeTest.cs
|
// Copyright 2018 Google LLC
//
// 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
//
// https://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.
// Note: this is not currently generated, but is intended to take
// the same form as regular generated smoke tests.
namespace Google.Cloud.Asset.V1Beta1.SmokeTests
{
using Google.Api.Gax;
using Google.Api.Gax.Grpc;
using Google.Api.Gax.ResourceNames;
using Google.Protobuf.WellKnownTypes;
using Grpc.Core;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
public class TraceServiceSmokeTest
{
public static int Main(string[] args)
{
// Read projectId from args
if (args.Length != 1)
{
Console.WriteLine("Usage: Project ID must be passed as first argument.");
Console.WriteLine();
return 1;
}
string projectId = args[0];
// Create client
AssetServiceClient client = AssetServiceClient.Create();
// Initialize request argument(s)
var request = new BatchGetAssetsHistoryRequest
{
ParentAsProjectName = new ProjectName(projectId),
ContentType = ContentType.Resource,
ReadTimeWindow = new TimeWindow { StartTime = DateTime.UtcNow.AddDays(-1).ToTimestamp() },
};
// Call API method
client.BatchGetAssetsHistory(request);
// Success
Console.WriteLine("Smoke test passed OK");
return 0;
}
}
}
|
// Copyright 2018 Google LLC
//
// 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
//
// https://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.
// Note: this is not currently generated, but is intended to take
// the same form as regular generated smoke tests.
namespace Google.Cloud.Asset.V1Beta1.SmokeTests
{
using Google.Api.Gax;
using Google.Api.Gax.Grpc;
using Google.Api.Gax.ResourceNames;
using Google.Protobuf.WellKnownTypes;
using Grpc.Core;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
public class TraceServiceSmokeTest
{
public static int Main(string[] args)
{
// Read projectId from args
if (args.Length != 1)
{
Console.WriteLine("Usage: Project ID must be passed as first argument.");
Console.WriteLine();
return 1;
}
string projectId = args[0];
// Create client
AssetServiceClient client = AssetServiceClient.Create();
// Initialize request argument(s)
var request = new BatchGetAssetsHistoryRequest
{
ParentAsProjectName = new ProjectName(projectId),
ContentType = ContentType.Resource,
ReadTimeWindow = new TimeWindow { StartTime = DateTime.UtcNow.AddDays(-30).ToTimestamp() },
};
// Call API method
client.BatchGetAssetsHistory(request);
// Success
Console.WriteLine("Smoke test passed OK");
return 0;
}
}
}
|
apache-2.0
|
C#
|
e33b3ff28c6763bd84920cdea67cf0909ccc8be2
|
Solve problem two.
|
ShooShoSha/ProjectEuler,ShooShoSha/ProjectEuler
|
ProjectEulerLibraryTests/ProblemTests.cs
|
ProjectEulerLibraryTests/ProblemTests.cs
|
namespace ProjectEulerLibrary.Tests
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass()]
public class ProblemTests
{
[TestMethod()]
public void SolveProblem1Test()
{
var actual = Problem.SolveProblem1(10);
Assert.AreEqual(23, actual);
}
[TestMethod]
public void SolveProblem2Test()
{
var actual = Problem.SolveProblem2();
Assert.AreEqual(4613732, actual);
}
}
}
|
namespace ProjectEulerLibrary.Tests
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass()]
public class ProblemTests
{
[TestMethod()]
public void SolveProblem1Test()
{
var actual = Problem.SolveProblem1(10);
Assert.AreEqual(23, actual);
}
}
}
|
mit
|
C#
|
98f0794ba6b95866fe732f0cc2944acd90167cd3
|
bump version
|
neutmute/loggly-csharp
|
SolutionItems/Properties/AssemblyInfo.cs
|
SolutionItems/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
[assembly: AssemblyVersion("4.5.1.0")]
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyProduct("loggly-csharp")]
[assembly: InternalsVisibleTo("Loggly.Tests")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyInformationalVersion("4.5.1.0-beta1")] // trigger pre release package
#else
[assembly: AssemblyConfiguration("Release")]
#endif
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
[assembly: AssemblyVersion("4.5.0.4")]
[assembly: AllowPartiallyTrustedCallers]
[assembly: AssemblyProduct("loggly-csharp")]
[assembly: InternalsVisibleTo("Loggly.Tests")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyInformationalVersion("4.5.0.4-beta1")] // trigger pre release package
#else
[assembly: AssemblyConfiguration("Release")]
#endif
|
mit
|
C#
|
3cb7e5b47ebb2bd02e4944b0c9df7203db06e487
|
add docs/comments
|
peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework
|
osu.Framework/Graphics/Rendering/IRendererExtensions.cs
|
osu.Framework/Graphics/Rendering/IRendererExtensions.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Primitives;
using osuTK;
namespace osu.Framework.Graphics.Rendering
{
public static class IRendererExtensions
{
/// <summary>
/// Applies a new orthographic projection rectangle. Pop with <see cref="IRenderer.PopProjectionMatrix"/>.
/// </summary>
/// <param name="renderer">The renderer.</param>
/// <param name="ortho">The rectangle to create the orthographic projection from.</param>
public static void PushOrtho(this IRenderer renderer, RectangleF ortho)
{
renderer.PushProjectionMatrix(Matrix4.CreateOrthographicOffCenter(ortho.Left, ortho.Right, ortho.Bottom, ortho.Top, -1, 1));
}
/// <summary>
/// Applies a new projection matrix so that all drawn vertices are transformed by <paramref name="matrix"/>.
/// This also affects masking. Call <see cref="PopLocalMatrix"/> after using.
/// </summary>
/// <param name="renderer">The renderer.</param>
/// <param name="matrix">The matrix.</param>
public static void PushLocalMatrix(this IRenderer renderer, Matrix4 matrix)
{
var currentMasking = renderer.CurrentMaskingInfo;
// normally toMaskingSpace is fed vertices already in screen space coordinates,
// but since we are modifying the matrix the vertices are in local space
currentMasking.ToMaskingSpace = new Matrix3(matrix) * currentMasking.ToMaskingSpace;
renderer.PushMaskingInfo(currentMasking, true);
renderer.PushProjectionMatrix(matrix * renderer.ProjectionMatrix);
}
/// <inheritdoc cref="PushLocalMatrix(IRenderer, Matrix4)"/>
public static void PushLocalMatrix(this IRenderer renderer, Matrix3 matrix)
{
renderer.PushLocalMatrix(new Matrix4(matrix));
}
/// <summary>
/// Pops the state generated by <see cref="PushLocalMatrix(IRenderer, Matrix4)"/>.
/// </summary>
/// <param name="renderer">The renderer.</param>
public static void PopLocalMatrix(this IRenderer renderer)
{
renderer.PopProjectionMatrix();
renderer.PopMaskingInfo();
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Primitives;
using osuTK;
namespace osu.Framework.Graphics.Rendering
{
public static class IRendererExtensions
{
/// <summary>
/// Applies a new orthographic projection rectangle. Pop with <see cref="IRenderer.PopProjectionMatrix"/>.
/// </summary>
/// <param name="renderer">The renderer.</param>
/// <param name="ortho">The rectangle to create the orthographic projection from.</param>
public static void PushOrtho(this IRenderer renderer, RectangleF ortho)
{
renderer.PushProjectionMatrix(Matrix4.CreateOrthographicOffCenter(ortho.Left, ortho.Right, ortho.Bottom, ortho.Top, -1, 1));
}
/// <summary>
/// Applies a new projection matrix by multiplying with the current one.
/// Call <see cref="PopLocalMatrix"/> after using.
/// </summary>
/// <param name="renderer">The renderer.</param>
/// <param name="matrix">The matrix.</param>
public static void PushLocalMatrix(this IRenderer renderer, Matrix4 matrix)
{
var currentMasking = renderer.CurrentMaskingInfo;
currentMasking.ToMaskingSpace = new Matrix3(matrix) * currentMasking.ToMaskingSpace;
renderer.PushMaskingInfo(currentMasking, true);
renderer.PushProjectionMatrix(matrix * renderer.ProjectionMatrix);
}
/// <inheritdoc cref="PushLocalMatrix(IRenderer, Matrix4)"/>
public static void PushLocalMatrix(this IRenderer renderer, Matrix3 matrix)
{
renderer.PushLocalMatrix(new Matrix4(matrix));
}
/// <summary>
/// Pops the state generated by <see cref="PushLocalMatrix(IRenderer, Matrix4)"/>.
/// </summary>
/// <param name="renderer">The renderer.</param>
public static void PopLocalMatrix(this IRenderer renderer)
{
renderer.PopProjectionMatrix();
renderer.PopMaskingInfo();
}
}
}
|
mit
|
C#
|
2b167efa038920b6a9853638697a840d5775964e
|
Update MaskAttribute.cs
|
estebanmurchio/MaskAttribute,estebanmurchio/MaskAttribute
|
src/MaskAttribute.cs
|
src/MaskAttribute.cs
|
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
namespace Infrastructure.Attributes
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class MaskAttribute : Attribute, IMetadataAware
{
public string Selector { get; private set; }
public string Mask { get; private set; }
public MaskAttribute(string selector, string mask)
{
Selector = selector;
Mask = mask;
}
private const string ScriptText =
"<script data-eval='true' type='text/javascript'>" +
"jQuery(document).ready(function () {{" +
"jQuery('{0}').mask('{1}');" +
"}});" +
"</script>";
public const string TemplateHint = "_maskedInput";
internal HttpContextBase Context
{
get { return new HttpContextWrapper(HttpContext.Current); }
}
public void OnMetadataCreated(ModelMetadata metadata)
{
var list = Context.Items["Scripts"] as IList<string> ?? new List<string>();
metadata.TemplateHint = TemplateHint;
metadata.AdditionalValues[TemplateHint] = Selector;
var s = string.Format(ScriptText, Selector, Mask);
if (!list.Contains(s))
list.Add(s);
Context.Items["Scripts"] = list;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
namespace Infrastructure.Attributes
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class MaskAttribute : Attribute, IMetadataAware
{
public string Selector { get; private set; }
public string Mask { get; private set; }
public MaskAttribute(string selector, string mask)
{
Selector = selector;
Mask = mask;
}
private const string ScriptText =
"<script data-eval='true' type='text/javascript'>" +
"jQuery(document).ready(function () {{" +
"jQuery('{0}').mask('{1}');" +
"}});" +
"</script>";
private const string AutoNumericScriptText =
"<script data-eval='true' type='text/javascript'>" +
"jQuery(document).ready(function () {{" +
"jQuery('{0}').autoNumeric('init', {1});" +
"}});" +
"</script>";
public const string TemplateHint = "_maskedInput";
internal HttpContextBase Context
{
get { return new HttpContextWrapper(HttpContext.Current); }
}
public void OnMetadataCreated(ModelMetadata metadata)
{
var list = Context.Items["Scripts"] as IList<string> ?? new List<string>();
metadata.TemplateHint = TemplateHint;
metadata.AdditionalValues[TemplateHint] = Selector;
var s = string.Format(Mask.StartsWith("{")
? AutoNumericScriptText
: ScriptText, Selector, Mask);
if (!list.Contains(s))
list.Add(s);
Context.Items["Scripts"] = list;
}
}
}
|
mit
|
C#
|
58522365e49f9d8b8093ac582fa73f3e850fc369
|
Add negative test of HasIgnoreDataMemberAttribute
|
skarpdev/dotnetcore-hubspot-client
|
test/unit/Core/ReflectionExtensionTest.cs
|
test/unit/Core/ReflectionExtensionTest.cs
|
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using RapidCore.Reflection;
using Skarp.HubSpotClient.Contact.Dto;
using Skarp.HubSpotClient.Core;
using Xunit;
namespace Skarp.HubSpotClient.UnitTest.Core
{
public class ReflectionExtensionTest
{
[Fact]
public void ReflectionExtension_resolves_prop_names_correctly()
{
var dto = new ClassWithDataMembers();
var dtoProps = dto.GetType().GetProperties();
var propNoCustomName = dtoProps.Single(p => p.Name == "MemberNoCustomName");
Assert.Equal("MemberNoCustomName", propNoCustomName.GetPropSerializedName());
var propWithCustomName = dtoProps.Single(p => p.Name == "MemberWithCustomName");
Assert.Equal("CallMeThis", propWithCustomName.GetPropSerializedName());
}
[Fact]
public void ReflectionExtension_can_find_methods_from_base_types_and_interfaces()
{
var dto = new ContactListHubSpotEntity<ContactHubSpotEntity>();
// find the Add(T) method on the List entity!
var listProp = dto.GetType().GetProperties().Single(p => p.Name == "Contacts");
var method = listProp.PropertyType.FindMethodRecursively("Add", new[] { typeof(ContactHubSpotEntity) });
Assert.NotNull(method);
}
[Fact]
public void ReflectionExtension_can_determine_if_prop_has_ignore_data_member()
{
var dto = new ClassWithDataMembers();
var propWithIgnore = dto.GetType().GetProperties().Single(p => p.Name == "IgnoreMePlease");
var hasAttr = propWithIgnore.HasIgnoreDataMemberAttribute();
Assert.True(hasAttr);
var propNoIgnore = dto.GetType().GetProperties().Single(p => p.Name == "MemberWithCustomName");
Assert.False(propNoIgnore.HasIgnoreDataMemberAttribute());
}
[DataContract]
private class ClassWithDataMembers
{
[DataMember()]
public string MemberNoCustomName { get; set; }
[DataMember(Name = "CallMeThis")]
public string MemberWithCustomName { get; set; }
[IgnoreDataMember]
public string IgnoreMePlease { get; set; }
}
}
}
|
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using RapidCore.Reflection;
using Skarp.HubSpotClient.Contact.Dto;
using Skarp.HubSpotClient.Core;
using Xunit;
namespace Skarp.HubSpotClient.UnitTest.Core
{
public class ReflectionExtensionTest
{
[Fact]
public void ReflectionExtension_resolves_prop_names_correctly()
{
var dto = new ClassWithDataMembers();
var dtoProps = dto.GetType().GetProperties();
var propNoCustomName = dtoProps.Single(p => p.Name == "MemberNoCustomName");
Assert.Equal("MemberNoCustomName", propNoCustomName.GetPropSerializedName());
var propWithCustomName = dtoProps.Single(p => p.Name == "MemberWithCustomName");
Assert.Equal("CallMeThis", propWithCustomName.GetPropSerializedName());
}
[Fact]
public void ReflectionExtension_can_find_methods_from_base_types_and_interfaces()
{
var dto = new ContactListHubSpotEntity<ContactHubSpotEntity>();
// find the Add(T) method on the List entity!
var listProp = dto.GetType().GetProperties().Single(p => p.Name == "Contacts");
var method = listProp.PropertyType.FindMethodRecursively("Add", new[] { typeof(ContactHubSpotEntity) });
Assert.NotNull(method);
}
[Fact]
public void ReflectionExtension_can_determine_if_prop_has_ignore_data_member()
{
var dto = new ClassWithDataMembers();
var propWithIgnore = dto.GetType().GetProperties().Single(p => p.Name == "IgnoreMePlease");
var hasAttr = propWithIgnore.HasIgnoreDataMemberAttribute();
Assert.True(hasAttr);
}
[DataContract]
private class ClassWithDataMembers
{
[DataMember()]
public string MemberNoCustomName { get; set; }
[DataMember(Name = "CallMeThis")]
public string MemberWithCustomName { get; set; }
[IgnoreDataMember]
public string IgnoreMePlease { get; set; }
}
}
}
|
mit
|
C#
|
d075c7d1ca07657a3c4f71a94dd944d9ab28d31a
|
Disable brittle WebSockets.Client test (#23920)
|
fgreinacher/corefx,wtgodbe/corefx,the-dwyer/corefx,Jiayili1/corefx,shimingsg/corefx,tijoytom/corefx,shimingsg/corefx,mmitche/corefx,ravimeda/corefx,Ermiar/corefx,ravimeda/corefx,seanshpark/corefx,ericstj/corefx,parjong/corefx,seanshpark/corefx,zhenlan/corefx,shimingsg/corefx,twsouthwick/corefx,ViktorHofer/corefx,ericstj/corefx,Ermiar/corefx,BrennanConroy/corefx,zhenlan/corefx,Jiayili1/corefx,the-dwyer/corefx,mmitche/corefx,wtgodbe/corefx,ViktorHofer/corefx,ericstj/corefx,axelheer/corefx,zhenlan/corefx,ptoonen/corefx,Ermiar/corefx,wtgodbe/corefx,wtgodbe/corefx,ViktorHofer/corefx,mmitche/corefx,ptoonen/corefx,tijoytom/corefx,ericstj/corefx,axelheer/corefx,ericstj/corefx,axelheer/corefx,parjong/corefx,BrennanConroy/corefx,ptoonen/corefx,twsouthwick/corefx,Jiayili1/corefx,mmitche/corefx,tijoytom/corefx,parjong/corefx,twsouthwick/corefx,tijoytom/corefx,ravimeda/corefx,Ermiar/corefx,zhenlan/corefx,shimingsg/corefx,tijoytom/corefx,BrennanConroy/corefx,Jiayili1/corefx,fgreinacher/corefx,shimingsg/corefx,wtgodbe/corefx,wtgodbe/corefx,the-dwyer/corefx,seanshpark/corefx,ViktorHofer/corefx,wtgodbe/corefx,fgreinacher/corefx,Jiayili1/corefx,twsouthwick/corefx,seanshpark/corefx,ravimeda/corefx,tijoytom/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ptoonen/corefx,twsouthwick/corefx,parjong/corefx,the-dwyer/corefx,seanshpark/corefx,Jiayili1/corefx,parjong/corefx,parjong/corefx,zhenlan/corefx,Ermiar/corefx,shimingsg/corefx,axelheer/corefx,axelheer/corefx,Ermiar/corefx,twsouthwick/corefx,parjong/corefx,Ermiar/corefx,zhenlan/corefx,ericstj/corefx,ravimeda/corefx,ptoonen/corefx,tijoytom/corefx,axelheer/corefx,the-dwyer/corefx,ravimeda/corefx,ravimeda/corefx,ptoonen/corefx,seanshpark/corefx,ViktorHofer/corefx,Jiayili1/corefx,the-dwyer/corefx,ptoonen/corefx,mmitche/corefx,mmitche/corefx,zhenlan/corefx,seanshpark/corefx,the-dwyer/corefx,twsouthwick/corefx,fgreinacher/corefx,shimingsg/corefx,mmitche/corefx,ericstj/corefx
|
src/System.Net.WebSockets.Client/tests/KeepAliveTest.cs
|
src/System.Net.WebSockets.Client/tests/KeepAliveTest.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Net.Test.Common;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace System.Net.WebSockets.Client.Tests
{
public class KeepAliveTest : ClientWebSocketTestBase
{
public KeepAliveTest(ITestOutputHelper output) : base(output) { }
[ActiveIssue(23204, TargetFrameworkMonikers.Uap)]
[ConditionalFact(nameof(WebSocketsSupported))]
[OuterLoop] // involves long delay
public async Task KeepAlive_LongDelayBetweenSendReceives_Succeeds()
{
using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(System.Net.Test.Common.Configuration.WebSockets.RemoteEchoServer, TimeOutMilliseconds, _output, TimeSpan.FromSeconds(10)))
{
await cws.SendAsync(new ArraySegment<byte>(new byte[1] { 42 }), WebSocketMessageType.Binary, true, CancellationToken.None);
await Task.Delay(TimeSpan.FromSeconds(60));
byte[] receiveBuffer = new byte[1];
Assert.Equal(1, (await cws.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None)).Count);
Assert.Equal(42, receiveBuffer[0]);
await cws.CloseAsync(WebSocketCloseStatus.NormalClosure, "KeepAlive_LongDelayBetweenSendReceives_Succeeds", CancellationToken.None);
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Net.Test.Common;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace System.Net.WebSockets.Client.Tests
{
public class KeepAliveTest : ClientWebSocketTestBase
{
public KeepAliveTest(ITestOutputHelper output) : base(output) { }
[ConditionalFact(nameof(WebSocketsSupported))]
[OuterLoop] // involves long delay
public async Task KeepAlive_LongDelayBetweenSendReceives_Succeeds()
{
using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(System.Net.Test.Common.Configuration.WebSockets.RemoteEchoServer, TimeOutMilliseconds, _output, TimeSpan.FromSeconds(10)))
{
await cws.SendAsync(new ArraySegment<byte>(new byte[1] { 42 }), WebSocketMessageType.Binary, true, CancellationToken.None);
await Task.Delay(TimeSpan.FromSeconds(60));
byte[] receiveBuffer = new byte[1];
Assert.Equal(1, (await cws.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None)).Count);
Assert.Equal(42, receiveBuffer[0]);
await cws.CloseAsync(WebSocketCloseStatus.NormalClosure, "KeepAlive_LongDelayBetweenSendReceives_Succeeds", CancellationToken.None);
}
}
}
}
|
mit
|
C#
|
71b5f8b3d7765fd6a83ad25048895b0caf479eeb
|
Change interface IDiscipline. Add TODO's for auto-propeties.
|
pz11u2/decanat
|
DecanatLib/DecanatLib/model/IDiscipline.cs
|
DecanatLib/DecanatLib/model/IDiscipline.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DecanatLib.utils;
namespace DecanatLib.model
{
interface IDiscipline
{
//TODO: убрать автосвойства из абстракций
//перечень предметов которые может вести препод
public String NameDiscipline { get; set; }
public TimeScoupe CountHours { get; set; }
public IGroup GroupName { get; set; }
public Byte WeeksCount { get; set; } //количество недель
public Byte Term { get; set; } //семестр
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DecanatLib.utils;
namespace DecanatLib.model
{
interface IDiscipline
{
//перечень предметов которые может вести препод
public String NameDiscipline { get; set; }
public TimeScoupe CountHours { get; set; }
public IGroup GroupName { get; set; }
public Byte WeeksCount { get; set; } //количество недель
public Byte Term { get; set; } //семестр
}
}
|
mit
|
C#
|
602b9660702586b0f850b98d0201734cde84adb5
|
Remove namespace declaration
|
astorch/motoi
|
src/ProductAssemblyInfo.cs
|
src/ProductAssemblyInfo.cs
|
using System.Reflection;
#if DEBUG
[assembly: AssemblyConfiguration("debug")]
#else
[assembly: AssemblyConfiguration("release")]
#endif
[assembly: AssemblyCompany("motoi.org")]
[assembly: AssemblyProduct("motoi .NET RCP")]
[assembly: AssemblyCopyright("Copyright © 2017 motoi.org")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
#if DEBUG
[assembly: AssemblyConfiguration("debug")]
#else
[assembly: AssemblyConfiguration("release")]
#endif
[assembly: AssemblyCompany("motoi.org")]
[assembly: AssemblyProduct("motoi .NET RCP")]
[assembly: AssemblyCopyright("Copyright © 2017 motoi.org")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
namespace motoi.platform.ui.properties {
}
|
mit
|
C#
|
528593f740e9efb56337d8e889fcfe088f91859a
|
Fix baseline
|
NetSys/e2d2,NetSys/NetBricks,NetSys/e2d2,apanda/NetBricks,NetSys/e2d2,NetSys/NetBricks,NetSys/NetBricks,apanda/NetBricks,NetSys/NetBricks,NetSys/NetBricks,NetSys/e2d2,apanda/NetBricks,NetSys/e2d2,apanda/NetBricks,apanda/NetBricks,NetSys/e2d2,NetSys/e2d2
|
test/managed/chaining-tests/chain-same-core/Baseline.cs
|
test/managed/chaining-tests/chain-same-core/Baseline.cs
|
using System;
using E2D2.SNApi;
using E2D2;
using E2D2.Collections;
using System.Runtime.CompilerServices;
using System.IO;
using System.Net;
namespace E2D2 {
public sealed class IpLookupChainingTest {
public static void Main(string[] args) {
var options = E2D2OptionParser.ParseOptions(args);
int nrxq = options.numRxq;
int ntxq = options.numTxq;
SoftNic.init_softnic (2, "test");
int length = 0;
if (args.Length - options.endIdx > 0) {
length += Convert.ToInt32(args[options.endIdx]);
}
Console.WriteLine("Chain length is {0}", length);
#if UNIQUE_CHECK
Console.WriteLine("UNIQUENESS ENABLED");
var vfIds = new int[length];
for (int i = 0; i < vfIds.Length; i++) {
// Should use some sort of randomness instead of doing it this way.
vfIds[i] = i;
}
#endif
IE2D2Component[] vfs = new IE2D2Component[length];
for (int i = 0; i < vfs.Length; i++) {
vfs[i] = new BaseLineVF();
}
IntPtr port1 = SoftNic.init_port ("vport0");
IntPtr port2 = SoftNic.init_port ("vport0");
PacketBuffer pkts = SoftNic.CreatePacketBuffer(32);
int pollRx= 0;
int pollTx = 0;
while (true) {
int rcvd = SoftNic.ReceiveBatch(port1, pollRx, ref pkts);
pollRx = (pollRx + 1) % nrxq;
if (rcvd > 0) {
for (int i = 0; i < vfs.Length; i++) {
try {
#if UNIQUE_CHECK
SoftNic.SetVF(i);
PacketBuffer.setOwnerStatic(pkts, i);
#endif
vfs[i].PushBatch(ref pkts);
} catch (Exception e) {
Console.WriteLine("Encountered error, quitting " + e.Message);
Environment.Exit(1);
}
}
SoftNic.SendBatch(port2, pollTx, ref pkts);
pollTx = (pollTx + 1) % ntxq;
}
}
}
}
}
|
using System;
using E2D2.SNApi;
using E2D2;
using E2D2.Collections;
using System.Runtime.CompilerServices;
using System.IO;
using System.Net;
namespace E2D2 {
public sealed class IpLookupChainingTest {
public static void Main(string[] args) {
var options = E2D2OptionParser.ParseOptions(args);
int nrxq = options.numRxq;
int ntxq = options.numTxq;
SoftNic.init_softnic (2, "test");
int length = 0;
if (args.Length - options.endIdx > 0) {
length += Convert.ToInt32(args[options.endIdx]);
}
Console.WriteLine("Chain length is {0}", length);
#if UNIQUE_CHECK
Console.WriteLine("UNIQUENESS ENABLED");
var vfIds = new int[length];
for (int i = 0; i < vfIds.Length; i++) {
// Should use some sort of randomness instead of doing it this way.
vfIds[i] = i;
}
#endif
IE2D2Component[] vfs = new IE2D2Component[length];
for (int i = 0; i < vfs.Length; i++) {
vfs[i] = new BaseLineVF();
}
IntPtr port1 = SoftNic.init_port ("vport0");
IntPtr port2 = SoftNic.init_port ("vport1");
PacketBuffer pkts = SoftNic.CreatePacketBuffer(32);
int pollRx= 0;
int pollTx = 0;
while (true) {
int rcvd = SoftNic.ReceiveBatch(port1, pollRx, ref pkts);
pollRx = (pollRx + 1) % nrxq;
if (rcvd > 0) {
for (int i = 0; i < vfs.Length; i++) {
try {
#if UNIQUE_CHECK
SoftNic.SetVF(i);
PacketBuffer.setOwnerStatic(pkts, i);
#endif
vfs[i].PushBatch(ref pkts);
} catch (Exception e) {
Console.WriteLine("Encountered error, quitting " + e.Message);
Environment.Exit(1);
}
}
SoftNic.SendBatch(port2, pollTx, ref pkts);
pollTx = (pollTx + 1) % ntxq;
}
}
}
}
}
|
isc
|
C#
|
43adc86645db319795668fa06b25c6f51381717d
|
Update TestBrand.cs
|
plivo/plivo-dotnet,plivo/plivo-dotnet
|
tests_netcore/Plivo.NetCore.Test/Resources/TestBrand.cs
|
tests_netcore/Plivo.NetCore.Test/Resources/TestBrand.cs
|
using System.Collections.Generic;
using Xunit;
using Plivo.Http;
using Plivo.Resource;
using Plivo.Resource.Brand;
using Plivo.Utilities;
using System;
namespace Plivo.NetCore.Test.Resources
{
public class TestBrand : BaseTestCase
{
[Fact]
public void TestBrandList()
{
var data = new Dictionary<string, object>();
var request =
new PlivoRequest(
"GET",
"Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Brand/",
"",
data);
var response =
System.IO.File.ReadAllText(
SOURCE_DIR + @"../Mocks/brandListResponse.json"
);
Setup<ListResponse<ListBrands>>(
200,
response
);
// res = Api.Brand.List();
AssertRequest(request);
}
[Fact]
public void TestBrandGet()
{
var id = "BRPXS6E";
var request =
new PlivoRequest(
"GET",
"Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Brand/" + id + "/",
"");
var response =
System.IO.File.ReadAllText(
SOURCE_DIR + @"../Mocks/brandGetResponse.json"
);
Setup<GetBrand>(
200,
response
);
// res = Api.Brand.Get(id);
AssertRequest(request);
}
}
}
|
using System.Collections.Generic;
using Xunit;
using Plivo.Http;
using Plivo.Resource;
using Plivo.Resource.Brand;
using Plivo.Utilities;
using System;
namespace Plivo.NetCore.Test.Resources
{
public class TestBrand : BaseTestCase
{
[Fact]
public void TestBrandList()
{
var data = new Dictionary<string, object>();
var request =
new PlivoRequest(
"GET",
"Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Brand/",
"",
data);
var response =
System.IO.File.ReadAllText(
SOURCE_DIR + @"../Mocks/brandListResponse.json"
);
Setup<ListResponse<ListBrands>>(
200,
response
);
res = Api.Brand.List();
AssertRequest(request);
}
[Fact]
public void TestBrandGet()
{
var id = "BRPXS6E";
var request =
new PlivoRequest(
"GET",
"Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Brand/" + id + "/",
"");
var response =
System.IO.File.ReadAllText(
SOURCE_DIR + @"../Mocks/brandGetResponse.json"
);
Setup<GetBrand>(
200,
response
);
res = Api.Brand.Get(id);
AssertRequest(request);
}
}
}
|
mit
|
C#
|
3fff7d87467347df15f12a00df3f6b398d667d5d
|
Update Interface
|
D-Yam/Millionaire
|
Interface/Interface/Class1.cs
|
Interface/Interface/Class1.cs
|
using System.Collections.Generic;
using System.ServiceModel;
using TypeDefine;
namespace Interface
{
[ServiceContract]
public interface IWcfInterface
{
/// <summary>
/// 今の自分のステータスを取得します。
/// </summary>
/// <param name="id">自分のID</param>
/// <returns>ステータス</returns>
[OperationContract]
Status GetMyStatus(string id);
/// <summary>
/// 現在一番上に出されているカード
/// </summary>
/// <returns>カードのリスト</returns>
[OperationContract]
List<Card> Layout();
/// <summary>
/// 最後に場札が流れたあと最初に出されたカード
/// </summary>
/// <returns>カードのリスト</returns>
[OperationContract]
List<Card> Lead();
/// <summary>
/// 最後に場札が流れてから今までに出されたカード
/// </summary>
/// <returns>indexが若いほど古いカードです。</returns>
[OperationContract]
List<List<Card>> TableCards();
/// <summary>
/// 今までに流れたカードのリスト
/// </summary>
/// <returns>indexが若いほど古いカードです。</returns>
[OperationContract]
List<List<Card>> Discards();
}
}
|
using System.Collections.Generic;
using System.ServiceModel;
using TypeDefine;
namespace Interface
{
[ServiceContract]
public interface IWcfInterface
{
[OperationContract]
/// <summary>
/// 今の自分のステータスを取得します。
/// </summary>
/// <param name="id">自分のID</param>
/// <returns>ステータス</returns>
Status GetMyStatus(string id);
/// <summary>
/// 現在一番上に出されているカード
/// </summary>
/// <returns>カードのリスト</returns>
List<Card> Layout();
/// <summary>
/// 最後に場札が流れたあと最初に出されたカード
/// </summary>
/// <returns>カードのリスト</returns>
List<Card> Lead();
/// <summary>
/// 最後に場札が流れてから今までに出されたカード
/// </summary>
/// <returns>indexが若いほど古いカードです。</returns>
List<List<Card>> TableCards();
/// <summary>
/// 今までに流れたカードのリスト
/// </summary>
/// <returns>indexが若いほど古いカードです。</returns>
List<List<Card>> Discards();
}
}
|
mit
|
C#
|
227cb6acdf8f3b79650417edf59b1f201f835f5e
|
Access Modifier Tests now PASS
|
TheTalkingDev/Kata.Solved.GildedRose.CSharp,dtro-devuk/Kata.Solved.GildedRose.CSharp
|
src/Kata.GildedRose.CSharp.Unit.Tests/WhenTestTheGildedRoseProgram.cs
|
src/Kata.GildedRose.CSharp.Unit.Tests/WhenTestTheGildedRoseProgram.cs
|
using Kata.GildedRose.CSharp.Console;
using NUnit.Framework;
using System.Collections.Generic;
namespace Kata.GildedRose.CSharp.Unit.Tests
{
[TestFixture]
public class WhenTestTheGildedRoseProgram
{
string _actualName = "+5 Dexterity Vest";
int _actualSellin = 10;
int _actualQuality = 10;
Item _actualStockItem;
IList<Item> _stockItems;
Program GildedRoseProgram;
[SetUp]
public void Init()
{
_actualStockItem = new Item
{
Name = _actualName,
SellIn = _actualSellin,
Quality = _actualQuality
};
GildedRoseProgram = new Program();
_stockItems = new List<Item> { _actualStockItem };
}
[Test]
public void ItShouldAllowUsToSetAndRetrieveTheItemsCorrectly()
{
GildedRoseProgram.Items = _stockItems;
Assert.AreEqual(_actualStockItem, GildedRoseProgram.Items[0]);
}
[Test]
public void ItShouldAllowUsAllowUsToUpdateItemsCorrectly()
{
GildedRoseProgram.Items = _stockItems;
GildedRoseProgram.UpdateQuality();
Assert.AreEqual(_actualStockItem, GildedRoseProgram.Items[0]);
}
[Test]
public void ItShouldReduceQualityOnUpdate()
{
GildedRoseProgram.Items = _stockItems;
GildedRoseProgram.UpdateQuality();
Assert.AreEqual(9, GildedRoseProgram.Items[0].Quality);
}
}
}
|
using Kata.GildedRose.CSharp.Console;
using NUnit.Framework;
using System.Collections.Generic;
namespace Kata.GildedRose.CSharp.Unit.Tests
{
[TestFixture]
public class WhenTestTheGildedRoseProgram
{
string _actualName = "+5 Dexterity Vest";
int _actualSellin = 10;
int _actualQuality = 10;
Item _actualStockItem;
IList<Item> _stockItems;
Program GildedRoseProgram;
[SetUp]
public void Init()
{
_actualStockItem = new Item
{
Name = _actualName,
SellIn = _actualSellin,
Quality = _actualQuality
};
GildedRoseProgram = new Program();
_stockItems = new List<Item> { _actualStockItem };
}
[Test]
public void ItShouldAllowUsToSetAndRetrieveTheItemsCorrectly()
{
GildedRoseProgram.Items = _stockItems;
Assert.AreEqual(_actualStockItem, GildedRoseProgram.Items[0]);
}
[Test]
public void ItShouldAllowUsAllowUsToUpdateItemsCorrectly()
{
GildedRoseProgram.Items = _stockItems;
GildedRoseProgram.UpdateQuality();
Assert.AreEqual(_actualStockItem, GildedRoseProgram.Items[0]);
}
[Test]
public void ItShouldReduceQualityOnUpdate()
{
GildedRoseProgram.Items = _stockItems;
GildedRoseProgram.UpdateQuality();
Assert.AreEqual(10, GildedRoseProgram.Items[0].Quality);
}
}
}
|
mit
|
C#
|
8dc3d83c2ac5294b085fb2d3468bb86f15c9c4a3
|
remove not used code
|
NikolayXHD/Lucene.Net.Contrib
|
EditedTokenLocator/ContextualEnumerator.cs
|
EditedTokenLocator/ContextualEnumerator.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
namespace Lucene.Net.Contrib
{
public sealed class ContextualEnumerator<T> : IEnumerator<T>
{
public ContextualEnumerator(IEnumerator<T> enumerator)
{
_enumerator = enumerator ?? throw new ArgumentNullException(nameof(enumerator));
HasNext = _enumerator.MoveNext();
if (HasNext)
{
_next = _enumerator.Current;
}
}
public void Reset()
{
_enumerator.Reset();
}
object IEnumerator.Current => Current;
public T Current
{
get
{
if (!_hasCurrent)
{
throw new InvalidOperationException("Enumeration is not started or already finished");
}
return _current;
}
}
public T Previous
{
get
{
if (!HasPrevious)
{
throw new InvalidOperationException("There is no previous element");
}
return _previous;
}
}
public T Next
{
get
{
if (!HasNext)
{
throw new InvalidOperationException("There is no next element");
}
return _next;
}
}
public bool HasPrevious { get; private set; }
public bool HasNext { get; private set; }
public bool MoveNext()
{
if (!HasNext)
{
return false;
}
_previous = _current;
HasPrevious = _hasCurrent;
_current = _next;
_hasCurrent = true;
HasNext = _enumerator.MoveNext();
if (HasNext)
{
_next = _enumerator.Current;
}
return true;
}
public void Dispose()
{
_enumerator.Dispose();
}
private readonly IEnumerator<T> _enumerator;
private T _current;
private T _previous;
private T _next;
private bool _hasCurrent;
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
namespace Lucene.Net.Contrib
{
public sealed class ContextualEnumerator<T> : IEnumerator<T>
{
public ContextualEnumerator(IEnumerable<T> collection)
{
if (collection == null)
{
throw new ArgumentNullException(nameof(collection));
}
_enumerator = collection.GetEnumerator();
HasNext = _enumerator.MoveNext();
if (HasNext)
{
_next = _enumerator.Current;
}
}
public ContextualEnumerator(IEnumerator<T> enumerator)
{
if (enumerator == null)
{
throw new ArgumentNullException(nameof(enumerator));
}
_enumerator = enumerator;
HasNext = _enumerator.MoveNext();
if (HasNext)
{
_next = _enumerator.Current;
}
}
public void Reset()
{
_enumerator.Reset();
}
object IEnumerator.Current => Current;
public T Current
{
get
{
if (!_hasCurrent)
{
throw new InvalidOperationException("Enumeration is not started or already finished");
}
return _current;
}
}
public T Previous
{
get
{
if (!HasPrevious)
{
throw new InvalidOperationException("There is no previous element");
}
return _previous;
}
}
public T Next
{
get
{
if (!HasNext)
{
throw new InvalidOperationException("There is no next element");
}
return _next;
}
}
public bool HasPrevious { get; private set; }
public bool HasNext { get; private set; }
public bool MoveNext()
{
if (!HasNext)
{
return false;
}
_previous = _current;
HasPrevious = _hasCurrent;
_current = _next;
_hasCurrent = true;
HasNext = _enumerator.MoveNext();
if (HasNext)
{
_next = _enumerator.Current;
}
return true;
}
public void Dispose()
{
_enumerator.Dispose();
}
private readonly IEnumerator<T> _enumerator;
private T _current;
private T _previous;
private T _next;
private bool _hasCurrent;
}
}
|
apache-2.0
|
C#
|
16e2eb5bd214952c4a0e74ecab401c9f066992dd
|
switch to IsAssignableFrom in EnumerableBlueprint
|
Construktion/Construktion,Construktion/Construktion
|
Construktion/Blueprints/Recursive/EnumerableBlueprint.cs
|
Construktion/Blueprints/Recursive/EnumerableBlueprint.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Construktion.Blueprints.Recursive
{
public class EnumerableBlueprint : Blueprint
{
public bool Matches(ConstruktionContext context)
{
return context.RequestType.GetTypeInfo().IsGenericType &&
typeof(IEnumerable).IsAssignableFrom(context.RequestType);
}
public object Construct(ConstruktionContext context, ConstruktionPipeline pipeline)
{
var closedType = context.RequestType.GenericTypeArguments[0];
var results = construct(closedType, pipeline);
return results;
}
private IList construct(Type closedType, ConstruktionPipeline pipeline)
{
//todo benchmark
var items = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(closedType));
for (var i = 0; i < pipeline.Settings.EnumuerableCount; i++)
{
var result = pipeline.Send(new ConstruktionContext(closedType));
items.Add(result);
}
return items;
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Construktion.Blueprints.Recursive
{
public class EnumerableBlueprint : Blueprint
{
public bool Matches(ConstruktionContext context)
{
return context.RequestType.GetTypeInfo().IsGenericType &&
context.RequestType.GetInterfaces().Contains(typeof(IEnumerable));
}
public object Construct(ConstruktionContext context, ConstruktionPipeline pipeline)
{
var closedType = context.RequestType.GenericTypeArguments[0];
var results = construct(closedType, pipeline);
return results;
}
private IList construct(Type closedType, ConstruktionPipeline pipeline)
{
//todo benchmark
var items = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(closedType));
for (var i = 0; i < pipeline.Settings.EnumuerableCount; i++)
{
var result = pipeline.Send(new ConstruktionContext(closedType));
items.Add(result);
}
return items;
}
}
}
|
mit
|
C#
|
464d8e162eb23aef5e3f6b65f7f8ee00e32f3391
|
Bump version.
|
JohanLarsson/Gu.Wpf.Geometry
|
Gu.Wpf.Geometry/Properties/AssemblyInfo.cs
|
Gu.Wpf.Geometry/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyTitle("Gu.Wpf.Geometry")]
[assembly: AssemblyDescription("Geometries for WPF.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Johan Larsson")]
[assembly: AssemblyProduct("Gu.Wpf.Geometry")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a9cbadf5-65f8-4a81-858c-ea0cdfeb2e99")]
[assembly: AssemblyVersion("2.2.1.0")]
[assembly: AssemblyFileVersion("2.2.1.0")]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100D3687DF6F8B0E6A6B7B73F276803765856327CEAB4EA9F369BCD6F30E59E0586DE0DF248F8F8B7A541D4FCB44F2E20785F90969D3A6BC83257A49E5B005D683C3C44DBCD8088C4C7C6445A29078E6781F7C53AFB8EB381F4C0D6EB6ED11FA0062B2BC6E554157ADC6BF83EF16AC4E07E4CFBBAFA3E668B55F5A4D05DE18A34BB", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Demo, PublicKey=0024000004800000940000000602000000240000525341310004000001000100D3687DF6F8B0E6A6B7B73F276803765856327CEAB4EA9F369BCD6F30E59E0586DE0DF248F8F8B7A541D4FCB44F2E20785F90969D3A6BC83257A49E5B005D683C3C44DBCD8088C4C7C6445A29078E6781F7C53AFB8EB381F4C0D6EB6ED11FA0062B2BC6E554157ADC6BF83EF16AC4E07E4CFBBAFA3E668B55F5A4D05DE18A34BB", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Benchmarks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100D3687DF6F8B0E6A6B7B73F276803765856327CEAB4EA9F369BCD6F30E59E0586DE0DF248F8F8B7A541D4FCB44F2E20785F90969D3A6BC83257A49E5B005D683C3C44DBCD8088C4C7C6445A29078E6781F7C53AFB8EB381F4C0D6EB6ED11FA0062B2BC6E554157ADC6BF83EF16AC4E07E4CFBBAFA3E668B55F5A4D05DE18A34BB", AllInternalsVisible = true)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: XmlnsDefinition("http://gu.se/Geometry", "Gu.Wpf.Geometry")]
[assembly: XmlnsDefinition("http://gu.se/Geometry", "Gu.Wpf.Geometry.Effects")]
[assembly: XmlnsPrefix("http://gu.se/Geometry", "geometry")]
[assembly: XmlnsPrefix("http://gu.se/Geometry", "effects")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
[assembly: AssemblyTitle("Gu.Wpf.Geometry")]
[assembly: AssemblyDescription("Geometries for WPF.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Johan Larsson")]
[assembly: AssemblyProduct("Gu.Wpf.Geometry")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a9cbadf5-65f8-4a81-858c-ea0cdfeb2e99")]
[assembly: AssemblyVersion("2.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100D3687DF6F8B0E6A6B7B73F276803765856327CEAB4EA9F369BCD6F30E59E0586DE0DF248F8F8B7A541D4FCB44F2E20785F90969D3A6BC83257A49E5B005D683C3C44DBCD8088C4C7C6445A29078E6781F7C53AFB8EB381F4C0D6EB6ED11FA0062B2BC6E554157ADC6BF83EF16AC4E07E4CFBBAFA3E668B55F5A4D05DE18A34BB", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Demo, PublicKey=0024000004800000940000000602000000240000525341310004000001000100D3687DF6F8B0E6A6B7B73F276803765856327CEAB4EA9F369BCD6F30E59E0586DE0DF248F8F8B7A541D4FCB44F2E20785F90969D3A6BC83257A49E5B005D683C3C44DBCD8088C4C7C6445A29078E6781F7C53AFB8EB381F4C0D6EB6ED11FA0062B2BC6E554157ADC6BF83EF16AC4E07E4CFBBAFA3E668B55F5A4D05DE18A34BB", AllInternalsVisible = true)]
[assembly: InternalsVisibleTo("Gu.Wpf.Geometry.Benchmarks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100D3687DF6F8B0E6A6B7B73F276803765856327CEAB4EA9F369BCD6F30E59E0586DE0DF248F8F8B7A541D4FCB44F2E20785F90969D3A6BC83257A49E5B005D683C3C44DBCD8088C4C7C6445A29078E6781F7C53AFB8EB381F4C0D6EB6ED11FA0062B2BC6E554157ADC6BF83EF16AC4E07E4CFBBAFA3E668B55F5A4D05DE18A34BB", AllInternalsVisible = true)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: XmlnsDefinition("http://gu.se/Geometry", "Gu.Wpf.Geometry")]
[assembly: XmlnsDefinition("http://gu.se/Geometry", "Gu.Wpf.Geometry.Effects")]
[assembly: XmlnsPrefix("http://gu.se/Geometry", "geometry")]
[assembly: XmlnsPrefix("http://gu.se/Geometry", "effects")]
|
mit
|
C#
|
d953c1cdf7242854c0fc1f2ec8b790812e050c47
|
Fix namespace so that external access wrapper type can be accessed from UT.
|
shyamnamboodiripad/roslyn,physhi/roslyn,physhi/roslyn,bartdesmet/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,tannergooding/roslyn,dotnet/roslyn,diryboy/roslyn,physhi/roslyn,bartdesmet/roslyn,AlekseyTs/roslyn,jasonmalinowski/roslyn,mgoertz-msft/roslyn,mavasani/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,tmat/roslyn,AmadeusW/roslyn,eriawan/roslyn,tmat/roslyn,bartdesmet/roslyn,mavasani/roslyn,tmat/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,panopticoncentral/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,AlekseyTs/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,mgoertz-msft/roslyn,dotnet/roslyn,weltkante/roslyn,mavasani/roslyn,panopticoncentral/roslyn,diryboy/roslyn,AlekseyTs/roslyn,tannergooding/roslyn,tannergooding/roslyn,AmadeusW/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,eriawan/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,sharwell/roslyn,diryboy/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,mgoertz-msft/roslyn,KevinRansom/roslyn
|
src/Workspaces/Remote/Core/ExternalAccess/UnitTesting/Api/UnitTestingPinnedSolutionInfoWrapper.cs
|
src/Workspaces/Remote/Core/ExternalAccess/UnitTesting/Api/UnitTestingPinnedSolutionInfoWrapper.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.Serialization;
using Microsoft.CodeAnalysis.Remote;
namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api
{
[DataContract]
internal readonly struct UnitTestingPinnedSolutionInfoWrapper
{
[DataMember(Order = 0)]
internal readonly PinnedSolutionInfo UnderlyingObject;
public UnitTestingPinnedSolutionInfoWrapper(PinnedSolutionInfo underlyingObject)
=> UnderlyingObject = underlyingObject;
public static implicit operator UnitTestingPinnedSolutionInfoWrapper(PinnedSolutionInfo info)
=> new(info);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.Serialization;
using Microsoft.CodeAnalysis.Remote;
namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting
{
[DataContract]
internal readonly struct UnitTestingPinnedSolutionInfoWrapper
{
[DataMember(Order = 0)]
internal readonly PinnedSolutionInfo UnderlyingObject;
public UnitTestingPinnedSolutionInfoWrapper(PinnedSolutionInfo underlyingObject)
=> UnderlyingObject = underlyingObject;
public static implicit operator UnitTestingPinnedSolutionInfoWrapper(PinnedSolutionInfo info)
=> new(info);
}
}
|
mit
|
C#
|
e73ce4fe6348436968e426f17819d51417d4f4a1
|
Update Intro_03_SingleRun
|
ig-sinicyn/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,Teknikaali/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,redknightlois/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,Teknikaali/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet,redknightlois/BenchmarkDotNet,alinasmirnova/BenchmarkDotNet,Ky7m/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,Ky7m/BenchmarkDotNet,Ky7m/BenchmarkDotNet,Teknikaali/BenchmarkDotNet,Ky7m/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,PerfDotNet/BenchmarkDotNet,redknightlois/BenchmarkDotNet,adamsitnik/BenchmarkDotNet,ig-sinicyn/BenchmarkDotNet
|
BenchmarkDotNet.Samples/Introduction/Intro_03_SingleRun.cs
|
BenchmarkDotNet.Samples/Introduction/Intro_03_SingleRun.cs
|
using BenchmarkDotNet.Tasks;
namespace BenchmarkDotNet.Samples.Introduction
{
public class Intro_03_SingleRun
{
private const int N = 128 * 1024 * 1024;
private int[] x = new int[N];
// The SingleRun mode is useful, if you want to measure the cold start of your application
[Benchmark]
[BenchmarkTask(5, mode: BenchmarkMode.SingleRun, platform: BenchmarkPlatform.X86, warmupIterationCount: 0, targetIterationCount: 1)]
[OperationsPerInvoke(N / 16)] // The OperationsPerInvoke help you to specify amount of basic operation inside the target method
public void ColdStart()
{
for (int i = 0; i < x.Length; i += 16)
x[i]++;
}
[Benchmark]
[BenchmarkTask(5, mode: BenchmarkMode.Throughput, platform: BenchmarkPlatform.X86, warmupIterationCount: 5, targetIterationCount: 10)]
[OperationsPerInvoke(N / 16)]
public void WarmStart()
{
for (int i = 0; i < x.Length; i += 16)
x[i]++;
}
[Benchmark]
[BenchmarkTask(5, mode: BenchmarkMode.Throughput, platform: BenchmarkPlatform.X86, warmupIterationCount: 0, targetIterationCount: 10)]
[OperationsPerInvoke(N / 16)]
public void Transition()
{
for (int i = 0; i < x.Length; i += 16)
x[i]++;
}
// See also: https://msdn.microsoft.com/en-us/library/cc656914.aspx
// See also: http://en.wikipedia.org/wiki/CPU_cache
}
}
|
using BenchmarkDotNet.Tasks;
namespace BenchmarkDotNet.Samples.Introduction
{
public class Intro_03_SingleRun
{
private const int N = 128 * 1024 * 1024;
private int[] x = new int[N];
// The SingleRun mode is useful, if you want to measure the cold start of your application
[Benchmark]
[BenchmarkTask(5, mode: BenchmarkMode.SingleRun, platform: BenchmarkPlatform.X86, warmupIterationCount: 0, targetIterationCount: 1)]
[OperationsPerInvoke(N / 16)] // The OperationsPerInvoke help you to specify amount of basic operation inside the target method
public void ColdStart()
{
for (int i = 0; i < x.Length; i += 16)
x[i]++;
}
[Benchmark]
[BenchmarkTask(5, mode: BenchmarkMode.Throughput, platform: BenchmarkPlatform.X86, warmupIterationCount: 5, targetIterationCount: 10)]
[OperationsPerInvoke(N / 16)]
public void WarmStart()
{
for (int i = 0; i < x.Length; i += 16)
x[i]++;
}
// See also: https://msdn.microsoft.com/en-us/library/cc656914.aspx
// See also: http://en.wikipedia.org/wiki/CPU_cache
}
}
|
mit
|
C#
|
0338edf3a1524381b41cf5b92f45f72dcf482ec8
|
Throw an exception of Unknown hotel is given
|
ArachisH/Sulakore
|
Sulakore/Habbo/HExtensions.cs
|
Sulakore/Habbo/HExtensions.cs
|
using System;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
namespace Sulakore.Habbo
{
public static class HExtensions
{
private static readonly Random _rng;
private const BindingFlags BINDINGS = (BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
static HExtensions()
{
_rng = new Random();
}
public static HSign GetRandomSign()
{
return (HSign)_rng.Next(0, 19);
}
public static HTheme GetRandomTheme()
{
return (HTheme)((_rng.Next(1, 7) + 2) & 7);
}
public static HDirection ToLeft(this HDirection facing)
{
return (HDirection)(((int)facing - 1) & 7);
}
public static HDirection ToRight(this HDirection facing)
{
return (HDirection)(((int)facing + 1) & 7);
}
public static Uri ToUri(this HHotel hotel)
{
return new Uri($"https://www.habbo.{hotel.ToDomain()}");
}
public static string ToDomain(this HHotel hotel)
{
if (hotel == HHotel.Unknown)
{
throw new ArgumentException("Hotel cannot be 'Unknown'.", nameof(hotel));
}
string value = hotel.ToString().ToLower();
return (value.Length != 5 ? value : value.Insert(3, "."));
}
public static IEnumerable<MethodInfo> GetAllMethods(this Type type)
{
return type.Excavate(t => t.GetMethods(BINDINGS));
}
public static IEnumerable<PropertyInfo> GetAllProperties(this Type type)
{
return type.Excavate(t => t.GetProperties(BINDINGS));
}
public static IEnumerable<T> Excavate<T>(this Type type, Func<Type, IEnumerable<T>> excavator)
{
IEnumerable<T> excavated = null;
while (type != null && type.BaseType != null)
{
IEnumerable<T> batch = excavator(type);
excavated = (excavated?.Concat(batch) ?? batch);
type = type.BaseType; ;
}
return excavated;
}
}
}
|
using System;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
namespace Sulakore.Habbo
{
public static class HExtensions
{
private static readonly Random _rng;
private const BindingFlags BINDINGS = (BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
static HExtensions()
{
_rng = new Random();
}
public static HSign GetRandomSign()
{
return (HSign)_rng.Next(0, 19);
}
public static HTheme GetRandomTheme()
{
return (HTheme)((_rng.Next(1, 7) + 2) & 7);
}
public static HDirection ToLeft(this HDirection facing)
{
return (HDirection)(((int)facing - 1) & 7);
}
public static HDirection ToRight(this HDirection facing)
{
return (HDirection)(((int)facing + 1) & 7);
}
public static string ToDomain(this HHotel hotel)
{
string value = hotel.ToString().ToLower();
return (value.Length != 5 ? value : value.Insert(3, "."));
}
public static Uri ToUri(this HHotel hotel)
{
return new Uri($"https://www.habbo.{hotel.ToDomain()}");
}
public static IEnumerable<MethodInfo> GetAllMethods(this Type type)
{
return type.Excavate(t => t.GetMethods(BINDINGS));
}
public static IEnumerable<PropertyInfo> GetAllProperties(this Type type)
{
return type.Excavate(t => t.GetProperties(BINDINGS));
}
public static IEnumerable<T> Excavate<T>(this Type type, Func<Type, IEnumerable<T>> excavator)
{
IEnumerable<T> excavated = null;
while (type != null && type.BaseType != null)
{
IEnumerable<T> batch = excavator(type);
excavated = (excavated?.Concat(batch) ?? batch);
type = type.BaseType; ;
}
return excavated;
}
}
}
|
mit
|
C#
|
cafc35695994446166b94e4cbc9ffef34b4a8066
|
Disable text localization
|
ndrmc/cats,ndrmc/cats,ndrmc/cats
|
Web/Helpers/LanguageHelper.cs
|
Web/Helpers/LanguageHelper.cs
|
using Cats.Services.Security;
using LanguageHelpers.Localization.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Cats.Helpers
{
public static class LanguageHelper
{
public static string Translate(this HtmlHelper html, string phrase, string language = "EN")
{
//TODO: By pass phrase translation to see the impact of localization module on performance
return phrase;
var currentLanguage = language;
// Get current language setting for the user.
// NOTE: Since we might call this method from public views where we might not have a signed-in
// user, we must check for possible errors.
try
{
var user = (UserIdentity)HttpContext.Current.User.Identity;
currentLanguage = user.Profile.LanguageCode;
}
catch (Exception)
{
currentLanguage = language;
}
// If the current language is 'English' then return the default value (the passed value)
if (currentLanguage == "EN")
return phrase;
// For other languages try to get the corresponding translation
var service = (ILocalizedTextService)DependencyResolver.Current.GetService(typeof(ILocalizedTextService));
return service.Translate(phrase, language);
}
}
}
|
using Cats.Services.Security;
using LanguageHelpers.Localization.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Cats.Helpers
{
public static class LanguageHelper
{
public static string Translate(this HtmlHelper html, string phrase, string language = "EN")
{
return phrase;
var currentLanguage = language;
// Get current language setting for the user.
// NOTE: Since we might call this method from public views where we might not have a signed-in
// user, we must check for possible errors.
try
{
var user = (UserIdentity)HttpContext.Current.User.Identity;
currentLanguage = user.Profile.LanguageCode;
}
catch (Exception)
{
currentLanguage = language;
}
// If the current language is 'English' then return the default value (the passed value)
if (currentLanguage == "EN")
return phrase;
// For other languages try to get the corresponding translation
var service = (ILocalizedTextService)DependencyResolver.Current.GetService(typeof(ILocalizedTextService));
return service.Translate(phrase, language);
}
}
}
|
apache-2.0
|
C#
|
1607f0dbaf724bf47bb2ae6e8f4ffd479bcc409e
|
Fix Dependencies
|
revaturelabs/revashare-svc-webapi
|
revashare-svc-webapi/revashare-svc-webapi.Tests/FlagTests.cs
|
revashare-svc-webapi/revashare-svc-webapi.Tests/FlagTests.cs
|
using Moq;
using NSubstitute;
using revashare_svc_webapi.Client.Controllers;
using revashare_svc_webapi.Logic;
using revashare_svc_webapi.Logic.AdminLogic;
using revashare_svc_webapi.Logic.Interfaces;
using revashare_svc_webapi.Logic.Models;
using revashare_svc_webapi.Logic.RevaShareServiceReference;
using revashare_svc_webapi.Logic.ServiceClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Xunit;
namespace revashare_svc_webapi.Tests
{
public class FlagTests
{
[Fact]
public void test_GetFlags()
{
RevaShareDataServiceClient dataClient = new RevaShareDataServiceClient();
List<FlagDAO> getflags = dataClient.GetAllFlags().ToList();
Assert.NotNull(getflags);
}
[Fact]
public void test_GetFlags_AdminLogic()
{
ServiceClient sc = new ServiceClient();
AdminLogic admLogic = new AdminLogic(sc);
var a = admLogic.GetReports();
Assert.NotEmpty(a);
}
}
}
|
using Moq;
using NSubstitute;
using revashare_svc_webapi.Client.Controllers;
using revashare_svc_webapi.Logic;
using revashare_svc_webapi.Logic.AdminLogic;
using revashare_svc_webapi.Logic.Interfaces;
using revashare_svc_webapi.Logic.Models;
using revashare_svc_webapi.Logic.RevaShareServiceReference;
using revashare_svc_webapi.Logic.ServiceClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Xunit;
namespace revashare_svc_webapi.Tests
{
public class FlagTests
{
[Fact]
public void test_GetFlags()
{
RevaShareDataServiceClient dataClient = new RevaShareDataServiceClient();
List<FlagDAO> getflags = dataClient.GetAllFlags().ToList();
Assert.NotNull(getflags);
}
[Fact]
public void test_GetFlags_AdminLogic()
{
ServiceClient sc = new ServiceClient();
AdminLogic admLogic = new AdminLogic(sc);
var a = admLogic.GetUserReports();
Assert.NotEmpty(a);
}
}
}
|
mit
|
C#
|
555527c24fcfc6a69eb895b7d704903b259c3783
|
fix session purging
|
mooware/mooftpserv
|
lib/Server.cs
|
lib/Server.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace mooftpserv.lib
{
public class Server
{
private int port;
private IPAddress host;
private TcpListener socket;
private IAuthHandler authHandler;
private IFileSystemHandler fsHandler;
private List<Session> sessions;
public Server(string host, int port)
{
this.port = port;
this.host = IPAddress.Parse(host);
this.sessions = new List<Session>();
}
public void Run()
{
if (authHandler == null)
authHandler = new DefaultAuthHandler();
if (fsHandler == null)
fsHandler = new DefaultFileSystemHandler(new DirectoryInfo(Directory.GetCurrentDirectory()));
if (socket == null)
socket = new TcpListener(host, port);
socket.Start();
while (true)
{
TcpClient client = socket.AcceptTcpClient();
Session session = new Session(client, authHandler.Clone(), fsHandler.Clone());
sessions.Add(session);
// purge old sessions
for (int i = sessions.Count - 1; i >= 0; --i)
{
if (!sessions[i].IsOpen) {
sessions.RemoveAt(i);
--i;
}
}
}
}
public void Stop()
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace mooftpserv.lib
{
public class Server
{
private int port;
private IPAddress host;
private TcpListener socket;
private IAuthHandler authHandler;
private IFileSystemHandler fsHandler;
private List<Session> sessions;
public Server(string host, int port)
{
this.port = port;
this.host = IPAddress.Parse(host);
this.sessions = new List<Session>();
}
public void Run()
{
if (authHandler == null)
authHandler = new DefaultAuthHandler();
if (fsHandler == null)
fsHandler = new DefaultFileSystemHandler(new DirectoryInfo(Directory.GetCurrentDirectory()));
if (socket == null)
socket = new TcpListener(host, port);
socket.Start();
while (true)
{
TcpClient client = socket.AcceptTcpClient();
Session session = new Session(client, authHandler.Clone(), fsHandler.Clone());
sessions.Add(session);
// purge old sessions
foreach (Session s in sessions)
{
if (!s.IsOpen)
sessions.Remove(s);
}
}
}
public void Stop()
{
}
}
}
|
mit
|
C#
|
39b85866399ff9935ac4f4ef90675c3b4595bd1e
|
Improve and un-skip tests
|
arkivverket/arkade5,arkivverket/arkade5,arkivverket/arkade5
|
src/Arkivverket.Arkade.Test/Core/ArkadeProcessingAreaTest.cs
|
src/Arkivverket.Arkade.Test/Core/ArkadeProcessingAreaTest.cs
|
using System;
using System.IO;
using Arkivverket.Arkade.Core;
using Arkivverket.Arkade.Util;
using FluentAssertions;
using Xunit;
namespace Arkivverket.Arkade.Test.Core
{
public class ArkadeProcessingAreaTest : IDisposable
{
private readonly string _locationPath;
private readonly DirectoryInfo _location;
public ArkadeProcessingAreaTest()
{
_locationPath = Path.Combine(Environment.CurrentDirectory, "TestData", "ProcessingAreaTests");
_location = new DirectoryInfo(_locationPath);
_location.Create();
}
[Fact]
public void ProcessingAreaIsEstablished()
{
ArkadeProcessingArea.Establish(_locationPath);
ArkadeProcessingArea.Location.FullName.Should().Be(_locationPath);
ArkadeProcessingArea.RootDirectory.FullName.Should().Be(_locationPath + "\\Arkade");
ArkadeProcessingArea.WorkDirectory.FullName.Should().Be(_locationPath + "\\Arkade\\work");
ArkadeProcessingArea.LogsDirectory.FullName.Should().Be(_locationPath + "\\Arkade\\logs");
}
[Fact]
public void ProcessingAreaIsEstablishedWithInvalidLocation()
{
string nonExistingLocation = Path.Combine(Environment.CurrentDirectory, "TestData", "NonExistingDirectory");
ArkadeProcessingArea.Establish(nonExistingLocation);
ProcessingAreaIsSetupWithTemporaryLogsDirectoryOnly();
}
[Fact]
public void ProcessingAreaIsEstablishedWithMissingLocation()
{
ArkadeProcessingArea.Establish("");
ProcessingAreaIsSetupWithTemporaryLogsDirectoryOnly();
}
private static void ProcessingAreaIsSetupWithTemporaryLogsDirectoryOnly()
{
string temporaryLogsDirectoryPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
ArkadeConstants.DirectoryNameTemporaryLogsLocation
);
ArkadeProcessingArea.LogsDirectory.FullName.Should().Be(temporaryLogsDirectoryPath);
ArkadeProcessingArea.Location.Should().BeNull();
ArkadeProcessingArea.RootDirectory.Should().BeNull();
ArkadeProcessingArea.WorkDirectory.Should().BeNull();
}
public void Dispose()
{
_location.Delete(true);
}
}
}
|
using System;
using System.IO;
using Arkivverket.Arkade.Core;
using Arkivverket.Arkade.Util;
using FluentAssertions;
using Xunit;
namespace Arkivverket.Arkade.Test.Core
{
public class ArkadeProcessingAreaTest
{
[Fact]
public void ProcessingAreaIsEstablished()
{
string location = Path.Combine(Environment.CurrentDirectory, "TestData");
ArkadeProcessingArea.Establish(location);
ArkadeProcessingArea.Location.FullName.Should().Be(location);
ArkadeProcessingArea.RootDirectory.FullName.Should().Be(location + "\\Arkade");
ArkadeProcessingArea.WorkDirectory.FullName.Should().Be(location + "\\Arkade\\work");
ArkadeProcessingArea.LogsDirectory.FullName.Should().Be(location + "\\Arkade\\logs");
}
[Fact (Skip="Fails on build server ...")]
public void ProcessingAreaIsEstablishedWithInvalidLocation()
{
string nonExistingLocation = Path.Combine(Environment.CurrentDirectory, "NonExistingDirectory");
ArkadeProcessingArea.Establish(nonExistingLocation);
ProcessingAreaIsSetupWithTemporaryLogsDirectoryOnly();
}
[Fact (Skip = "Fails on build server ...")]
public void ProcessingAreaIsEstablishedWithMissingLocation()
{
ArkadeProcessingArea.Establish("");
ProcessingAreaIsSetupWithTemporaryLogsDirectoryOnly();
}
private static void ProcessingAreaIsSetupWithTemporaryLogsDirectoryOnly()
{
string temporaryLogsDirectoryPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
ArkadeConstants.DirectoryNameTemporaryLogsLocation
);
ArkadeProcessingArea.LogsDirectory.FullName.Should().Be(temporaryLogsDirectoryPath);
ArkadeProcessingArea.Location.Should().BeNull();
ArkadeProcessingArea.RootDirectory.Should().BeNull();
ArkadeProcessingArea.WorkDirectory.Should().BeNull();
}
}
}
|
agpl-3.0
|
C#
|
68f7bc6f7b102ddadc83c159a4f45f7b66c82609
|
Refactor Jsonformatter
|
mattfrear/Swashbuckle.AspNetCore.Examples
|
src/Swashbuckle.AspNetCore.Filters/Examples/JsonFormatter.cs
|
src/Swashbuckle.AspNetCore.Filters/Examples/JsonFormatter.cs
|
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Swashbuckle.AspNetCore.Filters
{
internal class JsonFormatter
{
public object FormatJson(object examples, JsonSerializerSettings serializerSettings, bool includeMediaType)
{
if (includeMediaType)
{
var wrappedExamples = new Dictionary<string, object>
{
{
"application/json", examples
}
};
return SerializeDeserialize(wrappedExamples, serializerSettings);
}
return SerializeDeserialize(examples, serializerSettings);
}
private static object SerializeDeserialize(object examples, JsonSerializerSettings serializerSettings)
{
var jsonString = JsonConvert.SerializeObject(examples, serializerSettings);
var result = JsonConvert.DeserializeObject(jsonString);
return result;
}
}
}
|
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Swashbuckle.AspNetCore.Filters
{
internal class JsonFormatter
{
public object FormatJson(object examples, JsonSerializerSettings serializerSettings, bool includeMediaType)
{
if (includeMediaType)
{
examples = new Dictionary<string, object>
{
{
"application/json", examples
}
};
}
var jsonString = JsonConvert.SerializeObject(examples, serializerSettings);
var result = JsonConvert.DeserializeObject(jsonString);
return result;
}
}
}
|
mit
|
C#
|
50890047b9862b67d623ff5109de0f2e36f83335
|
Fix test name
|
Galad/tranquire,Galad/tranquire,Galad/tranquire
|
src/Tranquire.Selenium.Tests/Actions/OpenContextMenuTests.cs
|
src/Tranquire.Selenium.Tests/Actions/OpenContextMenuTests.cs
|
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tranquire.Selenium.Actions;
using Tranquire.Selenium.Questions;
using Tranquire.Tests;
using Xunit;
namespace Tranquire.Selenium.Tests.Actions
{
public class OpenContextMenuTests : WebDriverTest
{
public OpenContextMenuTests(WebDriverFixture fixture) : base(fixture, "OpenContextMenu.html")
{
}
[Theory, DomainAutoData]
public void Execute_ShouldOpenContextMenu(string expected)
{
//arrange
var js = $"setupTest('{expected}');";
Fixture.WebDriver.ExecuteScript(js);
var target = Target.The("element where to open the context menu").LocatedBy(By.Id("ClickableElement"));
var expectedClickContent = Target.The("expected click content").LocatedBy(By.Id("ExpectedValue"));
var action = OpenContextMenu.On(target);
//act
Fixture.Actor.When(action);
//assert
var actual = Answer(Value.Of(expectedClickContent).Value);
Assert.Equal(expected, actual);
}
}
}
|
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tranquire.Selenium.Actions;
using Tranquire.Selenium.Questions;
using Tranquire.Tests;
using Xunit;
namespace Tranquire.Selenium.Tests.Actions
{
public class OpenContextMenuTests : WebDriverTest
{
public OpenContextMenuTests(WebDriverFixture fixture) : base(fixture, "OpenContextMenu.html")
{
}
[Theory, DomainAutoData]
public void Execute_WhenTimeoutExpires_ShouldThrow(string expected)
{
//arrange
var js = $"setupTest('{expected}');";
Fixture.WebDriver.ExecuteScript(js);
var target = Target.The("element where to open the context menu").LocatedBy(By.Id("ClickableElement"));
var expectedClickContent = Target.The("expected click content").LocatedBy(By.Id("ExpectedValue"));
var action = OpenContextMenu.On(target);
//act
Fixture.Actor.When(action);
//assert
var actual = Answer(Value.Of(expectedClickContent).Value);
Assert.Equal(expected, actual);
}
}
}
|
mit
|
C#
|
9bd78ddfe2d1a9e76d0a889cc7c4ad3ff6bbffe3
|
Add email validity check to change email command
|
SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers
|
src/SFA.DAS.EmployerUsers.Application/Commands/RequestChangeEmail/RequestChangeEmailCommandValidator.cs
|
src/SFA.DAS.EmployerUsers.Application/Commands/RequestChangeEmail/RequestChangeEmailCommandValidator.cs
|
using System.Threading.Tasks;
using SFA.DAS.EmployerUsers.Application.Validation;
namespace SFA.DAS.EmployerUsers.Application.Commands.RequestChangeEmail
{
public class RequestChangeEmailCommandValidator : BaseValidator, IValidator<RequestChangeEmailCommand>
{
public Task<ValidationResult> ValidateAsync(RequestChangeEmailCommand item)
{
var result = new ValidationResult();
if (string.IsNullOrEmpty(item.UserId))
{
result.AddError(nameof(item.UserId));
}
if (string.IsNullOrEmpty(item.NewEmailAddress) || !IsEmailValid(item.NewEmailAddress))
{
result.AddError(nameof(item.NewEmailAddress), "Enter a valid email address");
}
if (string.IsNullOrEmpty(item.ConfirmEmailAddress) || !IsEmailValid(item.ConfirmEmailAddress))
{
result.AddError(nameof(item.ConfirmEmailAddress), "Re-type email address");
}
if (!result.IsValid())
{
return Task.FromResult(result);
}
if (!item.NewEmailAddress.Equals(item.ConfirmEmailAddress, System.StringComparison.CurrentCultureIgnoreCase))
{
result.AddError(nameof(item.ConfirmEmailAddress), "Emails don't match");
}
return Task.FromResult(result);
}
}
}
|
using System.Threading.Tasks;
using SFA.DAS.EmployerUsers.Application.Validation;
namespace SFA.DAS.EmployerUsers.Application.Commands.RequestChangeEmail
{
public class RequestChangeEmailCommandValidator : IValidator<RequestChangeEmailCommand>
{
public Task<ValidationResult> ValidateAsync(RequestChangeEmailCommand item)
{
var result = new ValidationResult();
if (string.IsNullOrEmpty(item.UserId))
{
result.AddError(nameof(item.UserId));
}
if (string.IsNullOrEmpty(item.NewEmailAddress))
{
result.AddError(nameof(item.NewEmailAddress), "Enter a valid email address");
}
if (string.IsNullOrEmpty(item.ConfirmEmailAddress))
{
result.AddError(nameof(item.ConfirmEmailAddress), "Re-type email address");
}
if (!result.IsValid())
{
return Task.FromResult(result);
}
if (!item.NewEmailAddress.Equals(item.ConfirmEmailAddress, System.StringComparison.CurrentCultureIgnoreCase))
{
result.AddError(nameof(item.ConfirmEmailAddress), "Emails don't match");
}
return Task.FromResult(result);
}
}
}
|
mit
|
C#
|
e32b142a21818237192b10f5cc378cef03ad643b
|
Add ClosestPointOnTs
|
Weingartner/SolidworksAddinFramework
|
SolidworksAddinFramework/CurveExtension.cs
|
SolidworksAddinFramework/CurveExtension.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using SolidWorks.Interop.sldworks;
namespace SolidworksAddinFramework
{
public static class CurveExtension
{
/// <summary>
/// Return the point at parameter value t on the curve.
/// </summary>
/// <param name="curve"></param>
/// <param name="t"></param>
/// <returns></returns>
public static double[] PointAt(this ICurve curve, double t)
{
return (double[]) curve.Evaluate2(t, 0);
}
public static double[] ClosestPointOnTs(this ICurve curve , double x, double y, double z)
{
return (double[]) curve.GetClosestPointOn(x, y, z);
}
/// <summary>
/// Return the length of the curve between the start
/// and end parameters.
/// </summary>
/// <param name="curve"></param>
/// <returns></returns>
public static double Length(this ICurve curve)
{
bool isPeriodic;
double end;
bool isClosed;
double start;
curve.GetEndParams(out start, out end, out isClosed, out isPeriodic);
return curve.GetLength3(start, end);
}
/// <summary>
/// Return the domain of the curve. ie the [startParam, endParam]
/// </summary>
/// <param name="curve"></param>
/// <returns></returns>
public static double[] Domain(this ICurve curve )
{
bool isPeriodic;
double end;
bool isClosed;
double start;
curve.GetEndParams(out start, out end, out isClosed, out isPeriodic);
return new[] {start, end};
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using SolidWorks.Interop.sldworks;
namespace SolidworksAddinFramework
{
public static class CurveExtension
{
/// <summary>
/// Return the point at parameter value t on the curve.
/// </summary>
/// <param name="curve"></param>
/// <param name="t"></param>
/// <returns></returns>
public static double[] PointAt(this ICurve curve, double t)
{
return (double[]) curve.Evaluate2(t, 0);
}
/// <summary>
/// Return the length of the curve between the start
/// and end parameters.
/// </summary>
/// <param name="curve"></param>
/// <returns></returns>
public static double Length(this ICurve curve)
{
bool isPeriodic;
double end;
bool isClosed;
double start;
curve.GetEndParams(out start, out end, out isClosed, out isPeriodic);
return curve.GetLength3(start, end);
}
/// <summary>
/// Return the domain of the curve. ie the [startParam, endParam]
/// </summary>
/// <param name="curve"></param>
/// <returns></returns>
public static double[] Domain(this ICurve curve )
{
bool isPeriodic;
double end;
bool isClosed;
double start;
curve.GetEndParams(out start, out end, out isClosed, out isPeriodic);
return new[] {start, end};
}
}
}
|
mit
|
C#
|
823702074b09428d662aec17a20fa52af69bc59a
|
update Modeller version
|
xirqlz/blueprint41
|
Blueprint41.Modeller/Properties/AssemblyInfo.cs
|
Blueprint41.Modeller/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("Blueprint41.Modeller")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Circles-Arrows")]
[assembly: AssemblyProduct("Blueprint41.Modeller")]
[assembly: AssemblyCopyright("Copyright © 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("946c189d-da9d-49dc-8a0c-cf4820b26c0d")]
// 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.2.0.0")]
[assembly: AssemblyFileVersion("1.2.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("Blueprint41.Modeller")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Circles-Arrows")]
[assembly: AssemblyProduct("Blueprint41.Modeller")]
[assembly: AssemblyCopyright("Copyright © 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("946c189d-da9d-49dc-8a0c-cf4820b26c0d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
|
mit
|
C#
|
6e017f877edf165a0b3f6b88911344d74b544c23
|
Remove reference to `omnisharp.useGlobalMono` from messages
|
OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn
|
src/OmniSharp.MSBuild/Logging/ErrorMessages.cs
|
src/OmniSharp.MSBuild/Logging/ErrorMessages.cs
|
namespace OmniSharp.MSBuild.Logging
{
internal class ErrorMessages
{
internal const string ReferenceAssembliesNotFoundUnix = "This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).";
internal const string ReferenceAssembliesNotFoundNet50Unix = "This project targets .NET 5.0 but the currently used MSBuild is not compatible with it - MSBuild 16.8+ is required. To solve this, run the net6.0 build of OmniSharp on the .NET SDK. (e.g. 'omnisharp.useModernNet': true in C# Extension for VS Code).";
internal const string ReferenceAssembliesNotFoundNet60Unix = "This project targets .NET 6.0 but the currently used MSBuild is not compatible with it - MSBuild 17.0+ is required. To solve this, run the net6.0 build of OmniSharp on the .NET SDK. (e.g. 'omnisharp.useModernNet': true in C# Extension for VS Code).";
internal const string ReferenceAssembliesNotFoundNet50Windows = "This project targets .NET 5.0 but the currently used MSBuild is not compatible with it - MSBuild 16.8+ is required. To solve this, if you have Visual Studio 2019 installed on your machine, make sure it is updated to version 16.8.";
internal const string ReferenceAssembliesNotFoundNet60Windows = "This project targets .NET 6.0 but the currently used MSBuild is not compatible with it - MSBuild 17.0+ is required. To solve this, if you have Visual Studio 2022 installed on your machine, make sure it is updated to version 17.0.";
}
}
|
namespace OmniSharp.MSBuild.Logging
{
internal class ErrorMessages
{
internal const string ReferenceAssembliesNotFoundUnix = "This project targets .NET version that requires reference assemblies that do not ship with OmniSharp out of the box (e.g. .NET Framework). The most common solution is to make sure Mono is installed on your machine (https://mono-project.com/download/) and that OmniSharp is started with that Mono installation (e.g. \"omnisharp.useGlobalMono\":\"always\" in C# Extension for VS Code).";
internal const string ReferenceAssembliesNotFoundNet50Unix = "This project targets .NET 5.0 but the currently used MSBuild is not compatible with it - MSBuild 16.8+ is required. To solve this, run OmniSharp on its embedded Mono (e.g. 'omnisharp.useGlobalMono':'never' in C# Extension for VS Code) or, if running on global Mono installation, make sure at least Mono 6.13 is installed on your machine (https://mono-project.com/download/). Alternatively, add 'omnisharp.json' to your project root with the setting { \"msbuild\": { \"useBundledOnly\": true } }.";
internal const string ReferenceAssembliesNotFoundNet60Unix = "This project targets .NET 6.0 but the currently used MSBuild is not compatible with it - MSBuild 16.9+ is required. To solve this, run OmniSharp on its embedded Mono (e.g. 'omnisharp.useGlobalMono':'never' in C# Extension for VS Code). Alternatively, add 'omnisharp.json' to your project root with the setting { \"msbuild\": { \"useBundledOnly\": true } }.";
internal const string ReferenceAssembliesNotFoundNet50Windows = "This project targets .NET 5.0 but the currently used MSBuild is not compatible with it - MSBuild 16.8+ is required. To solve this, if you have Visual Studio 2019 installed on your machine, make sure it is updated to version 16.8 or add 'omnisharp.json' to your project root with the setting { \"msbuild\": { \"useBundledOnly\": true } }.";
internal const string ReferenceAssembliesNotFoundNet60Windows = "This project targets .NET 6.0 but the currently used MSBuild is not compatible with it - MSBuild 16.9+ is required. To solve this, if you have Visual Studio 2019 installed on your machine, make sure it is updated to version 16.9 or add 'omnisharp.json' to your project root with the setting { \"msbuild\": { \"useBundledOnly\": true } }.";
}
}
|
mit
|
C#
|
4a4463600a434a763e06090df16bf18faa0ee582
|
Use acknowledgement callback to indicate whether createTopic event was successful
|
hoppity/kafka-http-dotnet
|
src/KafkaHttp.Net/KafkaProducer.cs
|
src/KafkaHttp.Net/KafkaProducer.cs
|
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Quobject.SocketIoClientDotNet.Client;
namespace KafkaHttp.Net
{
public interface IKafkaProducer
{
Task CreateTopic(string name);
void Publish(params Message<string>[] payload);
}
public class KafkaProducer : IKafkaProducer
{
private readonly Socket _socket;
private readonly Json _json;
public KafkaProducer(Socket socket)
{
_socket = socket;
_json = new Json();
}
public Task CreateTopic(string name)
{
Trace.TraceInformation($"Creating topic {name}...");
var tcs = new TaskCompletionSource<object>();
_socket.Emit(
"createTopic",
(e, d) =>
{
if (e != null)
{
Trace.TraceError(e.ToString());
tcs.SetException(new Exception(e.ToString()));
return;
}
Trace.TraceInformation($"Topic {name} created.");
tcs.SetResult(true);
}
, name);
return tcs.Task;
}
public void Publish(params Message<string>[] payload)
{
_socket.Emit("publish", _json.Serialize(payload));
}
}
}
|
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Quobject.SocketIoClientDotNet.Client;
namespace KafkaHttp.Net
{
public interface IKafkaProducer
{
Task CreateTopic(string name);
void Publish(params Message<string>[] payload);
}
public class KafkaProducer : IKafkaProducer
{
private readonly Socket _socket;
private readonly Json _json;
public KafkaProducer(Socket socket)
{
_socket = socket;
_json = new Json();
}
public Task CreateTopic(string name)
{
Trace.TraceInformation("Creating topic...");
var waitHandle = new AutoResetEvent(false);
_socket.On("topicCreated", o => waitHandle.Set());
_socket.Emit("createTopic", name);
return waitHandle.ToTask($"Failed to create topic {name}.", $"Created topic {name}.");
}
public void Publish(params Message<string>[] payload)
{
_socket.Emit("publish", _json.Serialize(payload));
}
}
}
|
apache-2.0
|
C#
|
21e8527b541fa5380c4081c727dba25505819bdd
|
add this.
|
horsdal/Nancy.Linker
|
src/Nancy.Linker/ResourceLinker.cs
|
src/Nancy.Linker/ResourceLinker.cs
|
namespace Nancy.Linker
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Nancy;
using Nancy.Routing;
public class ResourceLinker
{
private readonly IRouteCacheProvider routesProvider;
private List<RouteDescription> allRoutes = null;
private List<RouteDescription> AllRoutes
{
get
{
if (this.allRoutes == null)
this.allRoutes = this.routesProvider.GetCache().SelectMany(pair => pair.Value.Select(tuple => tuple.Item2)).ToList();
return this.allRoutes;
}
}
public ResourceLinker(IRouteCacheProvider routesProvider)
{
this.routesProvider = routesProvider;
}
public string BuildUriString(NancyContext context, string routeName, dynamic parameters)
{
var baseUri = new Uri(context.Request.Url.SiteBase.TrimEnd('/'));
var pathTemplate = this.AllRoutes.Single(r => r.Name == routeName).Path;
var uriTemplate = new UriTemplate(pathTemplate, true);
return uriTemplate.BindByName(baseUri, ToDictionary(parameters ?? new {})).ToString();
}
private static IDictionary<string, string> ToDictionary(object anonymousInstance)
{
var dictionary = anonymousInstance as IDictionary<string, string>;
if (dictionary != null) return dictionary;
return TypeDescriptor.GetProperties(anonymousInstance)
.OfType<PropertyDescriptor>()
.ToDictionary(p => p.Name, p => p.GetValue(anonymousInstance).ToString());
}
}
}
|
namespace Nancy.Linker
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Nancy;
using Nancy.Routing;
public class ResourceLinker
{
private readonly IRouteCacheProvider routesProvider;
private List<RouteDescription> allRoutes = null;
private List<RouteDescription> AllRoutes
{
get
{
if (allRoutes == null)
allRoutes = routesProvider.GetCache().SelectMany(pair => pair.Value.Select(tuple => tuple.Item2)).ToList();
return allRoutes;
}
}
public ResourceLinker(IRouteCacheProvider routesProvider)
{
this.routesProvider = routesProvider;
}
public string BuildUriString(NancyContext context, string routeName, dynamic parameters)
{
var baseUri = new Uri(context.Request.Url.SiteBase.TrimEnd('/'));
var pathTemplate = AllRoutes.Single(r => r.Name == routeName).Path;
var uriTemplate = new UriTemplate(pathTemplate, true);
return uriTemplate.BindByName(baseUri, ToDictionary(parameters ?? new {})).ToString();
}
private static IDictionary<string, string> ToDictionary(object anonymousInstance)
{
var dictionary = anonymousInstance as IDictionary<string, string>;
if (dictionary != null) return dictionary;
return TypeDescriptor.GetProperties(anonymousInstance)
.OfType<PropertyDescriptor>()
.ToDictionary(p => p.Name, p => p.GetValue(anonymousInstance).ToString());
}
}
}
|
mit
|
C#
|
66daf176624cb7fc23328a767ff6402165aacf1c
|
Bump version
|
Apex-net/WRP
|
src/WRP/Properties/AssemblyInfo.cs
|
src/WRP/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("WebReportPreview")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebReportPreview")]
[assembly: AssemblyCopyright("Copyright © 2015 Apex-net. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3cac1ff1-ca0c-4b41-9d4f-8f114c7d9883")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2015.0.*")]
[assembly: AssemblyFileVersion("2015.0.4.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("WebReportPreview")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebReportPreview")]
[assembly: AssemblyCopyright("Copyright © 2015 Apex-net. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3cac1ff1-ca0c-4b41-9d4f-8f114c7d9883")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2015.0.*")]
[assembly: AssemblyFileVersion("2015.0.2.0")]
|
mit
|
C#
|
712ab3865bf69fc300ee95a8e11e73dd71825bbc
|
Remove unused directives.
|
xlent-bi/Xlent.Match.ClientUtilities
|
code/ServiceBus/BaseClass.cs
|
code/ServiceBus/BaseClass.cs
|
using Microsoft.ServiceBus;
using Microsoft.WindowsAzure;
namespace Xlent.Match.ClientUtilities.ServiceBus
{
public class BaseClass
{
public BaseClass(string connectionStringName)
{
ConnectionString = CloudConfigurationManager.GetSetting(connectionStringName);
NamespaceManager = NamespaceManager.CreateFromConnectionString(ConnectionString);
}
public string ConnectionString { get; private set; }
public NamespaceManager NamespaceManager { get; private set; }
}
}
|
using System.Configuration;
using Microsoft.ServiceBus;
using Microsoft.WindowsAzure;
namespace Xlent.Match.ClientUtilities.ServiceBus
{
public class BaseClass
{
public BaseClass(string connectionStringName)
{
ConnectionString = CloudConfigurationManager.GetSetting(connectionStringName);
NamespaceManager = NamespaceManager.CreateFromConnectionString(ConnectionString);
}
public string ConnectionString { get; private set; }
public NamespaceManager NamespaceManager { get; private set; }
}
}
|
unlicense
|
C#
|
84a0b948e134092237e2cd5c7668c34f3da75a5c
|
Fix typo in VersionNavigation class name
|
peppy/osu,ZLima12/osu,EVAST9919/osu,peppy/osu-new,johnneijzen/osu,johnneijzen/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,2yangk23/osu,ppy/osu,ZLima12/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu
|
osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs
|
osu.Game/Online/API/Requests/Responses/APIChangelogBuild.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 Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIChangelogBuild : IEquatable<APIChangelogBuild>
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("version")]
public string Version { get; set; }
[JsonProperty("display_version")]
public string DisplayVersion { get; set; }
[JsonProperty("users")]
public long Users { get; set; }
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt { get; set; }
[JsonProperty("update_stream")]
public APIUpdateStream UpdateStream { get; set; }
[JsonProperty("changelog_entries")]
public List<APIChangelogEntry> ChangelogEntries { get; set; }
[JsonProperty("versions")]
public VersionNavigation Versions { get; set; }
public class VersionNavigation
{
[JsonProperty("next")]
public APIChangelogBuild Next { get; set; }
[JsonProperty("previous")]
public APIChangelogBuild Previous { get; set; }
}
public bool Equals(APIChangelogBuild other) => Id == other?.Id;
public override string ToString() => $"{UpdateStream.DisplayName} {DisplayVersion}";
}
}
|
// 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 Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIChangelogBuild : IEquatable<APIChangelogBuild>
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("version")]
public string Version { get; set; }
[JsonProperty("display_version")]
public string DisplayVersion { get; set; }
[JsonProperty("users")]
public long Users { get; set; }
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt { get; set; }
[JsonProperty("update_stream")]
public APIUpdateStream UpdateStream { get; set; }
[JsonProperty("changelog_entries")]
public List<APIChangelogEntry> ChangelogEntries { get; set; }
[JsonProperty("versions")]
public VersionNatigation Versions { get; set; }
public class VersionNatigation
{
[JsonProperty("next")]
public APIChangelogBuild Next { get; set; }
[JsonProperty("previous")]
public APIChangelogBuild Previous { get; set; }
}
public bool Equals(APIChangelogBuild other) => Id == other?.Id;
public override string ToString() => $"{UpdateStream.DisplayName} {DisplayVersion}";
}
}
|
mit
|
C#
|
35e1b8d8e35a6a2e76937f1ee75ccd9b5778644f
|
Allow using `ToLocalisableString` without a format string
|
ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,ppy/osu-framework,smoogipooo/osu-framework
|
osu.Framework/Localisation/LocalisableStringExtensions.cs
|
osu.Framework/Localisation/LocalisableStringExtensions.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;
#nullable enable
namespace osu.Framework.Localisation
{
public static class LocalisableStringExtensions
{
/// <summary>
/// Returns a <see cref="LocalisableFormattableString"/> formatting the given <paramref name="value"/> to a string, along with an optional <paramref name="format"/> string.
/// </summary>
/// <param name="value">The value to format.</param>
/// <param name="format">The format string.</param>
public static LocalisableFormattableString ToLocalisableString(this IFormattable value, string? format = null)
=> new LocalisableFormattableString(value, format);
}
}
|
// 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;
#nullable enable
namespace osu.Framework.Localisation
{
public static class LocalisableStringExtensions
{
/// <summary>
/// Returns a <see cref="LocalisableFormattableString"/> formatting the given <paramref name="value"/> with the specified <paramref name="format"/>.
/// </summary>
/// <param name="value">The value to format.</param>
/// <param name="format">The format string.</param>
public static LocalisableFormattableString ToLocalisableString(this IFormattable value, string? format)
=> new LocalisableFormattableString(value, format);
}
}
|
mit
|
C#
|
e735dbbecb225b2529162071a04875329580ff16
|
Add EF extensions for identity columns and index column order
|
TheOtherTimDuncan/TOTD
|
TOTD.EntityFramework/ConfigurationExtensions.cs
|
TOTD.EntityFramework/ConfigurationExtensions.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Infrastructure.Annotations;
using System.Data.Entity.ModelConfiguration.Configuration;
using System.Linq;
namespace TOTD.EntityFramework
{
public static class ConfigurationExtensions
{
public static PrimitivePropertyConfiguration HasIndex(this PrimitivePropertyConfiguration configuration)
{
return configuration.HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute()));
}
public static PrimitivePropertyConfiguration HasIndex(this PrimitivePropertyConfiguration configuration, string name)
{
return configuration.HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute(name)));
}
public static PrimitivePropertyConfiguration HasIndex(this PrimitivePropertyConfiguration configuration, string name, int order)
{
return configuration.HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute(name, order)));
}
public static PrimitivePropertyConfiguration HasUniqueIndex(this PrimitivePropertyConfiguration configuration)
{
return configuration.HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute()
{
IsUnique = true
}));
}
public static PrimitivePropertyConfiguration HasUniqueIndex(this PrimitivePropertyConfiguration configuration, string name)
{
return configuration.HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute(name)
{
IsUnique = true
}));
}
public static PrimitivePropertyConfiguration IsIdentity(this PrimitivePropertyConfiguration configuration)
{
return configuration.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Infrastructure.Annotations;
using System.Data.Entity.ModelConfiguration.Configuration;
using System.Linq;
namespace TOTD.EntityFramework
{
public static class ConfigurationExtensions
{
public static PrimitivePropertyConfiguration HasIndex(this PrimitivePropertyConfiguration configuration)
{
return configuration.HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute()));
}
public static PrimitivePropertyConfiguration HasIndex(this PrimitivePropertyConfiguration configuration, string name)
{
return configuration.HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute(name)));
}
public static PrimitivePropertyConfiguration HasUniqueIndex(this PrimitivePropertyConfiguration configuration)
{
return configuration.HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute()
{
IsUnique = true
}));
}
public static PrimitivePropertyConfiguration HasUniqueIndex(this PrimitivePropertyConfiguration configuration, string name)
{
return configuration.HasColumnAnnotation(IndexAnnotation.AnnotationName, new IndexAnnotation(new IndexAttribute(name)
{
IsUnique = true
}));
}
}
}
|
mit
|
C#
|
d2301068b6c2a04961986570075ef5075c2cf168
|
Fix changelog header staying dimmed after build show
|
ppy/osu,ppy/osu,ppy/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,smoogipoo/osu,peppy/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu
|
osu.Game/Overlays/Changelog/ChangelogUpdateStreamControl.cs
|
osu.Game/Overlays/Changelog/ChangelogUpdateStreamControl.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.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Changelog
{
public class ChangelogUpdateStreamControl : OverlayStreamControl<APIUpdateStream>
{
public ChangelogUpdateStreamControl()
{
SelectFirstTabByDefault = false;
}
protected override OverlayStreamItem<APIUpdateStream> CreateStreamItem(APIUpdateStream value) => new ChangelogUpdateStreamItem(value);
}
}
|
// 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.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Changelog
{
public class ChangelogUpdateStreamControl : OverlayStreamControl<APIUpdateStream>
{
protected override OverlayStreamItem<APIUpdateStream> CreateStreamItem(APIUpdateStream value) => new ChangelogUpdateStreamItem(value);
protected override void LoadComplete()
{
// suppress base logic of immediately selecting first item if one exists
// (we always want to start with no stream selected).
}
}
}
|
mit
|
C#
|
054e4051403a06c74038bda57f02fa5949b0c211
|
Remove unused constructor
|
andrewjleavitt/SpaceThing
|
Assets/Scripts/GunBehavior.cs
|
Assets/Scripts/GunBehavior.cs
|
using UnityEngine;
using UnityEngine.UI;
public class GunBehavior : MonoBehaviour {
public float fireRate = 0.0f;
public float heat = 0.0f;
public string weaponName;
public Slider charge;
public float nextFire = 0.0f;
public float heatBuildUp = 0.0f;
private Slider slider;
private SliderController sliderScript;
void Start() {
GameObject canvas = GameObject.Find("CanvasRenderer");
VerticalLayoutGroup sliderLayouGroup = canvas.GetComponent<VerticalLayoutGroup>();
GameObject sliderObject = Instantiate(Resources.Load("GunCooldownSlider"), sliderLayouGroup.transform) as GameObject;
slider = sliderObject.GetComponent<Slider>();
sliderScript = slider.GetComponent<SliderController>();
}
public void Trigger() {
if (Time.time > nextFire) {
Fire();
}
}
public float HeatTransfer() {
float heatToTransfer = heatBuildUp;
heatBuildUp = 0.0f;
return heatToTransfer;
}
private void Fire() {
Debug.unityLogger.Log("INFO", string.Format("Gun: {0} Triggered", weaponName));
Exhaust();
nextFire = Time.time + fireRate;
sliderScript.setMinMax(Time.time, nextFire);
}
private void Exhaust() {
heatBuildUp += heat; ;
}
}
|
using UnityEngine;
using UnityEngine.UI;
public class GunBehavior : MonoBehaviour {
public float fireRate = 0.0f;
public float heat = 0.0f;
public string weaponName;
public Slider charge;
public float nextFire = 0.0f;
public float heatBuildUp = 0.0f;
private Slider slider;
private SliderController sliderScript;
public GunBehavior(string newWeaponName, float newFireRate, float newHeat) {
weaponName = newWeaponName;
fireRate = newFireRate;
heat = newHeat;
}
void Start() {
GameObject canvas = GameObject.Find("CanvasRenderer");
VerticalLayoutGroup sliderLayouGroup = canvas.GetComponent<VerticalLayoutGroup>();
GameObject sliderObject = Instantiate(Resources.Load("GunCooldownSlider"), sliderLayouGroup.transform) as GameObject;
slider = sliderObject.GetComponent<Slider>();
sliderScript = slider.GetComponent<SliderController>();
}
public void Trigger() {
if (Time.time > nextFire) {
Fire();
}
}
public float HeatTransfer() {
float heatToTransfer = heatBuildUp;
heatBuildUp = 0.0f;
return heatToTransfer;
}
private void Fire() {
Debug.unityLogger.Log("INFO", string.Format("Gun: {0} Triggered", weaponName));
Exhaust();
nextFire = Time.time + fireRate;
sliderScript.setMinMax(Time.time, nextFire);
}
private void Exhaust() {
heatBuildUp += heat; ;
}
}
|
unlicense
|
C#
|
4d7f806ad50fa8ec8db6557af771b3c773f5af41
|
add Door array to RoomDetails script
|
whoa-algebraic/game-off-2016,virtuoushub/game-off-2016,whoa-algebraic/game-off-2016,virtuoushub/game-off-2016,virtuoushub/game-off-2016,whoa-algebraic/game-off-2016
|
Assets/Scripts/RoomDetails.cs
|
Assets/Scripts/RoomDetails.cs
|
using UnityEngine;
using System.Collections;
public class RoomDetails : MonoBehaviour {
public int Id;
public int HorizontalSize;
public int VerticalSize;
public GameObject[] Doors;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
|
using UnityEngine;
using System.Collections;
public class RoomDetails : MonoBehaviour {
public int ID;
public int HorizontalSize;
public int VerticalSize;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
|
mit
|
C#
|
584f67c50ef0ef582818d3d1028d3ad9848c1b9a
|
Set service name correctly when using Azure Pipelines urls (#1846)
|
Microsoft/vsts-agent,Microsoft/vsts-agent,Microsoft/vsts-agent,Microsoft/vsts-agent
|
src/Agent.Listener/Configuration/ServiceControlManager.cs
|
src/Agent.Listener/Configuration/ServiceControlManager.cs
|
using System;
using System.Linq;
using Microsoft.VisualStudio.Services.Agent.Util;
namespace Microsoft.VisualStudio.Services.Agent.Listener.Configuration
{
#if OS_WINDOWS
[ServiceLocator(Default = typeof(WindowsServiceControlManager))]
public interface IWindowsServiceControlManager : IAgentService
{
void ConfigureService(AgentSettings settings, CommandSettings command);
void UnconfigureService();
}
#endif
#if !OS_WINDOWS
#if OS_LINUX
[ServiceLocator(Default = typeof(SystemDControlManager))]
#elif OS_OSX
[ServiceLocator(Default = typeof(OsxServiceControlManager))]
#endif
public interface ILinuxServiceControlManager : IAgentService
{
void GenerateScripts(AgentSettings settings);
}
#endif
public class ServiceControlManager : AgentService
{
public void CalculateServiceName(AgentSettings settings, string serviceNamePattern, string serviceDisplayNamePattern, out string serviceName, out string serviceDisplayName)
{
Trace.Entering();
serviceName = string.Empty;
serviceDisplayName = string.Empty;
Uri accountUri = new Uri(settings.ServerUrl);
string accountName = string.Empty;
if (accountUri.Host.Equals("dev.azure.com", StringComparison.OrdinalIgnoreCase))
{
accountName = accountUri.AbsolutePath.Split('/', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
}
else
{
accountName = accountUri.Host.Split('.').FirstOrDefault();
}
if (string.IsNullOrEmpty(accountName))
{
throw new InvalidOperationException(StringUtil.Loc("CannotFindHostName", settings.ServerUrl));
}
serviceName = StringUtil.Format(serviceNamePattern, accountName, settings.AgentName);
serviceDisplayName = StringUtil.Format(serviceDisplayNamePattern, accountName, settings.AgentName);
Trace.Info($"Service name '{serviceName}' display name '{serviceDisplayName}' will be used for service configuration.");
}
}
}
|
using System;
using System.Linq;
using Microsoft.VisualStudio.Services.Agent.Util;
namespace Microsoft.VisualStudio.Services.Agent.Listener.Configuration
{
#if OS_WINDOWS
[ServiceLocator(Default = typeof(WindowsServiceControlManager))]
public interface IWindowsServiceControlManager : IAgentService
{
void ConfigureService(AgentSettings settings, CommandSettings command);
void UnconfigureService();
}
#endif
#if !OS_WINDOWS
#if OS_LINUX
[ServiceLocator(Default = typeof(SystemDControlManager))]
#elif OS_OSX
[ServiceLocator(Default = typeof(OsxServiceControlManager))]
#endif
public interface ILinuxServiceControlManager : IAgentService
{
void GenerateScripts(AgentSettings settings);
}
#endif
public class ServiceControlManager : AgentService
{
public void CalculateServiceName(AgentSettings settings, string serviceNamePattern, string serviceDisplayNamePattern, out string serviceName, out string serviceDisplayName)
{
Trace.Entering();
serviceName = string.Empty;
serviceDisplayName = string.Empty;
string accountName = new Uri(settings.ServerUrl).Host.Split('.').FirstOrDefault();
if (string.IsNullOrEmpty(accountName))
{
throw new InvalidOperationException(StringUtil.Loc("CannotFindHostName", settings.ServerUrl));
}
serviceName = StringUtil.Format(serviceNamePattern, accountName, settings.AgentName);
serviceDisplayName = StringUtil.Format(serviceDisplayNamePattern, accountName, settings.AgentName);
Trace.Info($"Service name '{serviceName}' display name '{serviceDisplayName}' will be used for service configuration.");
}
}
}
|
mit
|
C#
|
fb250abbdd4814045c13cdb345616d0adc028601
|
Fix debug presentation for ExecutableTarget
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Common/Execution/ExecutableTarget.cs
|
source/Nuke.Common/Execution/ExecutableTarget.cs
|
// Copyright 2019 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace Nuke.Common.Execution
{
[DebuggerDisplay("{" + nameof(Name) + "}")]
public class ExecutableTarget
{
internal ExecutableTarget()
{
}
internal MemberInfo Member { get; set; }
internal TargetDefinition Definition { get; set; }
public string Name { get; internal set; }
public string Description { get; internal set; }
public bool Listed { get; internal set; }
internal Target Factory { get; set; }
internal ICollection<Expression<Func<bool>>> DynamicConditions { get; set; } = new List<Expression<Func<bool>>>();
internal ICollection<Expression<Func<bool>>> StaticConditions { get; set; } = new List<Expression<Func<bool>>>();
internal DependencyBehavior DependencyBehavior { get; set; }
internal bool AssuredAfterFailure { get; set; }
internal bool ProceedAfterFailure { get; set; }
internal ICollection<LambdaExpression> Requirements { get; set; } = new List<LambdaExpression>();
internal ICollection<Action> Actions { get; set; } = new List<Action>();
internal ICollection<ExecutableTarget> ExecutionDependencies { get; } = new List<ExecutableTarget>();
internal ICollection<ExecutableTarget> OrderDependencies { get; } = new List<ExecutableTarget>();
internal ICollection<ExecutableTarget> TriggerDependencies { get; } = new List<ExecutableTarget>();
internal ICollection<ExecutableTarget> Triggers { get; } = new List<ExecutableTarget>();
internal IReadOnlyCollection<ExecutableTarget> AllDependencies
=> ExecutionDependencies.Concat(OrderDependencies).Concat(TriggerDependencies).ToList();
public bool IsDefault { get; internal set; }
public ExecutionStatus Status { get; internal set; }
public TimeSpan Duration { get; internal set; }
public bool Invoked { get; internal set; }
public string SkipReason { get; internal set; }
}
}
|
// Copyright 2019 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace Nuke.Common.Execution
{
[DebuggerDisplay("{" + nameof(ToDebugString) + "}")]
public class ExecutableTarget
{
internal ExecutableTarget()
{
}
internal MemberInfo Member { get; set; }
internal TargetDefinition Definition { get; set; }
public string Name { get; internal set; }
public string Description { get; internal set; }
public bool Listed { get; internal set; }
internal Target Factory { get; set; }
internal ICollection<Expression<Func<bool>>> DynamicConditions { get; set; } = new List<Expression<Func<bool>>>();
internal ICollection<Expression<Func<bool>>> StaticConditions { get; set; } = new List<Expression<Func<bool>>>();
internal DependencyBehavior DependencyBehavior { get; set; }
internal bool AssuredAfterFailure { get; set; }
internal bool ProceedAfterFailure { get; set; }
internal ICollection<LambdaExpression> Requirements { get; set; } = new List<LambdaExpression>();
internal ICollection<Action> Actions { get; set; } = new List<Action>();
internal ICollection<ExecutableTarget> ExecutionDependencies { get; } = new List<ExecutableTarget>();
internal ICollection<ExecutableTarget> OrderDependencies { get; } = new List<ExecutableTarget>();
internal ICollection<ExecutableTarget> TriggerDependencies { get; } = new List<ExecutableTarget>();
internal ICollection<ExecutableTarget> Triggers { get; } = new List<ExecutableTarget>();
internal IReadOnlyCollection<ExecutableTarget> AllDependencies
=> ExecutionDependencies.Concat(OrderDependencies).Concat(TriggerDependencies).ToList();
public bool IsDefault { get; internal set; }
public ExecutionStatus Status { get; internal set; }
public TimeSpan Duration { get; internal set; }
public bool Invoked { get; internal set; }
public string SkipReason { get; internal set; }
internal string ToDebugString()
{
return Name;
}
}
}
|
mit
|
C#
|
92978271e2a3c149c525e90b1bfd0f892b93c23c
|
Set namespace by convention
|
aspnetboilerplate/sample-odata,aspnetboilerplate/sample-odata,aspnetboilerplate/sample-odata
|
AbpODataDemo-Core-vNext/aspnet-core/src/AbpODataDemo.Web.Host/ResultWrapping/ODataWrapResultFilter.cs
|
AbpODataDemo-Core-vNext/aspnet-core/src/AbpODataDemo.Web.Host/ResultWrapping/ODataWrapResultFilter.cs
|
using Abp.Web.Results.Filters;
using System;
namespace AbpODataDemo.Web.Host.ResultWrapping
{
public class ODataWrapResultFilter : IWrapResultFilter
{
public bool HasFilterForWrapOnError(string url, out bool wrapOnError)
{
wrapOnError = false;
return new Uri(url).AbsolutePath.StartsWith("/odata", StringComparison.InvariantCultureIgnoreCase);
}
public bool HasFilterForWrapOnSuccess(string url, out bool wrapOnSuccess)
{
wrapOnSuccess = false;
return new Uri(url).AbsolutePath.StartsWith("/odata", StringComparison.InvariantCultureIgnoreCase);
}
}
}
|
using Abp.Web.Results.Filters;
using System;
namespace AbpODataDemo.ResultWrapping
{
public class ODataWrapResultFilter : IWrapResultFilter
{
public bool HasFilterForWrapOnError(string url, out bool wrapOnError)
{
wrapOnError = false;
return new Uri(url).AbsolutePath.StartsWith("/odata", StringComparison.InvariantCultureIgnoreCase);
}
public bool HasFilterForWrapOnSuccess(string url, out bool wrapOnSuccess)
{
wrapOnSuccess = false;
return new Uri(url).AbsolutePath.StartsWith("/odata", StringComparison.InvariantCultureIgnoreCase);
}
}
}
|
mit
|
C#
|
f996dc7a79a57e01c824d4efc22084366e1b84ec
|
Revert "Serial (#68)"
|
cetusfinance/qwack,cetusfinance/qwack,cetusfinance/qwack,cetusfinance/qwack
|
test/Qwack.Math.Tests/LinearRegressionFacts.cs
|
test/Qwack.Math.Tests/LinearRegressionFacts.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
namespace Qwack.Math.Tests
{
public class LinearRegressionFacts
{
[Fact]
public void VectorAndNoneVectorLinearRegressionMatches()
{
var rand = new System.Random();
var xArray = new double[50];
var yArray = new double[50];
for(var i = 0; i < xArray.Length;i++)
{
xArray[i] = rand.NextDouble();
yArray[i] = rand.NextDouble();
}
var reg1 = LinearRegression.LinearRegressionNoVector(xArray, yArray, false);
var reg2 = LinearRegression.LinearRegressionVector(xArray, yArray);
Assert.Equal(reg1.Alpha, reg2.Alpha);
Assert.Equal(reg1.Beta, reg2.Beta);
Assert.Equal(reg1.R2, reg2.R2);
Assert.Equal(reg1.SSE, reg2.SSE);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
namespace Qwack.Math.Tests
{
public class LinearRegressionFacts
{
[Fact(Skip = "Failure")]
public void VectorAndNoneVectorLinearRegressionMatches()
{
var rand = new System.Random();
var xArray = new double[50];
var yArray = new double[50];
for(var i = 0; i < xArray.Length;i++)
{
xArray[i] = rand.NextDouble();
yArray[i] = rand.NextDouble();
}
var reg1 = LinearRegression.LinearRegressionNoVector(xArray, yArray, false);
var reg2 = LinearRegression.LinearRegressionVector(xArray, yArray);
Assert.Equal(reg1.Alpha, reg2.Alpha);
Assert.Equal(reg1.Beta, reg2.Beta);
Assert.Equal(reg1.R2, reg2.R2);
}
}
}
|
mit
|
C#
|
b8409d1787806925b714f06708fda143d4858c07
|
Extend the extension methods test case again
|
jonathanvdc/ecsc
|
tests/cs/extension-methods/ExtensionMethods.cs
|
tests/cs/extension-methods/ExtensionMethods.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Herp
{
public Herp(int X)
{
this.X = X;
}
public int X { get; private set; }
}
public static class HerpExtensions
{
public static void PrintX(this Herp Value)
{
Console.WriteLine(Value.X);
}
}
public static class Program
{
public static void Main()
{
var herp = new Herp(20);
herp.PrintX();
var items = new List<int>();
items.Add(10);
items.Add(20);
items.Add(30);
// Note that ToArray<int> is actually a generic extension method:
// Enumerable.ToArray<T>.
foreach (var x in items.ToArray<int>())
{
Console.WriteLine(x);
}
foreach (var x in items.Concat<int>(new int[] { 40, 50 }))
{
Console.WriteLine(x);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Herp
{
public Herp(int X)
{
this.X = X;
}
public int X { get; private set; }
}
public static class HerpExtensions
{
public static void PrintX(this Herp Value)
{
Console.WriteLine(Value.X);
}
}
public static class Program
{
public static void Main()
{
var herp = new Herp(20);
herp.PrintX();
var items = new List<int>();
items.Add(10);
items.Add(20);
items.Add(30);
// Note that ToArray<int> is actually a generic extension method:
// Enumerable.ToArray<T>.
foreach (var x in items.ToArray<int>())
{
Console.WriteLine(x);
}
}
}
|
mit
|
C#
|
a2d5bbfaff6fc1b44d83e9088bc7c815a6483df5
|
clean up main
|
timmydo/gearup,timmydo/gearup,timmydo/gearup,timmydo/gearup
|
GearUp/Program.cs
|
GearUp/Program.cs
|
namespace GearUp
{
using System;
using Microsoft.AspNet.Hosting;
using System.Linq;
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Args:\n" + string.Join("\n", args));
var config = WebApplicationConfiguration.GetDefault(args);
var application = new WebApplicationBuilder()
.UseConfiguration(config)
.UseStartup<Startup>()
.Build();
var addresses = application.GetAddresses();
Console.WriteLine("Listening on " + string.Join(", ", addresses));
try
{
application.Run();
}
finally
{
Console.WriteLine("Exiting...");
}
}
}
}
|
namespace GearUp
{
using System;
using Microsoft.AspNet.Hosting;
using System.Linq;
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Args:\n" + string.Join("\n", args));
var config = WebApplicationConfiguration.GetDefault(args);
var application = new WebApplicationBuilder()
.UseConfiguration(config)
.UseStartup<Startup>()
.Build();
string port = System.Environment.GetEnvironmentVariable("HTTP_PLATFORM_PORT");
if (string.IsNullOrEmpty(port))
{
port = "5000";
}
Console.WriteLine("Port: " + port);
var addresses = application.GetAddresses();
Console.WriteLine("Listening on " + string.Join(", ", addresses));
addresses.Clear();
addresses.Add("http://localhost:" + port);
try
{
application.Run();
}
finally
{
Console.WriteLine("Exiting...");
}
}
}
}
|
mit
|
C#
|
5ffedb5fdc012efa809cec04a22bcdd1855d1ab4
|
Fix in API validation
|
pushrbx/squidex,Squidex/squidex,pushrbx/squidex,pushrbx/squidex,Squidex/squidex,pushrbx/squidex,Squidex/squidex,Squidex/squidex,pushrbx/squidex,Squidex/squidex
|
src/Squidex/Controllers/Api/Schemas/Models/AddFieldDto.cs
|
src/Squidex/Controllers/Api/Schemas/Models/AddFieldDto.cs
|
// ==========================================================================
// AddFieldDto.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System.ComponentModel.DataAnnotations;
// ReSharper disable ConvertIfStatementToReturnStatement
namespace Squidex.Controllers.Api.Schemas.Models
{
public sealed class AddFieldDto
{
/// <summary>
/// The name of the field. Must be unique within the schema.
/// </summary>
[Required]
[RegularExpression("^[a-zA-Z0-9]+(\\-[a-zA-Z0-9]+)*$")]
public string Name { get; set; }
/// <summary>
/// The field properties.
/// </summary>
[Required]
public FieldPropertiesDto Properties { get; set; }
}
}
|
// ==========================================================================
// AddFieldDto.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System.ComponentModel.DataAnnotations;
// ReSharper disable ConvertIfStatementToReturnStatement
namespace Squidex.Controllers.Api.Schemas.Models
{
public sealed class AddFieldDto
{
/// <summary>
/// The name of the field. Must be unique within the schema.
/// </summary>
[Required]
[RegularExpression("^[a-z0-9]+(\\-[a-z0-9]+)*$")]
public string Name { get; set; }
/// <summary>
/// The field properties.
/// </summary>
[Required]
public FieldPropertiesDto Properties { get; set; }
}
}
|
mit
|
C#
|
1af4953b13cb875f50626eae6f5369208726e86f
|
Add license to Sum indicator
|
bizcad/LeanAbhi,Mendelone/forex_trading,dalebrubaker/Lean,Jay-Jay-D/LeanSTP,Neoracle/Lean,bdilber/Lean,redmeros/Lean,mabeale/Lean,jameschch/Lean,andrewhart098/Lean,andrewhart098/Lean,bizcad/LeanITrend,squideyes/Lean,FrancisGauthier/Lean,bizcad/Lean,wowgeeker/Lean,dalebrubaker/Lean,exhau/Lean,AlexCatarino/Lean,florentchandelier/Lean,bdilber/Lean,bizcad/LeanAbhi,redmeros/Lean,Jay-Jay-D/LeanSTP,a-hart/Lean,AlexCatarino/Lean,JKarathiya/Lean,tzaavi/Lean,young-zhang/Lean,mabeale/Lean,JKarathiya/Lean,Phoenix1271/Lean,tomhunter-gh/Lean,rchien/Lean,JKarathiya/Lean,AnshulYADAV007/Lean,Obawoba/Lean,racksen/Lean,AlexCatarino/Lean,squideyes/Lean,racksen/Lean,QuantConnect/Lean,devalkeralia/Lean,StefanoRaggi/Lean,wowgeeker/Lean,kaffeebrauer/Lean,bizcad/LeanAbhi,FrancisGauthier/Lean,FrancisGauthier/Lean,AnshulYADAV007/Lean,bizcad/LeanJJN,FrancisGauthier/Lean,iamkingmaker/Lean,bizcad/Lean,devalkeralia/Lean,Obawoba/Lean,bizcad/Lean,AlexCatarino/Lean,dpavlenkov/Lean,AnObfuscator/Lean,wowgeeker/Lean,bdilber/Lean,andrewhart098/Lean,redmeros/Lean,florentchandelier/Lean,StefanoRaggi/Lean,Jay-Jay-D/LeanSTP,Phoenix1271/Lean,Neoracle/Lean,florentchandelier/Lean,tzaavi/Lean,bizcad/LeanJJN,AnObfuscator/Lean,redmeros/Lean,iamkingmaker/Lean,bizcad/LeanAbhi,bizcad/LeanITrend,AnObfuscator/Lean,florentchandelier/Lean,bizcad/LeanITrend,bizcad/LeanJJN,StefanoRaggi/Lean,dpavlenkov/Lean,tzaavi/Lean,exhau/Lean,Phoenix1271/Lean,tomhunter-gh/Lean,kaffeebrauer/Lean,jameschch/Lean,kaffeebrauer/Lean,racksen/Lean,dpavlenkov/Lean,desimonk/Lean,AnObfuscator/Lean,young-zhang/Lean,devalkeralia/Lean,jameschch/Lean,kaffeebrauer/Lean,JKarathiya/Lean,young-zhang/Lean,AnshulYADAV007/Lean,rchien/Lean,desimonk/Lean,mabeale/Lean,Obawoba/Lean,Neoracle/Lean,desimonk/Lean,exhau/Lean,dalebrubaker/Lean,Jay-Jay-D/LeanSTP,Mendelone/forex_trading,StefanoRaggi/Lean,bizcad/LeanITrend,QuantConnect/Lean,rchien/Lean,Jay-Jay-D/LeanSTP,tomhunter-gh/Lean,Obawoba/Lean,young-zhang/Lean,dpavlenkov/Lean,bdilber/Lean,AnshulYADAV007/Lean,kaffeebrauer/Lean,dalebrubaker/Lean,jameschch/Lean,bizcad/LeanJJN,tomhunter-gh/Lean,Mendelone/forex_trading,jameschch/Lean,squideyes/Lean,mabeale/Lean,bizcad/Lean,iamkingmaker/Lean,andrewhart098/Lean,a-hart/Lean,Phoenix1271/Lean,wowgeeker/Lean,desimonk/Lean,racksen/Lean,iamkingmaker/Lean,squideyes/Lean,AnshulYADAV007/Lean,tzaavi/Lean,Neoracle/Lean,QuantConnect/Lean,exhau/Lean,Mendelone/forex_trading,QuantConnect/Lean,rchien/Lean,devalkeralia/Lean,StefanoRaggi/Lean
|
Indicators/Sum.cs
|
Indicators/Sum.cs
|
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace QuantConnect.Indicators {
/// <summary>
/// Represents an indictor capable of tracking the sum for the given period
/// </summary>
public class Sum : WindowIndicator<IndicatorDataPoint> {
/// <summary>The sum for the given period</summary>
private decimal _sum;
/// <summary>
/// Gets a flag indicating when this indicator is ready and fully initialized
/// </summary>
public override bool IsReady {
get { return Samples >= Period; }
}
/// <summary>
/// Resets this indicator to its initial state
/// </summary>
public override void Reset() {
_sum = 0.0m;
base.Reset();
}
/// <summary>
/// Initializes a new instance of the Sum class with the specified name and period
/// </summary>
/// <param name="name">The name of this indicator</param>
/// <param name="period">The period of the SMA</param>
public Sum(string name, int period)
: base(name, period)
{
}
/// <summary>
/// Initializes a new instance of the Sum class with the default name and period
/// </summary>
/// <param name="period">The period of the SMA</param>
public Sum(int period)
: this("SUM" + period, period)
{
}
/// <summary>
/// Computes the next value for this indicator from the given state.
/// </summary>
/// <param name="window">The window of data held in this indicator</param>
/// <param name="input">The input value to this indicator on this time step</param>
/// <returns>A new value for this indicator</returns>
protected override decimal ComputeNextValue(IReadOnlyWindow<IndicatorDataPoint> window, IndicatorDataPoint input) {
_sum += input.Value;
if (window.IsReady) {
_sum -= window.MostRecentlyRemoved.Value;
}
return _sum;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QuantConnect.Indicators {
public class Sum : WindowIndicator<IndicatorDataPoint> {
/// <summary>The sum for the given period</summary>
private decimal _sum;
/// <summary>
/// Gets a flag indicating when this indicator is ready and fully initialized
/// </summary>
public override bool IsReady {
get { return Samples >= Period; }
}
/// <summary>
/// Resets this indicator to its initial state
/// </summary>
public override void Reset() {
_sum = 0.0m;
base.Reset();
}
/// <summary>
/// Initializes a new instance of the Sum class with the specified name and period
/// </summary>
/// <param name="name">The name of this indicator</param>
/// <param name="period">The period of the SMA</param>
public Sum(string name, int period)
: base(name, period)
{
}
/// <summary>
/// Initializes a new instance of the Sum class with the default name and period
/// </summary>
/// <param name="period">The period of the SMA</param>
public Sum(int period)
: this("SUM" + period, period)
{
}
/// <summary>
/// Computes the next value for this indicator from the given state.
/// </summary>
/// <param name="window">The window of data held in this indicator</param>
/// <param name="input">The input value to this indicator on this time step</param>
/// <returns>A new value for this indicator</returns>
protected override decimal ComputeNextValue(IReadOnlyWindow<IndicatorDataPoint> window, IndicatorDataPoint input) {
_sum += input.Value;
if (window.IsReady) {
_sum -= window.MostRecentlyRemoved.Value;
}
return _sum;
}
}
}
|
apache-2.0
|
C#
|
943d0fff2426ce1bd91fb70ec768c52fb82981c1
|
Update DeletingBlankColumns.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET
|
Examples/CSharp/Articles/DeleteBlankRowsColumns/DeletingBlankColumns.cs
|
Examples/CSharp/Articles/DeleteBlankRowsColumns/DeletingBlankColumns.cs
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles.DeleteBlankRowsColumns
{
public class DeletingBlankColumns
{
public static void Main()
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Create a new Workbook.
//Open an existing excel file.
Workbook wb = new Workbook(dataDir+ "SampleInput.xlsx");
//Create a Worksheets object with reference to
//the sheets of the Workbook.
WorksheetCollection sheets = wb.Worksheets;
//Get first Worksheet from WorksheetCollection
Worksheet sheet = sheets[0];
//Delete the Blank Rows from the worksheet
sheet.Cells.DeleteBlankRows();
//Save the excel file.
wb.Save(dataDir+ "mybook.out.xlsx");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Articles.DeleteBlankRowsColumns
{
public class DeletingBlankColumns
{
public static void Main()
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Create a new Workbook.
//Open an existing excel file.
Workbook wb = new Workbook(dataDir+ "SampleInput.xlsx");
//Create a Worksheets object with reference to
//the sheets of the Workbook.
WorksheetCollection sheets = wb.Worksheets;
//Get first Worksheet from WorksheetCollection
Worksheet sheet = sheets[0];
//Delete the Blank Rows from the worksheet
sheet.Cells.DeleteBlankRows();
//Save the excel file.
wb.Save(dataDir+ "mybook.out.xlsx");
}
}
}
|
mit
|
C#
|
c6fefe1a365eca1574b42791309ec6c9c2fc6e50
|
Add null check to TagCollection
|
asbjornu/GitVersion,GitTools/GitVersion,GitTools/GitVersion,asbjornu/GitVersion,gep13/GitVersion,gep13/GitVersion
|
src/GitVersion.LibGit2Sharp/Git/TagCollection.cs
|
src/GitVersion.LibGit2Sharp/Git/TagCollection.cs
|
using GitVersion.Extensions;
namespace GitVersion;
internal sealed class TagCollection : ITagCollection
{
private readonly LibGit2Sharp.TagCollection innerCollection;
internal TagCollection(LibGit2Sharp.TagCollection collection)
=> this.innerCollection = collection.NotNull();
public IEnumerator<ITag> GetEnumerator()
=> this.innerCollection.Select(tag => new Tag(tag)).GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
|
namespace GitVersion;
internal sealed class TagCollection : ITagCollection
{
private readonly LibGit2Sharp.TagCollection innerCollection;
internal TagCollection(LibGit2Sharp.TagCollection collection) => this.innerCollection = collection;
public IEnumerator<ITag> GetEnumerator() => this.innerCollection.Select(tag => new Tag(tag)).GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
|
mit
|
C#
|
7b766cf91a3da86318f4eac806c300fa66c6bc6b
|
Remove comments.
|
oliverzick/ImmutableUndoRedo
|
src/ImmutableUndoRedo/Properties/AssemblyInfo.cs
|
src/ImmutableUndoRedo/Properties/AssemblyInfo.cs
|
#region Copyright and license
// <copyright file="AssemblyInfo.cs" company="Oliver Zick">
// Copyright (c) 2015 Oliver Zick. All rights reserved.
// </copyright>
// <author>Oliver Zick</author>
// <license>
// 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.
// </license>
#endregion
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("ImmutableUndoRedo")]
[assembly: AssemblyDescription("A lightweight, flexible and easy to use do/undo/redo implementation based on immutable objects for .NET.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ImmutableUndoRedo")]
[assembly: AssemblyCopyright("Copyright © 2015 Oliver Zick. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("ef605850-4540-4e3a-9e71-cc10385d94c7")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
#region Copyright and license
// <copyright file="AssemblyInfo.cs" company="Oliver Zick">
// Copyright (c) 2015 Oliver Zick. All rights reserved.
// </copyright>
// <author>Oliver Zick</author>
// <license>
// 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.
// </license>
#endregion
using System.Reflection;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("ImmutableUndoRedo")]
[assembly: AssemblyDescription("A lightweight, flexible and easy to use do/undo/redo implementation based on immutable objects for .NET.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ImmutableUndoRedo")]
[assembly: AssemblyCopyright("Copyright © 2015 Oliver Zick. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("ef605850-4540-4e3a-9e71-cc10385d94c7")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.