commit
stringlengths 40
40
| old_file
stringlengths 4
237
| new_file
stringlengths 4
237
| old_contents
stringlengths 1
4.24k
| new_contents
stringlengths 1
4.87k
| subject
stringlengths 15
778
| message
stringlengths 15
8.75k
| lang
stringclasses 266
values | license
stringclasses 13
values | repos
stringlengths 5
127k
|
|---|---|---|---|---|---|---|---|---|---|
3fe9aaa8ddf64957100fe9f3b02e30440dce9cf6
|
osu.Framework/IO/Network/JsonWebRequest.cs
|
osu.Framework/IO/Network/JsonWebRequest.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using Newtonsoft.Json;
namespace osu.Framework.IO.Network
{
/// <summary>
/// A web request with a specific JSON response format.
/// </summary>
/// <typeparam name="T">the response format.</typeparam>
public class JsonWebRequest<T> : WebRequest
{
public JsonWebRequest(string url = null, params object[] args)
: base(url, args)
{
base.Finished += finished;
}
private void finished(WebRequest request, Exception e)
{
try
{
deserialisedResponse = JsonConvert.DeserializeObject<T>(ResponseString);
}
catch (Exception se)
{
e = e == null ? se : new AggregateException(e, se);
}
Finished?.Invoke(this, e);
}
private T deserialisedResponse;
public T ResponseObject => deserialisedResponse;
/// <summary>
/// Request has finished with success or failure. Check exception == null for success.
/// </summary>
public new event RequestCompleteHandler<T> Finished;
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using System.Net;
using Newtonsoft.Json;
namespace osu.Framework.IO.Network
{
/// <summary>
/// A web request with a specific JSON response format.
/// </summary>
/// <typeparam name="T">the response format.</typeparam>
public class JsonWebRequest<T> : WebRequest
{
public JsonWebRequest(string url = null, params object[] args)
: base(url, args)
{
base.Finished += finished;
}
protected override HttpWebRequest CreateWebRequest(string requestString = null)
{
var req = base.CreateWebRequest(requestString);
req.Accept = @"application/json";
return req;
}
private void finished(WebRequest request, Exception e)
{
try
{
deserialisedResponse = JsonConvert.DeserializeObject<T>(ResponseString);
}
catch (Exception se)
{
e = e == null ? se : new AggregateException(e, se);
}
Finished?.Invoke(this, e);
}
private T deserialisedResponse;
public T ResponseObject => deserialisedResponse;
/// <summary>
/// Request has finished with success or failure. Check exception == null for success.
/// </summary>
public new event RequestCompleteHandler<T> Finished;
}
}
|
Use the correct Accept type for json requests
|
Use the correct Accept type for json requests
We were getting html error responses from the API when http response code errors were expected
|
C#
|
mit
|
Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,default0/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,ZLima12/osu-framework,default0/osu-framework,DrabWeb/osu-framework,peppy/osu-framework
|
85f1974da6a60d0dc6eddafd99d21c5514cf626f
|
src/SFA.DAS.EmployerUsers.Api/Startup.cs
|
src/SFA.DAS.EmployerUsers.Api/Startup.cs
|
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(SFA.DAS.EmployerUsers.Api.Startup))]
namespace SFA.DAS.EmployerUsers.Api
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}
|
using System.Net;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(SFA.DAS.EmployerUsers.Api.Startup))]
namespace SFA.DAS.EmployerUsers.Api
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
ConfigureAuth(app);
}
}
}
|
Add TLS change to make the call to the Audit api work
|
Add TLS change to make the call to the Audit api work
|
C#
|
mit
|
SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers
|
6d501aa3a6fd0b68fa9fb838b671345555c6ae61
|
TSRandom/TSRandom/Properties/AssemblyInfo.cs
|
TSRandom/TSRandom/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("TSRandom")]
[assembly: AssemblyDescription("Thread safe random number generator")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TSRandom")]
[assembly: AssemblyCopyright("Copyright © Soleil Rojas 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("82f2ca28-6157-41ff-b644-2ef357ee4d6c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TSRandom")]
[assembly: AssemblyDescription("Thread safe random number generator")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TSRandom")]
[assembly: AssemblyCopyright("Copyright © Soleil Rojas 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("82f2ca28-6157-41ff-b644-2ef357ee4d6c")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Change the assembly version to use wildcard
|
Change the assembly version to use wildcard
|
C#
|
mit
|
Solybum/Libraries
|
02a7bcbdaba82dcac4b01799249744929f3f9413
|
src/Obsidian/Services/SignInService.cs
|
src/Obsidian/Services/SignInService.cs
|
using Microsoft.AspNetCore.Http;
using Obsidian.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Authentication;
using Obsidian.Application.OAuth20;
namespace Obsidian.Services
{
public class SignInService : ISignInService
{
private readonly IHttpContextAccessor _accessor;
const string Scheme = "Obsidian.Cookie";
public SignInService(IHttpContextAccessor accessor)
{
_accessor = accessor;
}
public async Task CookieSignInAsync(User user, bool isPersistent)
{
await CookieSignOutCurrentUserAsync();
var claims = new List<Claim>
{
new Claim(ClaimTypes.Name, user.UserName)
};
var identity = new ClaimsIdentity(claims);
var principal = new ClaimsPrincipal(identity);
var context = _accessor.HttpContext;
var props = new AuthenticationProperties{ IsPersistent = isPersistent };
await context.Authentication.SignInAsync(Scheme, principal, props);
}
public async Task CookieSignOutCurrentUserAsync()
=> await _accessor.HttpContext.Authentication.SignOutAsync(Scheme);
}
}
|
using Microsoft.AspNetCore.Http;
using Obsidian.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Authentication;
using Obsidian.Application.OAuth20;
namespace Obsidian.Services
{
public class SignInService : ISignInService
{
private readonly IHttpContextAccessor _accessor;
const string Scheme = "Obsidian.Cookie";
public SignInService(IHttpContextAccessor accessor)
{
_accessor = accessor;
}
public async Task CookieSignInAsync(User user, bool isPersistent)
{
await CookieSignOutCurrentUserAsync();
var claims = new List<Claim>
{
new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
new Claim(ClaimTypes.Name, user.UserName)
};
var identity = new ClaimsIdentity(claims);
var principal = new ClaimsPrincipal(identity);
var context = _accessor.HttpContext;
var props = new AuthenticationProperties{ IsPersistent = isPersistent };
await context.Authentication.SignInAsync(Scheme, principal, props);
}
public async Task CookieSignOutCurrentUserAsync()
=> await _accessor.HttpContext.Authentication.SignOutAsync(Scheme);
}
}
|
Revert "keep username only in sinin cookie"
|
Revert "keep username only in sinin cookie"
This reverts commit 6a2a4dceca65d2457a80f205ee5d1dfa65b7278b.
|
C#
|
apache-2.0
|
ZA-PT/Obsidian,ZA-PT/Obsidian,ZA-PT/Obsidian,ZA-PT/Obsidian
|
afe048a7a150bfdf3a6d22137b682073be355c17
|
src/Library.Test/AlwaysTests.cs
|
src/Library.Test/AlwaysTests.cs
|
#region Copyright and license
// // <copyright file="AlwaysTests.cs" company="Oliver Zick">
// // Copyright (c) 2016 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
namespace Delizious.Filtering
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public sealed class AlwaysTests
{
[TestMethod]
public void Succeed__When_Value_Is_Null()
{
Assert.IsTrue(Match.Always<GenericParameterHelper>().Matches(null));
}
[TestMethod]
public void Succeed__When_Value_Is_An_Instance()
{
Assert.IsTrue(Match.Always<GenericParameterHelper>().Matches(new GenericParameterHelper()));
}
}
}
|
#region Copyright and license
// // <copyright file="AlwaysTests.cs" company="Oliver Zick">
// // Copyright (c) 2016 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
namespace Delizious.Filtering
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public sealed class AlwaysTests
{
[TestMethod]
public void Match_Succeeds_When_Value_To_Match_Is_Null()
{
Assert.IsTrue(Match.Always<GenericParameterHelper>().Matches(null));
}
[TestMethod]
public void Match_Succeeds_When_Value_To_Match_Is_An_Instance()
{
Assert.IsTrue(Match.Always<GenericParameterHelper>().Matches(new GenericParameterHelper()));
}
}
}
|
Improve naming of tests to clearly indicate the feature to be tested
|
Improve naming of tests to clearly indicate the feature to be tested
|
C#
|
apache-2.0
|
oliverzick/Delizious-Filtering
|
8084a3405f4ca901237d9d8a51e11277e978858b
|
src/Nimbus.Tests.Integration/AssemblySetUp.cs
|
src/Nimbus.Tests.Integration/AssemblySetUp.cs
|
using NUnit.Framework;
[assembly: Category("IntegrationTest")]
[assembly: Parallelizable(ParallelScope.Fixtures)]
[assembly: LevelOfParallelism(32)]
|
using NUnit.Framework;
[assembly: Category("IntegrationTest")]
[assembly: Parallelizable(ParallelScope.Fixtures)]
[assembly: LevelOfParallelism(2)]
|
Reduce concurrency (not eliminate) in integration tests so that starting up a test suite run doesn't soak up all the threads in our thread pool.
|
Reduce concurrency (not eliminate) in integration tests so that starting up a test suite run doesn't soak up all the threads in our thread pool.
|
C#
|
mit
|
NimbusAPI/Nimbus,NimbusAPI/Nimbus
|
78089ae664d99f98890f860a27bb52e018f8b5a8
|
Facebook.iOS/custom_externals_download.cake
|
Facebook.iOS/custom_externals_download.cake
|
void DownloadAudienceNetwork (Artifact artifact)
{
var podSpec = artifact.PodSpecs [0];
var id = podSpec.Name;
var version = podSpec.Version;
var url = $"https://origincache.facebook.com/developers/resources/?id={id}-{version}.zip";
var basePath = $"./externals/{id}";
DownloadFile (url, $"{basePath}.zip", new Cake.Xamarin.Build.DownloadFileSettings { UserAgent = "curl/7.43.0" });
Unzip ($"{basePath}.zip", $"{basePath}");
CopyDirectory ($"{basePath}/Dynamic/{id}.framework", $"./externals/{id}.framework");
}
|
void DownloadAudienceNetwork (Artifact artifact)
{
var podSpec = artifact.PodSpecs [0];
var id = podSpec.Name;
var version = podSpec.Version;
var url = $"https://developers.facebook.com/resources/{id}-{version}.zip";
var basePath = $"./externals/{id}";
DownloadFile (url, $"{basePath}.zip", new Cake.Xamarin.Build.DownloadFileSettings { UserAgent = "curl/7.43.0" });
Unzip ($"{basePath}.zip", $"{basePath}");
CopyDirectory ($"{basePath}/Dynamic/{id}.framework", $"./externals/{id}.framework");
}
|
Use same url Facebook uses to download bits
|
[iOS][AudienceNetwork] Use same url Facebook uses to download bits
|
C#
|
mit
|
SotoiGhost/FacebookComponents,SotoiGhost/FacebookComponents
|
1d8399925c808326b4f9bae0105d740f58042b37
|
PackageViewModel/Utilities/TemporaryFile.cs
|
PackageViewModel/Utilities/TemporaryFile.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NuGet.Packaging;
namespace PackageExplorerViewModel.Utilities
{
public class TemporaryFile : IDisposable
{
public TemporaryFile(Stream stream, string extension)
{
if (stream == null)
throw new ArgumentNullException(nameof(stream));
if (!string.IsNullOrWhiteSpace(extension) || extension[0] != '.')
{
extension = string.Empty;
}
FileName = Path.GetTempFileName() + extension;
stream.CopyToFile(FileName);
}
public string FileName { get; }
bool disposed;
public void Dispose()
{
if (!disposed)
{
disposed = true;
try
{
File.Delete(FileName);
}
catch // best effort
{
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NuGet.Packaging;
namespace PackageExplorerViewModel.Utilities
{
public class TemporaryFile : IDisposable
{
public TemporaryFile(Stream stream, string extension)
{
if (stream == null)
throw new ArgumentNullException(nameof(stream));
if (string.IsNullOrWhiteSpace(extension) || extension[0] != '.')
{
extension = string.Empty;
}
FileName = Path.GetTempFileName() + extension;
stream.CopyToFile(FileName);
}
public string FileName { get; }
bool disposed;
public void Dispose()
{
if (!disposed)
{
disposed = true;
try
{
File.Delete(FileName);
}
catch // best effort
{
}
}
}
}
}
|
Fix check so file extension is preserved
|
Fix check so file extension is preserved
|
C#
|
mit
|
campersau/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer
|
1fe5df12632e41ec59f08f23669bd7c22b8e1b30
|
ConsoleWritePrettyOneDay.App/Program.cs
|
ConsoleWritePrettyOneDay.App/Program.cs
|
using System.Threading;
using System.Threading.Tasks;
using Console = System.Console;
namespace ConsoleWritePrettyOneDay.App
{
class Program
{
static void Main(string[] args)
{
Spinner.Wait(() => Thread.Sleep(5000), "waiting for sleep");
var task = Task.Run(() => Thread.Sleep(4000));
Spinner.Wait(task, "waiting for task");
Console.ReadLine();
}
}
}
|
using System.Threading;
using System.Threading.Tasks;
using Console = System.Console;
namespace ConsoleWritePrettyOneDay.App
{
class Program
{
static void Main(string[] args)
{
Spinner.Wait(() => Thread.Sleep(5000), "waiting for sleep");
var task = Task.Run(() => Thread.Sleep(4000));
Spinner.Wait(task, "waiting for task");
Console.WriteLine();
Console.WriteLine("Press [enter] to exit.");
Console.ReadLine();
}
}
}
|
Add message to press enter when sample App execution is complete
|
Add message to press enter when sample App execution is complete
|
C#
|
mit
|
prescottadam/ConsoleWritePrettyOneDay
|
51e1a6e55d74b7ce612707961b61e241bd10ca57
|
twitch-tv-viewer/Views/MainWindow.xaml.cs
|
twitch-tv-viewer/Views/MainWindow.xaml.cs
|
using System.Windows;
namespace twitch_tv_viewer.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Edit_Click(object sender, RoutedEventArgs e) => new Edit().ShowDialog();
private void Add_Click(object sender, RoutedEventArgs e) => new Add().ShowDialog();
}
}
|
using System.Windows;
using System.Windows.Input;
namespace twitch_tv_viewer.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Edit_Click(object sender, RoutedEventArgs e) => new Edit().ShowDialog();
private void Add_Click(object sender, RoutedEventArgs e) => new Add().ShowDialog();
private void Datagrid_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Delete)
new Delete().ShowDialog();
}
}
}
|
Add simple binding for showing display of delete view
|
Add simple binding for showing display of delete view
|
C#
|
mit
|
dukemiller/twitch-tv-viewer
|
7f7b0471abbe660cd607bc4b2aa8a70ef23c3785
|
uSync8.Core/Dependency/DependencyFlags.cs
|
uSync8.Core/Dependency/DependencyFlags.cs
|
using System;
namespace uSync8.Core.Dependency
{
[Flags]
public enum DependencyFlags
{
None = 0,
IncludeChildren = 2,
IncludeAncestors = 4,
IncludeDependencies = 8,
IncludeViews = 16,
IncludeMedia = 32,
IncludeLinked = 64,
IncludeMediaFiles = 128
}
}
|
using System;
namespace uSync8.Core.Dependency
{
[Flags]
public enum DependencyFlags
{
None = 0,
IncludeChildren = 2,
IncludeAncestors = 4,
IncludeDependencies = 8,
IncludeViews = 16,
IncludeMedia = 32,
IncludeLinked = 64,
IncludeMediaFiles = 128,
IncludeConfig = 256
}
}
|
Add config to the dependency flags.
|
Add config to the dependency flags.
|
C#
|
mpl-2.0
|
KevinJump/uSync,KevinJump/uSync,KevinJump/uSync
|
9df3dc9218fc9cc1ad7a9841837e9cd81455d62c
|
BmpListener/Bgp/CapabilityMultiProtocol.cs
|
BmpListener/Bgp/CapabilityMultiProtocol.cs
|
using BmpListener.Extensions;
using System;
using System.Linq;
namespace BmpListener.Bgp
{
public class CapabilityMultiProtocol : Capability
{
public CapabilityMultiProtocol(ArraySegment<byte> data) : base(data)
{
var afi = data.ToInt16(2);
var safi = data.ElementAt(4);
}
}
}
|
using System;
namespace BmpListener.Bgp
{
public class CapabilityMultiProtocol : Capability
{
public CapabilityMultiProtocol(ArraySegment<byte> data) : base(data)
{
Decode(CapabilityValue);
}
public AddressFamily Afi { get; set; }
public SubsequentAddressFamily Safi { get; set; }
// RFC 4760 - Reserved (8 bit) field. SHOULD be set to 0 by the
// sender and ignored by the receiver.
public byte Res { get { return 0; } }
public void Decode(ArraySegment<byte> data)
{
Array.Reverse(CapabilityValue.Array, data.Offset, 2);
Afi = (AddressFamily)BitConverter.ToInt16(data.Array, data.Offset);
Safi = (SubsequentAddressFamily)data.Array[data.Offset + 3];
}
}
}
|
Fix Multiprotocol AFI and SAFI decoding
|
Fix Multiprotocol AFI and SAFI decoding
|
C#
|
mit
|
mstrother/BmpListener
|
fb35ac8a853d6a2b4e72f9b7449f74ea94fcad8d
|
Mammoth/Couscous/java/net/URI.cs
|
Mammoth/Couscous/java/net/URI.cs
|
using System;
namespace Mammoth.Couscous.java.net {
internal class URI {
private readonly Uri _uri;
internal URI(string uri) {
try {
_uri = new Uri(uri, UriKind.RelativeOrAbsolute);
} catch (UriFormatException exception) {
throw new URISyntaxException(exception.Message);
}
}
internal URI(Uri uri) {
_uri = uri;
}
internal bool isAbsolute() {
return _uri.IsAbsoluteUri;
}
internal URL toURL() {
return new URL(_uri.ToString());
}
internal URI resolve(string relativeUri) {
if (new URI(relativeUri).isAbsolute()) {
return new URI(relativeUri);
} else if (_uri.IsAbsoluteUri) {
return new URI(new Uri(_uri, relativeUri));
} else {
var path = _uri.ToString();
var lastSlashIndex = path.LastIndexOf("/");
var basePath = lastSlashIndex == -1
? "."
: path.Substring(0, lastSlashIndex + 1);
return new URI(basePath + relativeUri);
}
}
}
}
|
using System;
namespace Mammoth.Couscous.java.net {
internal class URI {
private readonly Uri _uri;
internal URI(string uri) {
try {
_uri = new Uri(uri, UriKind.RelativeOrAbsolute);
} catch (UriFormatException exception) {
throw new URISyntaxException(exception.Message);
}
}
internal URI(Uri uri) {
_uri = uri;
}
internal bool isAbsolute() {
return _uri.IsAbsoluteUri;
}
internal URL toURL() {
return new URL(_uri.ToString());
}
internal URI resolve(string relativeUri) {
if (new URI(relativeUri).isAbsolute()) {
return new URI(relativeUri);
} else if (_uri.IsAbsoluteUri) {
return new URI(new Uri(_uri, relativeUri));
} else {
var path = _uri.ToString();
var basePath = System.IO.Path.GetDirectoryName(path);
return new URI(System.IO.Path.Combine(basePath, relativeUri));
}
}
}
}
|
Handle paths on Windows properly
|
Handle paths on Windows properly
|
C#
|
bsd-2-clause
|
mwilliamson/dotnet-mammoth
|
ca861dfd8d3320cca9e280aa0c2c4a4187526d10
|
NanoGames/Application/FpsView.cs
|
NanoGames/Application/FpsView.cs
|
// Copyright (c) the authors of nanoGames. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt in the project root.
using NanoGames.Engine;
using System.Collections.Generic;
using System.Diagnostics;
namespace NanoGames.Application
{
/// <summary>
/// A view that measures and draws the current frames per second.
/// </summary>
internal sealed class FpsView : IView
{
private readonly Queue<long> _times = new Queue<long>();
/// <inheritdoc/>
public void Update(Terminal terminal)
{
var fontSize = 6;
var color = new Color(0.60, 0.35, 0.05);
if (DebugMode.IsEnabled)
{
terminal.Graphics.Print(color, fontSize, new Vector(0, 0), "DEBUG");
}
var time = Stopwatch.GetTimestamp();
if (Settings.Instance.ShowFps && _times.Count > 0)
{
var fps = (double)Stopwatch.Frequency * _times.Count / (time - _times.Peek());
var fpsString = ((int)(fps + 0.5)).ToString("D2");
terminal.Graphics.Print(color, fontSize, new Vector(GraphicsConstants.Width - fpsString.Length * fontSize, 0), fpsString);
}
if (_times.Count > 128)
{
_times.Dequeue();
}
_times.Enqueue(time);
}
}
}
|
// Copyright (c) the authors of nanoGames. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt in the project root.
using NanoGames.Engine;
using System.Collections.Generic;
using System.Diagnostics;
namespace NanoGames.Application
{
/// <summary>
/// A view that measures and draws the current frames per second.
/// </summary>
internal sealed class FpsView : IView
{
private readonly Queue<long> _times = new Queue<long>();
/// <inheritdoc/>
public void Update(Terminal terminal)
{
var fontSize = 6;
var color = new Color(0.60, 0.35, 0.05);
if (DebugMode.IsEnabled)
{
terminal.Graphics.Print(color, fontSize, new Vector(0, 0), "DEBUG");
for (int i = 0; i <= System.GC.MaxGeneration; ++i)
{
terminal.Graphics.Print(color, fontSize, new Vector(0, (i + 1) * fontSize), string.Format("GC{0}: {1}", i, System.GC.CollectionCount(i)));
}
}
var time = Stopwatch.GetTimestamp();
if (Settings.Instance.ShowFps && _times.Count > 0)
{
var fps = (double)Stopwatch.Frequency * _times.Count / (time - _times.Peek());
var fpsString = ((int)(fps + 0.5)).ToString("D2");
terminal.Graphics.Print(color, fontSize, new Vector(GraphicsConstants.Width - fpsString.Length * fontSize, 0), fpsString);
}
if (_times.Count > 128)
{
_times.Dequeue();
}
_times.Enqueue(time);
}
}
}
|
Debug mode: Show the number of garbage collections
|
Debug mode: Show the number of garbage collections
|
C#
|
mit
|
codeflo/nanogames,codeflo/nanogames
|
db921a045f150126497a34412ffa786ddfc55993
|
exercises/concept/numbers/.meta/Example.cs
|
exercises/concept/numbers/.meta/Example.cs
|
public static class AssemblyLine
{
private const int ProductionRatePerHourForDefaultSpeed = 221;
public static double ProductionRatePerHour(int speed) =>
ProductionRatePerHourForSpeed(speed) * SuccessRate(speed);
private static int ProductionRatePerHourForSpeed(int speed) =>
ProductionRatePerHourForDefaultSpeed * speed;
public static int WorkingItemsPerMinute(int speed) =>
(int)ProductionRatePerHour(speed) / 60;
private static double SuccessRate(int speed)
{
if (speed == 0)
return 0.0;
if (speed >= 9)
return 0.77;
if (speed < 5)
return 1.0;
return 0.9;
}
}
|
public static class AssemblyLine
{
private const int ProductionRatePerHourForDefaultSpeed = 221;
public static double ProductionRatePerHour(int speed) =>
ProductionRatePerHourForSpeed(speed) * SuccessRate(speed);
private static int ProductionRatePerHourForSpeed(int speed) =>
ProductionRatePerHourForDefaultSpeed * speed;
public static int WorkingItemsPerMinute(int speed) =>
(int)(ProductionRatePerHour(speed) / 60);
private static double SuccessRate(int speed)
{
if (speed == 0)
return 0.0;
if (speed >= 9)
return 0.77;
if (speed < 5)
return 1.0;
return 0.9;
}
}
|
Fix rounding error in numbers exercise
|
Fix rounding error in numbers exercise
|
C#
|
mit
|
exercism/xcsharp,exercism/xcsharp
|
67523e748a1b73f8837f17e8c78d263ab96d780b
|
PackageViewModel/Types/ICredentialManager.cs
|
PackageViewModel/Types/ICredentialManager.cs
|
using System;
using System.Net;
namespace PackageExplorerViewModel.Types
{
public interface ICredentialManager
{
void TryAddUriCredentials(Uri feedUri);
void Add(ICredentials credentials, Uri feedUri);
ICredentials GetForUri(Uri uri);
}
}
|
using System;
using System.Net;
namespace PackageExplorerViewModel.Types
{
public interface ICredentialManager
{
void Add(ICredentials credentials, Uri feedUri);
ICredentials GetForUri(Uri uri);
}
}
|
Remove unused method from interface
|
Remove unused method from interface
|
C#
|
mit
|
NuGetPackageExplorer/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer,campersau/NuGetPackageExplorer
|
98ce69d1d32b65abd9983dbd1124cad8f6bc938b
|
osu.Game.Rulesets.Catch/UI/HitExplosion.cs
|
osu.Game.Rulesets.Catch/UI/HitExplosion.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch.Skinning.Default;
using osu.Game.Rulesets.Objects.Pooling;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Catch.UI
{
public class HitExplosion : PoolableDrawableWithLifetime<HitExplosionEntry>
{
private SkinnableDrawable skinnableExplosion;
public HitExplosion()
{
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = skinnableExplosion = new SkinnableDrawable(new CatchSkinComponent(CatchSkinComponents.HitExplosion), _ => new DefaultHitExplosion())
{
CentreComponent = false,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre
};
}
protected override void OnApply(HitExplosionEntry entry)
{
base.OnApply(entry);
ApplyTransformsAt(double.MinValue, true);
ClearTransforms(true);
(skinnableExplosion.Drawable as IHitExplosion)?.Animate(entry);
LifetimeEnd = skinnableExplosion.Drawable.LatestTransformEndTime;
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch.Skinning.Default;
using osu.Game.Rulesets.Objects.Pooling;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Catch.UI
{
public class HitExplosion : PoolableDrawableWithLifetime<HitExplosionEntry>
{
private SkinnableDrawable skinnableExplosion;
public HitExplosion()
{
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChild = skinnableExplosion = new SkinnableDrawable(new CatchSkinComponent(CatchSkinComponents.HitExplosion), _ => new DefaultHitExplosion())
{
CentreComponent = false,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre
};
}
protected override void OnApply(HitExplosionEntry entry)
{
base.OnApply(entry);
if (IsLoaded)
apply(entry);
}
protected override void LoadComplete()
{
base.LoadComplete();
apply(Entry);
}
private void apply(HitExplosionEntry entry)
{
ApplyTransformsAt(double.MinValue, true);
ClearTransforms(true);
(skinnableExplosion.Drawable as IHitExplosion)?.Animate(entry);
LifetimeEnd = skinnableExplosion.Drawable.LatestTransformEndTime;
}
}
}
|
Fix explosion reading out time values from wrong clock
|
Fix explosion reading out time values from wrong clock
|
C#
|
mit
|
NeoAdonis/osu,ppy/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,peppy/osu-new,peppy/osu
|
4d976094d1c69613ef581828d638ffdb04a48984
|
osu.Game/Input/Bindings/RealmKeyBinding.cs
|
osu.Game/Input/Bindings/RealmKeyBinding.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Input.Bindings;
using osu.Game.Database;
using Realms;
namespace osu.Game.Input.Bindings
{
[MapTo(nameof(KeyBinding))]
public class RealmKeyBinding : RealmObject, IHasGuidPrimaryKey, IKeyBinding
{
[PrimaryKey]
public Guid ID { get; set; }
public int? RulesetID { get; set; }
public int? Variant { get; set; }
public KeyCombination KeyCombination
{
get => KeyCombinationString;
set => KeyCombinationString = value.ToString();
}
public object Action
{
get => ActionInt;
set => ActionInt = (int)value;
}
[MapTo(nameof(Action))]
public int ActionInt { get; set; }
[MapTo(nameof(KeyCombination))]
public string KeyCombinationString { get; set; }
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Input.Bindings;
using osu.Game.Database;
using Realms;
namespace osu.Game.Input.Bindings
{
[MapTo(nameof(KeyBinding))]
public class RealmKeyBinding : RealmObject, IHasGuidPrimaryKey, IKeyBinding
{
[PrimaryKey]
public string StringGuid { get; set; }
[Ignored]
public Guid ID
{
get => Guid.Parse(StringGuid);
set => StringGuid = value.ToString();
}
public int? RulesetID { get; set; }
public int? Variant { get; set; }
public KeyCombination KeyCombination
{
get => KeyCombinationString;
set => KeyCombinationString = value.ToString();
}
public object Action
{
get => ActionInt;
set => ActionInt = (int)value;
}
[MapTo(nameof(Action))]
public int ActionInt { get; set; }
[MapTo(nameof(KeyCombination))]
public string KeyCombinationString { get; set; }
}
}
|
Switch Guid implementation temporarily to avoid compile time error
|
Switch Guid implementation temporarily to avoid compile time error
|
C#
|
mit
|
ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipooo/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu-new,peppy/osu
|
ff5945c63fc34c0c739b1eb84a31fed92fedc4e1
|
Unity/Assets/Code/Tweening/AnimateToPoint.cs
|
Unity/Assets/Code/Tweening/AnimateToPoint.cs
|
using UnityEngine;
using System.Collections;
using System;
public class AnimateToPoint : MonoBehaviour {
private SimpleTween tween;
private Vector3 sourcePos;
private Vector3 targetPos;
private Action onComplete;
private float timeScale;
private float timer;
public void Trigger(SimpleTween tween, Vector3 point) {
Trigger(tween, point, () => {});
}
public void Trigger(SimpleTween tween, Vector3 point, Action onComplete) {
this.tween = tween;
this.onComplete = onComplete;
sourcePos = transform.position;
targetPos = point;
timeScale = 1.0f / tween.Duration;
timer = 0.0f;
}
private void Update() {
if (tween != null) {
if (timer > 1.0f) {
transform.position = targetPos;
onComplete();
tween = null;
} else {
transform.position = tween.Evaluate(sourcePos, targetPos, timer);
}
timer += timeScale * Time.deltaTime;
}
}
}
|
using UnityEngine;
using System.Collections;
using System;
public class AnimateToPoint : MonoBehaviour {
private SimpleTween tween;
private Vector3 sourcePos;
private Vector3 targetPos;
private Action onComplete;
private float timeScale;
private float timer;
public void Trigger(SimpleTween tween, Vector3 point) {
Trigger(tween, point, () => {});
}
public void Trigger(SimpleTween tween, Vector3 point, Action onComplete) {
this.tween = tween;
this.onComplete = onComplete;
sourcePos = transform.position;
targetPos = point;
timeScale = 1.0f / tween.Duration;
timer = 0.0f;
}
private void Update() {
if (tween != null) {
if (timer > 1.0f) {
tween = null;
transform.position = targetPos;
onComplete();
} else {
transform.position = tween.Evaluate(sourcePos, targetPos, timer);
}
timer += timeScale * Time.deltaTime;
}
}
}
|
Fix ordering bug when chaining Tweens
|
Fix ordering bug when chaining Tweens
|
C#
|
mit
|
kevadsett/BAGameJam2016,kevadsett/BAGameJam2016,kevadsett/BAGameJam2016
|
d1b9168575ea75605cb72a252e8c722a9a991a5d
|
app/Assets/Scripts/AdminModeMessageWindow.cs
|
app/Assets/Scripts/AdminModeMessageWindow.cs
|
using UnityEngine;
using System.Collections;
public class AdminModeMessageWindow : MonoBehaviour {
private const float WINDOW_WIDTH = 300;
private const float WINDOW_HEIGHT = 120;
private const float MESSAGE_HEIGHT = 60;
private const float BUTTON_HEIGHT = 30;
private const float BUTTON_WIDTH = 40;
private string Message;
public void Initialize() {
Message = "Could not sync player records to server.\nReason \"Player " + PlayerOptions.Name + " log corrupted\".\nAdmin mode enabled";
}
void OnGUI () {
GUI.Window(0, WindowRect, MessageWindow, "Error");
}
void MessageWindow(int windowID) {
GUI.Label(LabelRect, Message);
if (GUI.Button(ButtonRect, "OK")) {
enabled = false;
}
}
private Rect WindowRect {
get {
var anchor = TransformToGuiFinder.Find(transform);
return new Rect(anchor.x - WINDOW_WIDTH / 2, anchor.y - WINDOW_HEIGHT / 2, WINDOW_WIDTH, WINDOW_HEIGHT);
}
}
private Rect LabelRect {
get { return new Rect(10, 20, WINDOW_WIDTH, MESSAGE_HEIGHT); }
}
private Rect ButtonRect {
get { return new Rect((WINDOW_WIDTH / 2) - (BUTTON_WIDTH / 2), 20 + MESSAGE_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT); }
}
}
|
using UnityEngine;
using System.Collections;
public class AdminModeMessageWindow : MonoBehaviour {
private const float WINDOW_WIDTH = 300;
private const float WINDOW_HEIGHT = 120;
private const float MESSAGE_HEIGHT = 60;
private const float BUTTON_HEIGHT = 30;
private const float BUTTON_WIDTH = 40;
private string Message;
public void Initialize() {
Message = "Could not sync player records to server.\nReason \"Player " + PlayerOptions.Name + " log corrupted\".\nAdmin mode enabled and player freed from track.";
}
void OnGUI () {
GUI.Window(0, WindowRect, MessageWindow, "Error");
}
void MessageWindow(int windowID) {
GUI.Label(LabelRect, Message);
if (GUI.Button(ButtonRect, "OK")) {
enabled = false;
}
}
private Rect WindowRect {
get {
var anchor = TransformToGuiFinder.Find(transform);
return new Rect(anchor.x - WINDOW_WIDTH / 2, anchor.y - WINDOW_HEIGHT / 2, WINDOW_WIDTH, WINDOW_HEIGHT);
}
}
private Rect LabelRect {
get { return new Rect(10, 20, WINDOW_WIDTH, MESSAGE_HEIGHT); }
}
private Rect ButtonRect {
get { return new Rect((WINDOW_WIDTH / 2) - (BUTTON_WIDTH / 2), 20 + MESSAGE_HEIGHT, BUTTON_WIDTH, BUTTON_HEIGHT); }
}
}
|
Change message to indicate player is freed from track
|
Change message to indicate player is freed from track
|
C#
|
mit
|
mikelovesrobots/daft-pong,mikelovesrobots/daft-pong
|
03fd69c754f914e88ec84455674524e665c8d0bb
|
src/Okanshi.Dashboard/GetMetrics.cs
|
src/Okanshi.Dashboard/GetMetrics.cs
|
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Okanshi.Dashboard.Models;
namespace Okanshi.Dashboard
{
public interface IGetMetrics
{
IEnumerable<Metric> Deserialize(string response);
}
public class GetMetrics : IGetMetrics
{
public IEnumerable<Metric> Deserialize(string response)
{
var deserializeObject = JsonConvert.DeserializeObject<IDictionary<string, dynamic>>(response);
return deserializeObject
.Select(x => new Metric
{
Name = x.Key,
Measurements = x.Value.measurements.ToObject<IEnumerable<Measurement>>(),
WindowSize = x.Value.windowSize.ToObject<float>()
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Okanshi.Dashboard.Models;
namespace Okanshi.Dashboard
{
public interface IGetMetrics
{
IEnumerable<Metric> Deserialize(string response);
}
public class GetMetrics : IGetMetrics
{
public IEnumerable<Metric> Deserialize(string response)
{
var jObject = JObject.Parse(response);
JToken versionToken;
jObject.TryGetValue("version", out versionToken);
var version = "0";
if (versionToken != null && versionToken.HasValues)
{
version = versionToken.Value<string>();
}
if (version.Equals("0", StringComparison.OrdinalIgnoreCase))
{
var deserializeObject = JsonConvert.DeserializeObject<IDictionary<string, dynamic>>(response);
return deserializeObject
.Select(x => new Metric
{
Name = x.Key,
Measurements = x.Value.measurements.ToObject<IEnumerable<Measurement>>(),
WindowSize = x.Value.windowSize.ToObject<float>()
});
}
return Enumerable.Empty<Metric>();
}
}
}
|
Handle optional version and fallback
|
Handle optional version and fallback
|
C#
|
mit
|
mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard
|
bdd9b97f31cdd24b8e99b09bd74d436fa02832b3
|
src/UnitTests/GitHub.App/ViewModels/PullRequestCreationViewModelTests.cs
|
src/UnitTests/GitHub.App/ViewModels/PullRequestCreationViewModelTests.cs
|
using System.Reactive.Linq;
using System.Threading.Tasks;
using NSubstitute;
using Xunit;
using UnitTests;
using GitHub.Models;
using System;
using GitHub.Services;
using GitHub.ViewModels;
public class PullRequestCreationViewModelTests : TempFileBaseClass
{
[Fact]
public async Task NullDescriptionBecomesEmptyBody()
{
var serviceProvider = Substitutes.ServiceProvider;
var service = new PullRequestService();
var notifications = Substitute.For<INotificationService>();
var host = serviceProvider.GetRepositoryHosts().GitHubHost;
var ms = Substitute.For<IModelService>();
host.ModelService.Returns(ms);
var repository = new SimpleRepositoryModel("name", new GitHub.Primitives.UriString("http://github.com/github/stuff"));
var title = "a title";
var vm = new PullRequestCreationViewModel(host, repository, service, notifications);
vm.SourceBranch = new BranchModel() { Name = "source" };
vm.TargetBranch = new BranchModel() { Name = "target" };
vm.PRTitle = title;
await vm.CreatePullRequest.ExecuteAsync();
ms.Received().CreatePullRequest(repository, vm.PRTitle, String.Empty, vm.SourceBranch, vm.TargetBranch);
}
}
|
using System.Reactive.Linq;
using System.Threading.Tasks;
using NSubstitute;
using Xunit;
using UnitTests;
using GitHub.Models;
using System;
using GitHub.Services;
using GitHub.ViewModels;
public class PullRequestCreationViewModelTests : TempFileBaseClass
{
[Fact]
public async Task NullDescriptionBecomesEmptyBody()
{
var serviceProvider = Substitutes.ServiceProvider;
var service = new PullRequestService();
var notifications = Substitute.For<INotificationService>();
var host = serviceProvider.GetRepositoryHosts().GitHubHost;
var ms = Substitute.For<IModelService>();
host.ModelService.Returns(ms);
var repository = new SimpleRepositoryModel("name", new GitHub.Primitives.UriString("http://github.com/github/stuff"));
var title = "a title";
var vm = new PullRequestCreationViewModel(host, repository, service, notifications);
vm.SourceBranch = new BranchModel() { Name = "source" };
vm.TargetBranch = new BranchModel() { Name = "target" };
vm.PRTitle = title;
await vm.CreatePullRequest.ExecuteAsync();
var unused = ms.Received().CreatePullRequest(repository, vm.PRTitle, String.Empty, vm.SourceBranch, vm.TargetBranch);
}
}
|
Fix code warning in test
|
Fix code warning in test
|
C#
|
mit
|
github/VisualStudio,github/VisualStudio,github/VisualStudio
|
797e14b7c1807ec5bcb9b203ab98692eba882d77
|
src/Squidex/Pipeline/SingleUrlsMiddleware.cs
|
src/Squidex/Pipeline/SingleUrlsMiddleware.cs
|
// ==========================================================================
// SingleUrlsMiddleware.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace Squidex.Pipeline
{
public sealed class SingleUrlsMiddleware
{
private readonly RequestDelegate next;
private readonly ILogger<SingleUrlsMiddleware> logger;
public SingleUrlsMiddleware(RequestDelegate next, ILoggerFactory factory)
{
this.next = next;
logger = factory.CreateLogger<SingleUrlsMiddleware>();
}
public async Task Invoke(HttpContext context)
{
var currentUrl = string.Concat(context.Request.Scheme, "://", context.Request.Host, context.Request.Path);
var hostName = context.Request.Host.ToString().ToLowerInvariant();
if (hostName.StartsWith("www"))
{
hostName = hostName.Substring(3);
}
var requestPath = context.Request.Path.ToString();
if (!requestPath.EndsWith("/") &&
!requestPath.Contains("."))
{
requestPath = requestPath + "/";
}
var newUrl = string.Concat("https://", hostName, requestPath);
if (!string.Equals(newUrl, currentUrl, StringComparison.OrdinalIgnoreCase))
{
logger.LogError("Invalid url: {0} instead {1}", currentUrl, newUrl);
context.Response.Redirect(newUrl, true);
}
else
{
await next(context);
}
}
}
}
|
// ==========================================================================
// SingleUrlsMiddleware.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace Squidex.Pipeline
{
public sealed class SingleUrlsMiddleware
{
private readonly RequestDelegate next;
private readonly ILogger<SingleUrlsMiddleware> logger;
public SingleUrlsMiddleware(RequestDelegate next, ILoggerFactory factory)
{
this.next = next;
logger = factory.CreateLogger<SingleUrlsMiddleware>();
}
public async Task Invoke(HttpContext context)
{
var currentUrl = string.Concat(context.Request.Scheme, "://", context.Request.Host, context.Request.Path);
var hostName = context.Request.Host.ToString().ToLowerInvariant();
if (hostName.StartsWith("www"))
{
hostName = hostName.Substring(3);
}
var requestPath = context.Request.Path.ToString();
if (!requestPath.EndsWith("/") &&
!requestPath.Contains("."))
{
requestPath = requestPath + "/";
}
var newUrl = string.Concat("https://", hostName, requestPath);
if (!string.Equals(newUrl, currentUrl, StringComparison.OrdinalIgnoreCase))
{
logger.LogError("Invalid url: {0} instead {1}", currentUrl, newUrl);
context.Response.Redirect(newUrl + context.Request.QueryString, true);
}
else
{
await next(context);
}
}
}
}
|
Fix the query string stuff
|
Fix the query string stuff
|
C#
|
mit
|
Squidex/squidex,pushrbx/squidex,pushrbx/squidex,Squidex/squidex,pushrbx/squidex,pushrbx/squidex,pushrbx/squidex,Squidex/squidex,Squidex/squidex,Squidex/squidex
|
264ece5130f4cc07d7f2a6edf4d921470db566e0
|
src/SceneJect.Common/Services/Factory/DepedencyInjectionFactoryService.cs
|
src/SceneJect.Common/Services/Factory/DepedencyInjectionFactoryService.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SceneJect.Common
{
public abstract class DepedencyInjectionFactoryService
{
/// <summary>
/// Service for resolving dependencies.
/// </summary>
protected IResolver resolverService { get; }
/// <summary>
/// Strategy for injection.
/// </summary>
protected IInjectionStrategy injectionStrategy { get; }
public DepedencyInjectionFactoryService(IResolver resolver, IInjectionStrategy injectionStrat)
{
if (resolver == null)
throw new ArgumentNullException(nameof(resolver), $"Provided {nameof(IResolver)} service provided is null.");
if (injectionStrategy == null)
throw new ArgumentNullException(nameof(injectionStrategy), $"Provided {nameof(IInjectionStrategy)} service provided is null.");
injectionStrategy = injectionStrat;
resolverService = resolver;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SceneJect.Common
{
public abstract class DepedencyInjectionFactoryService
{
/// <summary>
/// Service for resolving dependencies.
/// </summary>
protected IResolver resolverService { get; }
/// <summary>
/// Strategy for injection.
/// </summary>
protected IInjectionStrategy injectionStrategy { get; }
public DepedencyInjectionFactoryService(IResolver resolver, IInjectionStrategy injectionStrat)
{
if (resolver == null)
throw new ArgumentNullException(nameof(resolver), $"Provided {nameof(IResolver)} service provided is null.");
if (injectionStrat == null)
throw new ArgumentNullException(nameof(injectionStrat), $"Provided {nameof(IInjectionStrategy)} service provided is null.");
injectionStrategy = injectionStrat;
resolverService = resolver;
}
}
}
|
Fix Fault; Incorrect check in ctor
|
Fix Fault; Incorrect check in ctor
GameObjectFactory checked prop instead of param in ctor.
|
C#
|
mit
|
HelloKitty/SceneJect,HelloKitty/SceneJect
|
c2a37a16fa404e9ef58d12e38c7b9c9f1d8cb759
|
osu.Framework.iOS/Properties/AssemblyInfo.cs
|
osu.Framework.iOS/Properties/AssemblyInfo.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.Runtime.CompilerServices;
using ObjCRuntime;
// We publish our internal attributes to other sub-projects of the framework.
// Note, that we omit visual tests as they are meant to test the framework
// behavior "in the wild".
[assembly: InternalsVisibleTo("osu.Framework.Tests")]
[assembly: InternalsVisibleTo("osu.Framework.Tests.Dynamic")]
[assembly: LinkWith("libavcodec.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libavdevice.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libavfilter.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libavformat.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libavutil.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libbass.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libbass_fx.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libswresample.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libswscale.a", SmartLink = false, ForceLoad = true)]
|
// 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.Runtime.CompilerServices;
using ObjCRuntime;
// We publish our internal attributes to other sub-projects of the framework.
// Note, that we omit visual tests as they are meant to test the framework
// behavior "in the wild".
[assembly: InternalsVisibleTo("osu.Framework.Tests")]
[assembly: InternalsVisibleTo("osu.Framework.Tests.Dynamic")]
[assembly: LinkWith("libavcodec.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libavdevice.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libavfilter.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libavformat.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libavutil.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libbass.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libbass_fx.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libbassmix.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libswresample.a", SmartLink = false, ForceLoad = true)]
[assembly: LinkWith("libswscale.a", SmartLink = false, ForceLoad = true)]
|
Include BASSmix native library in linker
|
Include BASSmix native library in linker
|
C#
|
mit
|
peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework
|
3c7297fa3a30bc40c2ebf07f09fa964266128ca8
|
WootzJs.Mvc/ControllerActionInvoker.cs
|
WootzJs.Mvc/ControllerActionInvoker.cs
|
using System;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace WootzJs.Mvc
{
public class ControllerActionInvoker : IActionInvoker
{
public Task<ActionResult> InvokeAction(ControllerContext context, MethodInfo action)
{
var parameters = action.GetParameters();
var args = new object[parameters.Length];
var lastParameter = parameters.LastOrDefault();
// If async
if (lastParameter != null && lastParameter.ParameterType == typeof(Action<ActionResult>))
{
return (Task<ActionResult>)action.Invoke(context.Controller, args);
}
// If synchronous
else
{
var actionResult = (ActionResult)action.Invoke(context.Controller, args);
return Task.FromResult(actionResult);
}
}
}
}
|
using System;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace WootzJs.Mvc
{
public class ControllerActionInvoker : IActionInvoker
{
public Task<ActionResult> InvokeAction(ControllerContext context, MethodInfo action)
{
var parameters = action.GetParameters();
var args = new object[parameters.Length];
// If async
if (action.ReturnType == typeof(Task<ActionResult>))
{
return (Task<ActionResult>)action.Invoke(context.Controller, args);
}
// If synchronous
else
{
var actionResult = (ActionResult)action.Invoke(context.Controller, args);
return Task.FromResult(actionResult);
}
}
}
}
|
Fix logic to use the new task based async pattern
|
Fix logic to use the new task based async pattern
|
C#
|
mit
|
x335/WootzJs,kswoll/WootzJs,kswoll/WootzJs,x335/WootzJs,x335/WootzJs,kswoll/WootzJs
|
d522342f7567ccd55496cd904f9b5a1e0c7284ab
|
Battery-Commander.Web/Jobs/JobHandler.cs
|
Battery-Commander.Web/Jobs/JobHandler.cs
|
using FluentScheduler;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Logging;
using System;
namespace BatteryCommander.Web.Jobs
{
internal static class JobHandler
{
public static void WithScheduler(this IApplicationBuilder app, ILoggerFactory loggerFactory)
{
var logger = loggerFactory.CreateLogger(typeof(JobHandler));
JobManager.JobStart += (job) => logger.LogInformation("{job} started", job.Name);
JobManager.JobEnd += (job) => logger.LogInformation("{job} completed in {time}", job.Name, job.Duration);
JobManager.JobException += (context) => logger.LogError(context.Exception, "{job} failed", context.Name);
JobManager.UseUtcTime();
JobManager.JobFactory = new JobFactory(app.ApplicationServices);
var registry = new Registry();
registry.Schedule<SqliteBackupJob>().ToRunNow().AndEvery(1).Days().At(hours: 12, minutes: 0);
JobManager.Initialize(registry);
}
private class JobFactory : IJobFactory
{
private readonly IServiceProvider serviceProvider;
public JobFactory(IServiceProvider serviceProvider)
{
this.serviceProvider = serviceProvider;
}
public IJob GetJobInstance<T>() where T : IJob
{
return serviceProvider.GetService(typeof(T)) as IJob;
}
}
}
}
|
using FluentScheduler;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Logging;
using System;
namespace BatteryCommander.Web.Jobs
{
internal static class JobHandler
{
public static void WithScheduler(this IApplicationBuilder app, ILoggerFactory loggerFactory)
{
var logger = loggerFactory.CreateLogger(typeof(JobHandler));
JobManager.JobStart += (job) => logger.LogInformation("{job} started", job.Name);
JobManager.JobEnd += (job) => logger.LogInformation("{job} completed in {time}", job.Name, job.Duration);
JobManager.JobException += (context) => logger.LogError(context.Exception, "{job} failed", context.Name);
JobManager.UseUtcTime();
JobManager.JobFactory = new JobFactory(app.ApplicationServices);
var registry = new Registry();
registry.Schedule<SqliteBackupJob>().ToRunEvery(1).Days().At(hours: 12, minutes: 0);
JobManager.Initialize(registry);
}
private class JobFactory : IJobFactory
{
private readonly IServiceProvider serviceProvider;
public JobFactory(IServiceProvider serviceProvider)
{
this.serviceProvider = serviceProvider;
}
public IJob GetJobInstance<T>() where T : IJob
{
return serviceProvider.GetService(typeof(T)) as IJob;
}
}
}
}
|
Fix registration to send nightly
|
Fix registration to send nightly
|
C#
|
mit
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
737033ca69d94c0b7fbc5554e06a461489fa54ea
|
modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/TestExtensions.cs
|
modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/TestExtensions.cs
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 Apache.Ignite.Core.Tests.TestDll
{
using System.Linq;
/// <summary>
/// Extension methods for tests.
/// </summary>
public static class TestExtensions
{
/// <summary>
/// Reverses the string.
/// </summary>
public static string ReverseString(this string str)
{
return new string(str.Reverse().ToArray());
}
}
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 Apache.Ignite.Core.Tests.TestDll
{
using System.Diagnostics.CodeAnalysis;
using System.Linq;
/// <summary>
/// Extension methods for tests.
/// </summary>
[ExcludeFromCodeCoverage]
public static class TestExtensions
{
/// <summary>
/// Reverses the string.
/// </summary>
public static string ReverseString(this string str)
{
return new string(str.Reverse().ToArray());
}
}
}
|
Fix code coverage - exclude remote-only class
|
.NET: Fix code coverage - exclude remote-only class
|
C#
|
apache-2.0
|
nizhikov/ignite,SharplEr/ignite,SomeFire/ignite,SomeFire/ignite,nizhikov/ignite,ptupitsyn/ignite,voipp/ignite,NSAmelchev/ignite,samaitra/ignite,sk0x50/ignite,andrey-kuznetsov/ignite,andrey-kuznetsov/ignite,sk0x50/ignite,BiryukovVA/ignite,WilliamDo/ignite,dream-x/ignite,WilliamDo/ignite,shroman/ignite,daradurvs/ignite,SomeFire/ignite,nizhikov/ignite,vladisav/ignite,xtern/ignite,dream-x/ignite,SomeFire/ignite,wmz7year/ignite,dream-x/ignite,vladisav/ignite,BiryukovVA/ignite,ntikhonov/ignite,alexzaitzev/ignite,ptupitsyn/ignite,ascherbakoff/ignite,voipp/ignite,SomeFire/ignite,ilantukh/ignite,NSAmelchev/ignite,andrey-kuznetsov/ignite,amirakhmedov/ignite,nizhikov/ignite,daradurvs/ignite,daradurvs/ignite,xtern/ignite,chandresh-pancholi/ignite,ascherbakoff/ignite,BiryukovVA/ignite,ascherbakoff/ignite,xtern/ignite,SomeFire/ignite,apache/ignite,xtern/ignite,voipp/ignite,ntikhonov/ignite,ptupitsyn/ignite,SomeFire/ignite,alexzaitzev/ignite,vladisav/ignite,wmz7year/ignite,amirakhmedov/ignite,WilliamDo/ignite,andrey-kuznetsov/ignite,SharplEr/ignite,endian675/ignite,amirakhmedov/ignite,ntikhonov/ignite,irudyak/ignite,shroman/ignite,ilantukh/ignite,xtern/ignite,psadusumilli/ignite,irudyak/ignite,samaitra/ignite,StalkXT/ignite,samaitra/ignite,BiryukovVA/ignite,samaitra/ignite,BiryukovVA/ignite,SharplEr/ignite,endian675/ignite,vladisav/ignite,StalkXT/ignite,irudyak/ignite,WilliamDo/ignite,apache/ignite,sk0x50/ignite,chandresh-pancholi/ignite,ascherbakoff/ignite,SharplEr/ignite,NSAmelchev/ignite,chandresh-pancholi/ignite,amirakhmedov/ignite,apache/ignite,andrey-kuznetsov/ignite,ascherbakoff/ignite,endian675/ignite,SomeFire/ignite,apache/ignite,voipp/ignite,alexzaitzev/ignite,NSAmelchev/ignite,chandresh-pancholi/ignite,samaitra/ignite,endian675/ignite,sk0x50/ignite,alexzaitzev/ignite,amirakhmedov/ignite,psadusumilli/ignite,andrey-kuznetsov/ignite,WilliamDo/ignite,BiryukovVA/ignite,vladisav/ignite,endian675/ignite,vladisav/ignite,ptupitsyn/ignite,ilantukh/ignite,nizhikov/ignite,dream-x/ignite,irudyak/ignite,xtern/ignite,ilantukh/ignite,xtern/ignite,StalkXT/ignite,shroman/ignite,irudyak/ignite,StalkXT/ignite,dream-x/ignite,ptupitsyn/ignite,SharplEr/ignite,wmz7year/ignite,ptupitsyn/ignite,StalkXT/ignite,chandresh-pancholi/ignite,ptupitsyn/ignite,psadusumilli/ignite,shroman/ignite,irudyak/ignite,wmz7year/ignite,endian675/ignite,sk0x50/ignite,nizhikov/ignite,andrey-kuznetsov/ignite,daradurvs/ignite,wmz7year/ignite,ilantukh/ignite,psadusumilli/ignite,voipp/ignite,samaitra/ignite,samaitra/ignite,voipp/ignite,WilliamDo/ignite,xtern/ignite,alexzaitzev/ignite,ascherbakoff/ignite,nizhikov/ignite,daradurvs/ignite,SharplEr/ignite,wmz7year/ignite,ptupitsyn/ignite,BiryukovVA/ignite,SharplEr/ignite,samaitra/ignite,irudyak/ignite,BiryukovVA/ignite,StalkXT/ignite,daradurvs/ignite,nizhikov/ignite,ptupitsyn/ignite,ntikhonov/ignite,shroman/ignite,apache/ignite,vladisav/ignite,wmz7year/ignite,chandresh-pancholi/ignite,WilliamDo/ignite,psadusumilli/ignite,andrey-kuznetsov/ignite,psadusumilli/ignite,apache/ignite,chandresh-pancholi/ignite,endian675/ignite,voipp/ignite,samaitra/ignite,nizhikov/ignite,ptupitsyn/ignite,amirakhmedov/ignite,amirakhmedov/ignite,SomeFire/ignite,ascherbakoff/ignite,voipp/ignite,alexzaitzev/ignite,StalkXT/ignite,voipp/ignite,apache/ignite,alexzaitzev/ignite,ilantukh/ignite,dream-x/ignite,psadusumilli/ignite,NSAmelchev/ignite,endian675/ignite,amirakhmedov/ignite,dream-x/ignite,andrey-kuznetsov/ignite,vladisav/ignite,daradurvs/ignite,irudyak/ignite,ascherbakoff/ignite,daradurvs/ignite,BiryukovVA/ignite,ilantukh/ignite,sk0x50/ignite,NSAmelchev/ignite,NSAmelchev/ignite,shroman/ignite,NSAmelchev/ignite,samaitra/ignite,NSAmelchev/ignite,shroman/ignite,psadusumilli/ignite,BiryukovVA/ignite,daradurvs/ignite,ntikhonov/ignite,WilliamDo/ignite,apache/ignite,chandresh-pancholi/ignite,irudyak/ignite,sk0x50/ignite,shroman/ignite,dream-x/ignite,SharplEr/ignite,ilantukh/ignite,shroman/ignite,wmz7year/ignite,StalkXT/ignite,ilantukh/ignite,amirakhmedov/ignite,sk0x50/ignite,ilantukh/ignite,chandresh-pancholi/ignite,shroman/ignite,ascherbakoff/ignite,SomeFire/ignite,alexzaitzev/ignite,SharplEr/ignite,alexzaitzev/ignite,apache/ignite,sk0x50/ignite,StalkXT/ignite,daradurvs/ignite,xtern/ignite,andrey-kuznetsov/ignite,ntikhonov/ignite,ntikhonov/ignite,ntikhonov/ignite
|
9478cd97486e0e1a2ff1759161b29d53ec3c2014
|
Samples/Core.CrossDomainImages/Core.CrossDomainImagesWeb/Pages/Default.aspx.cs
|
Samples/Core.CrossDomainImages/Core.CrossDomainImagesWeb/Pages/Default.aspx.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Core.CrossDomainImagesWeb
{
public partial class Default : System.Web.UI.Page
{
protected void Page_PreInit(object sender, EventArgs e)
{
Uri redirectUrl;
switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
{
case RedirectionStatus.Ok:
return;
case RedirectionStatus.ShouldRedirect:
Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
break;
case RedirectionStatus.CanNotRedirect:
Response.Write("An error occurred while processing your request.");
Response.End();
break;
}
}
protected void Page_Load(object sender, EventArgs e)
{
try
{
var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
using (var clientContext = spContext.CreateUserClientContextForSPAppWeb())
{
//set access token in hidden field for client calls
hdnAccessToken.Value = spContext.UserAccessTokenForSPAppWeb;
//set images
Image1.ImageUrl = spContext.SPAppWebUrl + "AppImages/O365.png";
Services.ImgService svc = new Services.ImgService();
Image2.ImageUrl = svc.GetImage(spContext.UserAccessTokenForSPAppWeb, spContext.SPAppWebUrl.ToString(), "AppImages", "O365.png");
}
}
catch (Exception)
{
throw;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Core.CrossDomainImagesWeb
{
public partial class Default : System.Web.UI.Page
{
protected void Page_PreInit(object sender, EventArgs e)
{
Uri redirectUrl;
switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
{
case RedirectionStatus.Ok:
return;
case RedirectionStatus.ShouldRedirect:
Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
break;
case RedirectionStatus.CanNotRedirect:
Response.Write("An error occurred while processing your request.");
Response.End();
break;
}
}
protected void Page_Load(object sender, EventArgs e)
{
var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
using (var clientContext = spContext.CreateUserClientContextForSPAppWeb())
{
//set access token in hidden field for client calls
hdnAccessToken.Value = spContext.UserAccessTokenForSPAppWeb;
//set images
Image1.ImageUrl = spContext.SPAppWebUrl + "AppImages/O365.png";
Services.ImgService svc = new Services.ImgService();
Image2.ImageUrl = svc.GetImage(spContext.UserAccessTokenForSPAppWeb, spContext.SPAppWebUrl.ToString(), "AppImages", "O365.png");
}
}
}
}
|
Revert "added try catch, test commit"
|
Revert "added try catch, test commit"
This reverts commit f19532d23cb74beb6bba8128bb7d9d544972c761.
|
C#
|
mit
|
JBeerens/PnP,erwinvanhunen/PnP,hildabarbara/PnP,OneBitSoftware/PnP,JonathanHuss/PnP,baldswede/PnP,bstenberg64/PnP,edrohler/PnP,r0ddney/PnP,vman/PnP,yagoto/PnP,narval32/Shp,IDTimlin/PnP,IvanTheBearable/PnP,rgueldenpfennig/PnP,OzMakka/PnP,rgueldenpfennig/PnP,erwinvanhunen/PnP,timothydonato/PnP,grazies/PnP,Rick-Kirkham/PnP,weshackett/PnP,vman/PnP,NavaneethaDev/PnP,kendomen/PnP,selossej/PnP,rbarten/PnP,mauricionr/PnP,worksofwisdom/PnP,JonathanHuss/PnP,JilleFloridor/PnP,gavinbarron/PnP,OfficeDev/PnP,worksofwisdom/PnP,zrahui/PnP,rencoreab/PnP,Arknev/PnP,PaoloPia/PnP,biste5/PnP,mauricionr/PnP,aammiitt2/PnP,dalehhirt/PnP,Claire-Hindhaugh/PnP,jlsfernandez/PnP,machadosantos/PnP,perolof/PnP,Chowdarysandhya/PnPTest,lamills1/PnP,ebbypeter/PnP,MaurizioPz/PnP,rroman81/PnP,afsandeberg/PnP,Anil-Lakhagoudar/PnP,JonathanHuss/PnP,pascalberger/PnP,svarukala/PnP,jeroenvanlieshout/PnP,RickVanRousselt/PnP,jeroenvanlieshout/PnP,timschoch/PnP,IvanTheBearable/PnP,Chowdarysandhya/PnPTest,pbjorklund/PnP,brennaman/PnP,ebbypeter/PnP,biste5/PnP,chrisobriensp/PnP,8v060htwyc/PnP,OzMakka/PnP,joaopcoliveira/PnP,vnathalye/PnP,ivanvagunin/PnP,valt83/PnP,Rick-Kirkham/PnP,NexploreDev/PnP-PowerShell,rgueldenpfennig/PnP,bstenberg64/PnP,gautekramvik/PnP,pbjorklund/PnP,sandhyagaddipati/PnPSamples,werocool/PnP,GSoft-SharePoint/PnP,rencoreab/PnP,Arknev/PnP,SimonDoy/PnP,SteenMolberg/PnP,bstenberg64/PnP,bbojilov/PnP,sjuppuh/PnP,SteenMolberg/PnP,russgove/PnP,NexploreDev/PnP-PowerShell,mauricionr/PnP,briankinsella/PnP,andreasblueher/PnP,SPDoctor/PnP,pdfshareforms/PnP,sandhyagaddipati/PnPSamples,miksteri/OfficeDevPnP,werocool/PnP,pbjorklund/PnP,grazies/PnP,MaurizioPz/PnP,ifaham/Test,ebbypeter/PnP,Claire-Hindhaugh/PnP,miksteri/OfficeDevPnP,Arknev/PnP,r0ddney/PnP,markcandelora/PnP,spdavid/PnP,SimonDoy/PnP,darei-fr/PnP,NexploreDev/PnP-PowerShell,rbarten/PnP,srirams007/PnP,sandhyagaddipati/PnPSamples,nishantpunetha/PnP,durayakar/PnP,BartSnyckers/PnP,comblox/PnP,erwinvanhunen/PnP,darei-fr/PnP,ifaham/Test,perolof/PnP,patrick-rodgers/PnP,sndkr/PnP,baldswede/PnP,SuryaArup/PnP,Rick-Kirkham/PnP,bbojilov/PnP,sndkr/PnP,perolof/PnP,patrick-rodgers/PnP,valt83/PnP,sjuppuh/PnP,pdfshareforms/PnP,IvanTheBearable/PnP,darei-fr/PnP,levesquesamuel/PnP,jlsfernandez/PnP,joaopcoliveira/PnP,IDTimlin/PnP,8v060htwyc/PnP,andreasblueher/PnP,tomvr2610/PnP,pascalberger/PnP,chrisobriensp/PnP,gautekramvik/PnP,Arknev/PnP,selossej/PnP,nishantpunetha/PnP,NavaneethaDev/PnP,yagoto/PnP,zrahui/PnP,brennaman/PnP,kevhoyt/PnP,shankargurav/PnP,SuryaArup/PnP,grazies/PnP,SPDoctor/PnP,srirams007/PnP,8v060htwyc/PnP,biste5/PnP,sjuppuh/PnP,jlsfernandez/PnP,worksofwisdom/PnP,srirams007/PnP,timschoch/PnP,rroman81/PnP,JBeerens/PnP,BartSnyckers/PnP,ifaham/Test,JilleFloridor/PnP,PaoloPia/PnP,weshackett/PnP,OfficeDev/PnP,kendomen/PnP,OfficeDev/PnP,vnathalye/PnP,timschoch/PnP,rahulsuryawanshi/PnP,gavinbarron/PnP,IDTimlin/PnP,rahulsuryawanshi/PnP,kendomen/PnP,ivanvagunin/PnP,edrohler/PnP,lamills1/PnP,Claire-Hindhaugh/PnP,ivanvagunin/PnP,levesquesamuel/PnP,Chowdarysandhya/PnPTest,grazies/PnP,vman/PnP,patrick-rodgers/PnP,briankinsella/PnP,yagoto/PnP,durayakar/PnP,markcandelora/PnP,MaurizioPz/PnP,russgove/PnP,spdavid/PnP,OneBitSoftware/PnP,narval32/Shp,RickVanRousselt/PnP,GSoft-SharePoint/PnP,PieterVeenstra/PnP,gavinbarron/PnP,durayakar/PnP,Anil-Lakhagoudar/PnP,8v060htwyc/PnP,andreasblueher/PnP,rencoreab/PnP,pdfshareforms/PnP,shankargurav/PnP,bhoeijmakers/PnP,JBeerens/PnP,SuryaArup/PnP,Anil-Lakhagoudar/PnP,BartSnyckers/PnP,russgove/PnP,briankinsella/PnP,narval32/Shp,pascalberger/PnP,joaopcoliveira/PnP,GeiloStylo/PnP,miksteri/OfficeDevPnP,OfficeDev/PnP,lamills1/PnP,kevhoyt/PnP,PieterVeenstra/PnP,aammiitt2/PnP,rbarten/PnP,ivanvagunin/PnP,chrisobriensp/PnP,sndkr/PnP,nishantpunetha/PnP,edrohler/PnP,r0ddney/PnP,afsandeberg/PnP,PaoloPia/PnP,gautekramvik/PnP,weshackett/PnP,tomvr2610/PnP,yagoto/PnP,SteenMolberg/PnP,kevhoyt/PnP,SimonDoy/PnP,jeroenvanlieshout/PnP,comblox/PnP,OneBitSoftware/PnP,valt83/PnP,kendomen/PnP,GeiloStylo/PnP,hildabarbara/PnP,afsandeberg/PnP,werocool/PnP,zrahui/PnP,GSoft-SharePoint/PnP,shankargurav/PnP,bhoeijmakers/PnP,machadosantos/PnP,RickVanRousselt/PnP,pbjorklund/PnP,baldswede/PnP,PieterVeenstra/PnP,vnathalye/PnP,rahulsuryawanshi/PnP,bhoeijmakers/PnP,hildabarbara/PnP,selossej/PnP,SPDoctor/PnP,machadosantos/PnP,JonathanHuss/PnP,levesquesamuel/PnP,aammiitt2/PnP,OneBitSoftware/PnP,svarukala/PnP,GeiloStylo/PnP,svarukala/PnP,JilleFloridor/PnP,rroman81/PnP,PaoloPia/PnP,OzMakka/PnP,timothydonato/PnP,timothydonato/PnP,comblox/PnP,rencoreab/PnP,spdavid/PnP,bbojilov/PnP,dalehhirt/PnP,dalehhirt/PnP,brennaman/PnP,NavaneethaDev/PnP,markcandelora/PnP,bbojilov/PnP,tomvr2610/PnP
|
6c77bd836c938d089fc88e7f63516aa45ad07938
|
src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Dialog_OutOfProc.cs
|
src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Dialog_OutOfProc.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;
namespace Microsoft.VisualStudio.IntegrationTest.Utilities.OutOfProcess
{
public class Dialog_OutOfProc : OutOfProcComponent
{
public Dialog_OutOfProc(VisualStudioInstance visualStudioInstance)
: base(visualStudioInstance)
{
}
public void VerifyOpen(string dialogName)
{
// FindDialog will wait until the dialog is open, so the return value is unused.
DialogHelpers.FindDialogByName(GetMainWindowHWnd(), dialogName, isOpen: true, CancellationToken.None);
// Wait for application idle to ensure the dialog is fully initialized
VisualStudioInstance.WaitForApplicationIdle(CancellationToken.None);
}
public void VerifyClosed(string dialogName)
{
// FindDialog will wait until the dialog is closed, so the return value is unused.
DialogHelpers.FindDialogByName(GetMainWindowHWnd(), dialogName, isOpen: false, CancellationToken.None);
}
public void Click(string dialogName, string buttonName)
=> DialogHelpers.PressButtonWithNameFromDialogWithName(GetMainWindowHWnd(), dialogName, buttonName);
private IntPtr GetMainWindowHWnd()
=> VisualStudioInstance.Shell.GetHWnd();
}
}
|
// 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;
namespace Microsoft.VisualStudio.IntegrationTest.Utilities.OutOfProcess
{
public class Dialog_OutOfProc : OutOfProcComponent
{
public Dialog_OutOfProc(VisualStudioInstance visualStudioInstance)
: base(visualStudioInstance)
{
}
public void VerifyOpen(string dialogName)
{
using var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout);
// FindDialog will wait until the dialog is open, so the return value is unused.
DialogHelpers.FindDialogByName(GetMainWindowHWnd(), dialogName, isOpen: true, cancellationTokenSource.Token);
// Wait for application idle to ensure the dialog is fully initialized
VisualStudioInstance.WaitForApplicationIdle(cancellationTokenSource.Token);
}
public void VerifyClosed(string dialogName)
{
using var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout);
// FindDialog will wait until the dialog is closed, so the return value is unused.
DialogHelpers.FindDialogByName(GetMainWindowHWnd(), dialogName, isOpen: false, cancellationTokenSource.Token);
}
public void Click(string dialogName, string buttonName)
=> DialogHelpers.PressButtonWithNameFromDialogWithName(GetMainWindowHWnd(), dialogName, buttonName);
private IntPtr GetMainWindowHWnd()
=> VisualStudioInstance.Shell.GetHWnd();
}
}
|
Apply hang mitigating timeout in VerifyOpen and VerifyClosed
|
Apply hang mitigating timeout in VerifyOpen and VerifyClosed
|
C#
|
mit
|
diryboy/roslyn,jmarolf/roslyn,AlekseyTs/roslyn,ErikSchierboom/roslyn,weltkante/roslyn,heejaechang/roslyn,tmat/roslyn,mavasani/roslyn,reaction1989/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,KirillOsenkov/roslyn,stephentoub/roslyn,wvdd007/roslyn,mgoertz-msft/roslyn,CyrusNajmabadi/roslyn,brettfo/roslyn,brettfo/roslyn,physhi/roslyn,davkean/roslyn,aelij/roslyn,tmat/roslyn,dotnet/roslyn,agocke/roslyn,reaction1989/roslyn,diryboy/roslyn,AmadeusW/roslyn,heejaechang/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,eriawan/roslyn,tannergooding/roslyn,reaction1989/roslyn,jmarolf/roslyn,bartdesmet/roslyn,nguerrera/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,brettfo/roslyn,jasonmalinowski/roslyn,physhi/roslyn,gafter/roslyn,tmat/roslyn,eriawan/roslyn,nguerrera/roslyn,shyamnamboodiripad/roslyn,KirillOsenkov/roslyn,AmadeusW/roslyn,davkean/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,davkean/roslyn,agocke/roslyn,CyrusNajmabadi/roslyn,genlu/roslyn,panopticoncentral/roslyn,abock/roslyn,sharwell/roslyn,mavasani/roslyn,KevinRansom/roslyn,mgoertz-msft/roslyn,gafter/roslyn,gafter/roslyn,CyrusNajmabadi/roslyn,panopticoncentral/roslyn,mavasani/roslyn,dotnet/roslyn,heejaechang/roslyn,KevinRansom/roslyn,tannergooding/roslyn,weltkante/roslyn,mgoertz-msft/roslyn,nguerrera/roslyn,jasonmalinowski/roslyn,genlu/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,aelij/roslyn,wvdd007/roslyn,agocke/roslyn,panopticoncentral/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,ErikSchierboom/roslyn,genlu/roslyn,AlekseyTs/roslyn,abock/roslyn,wvdd007/roslyn,weltkante/roslyn,physhi/roslyn,sharwell/roslyn,abock/roslyn,stephentoub/roslyn,tannergooding/roslyn,sharwell/roslyn,AlekseyTs/roslyn,stephentoub/roslyn,aelij/roslyn,AmadeusW/roslyn
|
b75a5b778e0d22206dd17f0afce694825b39214f
|
osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerHistoryList.cs
|
osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerHistoryList.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.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.Rooms;
using osuTK;
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
{
/// <summary>
/// A historically-ordered list of <see cref="DrawableRoomPlaylistItem"/>s.
/// </summary>
public class MultiplayerHistoryList : DrawableRoomPlaylist
{
public MultiplayerHistoryList()
: base(false, false, true)
{
}
protected override FillFlowContainer<RearrangeableListItem<PlaylistItem>> CreateListFillFlowContainer() => new HistoryFillFlowContainer
{
Spacing = new Vector2(0, 2)
};
private class HistoryFillFlowContainer : FillFlowContainer<RearrangeableListItem<PlaylistItem>>
{
public override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.Reverse();
}
}
}
|
// 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.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.Rooms;
using osuTK;
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
{
/// <summary>
/// A historically-ordered list of <see cref="DrawableRoomPlaylistItem"/>s.
/// </summary>
public class MultiplayerHistoryList : DrawableRoomPlaylist
{
public MultiplayerHistoryList()
: base(false, false, true)
{
}
protected override FillFlowContainer<RearrangeableListItem<PlaylistItem>> CreateListFillFlowContainer() => new HistoryFillFlowContainer
{
Spacing = new Vector2(0, 2)
};
private class HistoryFillFlowContainer : FillFlowContainer<RearrangeableListItem<PlaylistItem>>
{
public override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.OfType<RearrangeableListItem<PlaylistItem>>().OrderByDescending(item => item.Model.GameplayOrder);
}
}
}
|
Update history list to also sort by gameplay order
|
Update history list to also sort by gameplay order
|
C#
|
mit
|
peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu
|
25ce87ab14dfe450ccda34131e2bf8e12c024055
|
src/NHibernate/Impl/BatchingBatcher.cs
|
src/NHibernate/Impl/BatchingBatcher.cs
|
using System;
using System.Data;
using NHibernate.Engine;
namespace NHibernate.Impl
{
/// <summary>
/// Summary description for BatchingBatcher.
/// </summary>
internal class BatchingBatcher : BatcherImpl
{
private int batchSize;
private int[] expectedRowCounts;
/// <summary>
///
/// </summary>
/// <param name="session"></param>
public BatchingBatcher( ISessionImplementor session ) : base( session )
{
expectedRowCounts = new int[ Factory.BatchSize ];
}
/// <summary>
///
/// </summary>
/// <param name="expectedRowCount"></param>
public override void AddToBatch( int expectedRowCount )
{
throw new NotImplementedException( "Batching not implemented yet" );
/*
log.Info( "Adding to batch" );
IDbCommand batchUpdate = CurrentStatment;
*/
}
/// <summary>
///
/// </summary>
/// <param name="ps"></param>
protected override void DoExecuteBatch( IDbCommand ps )
{
throw new NotImplementedException( "Batching not implemented yet" );
}
}
}
|
using System;
using System.Data;
using NHibernate.Engine;
namespace NHibernate.Impl
{
/// <summary>
/// Summary description for BatchingBatcher.
/// </summary>
internal class BatchingBatcher : BatcherImpl
{
//private int batchSize;
private int[] expectedRowCounts;
/// <summary>
///
/// </summary>
/// <param name="session"></param>
public BatchingBatcher( ISessionImplementor session ) : base( session )
{
expectedRowCounts = new int[ Factory.BatchSize ];
}
/// <summary>
///
/// </summary>
/// <param name="expectedRowCount"></param>
public override void AddToBatch( int expectedRowCount )
{
throw new NotImplementedException( "Batching not implemented yet" );
/*
log.Info( "Adding to batch" );
IDbCommand batchUpdate = CurrentStatment;
*/
}
/// <summary>
///
/// </summary>
/// <param name="ps"></param>
protected override void DoExecuteBatch( IDbCommand ps )
{
throw new NotImplementedException( "Batching not implemented yet" );
}
}
}
|
Comment out batchSize for now as not used
|
Comment out batchSize for now as not used
SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@1312
|
C#
|
lgpl-2.1
|
hazzik/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,nhibernate/nhibernate-core,alobakov/nhibernate-core,ManufacturingIntelligence/nhibernate-core,gliljas/nhibernate-core,RogerKratz/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,nkreipke/nhibernate-core,ManufacturingIntelligence/nhibernate-core,lnu/nhibernate-core,hazzik/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,gliljas/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,livioc/nhibernate-core,fredericDelaporte/nhibernate-core,ManufacturingIntelligence/nhibernate-core,gliljas/nhibernate-core,nkreipke/nhibernate-core,livioc/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,livioc/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,alobakov/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,ngbrown/nhibernate-core,lnu/nhibernate-core
|
8fd7cd51e275e2733f3c0741f55e02ed2de9c0d3
|
samples/MvcSample.Web/Home2Controller.cs
|
samples/MvcSample.Web/Home2Controller.cs
|
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc;
using MvcSample.Web.Models;
namespace MvcSample.Web.RandomNameSpace
{
public class Home2Controller
{
private User _user = new User() { Name = "User Name", Address = "Home Address" };
[Activate]
public HttpResponse Response
{
get; set;
}
public ActionContext ActionContext { get; set; }
public string Index()
{
return "Hello World: my namespace is " + this.GetType().Namespace;
}
public ActionResult Something()
{
return new ContentResult
{
Content = "Hello World From Content"
};
}
public ActionResult Hello()
{
return new ContentResult
{
Content = "Hello World",
};
}
public void Raw()
{
Response.WriteAsync("Hello World raw");
}
public ActionResult UserJson()
{
var jsonResult = new JsonResult(_user);
return jsonResult;
}
public User User()
{
return _user;
}
}
}
|
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc;
using MvcSample.Web.Models;
namespace MvcSample.Web.RandomNameSpace
{
public class Home2Controller
{
private User _user = new User() { Name = "User Name", Address = "Home Address" };
[Activate]
public HttpResponse Response
{
get; set;
}
public ActionContext ActionContext { get; set; }
public string Index()
{
return "Hello World: my namespace is " + this.GetType().Namespace;
}
public ActionResult Something()
{
return new ContentResult
{
Content = "Hello World From Content"
};
}
public ActionResult Hello()
{
return new ContentResult
{
Content = "Hello World",
};
}
public async Task Raw()
{
await Response.WriteAsync("Hello World raw");
}
public ActionResult UserJson()
{
var jsonResult = new JsonResult(_user);
return jsonResult;
}
public User User()
{
return _user;
}
}
}
|
Fix the sample to await when writing directly to the output stream in a controller.
|
Fix the sample to await when writing directly to the output stream in a controller.
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
544b2cced2425ec985511195647a116ae69962e7
|
src/Tests/Framework/ManagedElasticsearch/Tasks/ValidationTasks/ValidatePluginsTask.cs
|
src/Tests/Framework/ManagedElasticsearch/Tasks/ValidationTasks/ValidatePluginsTask.cs
|
using System;
using System.Linq;
using Nest;
using Tests.Framework.ManagedElasticsearch.Nodes;
using Tests.Framework.ManagedElasticsearch.Plugins;
namespace Tests.Framework.ManagedElasticsearch.Tasks.ValidationTasks
{
public class ValidatePluginsTask : NodeValidationTaskBase
{
public override void Validate(IElasticClient client, NodeConfiguration configuration)
{
var v = configuration.ElasticsearchVersion;
var requiredMonikers = ElasticsearchPluginCollection.Supported
.Where(plugin => plugin.IsValid(v) && configuration.RequiredPlugins.Contains(plugin.Plugin))
.Select(plugin => plugin.Moniker)
.ToList();
if (!requiredMonikers.Any()) return;
var checkPlugins = client.CatPlugins();
if (!checkPlugins.IsValid)
throw new Exception($"Failed to check plugins: {checkPlugins.DebugInformation}.");
var missingPlugins = requiredMonikers
.Except((checkPlugins.Records ?? Enumerable.Empty<CatPluginsRecord>()).Select(r => r.Component))
.ToList();
if (!missingPlugins.Any()) return;
var pluginsString = string.Join(", ", missingPlugins);
throw new Exception($"Already running elasticsearch missed the following plugin(s): {pluginsString}.");
}
}
}
|
using System;
using System.Linq;
using Nest;
using Tests.Document.Multiple.UpdateByQuery;
using Tests.Framework.ManagedElasticsearch.Nodes;
using Tests.Framework.ManagedElasticsearch.Plugins;
namespace Tests.Framework.ManagedElasticsearch.Tasks.ValidationTasks
{
public class ValidatePluginsTask : NodeValidationTaskBase
{
public override void Validate(IElasticClient client, NodeConfiguration configuration)
{
var v = configuration.ElasticsearchVersion;
var requiredMonikers = ElasticsearchPluginCollection.Supported
.Where(plugin => plugin.IsValid(v) && configuration.RequiredPlugins.Contains(plugin.Plugin))
.Select(plugin => plugin.Moniker)
.ToList();
if (!requiredMonikers.Any()) return;
// 6.2.4 splits out X-Pack into separate plugin names
if (requiredMonikers.Contains(ElasticsearchPlugin.XPack.Moniker()) && TestClient.VersionUnderTestSatisfiedBy(">=6.2.4"))
{
requiredMonikers.Remove(ElasticsearchPlugin.XPack.Moniker());
requiredMonikers.Add(ElasticsearchPlugin.XPack.Moniker() + "-core");
}
var checkPlugins = client.CatPlugins();
if (!checkPlugins.IsValid)
throw new Exception($"Failed to check plugins: {checkPlugins.DebugInformation}.");
var missingPlugins = requiredMonikers
.Except((checkPlugins.Records ?? Enumerable.Empty<CatPluginsRecord>()).Select(r => r.Component))
.ToList();
if (!missingPlugins.Any()) return;
var pluginsString = string.Join(", ", missingPlugins);
throw new Exception($"Already running elasticsearch missed the following plugin(s): {pluginsString}.");
}
}
}
|
Validate existence of x-pack-core for 6.2.4+
|
Validate existence of x-pack-core for 6.2.4+
This commit asserts that for integration tests running against 6.2.4+, plugin validation
checks for x-pack-core as opposed to x-pack; x-pack plugin was split out into separate
plugin names
|
C#
|
apache-2.0
|
elastic/elasticsearch-net,elastic/elasticsearch-net
|
1cdef5fa110f6d6a8af11673d68414e964b07787
|
P2E.DataObjects/ApplicationInformation.cs
|
P2E.DataObjects/ApplicationInformation.cs
|
using System.Reflection;
using P2E.Interfaces.DataObjects;
namespace P2E.DataObjects
{
public class ApplicationInformation : IApplicationInformation
{
public string Name { get; }
public string Version { get; }
public ApplicationInformation()
{
Name = Assembly.GetEntryAssembly().GetName().Name;
Version = Assembly.GetEntryAssembly().GetName().Version.ToString();
}
}
}
|
using System.Reflection;
using P2E.Interfaces.DataObjects;
namespace P2E.DataObjects
{
public class ApplicationInformation : IApplicationInformation
{
public string Name => Assembly.GetEntryAssembly().GetName().Name;
public string Version => Assembly.GetEntryAssembly().GetName().Version.ToString();
}
}
|
Rewrite with expression bodies properties syntax.
|
Rewrite with expression bodies properties syntax.
|
C#
|
bsd-2-clause
|
SludgeVohaul/P2EApp
|
b0aa226e442f2d2e6d306c5e16165e293acdb5d2
|
Source/BitDiffer.Common/Misc/Constants.cs
|
Source/BitDiffer.Common/Misc/Constants.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace BitDiffer.Common.Misc
{
public class Constants
{
public const string ProductName = "BitDiffer";
public const string ProductSubTitle = "Assembly Comparison Tool";
public const string HelpUrl = "https://github.com/grennis/bitdiffer/wiki";
public const string ExtractionDomainPrefix = "Temp App Domain";
public const string ComparisonEmailSubject = "BitDiffer Assembly Comparison Report";
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace BitDiffer.Common.Misc
{
public class Constants
{
public const string ProductName = "BitDiffer";
public const string ProductSubTitle = "Assembly Comparison Tool";
public const string HelpUrl = "https://github.com/bitdiffer/bitdiffer/wiki";
public const string ExtractionDomainPrefix = "Temp App Domain";
public const string ComparisonEmailSubject = "BitDiffer Assembly Comparison Report";
}
}
|
Use correct URL for help
|
Use correct URL for help
Clicking on Help in the menu currently opens an old URL which displays the message "This repository has been deleted".
|
C#
|
mit
|
grennis/bitdiffer
|
1eec57c803e70099c09d63149a6b85e3cc65e822
|
SurveyMonkey/Properties/AssemblyInfo.cs
|
SurveyMonkey/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("SurveyMonkeyApi")]
[assembly: AssemblyDescription("Library for accessing v2 of the Survey Monkey Api")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SurveyMonkeyApi")]
[assembly: AssemblyCopyright("Copyright © Ben Emmett")]
[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("da9e0373-83cd-4deb-87a5-62b313be61ec")]
// 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.3.0")]
[assembly: AssemblyFileVersion("1.2.3.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SurveyMonkeyApi")]
[assembly: AssemblyDescription("Library for accessing v2 of the Survey Monkey Api")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SurveyMonkeyApi")]
[assembly: AssemblyCopyright("Copyright © Ben Emmett")]
[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("da9e0373-83cd-4deb-87a5-62b313be61ec")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
|
Bump assembly info for 1.3.0 release
|
Bump assembly info for 1.3.0 release
|
C#
|
mit
|
NellyHaglund/SurveyMonkeyApi,bcemmett/SurveyMonkeyApi
|
13e267b2b40454afa9902e2c2627a2230d2a4edf
|
src/ZobShop.Services/ProductRatingService.cs
|
src/ZobShop.Services/ProductRatingService.cs
|
using ZobShop.Data.Contracts;
using ZobShop.Factories;
using ZobShop.Models;
using ZobShop.Services.Contracts;
namespace ZobShop.Services
{
public class ProductRatingService : IProductRatingService
{
private readonly IRepository<User> userRepository;
private readonly IRepository<ProductRating> productRatingRepository;
private readonly IRepository<Product> productRepository;
private readonly IUnitOfWork unitOfWork;
private readonly IProductRatingFactory factory;
public ProductRatingService(IRepository<User> userRepository,
IRepository<Product> productRepository,
IRepository<ProductRating> productRatingRepository,
IUnitOfWork unitOfWork,
IProductRatingFactory factory)
{
this.userRepository = userRepository;
this.productRepository = productRepository;
this.productRatingRepository = productRatingRepository;
this.unitOfWork = unitOfWork;
this.factory = factory;
}
public ProductRating CreateProductRating(int rating, string content, int productId, string userId)
{
var product = this.productRepository.GetById(productId);
var user = this.userRepository.GetById(userId);
var newRating = this.factory.CreateProductRating(rating, content, product, user);
this.productRatingRepository.Add(newRating);
this.unitOfWork.Commit();
return newRating;
}
}
}
|
using System;
using ZobShop.Data.Contracts;
using ZobShop.Factories;
using ZobShop.Models;
using ZobShop.Services.Contracts;
namespace ZobShop.Services
{
public class ProductRatingService : IProductRatingService
{
private readonly IRepository<User> userRepository;
private readonly IRepository<ProductRating> productRatingRepository;
private readonly IRepository<Product> productRepository;
private readonly IUnitOfWork unitOfWork;
private readonly IProductRatingFactory factory;
public ProductRatingService(IRepository<User> userRepository,
IRepository<Product> productRepository,
IRepository<ProductRating> productRatingRepository,
IUnitOfWork unitOfWork,
IProductRatingFactory factory)
{
if (userRepository == null)
{
throw new ArgumentNullException("user repository cannot be null");
}
if (productRepository == null)
{
throw new ArgumentNullException("product repository cannot be null");
}
if (productRatingRepository == null)
{
throw new ArgumentNullException("product rating repository cannot be null");
}
if (unitOfWork == null)
{
throw new ArgumentNullException("unit of work repository cannot be null");
}
if (factory == null)
{
throw new ArgumentNullException("factory repository cannot be null");
}
this.userRepository = userRepository;
this.productRepository = productRepository;
this.productRatingRepository = productRatingRepository;
this.unitOfWork = unitOfWork;
this.factory = factory;
}
public ProductRating CreateProductRating(int rating, string content, int productId, string userId)
{
var product = this.productRepository.GetById(productId);
var user = this.userRepository.GetById(userId);
var newRating = this.factory.CreateProductRating(rating, content, product, user);
this.productRatingRepository.Add(newRating);
this.unitOfWork.Commit();
return newRating;
}
}
}
|
Add checks in product rating service
|
Add checks in product rating service
|
C#
|
mit
|
Branimir123/ZobShop,Branimir123/ZobShop,Branimir123/ZobShop
|
65097865ac4fb4fd6c9056b9e1d035631b245e7d
|
GUI/Types/ParticleRenderer/INumberProvider.cs
|
GUI/Types/ParticleRenderer/INumberProvider.cs
|
using System;
using ValveResourceFormat.Serialization;
namespace GUI.Types.ParticleRenderer
{
public interface INumberProvider
{
double NextNumber();
}
public class LiteralNumberProvider : INumberProvider
{
private readonly double value;
public LiteralNumberProvider(double value)
{
this.value = value;
}
public double NextNumber() => value;
}
public static class INumberProviderExtensions
{
public static INumberProvider GetNumberProvider(this IKeyValueCollection keyValues, string propertyName)
{
var property = keyValues.GetProperty<object>(propertyName);
if (property is IKeyValueCollection numberProviderParameters)
{
var type = numberProviderParameters.GetProperty<string>("m_nType");
switch (type)
{
case "PF_TYPE_LITERAL":
return new LiteralNumberProvider(numberProviderParameters.GetDoubleProperty("m_flLiteralValue"));
default:
throw new InvalidCastException($"Could not create number provider of type {type}.");
}
}
else
{
return new LiteralNumberProvider(Convert.ToDouble(property));
}
}
public static int NextInt(this INumberProvider numberProvider)
{
return (int)numberProvider.NextNumber();
}
}
}
|
using System;
using ValveResourceFormat.Serialization;
namespace GUI.Types.ParticleRenderer
{
public interface INumberProvider
{
double NextNumber();
}
public class LiteralNumberProvider : INumberProvider
{
private readonly double value;
public LiteralNumberProvider(double value)
{
this.value = value;
}
public double NextNumber() => value;
}
public static class INumberProviderExtensions
{
public static INumberProvider GetNumberProvider(this IKeyValueCollection keyValues, string propertyName)
{
var property = keyValues.GetProperty<object>(propertyName);
if (property is IKeyValueCollection numberProviderParameters)
{
var type = numberProviderParameters.GetProperty<string>("m_nType");
switch (type)
{
case "PF_TYPE_LITERAL":
return new LiteralNumberProvider(numberProviderParameters.GetDoubleProperty("m_flLiteralValue"));
default:
if (numberProviderParameters.ContainsKey("m_flLiteralValue"))
{
Console.Error.WriteLine($"Number provider of type {type} is not directly supported, but it has m_flLiteralValue.");
return new LiteralNumberProvider(numberProviderParameters.GetDoubleProperty("m_flLiteralValue"));
}
throw new InvalidCastException($"Could not create number provider of type {type}.");
}
}
else
{
return new LiteralNumberProvider(Convert.ToDouble(property));
}
}
public static int NextInt(this INumberProvider numberProvider)
{
return (int)numberProvider.NextNumber();
}
}
}
|
Support all particle num providers with m_flLiteralValue
|
Support all particle num providers with m_flLiteralValue
|
C#
|
mit
|
SteamDatabase/ValveResourceFormat
|
4196b9af5adbe25e37081778f5768504a475b161
|
LINQToTTreeHelpers/LINQToTreeHelpers/Utils.cs
|
LINQToTTreeHelpers/LINQToTreeHelpers/Utils.cs
|
namespace LINQToTreeHelpers
{
public static class Utils
{
/// <summary>
/// Write out an object. Eventually, with ROOTNET improvements this will work better and perahps
/// won't be needed!
/// </summary>
/// <param name="obj"></param>
/// <param name="dir"></param>
internal static void InternalWriteObject(this ROOTNET.Interface.NTObject obj, ROOTNET.Interface.NTDirectory dir)
{
var h = obj as ROOTNET.Interface.NTH1;
if (h != null)
{
var copy = h.Clone();
dir.WriteTObject(copy); // Ugly from a memory pov, but...
copy.SetNull();
}
else
{
dir.WriteTObject(obj);
obj.SetNull();
}
}
/// <summary>
/// Take a string and "sanatize" it for a root name.
/// </summary>
/// <param name="name">Text name to be used as a ROOT name</param>
/// <returns>argument name with spaces removes, as well as other characters</returns>
public static string FixupForROOTName(this string name)
{
var result = name.Replace(" ", "");
result = result.Replace("_{", "");
result = result.Replace("{", "");
result = result.Replace("}", "");
result = result.Replace("-", "");
result = result.Replace("\\", "");
result = result.Replace("%", "");
result = result.Replace("<", "");
result = result.Replace(">", "");
return result;
}
}
}
|
namespace LINQToTreeHelpers
{
public static class Utils
{
/// <summary>
/// Write out an object. Eventually, with ROOTNET improvements this will work better and perahps
/// won't be needed!
/// </summary>
/// <param name="obj"></param>
/// <param name="dir"></param>
internal static void InternalWriteObject(this ROOTNET.Interface.NTObject obj, ROOTNET.Interface.NTDirectory dir)
{
var h = obj as ROOTNET.Interface.NTH1;
if (h != null)
{
var copy = h.Clone();
dir.WriteTObject(copy); // Ugly from a memory pov, but...
copy.SetNull();
}
else
{
dir.WriteTObject(obj);
obj.SetNull();
}
}
/// <summary>
/// Take a string and "sanatize" it for a root name.
/// </summary>
/// <param name="name">Text name to be used as a ROOT name</param>
/// <returns>argument name with spaces removes, as well as other characters</returns>
public static string FixupForROOTName(this string name)
{
var result = name.Replace(" ", "");
result = result.Replace("_{", "");
result = result.Replace("{", "");
result = result.Replace("}", "");
result = result.Replace("-", "");
result = result.Replace("\\", "");
result = result.Replace("%", "");
result = result.Replace("<", "lt");
result = result.Replace(">", "gt");
return result;
}
}
}
|
Improve translation when removing strings from names!
|
Improve translation when removing strings from names!
|
C#
|
lgpl-2.1
|
gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT
|
0564e4186b6a9091d6ac5ab9e028cd022f8b3bab
|
DesktopWidgets/Widgets/Search/ViewModel.cs
|
DesktopWidgets/Widgets/Search/ViewModel.cs
|
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using DesktopWidgets.Classes;
using DesktopWidgets.Helpers;
using DesktopWidgets.ViewModelBase;
using GalaSoft.MvvmLight.Command;
namespace DesktopWidgets.Widgets.Search
{
public class ViewModel : WidgetViewModelBase
{
private string _searchText;
public ViewModel(WidgetId id) : base(id)
{
Settings = id.GetSettings() as Settings;
if (Settings == null)
return;
Go = new RelayCommand(GoExecute);
OnKeyUp = new RelayCommand<KeyEventArgs>(OnKeyUpExecute);
}
public Settings Settings { get; }
public ICommand Go { get; set; }
public ICommand OnKeyUp { get; set; }
public string SearchText
{
get { return _searchText; }
set
{
if (_searchText != value)
{
_searchText = value;
RaisePropertyChanged(nameof(SearchText));
}
}
}
private void GoExecute()
{
if (string.IsNullOrWhiteSpace(Settings.BaseUrl))
{
Popup.Show("You must set up a base URL first.", MessageBoxButton.OK, MessageBoxImage.Exclamation);
return;
}
var searchText = SearchText;
SearchText = string.Empty;
Process.Start($"{Settings.BaseUrl}{searchText}{Settings.URLSuffix}");
}
private void OnKeyUpExecute(KeyEventArgs args)
{
if (args.Key == Key.Enter)
GoExecute();
}
}
}
|
using System.Diagnostics;
using System.Windows.Input;
using DesktopWidgets.Classes;
using DesktopWidgets.Helpers;
using DesktopWidgets.ViewModelBase;
using GalaSoft.MvvmLight.Command;
namespace DesktopWidgets.Widgets.Search
{
public class ViewModel : WidgetViewModelBase
{
private string _searchText;
public ViewModel(WidgetId id) : base(id)
{
Settings = id.GetSettings() as Settings;
if (Settings == null)
return;
Go = new RelayCommand(GoExecute);
OnKeyUp = new RelayCommand<KeyEventArgs>(OnKeyUpExecute);
}
public Settings Settings { get; }
public ICommand Go { get; set; }
public ICommand OnKeyUp { get; set; }
public string SearchText
{
get { return _searchText; }
set
{
if (_searchText != value)
{
_searchText = value;
RaisePropertyChanged(nameof(SearchText));
}
}
}
private void GoExecute()
{
var searchText = SearchText;
SearchText = string.Empty;
Process.Start($"{Settings.BaseUrl}{searchText}{Settings.URLSuffix}");
}
private void OnKeyUpExecute(KeyEventArgs args)
{
if (args.Key == Key.Enter)
GoExecute();
}
}
}
|
Remove "Search" widget base URL warning
|
Remove "Search" widget base URL warning
|
C#
|
apache-2.0
|
danielchalmers/DesktopWidgets
|
d7a0fc94bfc7d60febe02fcafe3fc6ff0d7b9de5
|
main/Smartsheet/Api/Models/ObjectExclusion.cs
|
main/Smartsheet/Api/Models/ObjectExclusion.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 System.Runtime.Serialization;
namespace Smartsheet.Api.Models
{
/// <summary>
/// Represents specific objects that can be excluded in some responses.
/// </summary>
public enum ObjectExclusion
{
/// <summary>
/// The discussions
/// </summary>
[EnumMember(Value = "nonexistentCells")]
NONEXISTENT_CELLS
}
}
|
// #[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 objects that can be excluded in some responses.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ObjectExclusion
{
/// <summary>
/// The discussions
/// </summary>
[EnumMember(Value = "nonexistentCells")]
NONEXISTENT_CELLS
}
}
|
Make sure NONEXISTENT_CELLS is serialized into nonexistentCells
|
Make sure NONEXISTENT_CELLS is serialized into nonexistentCells
|
C#
|
apache-2.0
|
smartsheet-platform/smartsheet-csharp-sdk,smartsheet-platform/smartsheet-csharp-sdk
|
ed9ce8b7fe509527ded528a6ae6b0fc07f7b2d33
|
src/FilterLists.Agent/Entities/ListInfo.cs
|
src/FilterLists.Agent/Entities/ListInfo.cs
|
using System;
namespace FilterLists.Agent.Entities
{
public class ListInfo
{
public int Id { get; }
public Uri ViewUrl { get; }
}
}
|
using System;
namespace FilterLists.Agent.Entities
{
public class ListInfo
{
public int Id { get; private set; }
public Uri ViewUrl { get; private set; }
}
}
|
Revert "remove unused private setters"
|
Revert "remove unused private setters"
This reverts commit 0f6940904667a1a24c9605fe7a827d67a0d79905.
|
C#
|
mit
|
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
|
deeeaafda20ebd00d845c9f3e34148a74b006fc9
|
Assets/Scripts/Bullet.cs
|
Assets/Scripts/Bullet.cs
|
using UnityEngine;
using System.Collections;
public class Bullet : MonoBehaviour {
public int bulletSpeed = 715;
void Start () {
GetComponent<Rigidbody>().AddRelativeForce(Vector3.forward * bulletSpeed);
}
}
|
using UnityEngine;
using System.Collections;
public class Bullet : MonoBehaviour {
public int bulletSpeed = 715;
void Start() {
GetComponent<Rigidbody>().AddRelativeForce(Vector3.forward * bulletSpeed);
}
void OnTriggerEnter(Collider other) {
Destroy(gameObject);
}
}
|
Destroy bullets on trigger event
|
Destroy bullets on trigger event
|
C#
|
mit
|
ne1ro/desperation
|
2dbb04350d85c3c7e37f26e003820e8fdfea847e
|
Assets/Scripts/Menu/Dropdowns/DropdownLanguageFontUpdater.cs
|
Assets/Scripts/Menu/Dropdowns/DropdownLanguageFontUpdater.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DropdownLanguageFontUpdater : MonoBehaviour
{
[SerializeField]
private Text textComponent;
void Start ()
{
Font overrideFont = LocalizationManager.instance.getAllLanguages()[transform.GetSiblingIndex() - 1].overrideFont;
if (overrideFont != null)
textComponent.font = overrideFont;
}
void Update ()
{
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DropdownLanguageFontUpdater : MonoBehaviour
{
[SerializeField]
private Text textComponent;
void Start ()
{
var language = LocalizationManager.instance.getAllLanguages()[transform.GetSiblingIndex() - 1];
if (language.overrideFont != null)
{
textComponent.font = language.overrideFont;
if (language.forceUnbold)
textComponent.fontStyle = FontStyle.Normal;
}
}
void Update ()
{
}
}
|
Apply force unbold to dropdown options
|
Apply force unbold to dropdown options
|
C#
|
mit
|
NitorInc/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare
|
bb5eb966254a46e090077837a9d48408e8dcbb77
|
src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewManfiest.cs
|
src/Microsoft.AspNetCore.Mvc.Razor/Compilation/CompiledViewManfiest.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Reflection;
using System.Runtime.Loader;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
{
public static class CompiledViewManfiest
{
public static readonly string PrecompiledViewsAssemblySuffix = ".PrecompiledViews";
public static Type GetManifestType(AssemblyPart assemblyPart, string typeName)
{
EnsureFeatureAssembly(assemblyPart);
var precompiledAssemblyName = new AssemblyName(assemblyPart.Assembly.FullName);
precompiledAssemblyName.Name = precompiledAssemblyName.Name + PrecompiledViewsAssemblySuffix;
return Type.GetType($"{typeName},{precompiledAssemblyName}");
}
private static void EnsureFeatureAssembly(AssemblyPart assemblyPart)
{
if (assemblyPart.Assembly.IsDynamic || string.IsNullOrEmpty(assemblyPart.Assembly.Location))
{
return;
}
var precompiledAssemblyFileName = assemblyPart.Assembly.GetName().Name
+ PrecompiledViewsAssemblySuffix
+ ".dll";
var precompiledAssemblyFilePath = Path.Combine(
Path.GetDirectoryName(assemblyPart.Assembly.Location),
precompiledAssemblyFileName);
if (File.Exists(precompiledAssemblyFilePath))
{
try
{
Assembly.LoadFile(precompiledAssemblyFilePath);
}
catch (FileLoadException)
{
// Don't throw if assembly cannot be loaded. This can happen if the file is not a managed assembly.
}
}
}
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Reflection;
using System.Runtime.Loader;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
{
public static class CompiledViewManfiest
{
public static readonly string PrecompiledViewsAssemblySuffix = ".PrecompiledViews";
public static Type GetManifestType(AssemblyPart assemblyPart, string typeName)
{
var assembly = GetFeatureAssembly(assemblyPart);
return assembly?.GetType(typeName);
}
private static Assembly GetFeatureAssembly(AssemblyPart assemblyPart)
{
if (assemblyPart.Assembly.IsDynamic || string.IsNullOrEmpty(assemblyPart.Assembly.Location))
{
return null;
}
var precompiledAssemblyFileName = assemblyPart.Assembly.GetName().Name
+ PrecompiledViewsAssemblySuffix
+ ".dll";
var precompiledAssemblyFilePath = Path.Combine(
Path.GetDirectoryName(assemblyPart.Assembly.Location),
precompiledAssemblyFileName);
if (File.Exists(precompiledAssemblyFilePath))
{
try
{
return Assembly.LoadFile(precompiledAssemblyFilePath);
}
catch (FileLoadException)
{
// Don't throw if assembly cannot be loaded. This can happen if the file is not a managed assembly.
}
}
return null;
}
}
}
|
Load the precompilation type from the loaded assembly
|
Load the precompilation type from the loaded assembly
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
6ab190e83fb651864cb64b656ec80678270348f6
|
src/Tests/Nest.Tests.Unit/ObjectInitializer/Index/IndexRequestTests.cs
|
src/Tests/Nest.Tests.Unit/ObjectInitializer/Index/IndexRequestTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Elasticsearch.Net;
using FluentAssertions;
using Nest;
using Nest.Tests.MockData.Domain;
using NUnit.Framework;
namespace Nest.Tests.Unit.ObjectInitializer.Index
{
[TestFixture]
public class IndexRequestTests : BaseJsonTests
{
private readonly IElasticsearchResponse _status;
public IndexRequestTests()
{
var newProject = new ElasticsearchProject
{
Id = 15,
Name = "Some awesome new elasticsearch project"
};
var request = new IndexRequest<ElasticsearchProject>(newProject)
{
Replication = Replication.Async
};
//TODO Index(request) does not work as expected
var response = this._client.Index<ElasticsearchProject>(request);
this._status = response.ConnectionStatus;
}
public void SettingsTest()
{
}
[Test]
public void Url()
{
this._status.RequestUrl.Should().EndWith("/nest_test_data/elasticsearchprojects/15?replication=async");
this._status.RequestMethod.Should().Be("PUT");
}
[Test]
public void IndexBody()
{
this.JsonEquals(this._status.Request, MethodBase.GetCurrentMethod());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Elasticsearch.Net;
using FluentAssertions;
using Nest;
using Nest.Tests.MockData.Domain;
using NUnit.Framework;
namespace Nest.Tests.Unit.ObjectInitializer.Index
{
[TestFixture]
public class IndexRequestTests : BaseJsonTests
{
private readonly IElasticsearchResponse _status;
public IndexRequestTests()
{
var newProject = new ElasticsearchProject
{
Id = 15,
Name = "Some awesome new elasticsearch project"
};
var request = new IndexRequest<ElasticsearchProject>(newProject)
{
Replication = Replication.Async
};
//TODO Index(request) does not work as expected
var response = this._client.Index<ElasticsearchProject>(request);
this._status = response.ConnectionStatus;
}
[Test]
public void Url()
{
this._status.RequestUrl.Should().EndWith("/nest_test_data/elasticsearchprojects/15?replication=async");
this._status.RequestMethod.Should().Be("PUT");
}
[Test]
public void IndexBody()
{
this.JsonEquals(this._status.Request, MethodBase.GetCurrentMethod());
}
}
}
|
Remove empty method checked in by mistake
|
Remove empty method checked in by mistake
|
C#
|
apache-2.0
|
tkirill/elasticsearch-net,cstlaurent/elasticsearch-net,DavidSSL/elasticsearch-net,faisal00813/elasticsearch-net,gayancc/elasticsearch-net,azubanov/elasticsearch-net,amyzheng424/elasticsearch-net,robertlyson/elasticsearch-net,geofeedia/elasticsearch-net,adam-mccoy/elasticsearch-net,abibell/elasticsearch-net,starckgates/elasticsearch-net,junlapong/elasticsearch-net,UdiBen/elasticsearch-net,amyzheng424/elasticsearch-net,adam-mccoy/elasticsearch-net,junlapong/elasticsearch-net,gayancc/elasticsearch-net,mac2000/elasticsearch-net,UdiBen/elasticsearch-net,tkirill/elasticsearch-net,starckgates/elasticsearch-net,robrich/elasticsearch-net,mac2000/elasticsearch-net,faisal00813/elasticsearch-net,jonyadamit/elasticsearch-net,SeanKilleen/elasticsearch-net,Grastveit/NEST,joehmchan/elasticsearch-net,geofeedia/elasticsearch-net,CSGOpenSource/elasticsearch-net,ststeiger/elasticsearch-net,wawrzyn/elasticsearch-net,robrich/elasticsearch-net,wawrzyn/elasticsearch-net,cstlaurent/elasticsearch-net,elastic/elasticsearch-net,UdiBen/elasticsearch-net,abibell/elasticsearch-net,cstlaurent/elasticsearch-net,RossLieberman/NEST,tkirill/elasticsearch-net,SeanKilleen/elasticsearch-net,junlapong/elasticsearch-net,wawrzyn/elasticsearch-net,faisal00813/elasticsearch-net,abibell/elasticsearch-net,LeoYao/elasticsearch-net,geofeedia/elasticsearch-net,RossLieberman/NEST,KodrAus/elasticsearch-net,elastic/elasticsearch-net,mac2000/elasticsearch-net,robertlyson/elasticsearch-net,azubanov/elasticsearch-net,RossLieberman/NEST,joehmchan/elasticsearch-net,Grastveit/NEST,jonyadamit/elasticsearch-net,KodrAus/elasticsearch-net,CSGOpenSource/elasticsearch-net,adam-mccoy/elasticsearch-net,DavidSSL/elasticsearch-net,gayancc/elasticsearch-net,robertlyson/elasticsearch-net,CSGOpenSource/elasticsearch-net,TheFireCookie/elasticsearch-net,Grastveit/NEST,DavidSSL/elasticsearch-net,ststeiger/elasticsearch-net,amyzheng424/elasticsearch-net,SeanKilleen/elasticsearch-net,joehmchan/elasticsearch-net,starckgates/elasticsearch-net,TheFireCookie/elasticsearch-net,jonyadamit/elasticsearch-net,TheFireCookie/elasticsearch-net,LeoYao/elasticsearch-net,azubanov/elasticsearch-net,LeoYao/elasticsearch-net,ststeiger/elasticsearch-net,robrich/elasticsearch-net,KodrAus/elasticsearch-net
|
3d340e133fee63b068a6e9f31c907f815bd453f6
|
src/PPWCode.Vernacular.NHibernate.I.Tests/DictionariesAndLists/Mappers/PlaneMapper.cs
|
src/PPWCode.Vernacular.NHibernate.I.Tests/DictionariesAndLists/Mappers/PlaneMapper.cs
|
// Copyright 2017 by PeopleWare n.v..
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using NHibernate.Mapping.ByCode.Conformist;
using PPWCode.Vernacular.NHibernate.I.Tests.DictionariesAndLists.Models;
namespace PPWCode.Vernacular.NHibernate.I.Tests.DictionariesAndLists.Mappers
{
public class PlaneMapper : ComponentMapping<Plane>
{
public PlaneMapper()
{
Component(p => p.Normal);
Component(p => p.Translation);
}
}
}
|
// Copyright 2017 by PeopleWare n.v..
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using NHibernate.Mapping.ByCode.Conformist;
using PPWCode.Vernacular.NHibernate.I.Tests.DictionariesAndLists.Models;
namespace PPWCode.Vernacular.NHibernate.I.Tests.DictionariesAndLists.Mappers
{
public class PlaneMapper : ComponentMapping<Plane>
{
public PlaneMapper()
{
Component(p => p.Normal);
Property(p => p.Translation);
}
}
}
|
Fix wrong mapping for Translation, should be mapped as a property instead of Component
|
Fix wrong mapping for Translation, should be mapped as a property instead of Component
|
C#
|
apache-2.0
|
peopleware/net-ppwcode-vernacular-nhibernate
|
5ef8e26ebe894322c8aaba026051c3bba5ab15f7
|
osu.Game.Tests/Visual/Gameplay/TestSceneModValidity.cs
|
osu.Game.Tests/Visual/Gameplay/TestSceneModValidity.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.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Tests.Visual.Gameplay
{
[HeadlessTest]
public class TestSceneModValidity : TestSceneAllRulesetPlayers
{
protected override void AddCheckSteps()
{
AddStep("Check all mod acronyms are unique", () =>
{
var mods = Ruleset.Value.CreateInstance().AllMods;
IEnumerable<string> acronyms = mods.Select(m => m.Acronym);
Assert.That(acronyms, Is.Unique);
});
AddStep("Check all mods are two-way incompatible", () =>
{
var mods = Ruleset.Value.CreateInstance().AllMods;
IEnumerable<Mod> modInstances = mods.Select(mod => mod.CreateInstance());
foreach (var mod in modInstances)
{
var modIncompatibilities = mod.IncompatibleMods;
foreach (var incompatibleModType in modIncompatibilities)
{
var incompatibleMod = modInstances.First(m => incompatibleModType.IsInstanceOfType(m));
Assert.That(
incompatibleMod.IncompatibleMods.Any(m => m.IsInstanceOfType(mod)),
$"{mod} has {incompatibleMod} in it's incompatible mods, but {incompatibleMod} does not have {mod} in it's incompatible mods."
);
}
}
});
}
}
}
|
// 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.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Tests.Visual.Gameplay
{
[HeadlessTest]
public class TestSceneModValidity : TestSceneAllRulesetPlayers
{
protected override void AddCheckSteps()
{
AddStep("Check all mod acronyms are unique", () =>
{
var mods = Ruleset.Value.CreateInstance().AllMods;
IEnumerable<string> acronyms = mods.Select(m => m.Acronym);
Assert.That(acronyms, Is.Unique);
});
AddStep("Check all mods are two-way incompatible", () =>
{
var mods = Ruleset.Value.CreateInstance().AllMods;
IEnumerable<Mod> modInstances = mods.Select(mod => mod.CreateInstance());
foreach (var modToCheck in modInstances)
{
var incompatibleMods = modToCheck.IncompatibleMods;
foreach (var incompatible in incompatibleMods)
{
foreach (var incompatibleMod in modInstances.Where(m => incompatible.IsInstanceOfType(m)))
{
Assert.That(
incompatibleMod.IncompatibleMods.Any(m => m.IsInstanceOfType(modToCheck)),
$"{modToCheck} has {incompatibleMod} in it's incompatible mods, but {incompatibleMod} does not have {modToCheck} in it's incompatible mods."
);
}
}
}
});
}
}
}
|
Fix check not accounting for mods not existing in certain rulesets
|
Fix check not accounting for mods not existing in certain rulesets
Also check all instances, rather than first.
|
C#
|
mit
|
peppy/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu,ppy/osu
|
004d0d2ee5b8d53d4118af997dea99211a3b3f12
|
WindowsAzurePowershell/src/Management.Test/Tests/Utilities/PowerShellTest.cs
|
WindowsAzurePowershell/src/Management.Test/Tests/Utilities/PowerShellTest.cs
|
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft 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 Microsoft.WindowsAzure.Management.CloudService.Test.Utilities
{
using System.Management.Automation;
using VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure.Management.Test.Tests.Utilities;
[TestClass]
public class PowerShellTest
{
protected PowerShell powershell;
protected string[] modules;
public PowerShellTest(params string[] modules)
{
this.modules = modules;
}
protected void AddScenarioScript(string script)
{
powershell.AddScript(Testing.GetTestResourceContents(script));
}
[TestInitialize]
public virtual void SetupTest()
{
powershell = PowerShell.Create();
foreach (string moduleName in modules)
{
powershell.AddScript(string.Format("Import-Module \"{0}\"", Testing.GetTestResourcePath(moduleName)));
}
powershell.AddScript("$verbosepreference='continue'");
}
[TestCleanup]
public virtual void TestCleanup()
{
powershell.Dispose();
}
}
}
|
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft 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 Microsoft.WindowsAzure.Management.CloudService.Test.Utilities
{
using System.Management.Automation;
using VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure.Management.Test.Tests.Utilities;
[TestClass]
public class PowerShellTest
{
protected PowerShell powershell;
protected string[] modules;
public PowerShellTest(params string[] modules)
{
this.modules = modules;
}
protected void AddScenarioScript(string script)
{
powershell.AddScript(Testing.GetTestResourceContents(script));
}
[TestInitialize]
public virtual void SetupTest()
{
powershell = PowerShell.Create();
foreach (string moduleName in modules)
{
powershell.AddScript(string.Format("Import-Module \"{0}\"", Testing.GetTestResourcePath(moduleName)));
}
powershell.AddScript("$VerbosePreference='Continue'");
powershell.AddScript("$DebugPreference='Continue'");
}
[TestCleanup]
public virtual void TestCleanup()
{
powershell.Dispose();
}
}
}
|
Enable debug by default in scenario tests
|
Enable debug by default in scenario tests
|
C#
|
apache-2.0
|
akromm/azure-sdk-tools,DinoV/azure-sdk-tools,markcowl/azure-sdk-tools,Madhukarc/azure-sdk-tools,akromm/azure-sdk-tools,DinoV/azure-sdk-tools,antonba/azure-sdk-tools,akromm/azure-sdk-tools,johnkors/azure-sdk-tools,johnkors/azure-sdk-tools,Madhukarc/azure-sdk-tools,johnkors/azure-sdk-tools,Madhukarc/azure-sdk-tools,antonba/azure-sdk-tools,markcowl/azure-sdk-tools,johnkors/azure-sdk-tools,antonba/azure-sdk-tools,antonba/azure-sdk-tools,markcowl/azure-sdk-tools,johnkors/azure-sdk-tools,DinoV/azure-sdk-tools,akromm/azure-sdk-tools,Madhukarc/azure-sdk-tools,Madhukarc/azure-sdk-tools,antonba/azure-sdk-tools,DinoV/azure-sdk-tools,markcowl/azure-sdk-tools,markcowl/azure-sdk-tools,DinoV/azure-sdk-tools,akromm/azure-sdk-tools
|
ed49166c861ed369d2981aaf83b4b56e3f0306a5
|
templates/log_rss.cs
|
templates/log_rss.cs
|
<?xml version="1.0"?>
<!-- RSS generated by Trac v<?cs var:trac.version ?> on <?cs var:trac.time ?> -->
<rss version="2.0">
<channel><?cs
if:project.name_encoded ?>
<title><?cs var:project.name_encoded ?>: Revisions of <?cs var:log.path ?></title><?cs
else ?>
<title>Revisions of <?cs var:log.path ?></title><?cs
/if ?>
<link><?cs var:base_host ?><?cs var:log.log_href ?></link>
<description>Trac Log - Revisions of <?cs var:log.path ?></description>
<language>en-us</language>
<generator>Trac v<?cs var:trac.version ?></generator><?cs
each:item = log.items ?><?cs
with:change = log.changes[item.rev] ?>
<item>
<author><?cs var:change.author ?></author>
<pubDate><?cs var:change.date ?></pubDate>
<title>Revision <?cs var:item.rev ?>: <?cs var:change.shortlog ?></title>
<link><?cs var:base_host ?><?cs var:item.changeset_href ?></link>
<description><?cs var:change.message ?></description>
<category>Report</category>
</item><?cs
/with ?><?cs
/each ?>
</channel>
</rss>
|
<?xml version="1.0"?>
<!-- RSS generated by Trac v<?cs var:trac.version ?> on <?cs var:trac.time ?> -->
<rss version="2.0">
<channel><?cs
if:project.name_encoded ?>
<title><?cs var:project.name_encoded ?>: Revisions of <?cs var:log.path ?></title><?cs
else ?>
<title>Revisions of <?cs var:log.path ?></title><?cs
/if ?>
<link><?cs var:base_host ?><?cs var:log.log_href ?></link>
<description>Trac Log - Revisions of <?cs var:log.path ?></description>
<language>en-us</language>
<generator>Trac v<?cs var:trac.version ?></generator><?cs
each:item = log.items ?><?cs
with:change = log.changes[item.rev] ?>
<item>
<author><?cs var:change.author ?></author>
<pubDate><?cs var:change.date ?></pubDate>
<title>Revision <?cs var:item.rev ?>: <?cs var:change.shortlog ?></title>
<link><?cs var:base_host ?><?cs var:item.changeset_href ?></link>
<description><?cs var:change.message ?></description>
<category>Log</category>
</item><?cs
/with ?><?cs
/each ?>
</channel>
</rss>
|
Fix category of revision log RSS feeds.
|
Fix category of revision log RSS feeds.
git-svn-id: 0d96b0c1a6983ccc08b3732614f4d6bfcf9cbb42@2261 af82e41b-90c4-0310-8c96-b1721e28e2e2
|
C#
|
bsd-3-clause
|
rbaumg/trac,rbaumg/trac,rbaumg/trac,rbaumg/trac
|
36f1427645c1ae2563e4864a87cf837c1ba6163e
|
src/SFA.DAS.EAS.Account.Api.Types/EmployerAgreementStatus.cs
|
src/SFA.DAS.EAS.Account.Api.Types/EmployerAgreementStatus.cs
|
using System.ComponentModel;
namespace SFA.DAS.EAS.Account.Api.Types
{
public enum EmployerAgreementStatus
{
[Description("Not signed")]
Pending = 1,
[Description("Signed")]
Signed = 2,
[Description("Expired")]
Expired = 3,
[Description("Superceded")]
Superceded = 4
}
}
|
using System.ComponentModel;
namespace SFA.DAS.EAS.Account.Api.Types
{
public enum EmployerAgreementStatus
{
[Description("Not signed")]
Pending = 1,
[Description("Signed")]
Signed = 2,
[Description("Expired")]
Expired = 3,
[Description("Superseded")]
Superceded = 4
}
}
|
Update spelling mistake in api types
|
Update spelling mistake in api types
|
C#
|
mit
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
2491cfa0e048432aa392689f08cdc959fb3568e7
|
Countdown/Views/ScrollTo.cs
|
Countdown/Views/ScrollTo.cs
|
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
namespace Countdown.Views
{
internal class ScrollTo
{
public static void SetItem(UIElement element, object value)
{
element.SetValue(ItemProperty, value);
}
public static object GetItem(UIElement element)
{
return element.GetValue(ItemProperty);
}
public static readonly DependencyProperty ItemProperty =
DependencyProperty.RegisterAttached("Item",
typeof(object),
typeof(ScrollTo),
new FrameworkPropertyMetadata(OnScrollToItemPropertyChanged));
private static void OnScrollToItemPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
{
if ((e.NewValue is not null) && (source is ListBox list))
{
list.SelectedItem = e.NewValue;
if (list.IsGrouping)
{
// Work around a bug that stops ScrollIntoView() working on Net5.0
// see https://github.com/dotnet/wpf/issues/4797
_ = list.Dispatcher.BeginInvoke(DispatcherPriority.Loaded,
new Action(() => list.ScrollIntoView(e.NewValue)));
}
else
{
list.ScrollIntoView(e.NewValue);
}
}
}
}
}
|
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
namespace Countdown.Views
{
internal class ScrollTo
{
public static void SetItem(UIElement element, object value)
{
element.SetValue(ItemProperty, value);
}
public static object GetItem(UIElement element)
{
return element.GetValue(ItemProperty);
}
public static readonly DependencyProperty ItemProperty =
DependencyProperty.RegisterAttached("Item",
typeof(object),
typeof(ScrollTo),
new FrameworkPropertyMetadata(OnScrollToItemPropertyChanged));
private static void OnScrollToItemPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
{
if ((e.NewValue is not null) && (source is ListBox list))
{
list.SelectedItem = e.NewValue;
if (list.IsGrouping)
{
// Work around a bug that stops ScrollIntoView() working on Net5.0
// see https://github.com/dotnet/wpf/issues/4797
_ = list.Dispatcher.BeginInvoke(DispatcherPriority.Loaded,
new Action(() =>
{
list.ScrollIntoView(e.NewValue);
_ = list.Focus();
}));
}
else
{
list.ScrollIntoView(e.NewValue);
_ = list.Focus();
}
}
}
}
}
|
Add a list focus call
|
Add a list focus call
If the item is important enough to scroll it into view then its container should also get focus.
|
C#
|
unlicense
|
DHancock/Countdown
|
699929a3ec5f32f4ae3b5574cc201cb62de5766d
|
Battery-Commander.Web/Models/EvaluationListViewModel.cs
|
Battery-Commander.Web/Models/EvaluationListViewModel.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace BatteryCommander.Web.Models
{
public class EvaluationListViewModel
{
public IEnumerable<Evaluation> Evaluations { get; set; } = Enumerable.Empty<Evaluation>();
[Display(Name = "Delinquent > 60 Days")]
public int Delinquent => Evaluations.Where(_ => _.IsDelinquent).Count();
public int Due => Evaluations.Where(_ => !_.IsDelinquent).Where(_ => _.ThruDate < DateTime.Today).Count();
[Display(Name = "Next 30")]
public int Next30 => Evaluations.Where(_ => 0 <= _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 30).Count();
[Display(Name = "Next 60")]
public int Next60 => Evaluations.Where(_ => 30 < _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 60).Count();
[Display(Name = "Next 90")]
public int Next90 => Evaluations.Where(_ => 60 < _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 90).Count();
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace BatteryCommander.Web.Models
{
public class EvaluationListViewModel
{
public IEnumerable<Evaluation> Evaluations { get; set; } = Enumerable.Empty<Evaluation>();
[Display(Name = "Delinquent > 60 Days")]
public int Delinquent => Evaluations.Where(_ => !_.IsCompleted).Where(_ => _.IsDelinquent).Count();
public int Due => Evaluations.Where(_ => !_.IsCompleted).Where(_ => !_.IsDelinquent).Where(_ => _.ThruDate < DateTime.Today).Count();
[Display(Name = "Next 30")]
public int Next30 => Evaluations.Where(_ => !_.IsCompleted).Where(_ => 0 <= _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 30).Count();
[Display(Name = "Next 60")]
public int Next60 => Evaluations.Where(_ => !_.IsCompleted).Where(_ => 30 < _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 60).Count();
[Display(Name = "Next 90")]
public int Next90 => Evaluations.Where(_ => !_.IsCompleted).Where(_ => 60 < _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 90).Count();
}
}
|
Make sure to take into account completed when looking at ALL
|
Make sure to take into account completed when looking at ALL
|
C#
|
mit
|
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
|
d3106439f167a65c9e5f8a02c6f45bb4319e8dd8
|
Code/Luval.Orm/SqlServerLanguageProvider.cs
|
Code/Luval.Orm/SqlServerLanguageProvider.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Luval.Common;
namespace Luval.Orm
{
public class SqlServerLanguageProvider : AnsiSqlLanguageProvider
{
public SqlServerLanguageProvider() : this(DbConfiguration.Get<ISqlExpressionProvider>(), DbConfiguration.Get<IObjectAccesor>())
{
}
public SqlServerLanguageProvider(ISqlExpressionProvider expressionProvider, IObjectAccesor objectAccesor) : base(expressionProvider, new SqlServerDialectProvider(), objectAccesor)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Luval.Common;
namespace Luval.Orm
{
public class SqlServerLanguageProvider : AnsiSqlLanguageProvider
{
public SqlServerLanguageProvider() : this(DbConfiguration.Get<ISqlExpressionProvider>(), DbConfiguration.Get<IObjectAccesor>())
{
}
public SqlServerLanguageProvider(ISqlExpressionProvider expressionProvider, IObjectAccesor objectAccesor) : base(expressionProvider, new SqlServerDialectProvider(), objectAccesor)
{
}
public override string GetLastIdentityInsert()
{
return "SELECT SCOPE_IDENTITY()";
}
}
}
|
Fix bug in the Sql Server implementation
|
Fix bug in the Sql Server implementation
|
C#
|
apache-2.0
|
marinoscar/Luval
|
53c5a4d11753d729808c0b72bffb98ec15fd1896
|
MitternachtWeb/Views/GuildList/Index.cshtml
|
MitternachtWeb/Views/GuildList/Index.cshtml
|
@model IEnumerable<Discord.WebSocket.SocketGuild>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayName("GuildId")
</th>
<th>
@Html.DisplayName("GuildName")
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach(var guild in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => guild.Id)
</td>
<td>
@Html.DisplayFor(modelItem => guild.Name)
</td>
<td>
<a asp-area="Guild" asp-controller="Stats" asp-action="Index" asp-route-guildId="@guild.Id">Details</a>
</td>
</tr>
}
</tbody>
</table>
|
@model IEnumerable<Discord.WebSocket.SocketGuild>
<div class="list-group">
@foreach(var guild in Model) {
<a class="list-group-item list-group-item-action" asp-area="Guild" asp-controller="Stats" asp-action="Index" asp-route-guildId="@guild.Id">@guild.Name</a>
}
</div>
|
Use list-group instead of a table.
|
Use list-group instead of a table.
|
C#
|
mit
|
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
|
2039e8bec03b4fd2717e7ff55bf2ab1618e6421d
|
SnittListan/IoC/WindsorControllerFactory.cs
|
SnittListan/IoC/WindsorControllerFactory.cs
|
using System;
using System.Web.Mvc;
using System.Web.Routing;
using Castle.MicroKernel;
namespace SnittListan.IoC
{
public class WindsorControllerFactory : DefaultControllerFactory
{
private readonly IKernel kernel;
public WindsorControllerFactory(IKernel kernel)
{
this.kernel = kernel;
}
public override IController CreateController(RequestContext requestContext, string controllerName)
{
if (requestContext == null)
{
throw new ArgumentNullException("requestContext");
}
if (controllerName == null)
{
throw new ArgumentNullException("controllerName");
}
try
{
return kernel.Resolve<IController>(controllerName + "controller");
}
catch (ComponentNotFoundException ex)
{
throw new ApplicationException(string.Format("No controller with name '{0}' found", controllerName), ex);
}
}
public override void ReleaseController(IController controller)
{
if (controller == null)
{
throw new ArgumentNullException("controller");
}
kernel.ReleaseComponent(controller);
}
}
}
|
using System;
using System.Web.Mvc;
using System.Web.Routing;
using Castle.MicroKernel;
using System.Web;
namespace SnittListan.IoC
{
public class WindsorControllerFactory : DefaultControllerFactory
{
private readonly IKernel kernel;
public WindsorControllerFactory(IKernel kernel)
{
this.kernel = kernel;
}
public override IController CreateController(RequestContext requestContext, string controllerName)
{
if (requestContext == null)
{
throw new ArgumentNullException("requestContext");
}
if (controllerName == null)
{
throw new HttpException(404, string.Format("The controller path '{0}' could not be found.", controllerName));
}
try
{
return kernel.Resolve<IController>(controllerName + "controller");
}
catch (ComponentNotFoundException ex)
{
throw new ApplicationException(string.Format("No controller with name '{0}' found", controllerName), ex);
}
}
public override void ReleaseController(IController controller)
{
if (controller == null)
{
throw new ArgumentNullException("controller");
}
kernel.ReleaseComponent(controller);
}
}
}
|
Throw HttpException when trying to resolve unknown controller
|
Throw HttpException when trying to resolve unknown controller
|
C#
|
mit
|
dlidstrom/Snittlistan,dlidstrom/Snittlistan,dlidstrom/Snittlistan
|
41c12fd0bece51c67648ca23158de200efcf04a0
|
src/PeNet/Parser/PKCS7Parser.cs
|
src/PeNet/Parser/PKCS7Parser.cs
|
using System.Security.Cryptography.X509Certificates;
using PeNet.Structures;
namespace PeNet.Parser
{
internal class PKCS7Parser : SafeParser<X509Certificate2>
{
private readonly WIN_CERTIFICATE _winCertificate;
internal PKCS7Parser(WIN_CERTIFICATE winCertificate)
: base(null, 0)
{
_winCertificate = winCertificate;
}
protected override X509Certificate2 ParseTarget()
{
if (_winCertificate?.wCertificateType !=
(ushort) Constants.WinCertificateType.WIN_CERT_TYPE_PKCS_SIGNED_DATA)
{
return null;
}
var cert = _winCertificate.bCertificate;
return new X509Certificate2(cert);
}
}
}
|
using System.Security.Cryptography.X509Certificates;
using PeNet.Structures;
namespace PeNet.Parser
{
internal class PKCS7Parser : SafeParser<X509Certificate2>
{
private readonly WIN_CERTIFICATE _winCertificate;
internal PKCS7Parser(WIN_CERTIFICATE winCertificate)
: base(null, 0)
{
_winCertificate = winCertificate;
}
protected override X509Certificate2 ParseTarget()
{
if (_winCertificate?.wCertificateType !=
(ushort) Constants.WinCertificateType.WIN_CERT_TYPE_PKCS_SIGNED_DATA)
{
return null;
}
var pkcs7 = _winCertificate.bCertificate;
var collection = new X509Certificate2Collection();
collection.Import(pkcs7);
if (collection.Count == 0)
return null;
return collection[0];
}
}
}
|
Use collection of certificates to parse pkcs7
|
Use collection of certificates to parse pkcs7
|
C#
|
apache-2.0
|
secana/PeNet
|
4060313ebecc09b4ebd5f69751738b780cc26ad7
|
src/ScriptEngine/CSharpScriptEngine.cs
|
src/ScriptEngine/CSharpScriptEngine.cs
|
using System;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.CodeAnalysis.CSharp.Scripting;
namespace ScriptSharp.ScriptEngine
{
public class CSharpScriptEngine
{
private static ScriptState<object> scriptState = null;
public static object Execute(string code)
{
scriptState = scriptState == null ? CSharpScript.RunAsync(code).Result : scriptState.ContinueWithAsync(code).Result;
if (scriptState.ReturnValue != null && !string.IsNullOrEmpty(scriptState.ReturnValue.ToString()))
return scriptState.ReturnValue;
return "";
}
}
}
|
using System;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.CodeAnalysis.CSharp.Scripting;
namespace ScriptSharp.ScriptEngine
{
public class CSharpScriptEngine
{
private static ScriptState<object> scriptState = null;
public static object Execute(string code)
{
scriptState = scriptState == null ? CSharpScript.RunAsync(code).Result : scriptState.ContinueWithAsync(code).Result;
if (scriptState.ReturnValue != null && !string.IsNullOrEmpty(scriptState.ReturnValue.ToString()))
return scriptState.ReturnValue;
return null;
}
}
}
|
Change return type of script engine
|
Change return type of script engine
|
C#
|
mit
|
chribben/ScriptSharp,chribben/ScriptSharp,chribben/ScriptSharp
|
f0d28e48335c102ce626fae6b6d76e6188881276
|
src/RealEstateAgencyFranchise/Controllers/OfficeController.cs
|
src/RealEstateAgencyFranchise/Controllers/OfficeController.cs
|
using Starcounter;
using System;
namespace RealEstateAgencyFranchise.Controllers
{
internal class OfficeController
{
public Json Get(long officeObjectNo)
{
throw new NotImplementedException();
}
}
}
|
using RealEstateAgencyFranchise.Database;
using Starcounter;
using System.Linq;
namespace RealEstateAgencyFranchise.Controllers
{
internal class OfficeController
{
public Json Get(ulong officeObjectNo)
{
return Db.Scope(() =>
{
var offices = Db.SQL<Office>(
"select o from Office o where o.ObjectNo = ?",
officeObjectNo);
if (offices == null || !offices.Any())
{
return new Response()
{
StatusCode = 404,
StatusDescription = "Office not found"
};
}
var office = offices.First;
var json = new OfficeListJson
{
Data = office
};
if (Session.Current == null)
{
Session.Current = new Session(SessionOptions.PatchVersioning);
}
json.Session = Session.Current;
return json;
});
}
}
}
|
Implement getting data for office details
|
Implement getting data for office details
|
C#
|
mit
|
aregaz/starcounterdemo,aregaz/starcounterdemo
|
839a484fb2be4f6614431cc96ac76cc279e27897
|
Criteo.Profiling.Tracing/Utils/TimeUtils.cs
|
Criteo.Profiling.Tracing/Utils/TimeUtils.cs
|
using System;
namespace Criteo.Profiling.Tracing.Utils
{
internal static class TimeUtils
{
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public static DateTime UtcNow
{
get
{
return HighResolutionDateTime.IsAvailable ? HighResolutionDateTime.UtcNow : DateTime.UtcNow;
}
}
/// <summary>
/// Create a UNIX timestamp from a UTC date time. Time is expressed in microseconds and not seconds.
/// </summary>
/// <see href="https://en.wikipedia.org/wiki/Unix_time"/>
/// <param name="utcDateTime"></param>
/// <returns></returns>
public static long ToUnixTimestamp(DateTime utcDateTime)
{
return (long)(utcDateTime.Subtract(Epoch).TotalMilliseconds * 1000L);
}
}
}
|
using System;
namespace Criteo.Profiling.Tracing.Utils
{
public static class TimeUtils
{
private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public static DateTime UtcNow
{
get
{
return HighResolutionDateTime.IsAvailable ? HighResolutionDateTime.UtcNow : DateTime.UtcNow;
}
}
/// <summary>
/// Create a UNIX timestamp from a UTC date time. Time is expressed in microseconds and not seconds.
/// </summary>
/// <see href="https://en.wikipedia.org/wiki/Unix_time"/>
/// <param name="utcDateTime"></param>
/// <returns></returns>
public static long ToUnixTimestamp(DateTime utcDateTime)
{
return (long)(utcDateTime.Subtract(Epoch).TotalMilliseconds * 1000L);
}
}
}
|
Change time utils visibility from internal to public
|
Change time utils visibility from internal to public
Change-Id: Ifc984cd613e3daeea243467392652c5efd9ba34b
|
C#
|
apache-2.0
|
criteo/zipkin4net,criteo/zipkin4net
|
d709378465e578547a2044cd7be41884991914fa
|
src/SharpGraphEditor.Graph.Core/Algorithms/DepthFirstSearchAlgorithm.cs
|
src/SharpGraphEditor.Graph.Core/Algorithms/DepthFirstSearchAlgorithm.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpGraphEditor.Graph.Core.Elements;
namespace SharpGraphEditor.Graph.Core.Algorithms
{
public class DepthFirstSearchAlgorithm : IAlgorithm
{
public string Name => "Depth first search";
public string Description => "Depth first search";
public void Run(IGraph graph, AlgorithmParameter p)
{
if (graph.Vertices.Count() == 0)
{
return;
}
graph.ChangeColor(graph.Vertices.ElementAt(0), VertexColor.Gray);
var dfs = new Helpers.DepthFirstSearch(graph)
{
ProcessEdge = (v1, v2) =>
{
graph.ChangeColor(v2, VertexColor.Gray);
},
ProcessVertexLate = (v) =>
{
graph.ChangeColor(v, VertexColor.Black);
}
};
dfs.Run(graph.Vertices.First());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpGraphEditor.Graph.Core.Elements;
namespace SharpGraphEditor.Graph.Core.Algorithms
{
public class DepthFirstSearchAlgorithm : IAlgorithm
{
public string Name => "Depth first search";
public string Description => "Depth first search";
public void Run(IGraph graph, AlgorithmParameter p)
{
if (graph.Vertices.Count() == 0)
{
return;
}
graph.ChangeColor(graph.Vertices.ElementAt(0), VertexColor.Gray);
var dfs = new Helpers.DepthFirstSearch(graph)
{
ProcessEdge = (v1, v2) =>
{
if (v2.Color != VertexColor.Gray)
{
graph.ChangeColor(v2, VertexColor.Gray);
}
},
ProcessVertexLate = (v) =>
{
graph.ChangeColor(v, VertexColor.Black);
}
};
dfs.Run(graph.Vertices.First());
}
}
}
|
Fix bug with DFS when some vertices painted in gray twice
|
Fix bug with DFS when some vertices painted in gray twice
|
C#
|
apache-2.0
|
AceSkiffer/SharpGraphEditor
|
cc4a0afdf4196dd9f4d99d1a93aaa7c3ee414795
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Extras.AggregateService")]
[assembly: AssemblyDescription("Autofac Aggregate Service Module")]
[assembly: ComVisible(false)]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Autofac.Extras.AggregateService")]
[assembly: ComVisible(false)]
|
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
|
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
|
C#
|
mit
|
autofac/Autofac.Extras.AggregateService
|
c86d06b7f5048a04ae7ebcec0f350dcc2ff4bf29
|
src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Services/HttpClientWrapper.cs
|
src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Services/HttpClientWrapper.cs
|
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using NLog;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Configuration;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Interfaces;
namespace SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Services
{
public class HttpClientWrapper : IHttpClientWrapper
{
private readonly ILogger _logger;
private readonly EmployerApprenticeshipsServiceConfiguration _configuration;
public HttpClientWrapper(ILogger logger, EmployerApprenticeshipsServiceConfiguration configuration)
{
_logger = logger;
_configuration = configuration;
}
public async Task<string> SendMessage<T>(T content, string url)
{
try
{
using (var httpClient = CreateHttpClient())
{
var serializeObject = JsonConvert.SerializeObject(content);
var response = await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Post, url)
{
Content = new StringContent(serializeObject, Encoding.UTF8, "application/json")
});
return response.Content.ToString();
}
}
catch (Exception ex)
{
_logger.Error(ex);
}
return null;
}
private HttpClient CreateHttpClient()
{
return new HttpClient
{
BaseAddress = new Uri(_configuration.Hmrc.BaseUrl)
};
}
}
}
|
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using NLog;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Configuration;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Interfaces;
namespace SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Services
{
public class HttpClientWrapper : IHttpClientWrapper
{
private readonly ILogger _logger;
private readonly EmployerApprenticeshipsServiceConfiguration _configuration;
public HttpClientWrapper(ILogger logger, EmployerApprenticeshipsServiceConfiguration configuration)
{
_logger = logger;
_configuration = configuration;
}
public async Task<string> SendMessage<T>(T content, string url)
{
try
{
using (var httpClient = CreateHttpClient())
{
var serializeObject = JsonConvert.SerializeObject(content);
var response = await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Post, url)
{
Content = new StringContent(serializeObject, Encoding.UTF8, "application/json")
});
return await response.Content.ReadAsStringAsync();
}
}
catch (Exception ex)
{
_logger.Error(ex);
}
return null;
}
private HttpClient CreateHttpClient()
{
return new HttpClient
{
BaseAddress = new Uri(_configuration.Hmrc.BaseUrl)
};
}
}
}
|
Change httpclientwrapper to return the content as string async.
|
Change httpclientwrapper to return the content as string async.
|
C#
|
mit
|
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
|
10f88b7b04a037f9fe9acbf59ecec7a48b04b2af
|
AsterNET.ARI/Middleware/Default/Command.cs
|
AsterNET.ARI/Middleware/Default/Command.cs
|
using System;
using RestSharp;
using Newtonsoft.Json;
using RestSharp.Portable;
using RestSharp.Portable.Authenticators;
using RestSharp.Portable.HttpClient;
namespace AsterNET.ARI.Middleware.Default
{
public class Command : IRestCommand
{
internal RestClient Client;
internal RestRequest Request;
public Command(StasisEndpoint info, string path)
{
Client = new RestClient(info.AriEndPoint)
{
Authenticator = new HttpBasicAuthenticator(info.Username, info.Password)
};
Request = new RestRequest(path);
}
public string UniqueId { get; set; }
public string Url { get; set; }
public string Method
{
get { return Request.Method.ToString(); }
set { Request.Method = (RestSharp.Portable.Method) Enum.Parse(typeof (RestSharp.Portable.Method), value); }
}
public string Body { get; private set; }
public void AddUrlSegment(string segName, string value)
{
Request.AddUrlSegment(segName, value);
}
public void AddParameter(string name, object value, Middleware.ParameterType type)
{
if (type == ParameterType.RequestBody)
{
Request.Serializer = new RestSharp.Portable.Serializers.JsonSerializer();
Request.AddParameter(name, JsonConvert.SerializeObject(value), (RestSharp.Portable.ParameterType)Enum.Parse(typeof(RestSharp.Portable.ParameterType), type.ToString()));
}
else
{
Request.AddParameter(name, value, (RestSharp.Portable.ParameterType)Enum.Parse(typeof(RestSharp.Portable.ParameterType), type.ToString()));
}
}
}
}
|
using System;
using RestSharp.Portable;
using RestSharp.Portable.Authenticators;
using RestSharp.Portable.HttpClient;
namespace AsterNET.ARI.Middleware.Default
{
public class Command : IRestCommand
{
internal RestClient Client;
internal RestRequest Request;
public Command(StasisEndpoint info, string path)
{
Client = new RestClient(info.AriEndPoint)
{
Authenticator = new HttpBasicAuthenticator(info.Username, info.Password)
};
Request = new RestRequest(path) {Serializer = new RestSharp.Portable.Serializers.JsonSerializer()};
}
public string UniqueId { get; set; }
public string Url { get; set; }
public string Method
{
get { return Request.Method.ToString(); }
set { Request.Method = (RestSharp.Portable.Method) Enum.Parse(typeof (RestSharp.Portable.Method), value); }
}
public string Body { get; private set; }
public void AddUrlSegment(string segName, string value)
{
Request.AddUrlSegment(segName, value);
}
public void AddParameter(string name, object value, Middleware.ParameterType type)
{
Request.AddParameter(name, value, (RestSharp.Portable.ParameterType)Enum.Parse(typeof(RestSharp.Portable.ParameterType), type.ToString()));
}
}
}
|
Fix bug with double serialization
|
Fix bug with double serialization
|
C#
|
mit
|
seiggy/AsterNET.ARI,skrusty/AsterNET.ARI,seiggy/AsterNET.ARI,seiggy/AsterNET.ARI,skrusty/AsterNET.ARI,skrusty/AsterNET.ARI
|
9c8d3c3acd73cd6867f0f2238a127f44aaf645c2
|
Assets/EasyButtons/ScriptableObjectExample.cs
|
Assets/EasyButtons/ScriptableObjectExample.cs
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
using Object = UnityEngine.Object;
[CreateAssetMenu(fileName = "Example.asset", menuName = "New Example ScriptableObject")]
public class ScriptableObjectExample : ScriptableObject
{
[EasyButtons.Button]
public void SayHello()
{
Debug.Log("Hello");
}
}
|
using UnityEngine;
[CreateAssetMenu(fileName = "Example.asset", menuName = "New Example ScriptableObject")]
public class ScriptableObjectExample : ScriptableObject
{
[EasyButtons.Button]
public void SayHello()
{
Debug.Log("Hello");
}
}
|
Remove unnecessary usings in example script
|
Remove unnecessary usings in example script
|
C#
|
mit
|
madsbangh/EasyButtons
|
06b366fd3d54740bf143b7c8781a8bb7e22d6c3e
|
ExpressionToCodeTest/ValueTupleTests.cs
|
ExpressionToCodeTest/ValueTupleTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using Xunit;
namespace ExpressionToCodeTest {
public class ValueTupleTests {
[Fact]
public void ExpressionCompileValueTupleEqualsWorks() {
var tuple = (1, 3);
var tuple2 = (1, "123".Length);
Expression<Func<bool>> expr = () => tuple.Equals(tuple2);
Assert.True(expr.Compile()());
}
[Fact]
public void FastExpressionCompileValueTupleEqualsWorks() {
var tuple = (1, 3);
(int, int Length) tuple2 = (1, "123".Length);
ValueTuple<int,int> x;
var expr = FastExpressionCompiler.ExpressionCompiler.Compile(() => tuple.Equals(tuple2));
Assert.True(expr());
}
[Fact]
public void AssertingOnValueTupleEqualsWorks() {
var tuple = (1, 3);
var tuple2 = (1, "123".Length);
Expression<Func<bool>> expr = () => tuple.Equals(tuple2);
Assert.True(expr.Compile()());
PAssert.That(() => tuple.Equals(tuple2));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using Xunit;
namespace ExpressionToCodeTest {
public class ValueTupleTests {
[Fact]
public void ExpressionWithValueTupleEqualsCanCompile() {
var tuple = (1, 3);
var tuple2 = (1, "123".Length);
Expression<Func<int>> ok1 = () => tuple.Item1;
Expression<Func<int>> ok2 = () => tuple.GetHashCode();
Expression<Func<Tuple<int, int>>> ok3 = () => tuple.ToTuple();
ok1.Compile();
ok2.Compile();
ok3.Compile();
Expression<Func<bool>> err1 = () => tuple.Equals(tuple2);
Expression<Func<int>> err2 = () => tuple.CompareTo(tuple2);
err1.Compile();//crash
err2.Compile();//crash
}
[Fact]
public void FastExpressionCompileValueTupleEqualsWorks() {
var tuple = (1, 3);
(int, int Length) tuple2 = (1, "123".Length);
var expr = FastExpressionCompiler.ExpressionCompiler.Compile(() => tuple.Equals(tuple2));
Assert.True(expr());
}
[Fact]
public void AssertingOnValueTupleEqualsWorks() {
var tuple = (1, 3);
var tuple2 = (1, "123".Length);
Expression<Func<bool>> expr = () => tuple.Equals(tuple2);
Assert.True(expr.Compile()());
PAssert.That(() => tuple.Equals(tuple2));
}
}
}
|
Rearrange test to better self-document what currently works and what does not.
|
Rearrange test to better self-document what currently works and what does not.
|
C#
|
apache-2.0
|
EamonNerbonne/ExpressionToCode
|
5cb6963940662f61982dbc43457303b70471b45e
|
osu.Game.Rulesets.Osu/Objects/Spinner.cs
|
osu.Game.Rulesets.Osu/Objects/Spinner.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Database;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Rulesets.Osu.Objects
{
public class Spinner : OsuHitObject, IHasEndTime
{
public double EndTime { get; set; }
public double Duration => EndTime - StartTime;
/// <summary>
/// Number of spins required to finish the spinner without miss.
/// </summary>
public int SpinsRequired { get; protected set; } = 1;
public override bool NewCombo => true;
public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(controlPointInfo, difficulty);
SpinsRequired = (int)(Duration / 1000 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5));
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Database;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Rulesets.Osu.Objects
{
public class Spinner : OsuHitObject, IHasEndTime
{
public double EndTime { get; set; }
public double Duration => EndTime - StartTime;
/// <summary>
/// Number of spins required to finish the spinner without miss.
/// </summary>
public int SpinsRequired { get; protected set; } = 1;
public override bool NewCombo => true;
public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(controlPointInfo, difficulty);
SpinsRequired = (int)(Duration / 1000 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5));
// spinning doesn't match 1:1 with stable, so let's fudge them easier for the time being.
SpinsRequired = (int)(SpinsRequired * 0.6);
}
}
}
|
Make spinners easier for now
|
Make spinners easier for now
The underlying spin counting doesn't match stabnle, so they have been near impossible to complete until now.
|
C#
|
mit
|
NeoAdonis/osu,NeoAdonis/osu,johnneijzen/osu,NeoAdonis/osu,EVAST9919/osu,smoogipooo/osu,tacchinotacchi/osu,ZLima12/osu,peppy/osu,ppy/osu,Frontear/osuKyzer,2yangk23/osu,ppy/osu,DrabWeb/osu,smoogipoo/osu,naoey/osu,Damnae/osu,johnneijzen/osu,DrabWeb/osu,naoey/osu,smoogipoo/osu,ppy/osu,peppy/osu-new,DrabWeb/osu,EVAST9919/osu,ZLima12/osu,UselessToucan/osu,2yangk23/osu,smoogipoo/osu,peppy/osu,osu-RP/osu-RP,Drezi126/osu,UselessToucan/osu,naoey/osu,UselessToucan/osu,Nabile-Rahmani/osu,peppy/osu
|
9fc6b8fcf5497f8cfc76bedcd2542c26b7d82e8c
|
src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs
|
src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.VisualStudio.Editor.Razor;
using Microsoft.VisualStudio.Text.Editor;
using MonoDevelop.Ide.CodeCompletion;
namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor
{
internal class DefaultVisualStudioCompletionBroker : VisualStudioCompletionBroker
{
public override bool IsCompletionActive(ITextView textView)
{
if (textView == null)
{
throw new ArgumentNullException(nameof(textView));
}
if (textView.HasAggregateFocus)
{
return CompletionWindowManager.IsVisible ||
(textView.Properties.TryGetProperty<bool>("RoslynCompletionPresenterSession.IsCompletionActive", out var visible)
&& visible);
}
// Text view does not have focus, if the completion window is visible it's for a different text view.
return false;
}
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.VisualStudio.Editor.Razor;
using Microsoft.VisualStudio.Text.Editor;
using MonoDevelop.Ide.CodeCompletion;
namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor
{
internal class DefaultVisualStudioCompletionBroker : VisualStudioCompletionBroker
{
private const string IsCompletionActiveKey = "RoslynCompletionPresenterSession.IsCompletionActive";
public override bool IsCompletionActive(ITextView textView)
{
if (textView == null)
{
throw new ArgumentNullException(nameof(textView));
}
if (!textView.HasAggregateFocus)
{
// Text view does not have focus, if the completion window is visible it's for a different text view.
return false;
}
if (CompletionWindowManager.IsVisible)
{
return true;
}
if (textView.Properties.TryGetProperty<bool>(IsCompletionActiveKey, out var visible))
{
return visible;
}
return false;
}
}
}
|
Clean up mac completion broker.
|
Clean up mac completion broker.
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
6d7cfc8ed290c07f574bb22c0777d9e3d7f0201f
|
Contentful.Core/Models/Management/EditorInterfaceControl.cs
|
Contentful.Core/Models/Management/EditorInterfaceControl.cs
|
using Contentful.Core.Configuration;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
namespace Contentful.Core.Models.Management
{
[JsonConverter(typeof(EditorInterfaceControlJsonConverter))]
public class EditorInterfaceControl
{
public string FieldId { get; set; }
public string WidgetId { get; set; }
public EditorInterfaceControlSettings Settings { get; set; }
}
}
|
using Contentful.Core.Configuration;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
namespace Contentful.Core.Models.Management
{
[JsonConverter(typeof(EditorInterfaceControlJsonConverter))]
public class EditorInterfaceControl
{
public string FieldId { get; set; }
public string WidgetId { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public EditorInterfaceControlSettings Settings { get; set; }
}
}
|
Add null handling for editorinterface settings
|
Add null handling for editorinterface settings
|
C#
|
mit
|
contentful/contentful.net
|
4d9e526bcb0d691dd3622551068deb0ca4b9e54c
|
src/Core/CoreLib/Properties/AssemblyInfo.cs
|
src/Core/CoreLib/Properties/AssemblyInfo.cs
|
// AssemblyInfo.cs
// Script#/Libraries/CoreLib
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("mscorlib")]
[assembly: AssemblyDescription("Script# Core Assembly")]
[assembly: ScriptAssembly("core")]
|
// AssemblyInfo.cs
// Script#/Libraries/CoreLib
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("mscorlib")]
[assembly: AssemblyDescription("Script# Core Assembly")]
[assembly: ScriptAssembly("ss")]
|
Update mscorlib assembly name to match eventual module name
|
Update mscorlib assembly name to match eventual module name
|
C#
|
apache-2.0
|
nikhilk/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp,nikhilk/scriptsharp,x335/scriptsharp,x335/scriptsharp
|
be06a4df2fed4527290daa7248a90f72c40f0b20
|
tooling/Microsoft.VisualStudio.BlazorExtension/Properties/AssemblyInfo.cs
|
tooling/Microsoft.VisualStudio.BlazorExtension/Properties/AssemblyInfo.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.VisualStudio.Shell;
// Add binding redirects for each assembly we ship in VS. This is required so that these assemblies show
// up in the Load context, which means that we can use ServiceHub and other nice things.
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.AspNetCore.Blazor.AngleSharp",
GenerateCodeBase = true,
PublicKeyToken = "",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "0.9.9.0",
NewVersion = "0.9.9.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.AspNetCore.Blazor.Razor.Extensions",
GenerateCodeBase = true,
PublicKeyToken = "",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "1.0.0.0",
NewVersion = "1.0.0.0")]
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.VisualStudio.LanguageServices.Blazor",
GenerateCodeBase = true,
PublicKeyToken = "",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "1.0.0.0",
NewVersion = "1.0.0.0")]
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.VisualStudio.Shell;
// Add binding redirects for each assembly we ship in VS. This is required so that these assemblies show
// up in the Load context, which means that we can use ServiceHub and other nice things.
[assembly: ProvideBindingRedirection(
AssemblyName = "Microsoft.VisualStudio.LanguageServices.Blazor",
GenerateCodeBase = true,
PublicKeyToken = "",
OldVersionLowerBound = "0.0.0.0",
OldVersionUpperBound = "1.0.0.0",
NewVersion = "1.0.0.0")]
|
Remove binding redirects for missing assemblies
|
Remove binding redirects for missing assemblies
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
57019b872ad395b02dce6c37b65bce5c0308c584
|
src/Atata.Tests/AtataContextBuilderTests.cs
|
src/Atata.Tests/AtataContextBuilderTests.cs
|
using System;
using NUnit.Framework;
namespace Atata.Tests
{
public class AtataContextBuilderTests : UITestFixtureBase
{
[Test]
public void AtataContextBuilder_Build_WithoutDriver()
{
InvalidOperationException exception = Assert.Throws<InvalidOperationException>(() =>
AtataContext.Configure().Build());
Assert.That(exception.Message, Does.Contain("no driver is specified"));
}
[Test]
public void AtataContextBuilder_OnDriverCreated()
{
int executionsCount = 0;
AtataContext.Configure().
UseChrome().
OnDriverCreated(driver =>
{
executionsCount++;
}).
Build();
Assert.That(executionsCount, Is.EqualTo(1));
}
[Test]
public void AtataContextBuilder_OnDriverCreated_RestartDriver()
{
int executionsCount = 0;
AtataContext.Configure().
UseChrome().
OnDriverCreated(() =>
{
executionsCount++;
}).
Build();
AtataContext.Current.RestartDriver();
Assert.That(executionsCount, Is.EqualTo(2));
}
}
}
|
using System;
using NUnit.Framework;
namespace Atata.Tests
{
public class AtataContextBuilderTests : UITestFixtureBase
{
[Test]
public void AtataContextBuilder_Build_WithoutDriver()
{
InvalidOperationException exception = Assert.Throws<InvalidOperationException>(() =>
AtataContext.Configure().Build());
Assert.That(exception.Message, Does.Contain("no driver is specified"));
}
[Test]
public void AtataContextBuilder_OnBuilding()
{
int executionsCount = 0;
AtataContext.Configure().
UseChrome().
OnBuilding(() => executionsCount++).
Build();
Assert.That(executionsCount, Is.EqualTo(1));
}
[Test]
public void AtataContextBuilder_OnBuilding_WithoutDriver()
{
int executionsCount = 0;
Assert.Throws<InvalidOperationException>(() =>
AtataContext.Configure().
UseDriver(() => null).
OnBuilding(() => executionsCount++).
Build());
Assert.That(executionsCount, Is.EqualTo(1));
}
[Test]
public void AtataContextBuilder_OnDriverCreated()
{
int executionsCount = 0;
AtataContext.Configure().
UseChrome().
OnDriverCreated(driver => executionsCount++).
Build();
Assert.That(executionsCount, Is.EqualTo(1));
}
[Test]
public void AtataContextBuilder_OnDriverCreated_RestartDriver()
{
int executionsCount = 0;
AtataContext.Configure().
UseChrome().
OnDriverCreated(() => executionsCount++).
Build();
AtataContext.Current.RestartDriver();
Assert.That(executionsCount, Is.EqualTo(2));
}
}
}
|
Add AtataContextBuilder_OnBuilding and AtataContextBuilder_OnBuilding_WithoutDriver tests
|
Add AtataContextBuilder_OnBuilding and AtataContextBuilder_OnBuilding_WithoutDriver tests
|
C#
|
apache-2.0
|
YevgeniyShunevych/Atata,atata-framework/atata,YevgeniyShunevych/Atata,atata-framework/atata
|
f4f7fac189cb0f6b9d70e9d9b022173667b31f76
|
src/Microsoft.AspNet.Identity.EntityFramework/IdentityEntityFrameworkServices.cs
|
src/Microsoft.AspNet.Identity.EntityFramework/IdentityEntityFrameworkServices.cs
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
namespace Microsoft.AspNet.Identity
{
/// <summary>
/// Default services
/// </summary>
public class IdentityEntityFrameworkServices
{
public static IServiceCollection GetDefaultServices(Type userType, Type roleType, Type contextType, Type keyType = null, IConfiguration config = null)
{
Type userStoreType;
Type roleStoreType;
if (keyType != null)
{
userStoreType = typeof(UserStore<,,,>).MakeGenericType(userType, roleType, contextType, keyType);
roleStoreType = typeof(RoleStore<,,>).MakeGenericType(roleType, contextType, keyType);
}
else
{
userStoreType = typeof(UserStore<,,>).MakeGenericType(userType, roleType, contextType);
roleStoreType = typeof(RoleStore<,>).MakeGenericType(roleType, contextType);
}
var services = new ServiceCollection();
services.AddScoped(
typeof(IUserStore<>).MakeGenericType(userType),
userStoreType);
services.AddScoped(
typeof(IRoleStore<>).MakeGenericType(roleType),
roleStoreType);
return services;
}
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
namespace Microsoft.AspNet.Identity
{
/// <summary>
/// Default services
/// </summary>
public class IdentityEntityFrameworkServices
{
public static IServiceCollection GetDefaultServices(Type userType, Type roleType, Type contextType, Type keyType = null)
{
Type userStoreType;
Type roleStoreType;
if (keyType != null)
{
userStoreType = typeof(UserStore<,,,>).MakeGenericType(userType, roleType, contextType, keyType);
roleStoreType = typeof(RoleStore<,,>).MakeGenericType(roleType, contextType, keyType);
}
else
{
userStoreType = typeof(UserStore<,,>).MakeGenericType(userType, roleType, contextType);
roleStoreType = typeof(RoleStore<,>).MakeGenericType(roleType, contextType);
}
var services = new ServiceCollection();
services.AddScoped(
typeof(IUserStore<>).MakeGenericType(userType),
userStoreType);
services.AddScoped(
typeof(IRoleStore<>).MakeGenericType(roleType),
roleStoreType);
return services;
}
}
}
|
Remove extra config param that's not used
|
Remove extra config param that's not used
|
C#
|
apache-2.0
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
17e0105c2cff5b17aefd5f9b52c1dd29d6b9482c
|
osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs
|
osu.Game/Screens/Edit/Setup/LabelledTextBoxWithPopover.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Screens.Edit.Setup
{
internal abstract class LabelledTextBoxWithPopover : LabelledTextBox, IHasPopover
{
public abstract Popover GetPopover();
protected override OsuTextBox CreateTextBox() =>
new PopoverTextBox
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
CornerRadius = CORNER_RADIUS,
OnFocused = this.ShowPopover
};
internal class PopoverTextBox : OsuTextBox
{
public Action OnFocused;
protected override bool OnDragStart(DragStartEvent e)
{
// This text box is intended to be "read only" without actually specifying that.
// As such we don't want to allow the user to select its content with a drag.
return false;
}
protected override void OnFocus(FocusEvent e)
{
OnFocused?.Invoke();
base.OnFocus(e);
GetContainingInputManager().TriggerFocusContention(this);
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Screens.Edit.Setup
{
internal abstract class LabelledTextBoxWithPopover : LabelledTextBox, IHasPopover
{
public abstract Popover GetPopover();
protected override OsuTextBox CreateTextBox() =>
new PopoverTextBox
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
CornerRadius = CORNER_RADIUS,
OnFocused = this.ShowPopover
};
internal class PopoverTextBox : OsuTextBox
{
public Action OnFocused;
protected override bool OnDragStart(DragStartEvent e)
{
// This text box is intended to be "read only" without actually specifying that.
// As such we don't want to allow the user to select its content with a drag.
return false;
}
protected override void OnFocus(FocusEvent e)
{
if (Current.Disabled)
return;
OnFocused?.Invoke();
base.OnFocus(e);
GetContainingInputManager().TriggerFocusContention(this);
}
}
}
}
|
Fix interaction with popover when textbox is disabled
|
Fix interaction with popover when textbox is disabled
|
C#
|
mit
|
peppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu
|
2fb4a3b3d722594f095c64e84bbe0f19aa7ccd2b
|
Core/ELFinder.Connector/Drivers/FileSystem/Extensions/FIleSystemInfoExtensions.cs
|
Core/ELFinder.Connector/Drivers/FileSystem/Extensions/FIleSystemInfoExtensions.cs
|
using System.IO;
using System.Linq;
namespace ELFinder.Connector.Drivers.FileSystem.Extensions
{
/// <summary>
/// File system info extensions
/// </summary>
public static class FIleSystemInfoExtensions
{
#region Extension methods
/// <summary>
/// Get visible files in directory
/// </summary>
/// <param name="info">Directory info</param>
/// <returns>Result directories</returns>
public static FileInfo[] GetVisibleFiles(this DirectoryInfo info)
{
return info.GetFiles().Where(x => !x.IsHidden()).ToArray();
}
/// <summary>
/// Get visible directories
/// </summary>
/// <param name="info">Directory info</param>
/// <returns>Result directories</returns>
public static DirectoryInfo[] GetVisibleDirectories(this DirectoryInfo info)
{
return info.GetDirectories().Where(x => !x.IsHidden()).ToArray();
}
/// <summary>
/// Get if file is hidden
/// </summary>
/// <param name="info">File info</param>
/// <returns>True/False based on result</returns>
public static bool IsHidden(this FileSystemInfo info)
{
return (info.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
}
#endregion
}
}
|
using System.IO;
using System.Linq;
namespace ELFinder.Connector.Drivers.FileSystem.Extensions
{
/// <summary>
/// File system info extensions
/// </summary>
public static class FIleSystemInfoExtensions
{
#region Extension methods
/// <summary>
/// Get visible files in directory
/// </summary>
/// <param name="info">Directory info</param>
/// <returns>Result directories</returns>
public static FileInfo[] GetVisibleFiles(this DirectoryInfo info)
{
try
{
return info.GetFiles().Where(x => !x.IsHidden()).ToArray();
}
catch (System.Exception)
{
return new FileInfo[0];
}
}
/// <summary>
/// Get visible directories
/// </summary>
/// <param name="info">Directory info</param>
/// <returns>Result directories</returns>
public static DirectoryInfo[] GetVisibleDirectories(this DirectoryInfo info)
{
try
{
return info.GetDirectories().Where(x => !x.IsHidden()).ToArray();
}
catch (System.Exception)
{
return new DirectoryInfo[0];
}
}
/// <summary>
/// Get if file is hidden
/// </summary>
/// <param name="info">File info</param>
/// <returns>True/False based on result</returns>
public static bool IsHidden(this FileSystemInfo info)
{
return (info.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
}
#endregion
}
}
|
Fix Unable to connect to backend on access denied
|
Fix Unable to connect to backend on access denied
|
C#
|
bsd-3-clause
|
linguanostra/ELFinder.Connector.NET,linguanostra/ELFinder.Connector.NET
|
ed981afc8bb238255a14bded84bdf4eca9bffa10
|
Cirrious/PhoneCall/Cirrious.MvvmCross.Plugins.PhoneCall.WindowsStore/MvxPhoneCallTask.cs
|
Cirrious/PhoneCall/Cirrious.MvvmCross.Plugins.PhoneCall.WindowsStore/MvxPhoneCallTask.cs
|
// MvxPhoneCallTask.cs
// (c) Copyright Cirrious Ltd. http://www.cirrious.com
// MvvmCross is licensed using Microsoft Public License (Ms-PL)
// Contributions and inspirations noted in readme.md and license.txt
//
// Project Lead - Stuart Lodge, @slodge, me@slodge.com
using System;
using Windows.System;
namespace Cirrious.MvvmCross.Plugins.PhoneCall.WindowsStore
{
public class MvxPhoneCallTask : IMvxPhoneCallTask
{
public void MakePhoneCall(string name, string number)
{
// TODO! This is far too skype specific
// TODO! name/number need looking at
// this is the best I can do so far...
var uri = new Uri("skype:" + number + "?call", UriKind.Absolute);
Launcher.LaunchUriAsync(uri);
}
}
}
|
// MvxPhoneCallTask.cs
// (c) Copyright Cirrious Ltd. http://www.cirrious.com
// MvvmCross is licensed using Microsoft Public License (Ms-PL)
// Contributions and inspirations noted in readme.md and license.txt
//
// Project Lead - Stuart Lodge, @slodge, me@slodge.com
using System;
using Windows.System;
namespace Cirrious.MvvmCross.Plugins.PhoneCall.WindowsStore
{
public class MvxPhoneCallTask : IMvxPhoneCallTask
{
public void MakePhoneCall(string name, string number)
{
//The tel URI for Telephone Numbers : http://tools.ietf.org/html/rfc3966
//Handled by skype
var uri = new Uri("tel:" + Uri.EscapeDataString(phoneNumber), UriKind.Absolute);
Launcher.LaunchUriAsync(uri);
}
}
}
|
Use the tel uri in windows store for phone calls
|
Use the tel uri in windows store for phone calls
This is handled by Skype but not Skype specific (RFC3966).
|
C#
|
mit
|
MatthewSannes/MvvmCross-Plugins,martijn00/MvvmCross-Plugins,lothrop/MvvmCross-Plugins,Didux/MvvmCross-Plugins
|
9c82fb4058c18e573c68cc4de86f94778adf1479
|
src/HealthNet.AspNetCore/HealthNetMiddlewareExtensions.cs
|
src/HealthNet.AspNetCore/HealthNetMiddlewareExtensions.cs
|
using System;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace HealthNet.AspNetCore
{
public static class HealthNetMiddlewareExtensions
{
private static readonly Type VersionProviderType = typeof(IVersionProvider);
private static readonly Type SystemCheckerType = typeof(ISystemChecker);
public static IApplicationBuilder UseHealthNet(this IApplicationBuilder builder)
{
return builder.UseMiddleware<HealthNetMiddleware>();
}
public static IServiceCollection AddHealthNet(this IServiceCollection service)
{
return service.AddTransient<HealthCheckService>();
}
public static IServiceCollection AddHealthNet<THealthNetConfig>(this IServiceCollection service) where THealthNetConfig : class, IHealthNetConfiguration
{
var assembyTypes = typeof(THealthNetConfig).Assembly.GetTypes();
service.AddSingleton<IHealthNetConfiguration, THealthNetConfig>();
var versionProvider = assembyTypes
.FirstOrDefault(x => x.IsClass && !x.IsAbstract && VersionProviderType.IsAssignableFrom(x));
service.AddSingleton(VersionProviderType, versionProvider ?? typeof(AssemblyFileVersionProvider));
var systemCheckers = assembyTypes
.Where(x => x.IsClass && !x.IsAbstract && SystemCheckerType.IsAssignableFrom(x));
foreach (var checkerType in systemCheckers)
{
service.AddTransient(SystemCheckerType, checkerType);
}
return service.AddHealthNet();
}
}
}
|
using System;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace HealthNet.AspNetCore
{
public static class HealthNetMiddlewareExtensions
{
private static readonly Type VersionProviderType = typeof(IVersionProvider);
private static readonly Type SystemCheckerType = typeof(ISystemChecker);
public static IApplicationBuilder UseHealthNet(this IApplicationBuilder builder)
{
return builder.UseMiddleware<HealthNetMiddleware>();
}
public static IServiceCollection AddHealthNet(this IServiceCollection service)
{
return service.AddTransient<HealthCheckService>();
}
public static IServiceCollection AddHealthNet<THealthNetConfig>(this IServiceCollection service, bool autoRegisterCheckers = true) where THealthNetConfig : class, IHealthNetConfiguration
{
var assembyTypes = typeof(THealthNetConfig).Assembly.GetTypes();
service.AddSingleton<IHealthNetConfiguration, THealthNetConfig>();
var versionProvider = assembyTypes
.FirstOrDefault(x => x.IsClass && !x.IsAbstract && VersionProviderType.IsAssignableFrom(x));
service.AddSingleton(VersionProviderType, versionProvider ?? typeof(AssemblyFileVersionProvider));
if (autoRegisterCheckers)
{
var systemCheckers = assembyTypes
.Where(x => x.IsClass && !x.IsAbstract && SystemCheckerType.IsAssignableFrom(x));
foreach (var checkerType in systemCheckers)
{
service.AddTransient(SystemCheckerType, checkerType);
}
}
return service.AddHealthNet();
}
}
}
|
Allow option to prevent system checkers from being auto registered
|
Allow option to prevent system checkers from being auto registered
|
C#
|
apache-2.0
|
bronumski/HealthNet,bronumski/HealthNet,bronumski/HealthNet
|
18daceaa1c05781f8db843034ca7769c507f5938
|
test/Telegram.Bot.Tests.Unit/Serialization/ReplyMarkupSerializationTests.cs
|
test/Telegram.Bot.Tests.Unit/Serialization/ReplyMarkupSerializationTests.cs
|
using Newtonsoft.Json;
using Telegram.Bot.Types.ReplyMarkups;
using Xunit;
namespace Telegram.Bot.Tests.Unit.Serialization
{
public class ReplyMarkupSerializationTests
{
[Theory(DisplayName = "Should serialize request poll keyboard button")]
[InlineData(null)]
[InlineData("regular")]
[InlineData("quiz")]
public void Should_Serialize_Request_Poll_Keyboard_Button(string type)
{
IReplyMarkup replyMarkup = new ReplyKeyboardMarkup(
KeyboardButton.WithRequestPoll("Create a poll", type)
);
string serializedReplyMarkup = JsonConvert.SerializeObject(replyMarkup);
string expectedType = string.IsNullOrEmpty(type)
? "{}"
: @$"{{""type"":""{type}""}}";
Assert.Contains(@$"""request_poll"":{expectedType}", serializedReplyMarkup);
}
}
}
|
using Newtonsoft.Json;
using Telegram.Bot.Types.ReplyMarkups;
using Xunit;
namespace Telegram.Bot.Tests.Unit.Serialization
{
public class ReplyMarkupSerializationTests
{
[Theory(DisplayName = "Should serialize request poll keyboard button")]
[InlineData(null)]
[InlineData("regular")]
[InlineData("quiz")]
public void Should_Serialize_Request_Poll_Keyboard_Button(string type)
{
IReplyMarkup replyMarkup = new ReplyKeyboardMarkup(
KeyboardButton.WithRequestPoll("Create a poll", type)
);
string serializedReplyMarkup = JsonConvert.SerializeObject(replyMarkup);
string expectedType = string.IsNullOrEmpty(type)
? "{}"
: string.Format(@"{{""type"":""{0}""}}", type);
Assert.Contains(@$"""request_poll"":{expectedType}", serializedReplyMarkup);
}
}
}
|
Change string formatting due to appveyor failing
|
Change string formatting due to appveyor failing
|
C#
|
mit
|
MrRoundRobin/telegram.bot,TelegramBots/telegram.bot
|
c42caaa1017d8727a6f71d74fd24d0e4237e47e2
|
Halforbit.DataStores/FileStores/LocalStorage/Attributes/RootPathAttribute.cs
|
Halforbit.DataStores/FileStores/LocalStorage/Attributes/RootPathAttribute.cs
|
using Halforbit.DataStores.FileStores.Implementation;
using Halforbit.DataStores.FileStores.LocalStorage.Implementation;
using Halforbit.Facets.Attributes;
using System;
namespace HalfOrbit.DataStores.FileStores.LocalStorage.Attributes
{
public class RootPathAttribute : FacetParameterAttribute
{
public RootPathAttribute(string value = null, string configKey = null) : base(value, configKey) { }
public override Type TargetType => typeof(LocalFileStore);
public override string ParameterName => "rootPath";
public override Type[] ImpliedTypes => new Type[]
{
typeof(FileStoreDataStore<,>)
};
}
}
|
using Halforbit.DataStores.FileStores.Implementation;
using Halforbit.DataStores.FileStores.LocalStorage.Implementation;
using Halforbit.Facets.Attributes;
using System;
namespace Halforbit.DataStores.FileStores.LocalStorage.Attributes
{
public class RootPathAttribute : FacetParameterAttribute
{
public RootPathAttribute(string value = null, string configKey = null) : base(value, configKey) { }
public override Type TargetType => typeof(LocalFileStore);
public override string ParameterName => "rootPath";
public override Type[] ImpliedTypes => new Type[]
{
typeof(FileStoreDataStore<,>)
};
}
}
|
Fix a small, old typo
|
Fix a small, old typo
|
C#
|
mit
|
halforbit/data-stores
|
68912c257276199a48cab8eaf77dad4f771c2030
|
Platform/Platform.Data.Core/Sequences/SequencesOptions.cs
|
Platform/Platform.Data.Core/Sequences/SequencesOptions.cs
|
using System;
using Platform.Data.Core.Pairs;
namespace Platform.Data.Core.Sequences
{
public struct SequencesOptions // TODO: To use type parameter <TLink> the ILinks<TLink> must contain GetConstants function.
{
public ulong SequenceMarkerLink;
public bool UseCascadeUpdate;
public bool UseCascadeDelete;
public bool UseSequenceMarker;
public bool UseCompression;
public bool UseGarbageCollection;
public bool EnforceSingleSequenceVersionOnWrite;
public bool EnforceSingleSequenceVersionOnRead; // TODO: Реализовать компактификацию при чтении
public bool UseRequestMarker;
public bool StoreRequestResults;
public void InitOptions(ILinks<ulong> links)
{
if (SequenceMarkerLink == LinksConstants.Null)
SequenceMarkerLink = links.Create(LinksConstants.Itself, LinksConstants.Itself);
}
public void ValidateOptions()
{
if (UseGarbageCollection && !UseSequenceMarker)
throw new NotSupportedException("To use garbage collection UseSequenceMarker option must be on.");
}
}
}
|
using System;
using Platform.Data.Core.Pairs;
namespace Platform.Data.Core.Sequences
{
public struct SequencesOptions // TODO: To use type parameter <TLink> the ILinks<TLink> must contain GetConstants function.
{
public ulong SequenceMarkerLink;
public bool UseCascadeUpdate;
public bool UseCascadeDelete;
public bool UseSequenceMarker;
public bool UseCompression;
public bool UseGarbageCollection;
public bool EnforceSingleSequenceVersionOnWrite;
// TODO: Реализовать компактификацию при чтении
//public bool EnforceSingleSequenceVersionOnRead;
//public bool UseRequestMarker;
//public bool StoreRequestResults;
public void InitOptions(ILinks<ulong> links)
{
if (UseSequenceMarker && SequenceMarkerLink == LinksConstants.Null)
SequenceMarkerLink = links.Create(LinksConstants.Itself, LinksConstants.Itself);
}
public void ValidateOptions()
{
if (UseGarbageCollection && !UseSequenceMarker)
throw new NotSupportedException("To use garbage collection UseSequenceMarker option must be on.");
}
}
}
|
Create Sequence Marker only if it is used.
|
Create Sequence Marker only if it is used.
|
C#
|
unlicense
|
linksplatform/Crawler,linksplatform/Crawler,linksplatform/Crawler
|
13aafc96b177038568ad353f51f514cf43024af9
|
core/VerificationProviderException.cs
|
core/VerificationProviderException.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mios.Payment {
[Serializable]
public class VerificationProviderException : Exception {
public VerificationProviderException() { }
public VerificationProviderException(string message) : base(message) { }
public VerificationProviderException(string message, Exception inner) : base(message, inner) { }
protected VerificationProviderException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
: base(info, context) { }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mios.Payment {
[Serializable]
public class VerificationProviderException : Exception {
public string ResponseContent {
get { return Data["Response"] as string; }
set { Data["Response"] = value; }
}
public VerificationProviderException() { }
public VerificationProviderException(string message) : base(message) { }
public VerificationProviderException(string message, Exception inner) : base(message, inner) { }
protected VerificationProviderException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
: base(info, context) { }
}
}
|
Add property for response content, mapped to Data collection.
|
Add property for response content, mapped to Data collection.
|
C#
|
bsd-2-clause
|
mios-fi/mios.payment
|
6fd839223e5569367916c5176e65476abbcb442b
|
TwitchPlaysAssembly/Src/ComponentSolvers/Modded/Misc/BlockbustersComponentSolver.cs
|
TwitchPlaysAssembly/Src/ComponentSolvers/Modded/Misc/BlockbustersComponentSolver.cs
|
using System.Collections;
using System.Linq;
using System.Text.RegularExpressions;
public class BlockbustersComponentSolver : ComponentSolver
{
public BlockbustersComponentSolver(TwitchModule module) :
base(module)
{
selectables = Module.BombComponent.GetComponent<KMSelectable>().Children;
ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "Press a tile using !{0} 2E. Tiles are specified by column then row.");
}
int CharacterToIndex(char character) => character >= 'a' ? character - 'a' : character - '1';
protected internal override IEnumerator RespondToCommandInternal(string inputCommand)
{
inputCommand = Regex.Replace(inputCommand, @"(\W|_|^(press|submit|click|answer))", "");
if (inputCommand.Length != 2) yield break;
int column = CharacterToIndex(inputCommand[0]);
int row = CharacterToIndex(inputCommand[1]);
if (column.InRange(0, 4) && row.InRange(0, 4) && (row < 4 || column % 2 == 1))
{
yield return null;
yield return DoInteractionClick(selectables[Enumerable.Range(0, column).Select(n => (n % 2 == 0) ? 4 : 5).Sum() + row]);
}
}
private readonly KMSelectable[] selectables;
}
|
using System.Collections;
using System.Linq;
using System.Text.RegularExpressions;
public class BlockbustersComponentSolver : ComponentSolver
{
public BlockbustersComponentSolver(TwitchModule module) :
base(module)
{
selectables = Module.BombComponent.GetComponent<KMSelectable>().Children;
ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "Press a tile using !{0} 2E. Tiles are specified by column then row.");
}
int CharacterToIndex(char character) => character >= 'a' ? character - 'a' : character - '1';
protected internal override IEnumerator RespondToCommandInternal(string inputCommand)
{
inputCommand = Regex.Replace(inputCommand.ToLowerInvariant(), @"(\W|_|^(press|submit|click|answer))", "");
if (inputCommand.Length != 2) yield break;
int column = CharacterToIndex(inputCommand[0]);
int row = CharacterToIndex(inputCommand[1]);
if (column.InRange(0, 4) && row.InRange(0, 4) && (row < 4 || column % 2 == 1))
{
yield return null;
yield return DoInteractionClick(selectables[Enumerable.Range(0, column).Select(n => (n % 2 == 0) ? 4 : 5).Sum() + row]);
}
}
private readonly KMSelectable[] selectables;
}
|
Fix Blockbusters not accepting uppercase input
|
Fix Blockbusters not accepting uppercase input
|
C#
|
mit
|
samfun123/KtaneTwitchPlays,CaitSith2/KtaneTwitchPlays
|
2378d926e8e265ffecc3320869849c7554eda4dd
|
build/TestAssemblyInfo.cs
|
build/TestAssemblyInfo.cs
|
using Xunit;
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]
|
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using Xunit;
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]
// Register test framework for assembly fixture
[assembly: TestFramework("Xunit.NetCore.Extensions.XunitTestFrameworkWithAssemblyFixture", "Xunit.NetCore.Extensions")]
[assembly: AssemblyFixture(typeof(MSBuildTestAssemblyFixture))]
public class MSBuildTestAssemblyFixture
{
public MSBuildTestAssemblyFixture()
{
// Find correct version of "dotnet", and set DOTNET_HOST_PATH so that the Roslyn tasks will use the right host
var currentFolder = System.AppContext.BaseDirectory;
while (currentFolder != null)
{
string potentialVersionsPropsPath = Path.Combine(currentFolder, "build", "Versions.props");
if (File.Exists(potentialVersionsPropsPath))
{
var doc = XDocument.Load(potentialVersionsPropsPath);
var ns = doc.Root.Name.Namespace;
var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
if (cliVersionElement != null)
{
string cliVersion = cliVersionElement.Value;
string dotnetPath = Path.Combine(currentFolder, "artifacts", ".dotnet", cliVersion, "dotnet");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
dotnetPath += ".exe";
}
Environment.SetEnvironmentVariable("DOTNET_HOST_PATH", dotnetPath);
}
break;
}
currentFolder = Directory.GetParent(currentFolder)?.FullName;
}
}
}
|
Set DOTNET_HOST_PATH so Roslyn tasks will use the right host
|
Set DOTNET_HOST_PATH so Roslyn tasks will use the right host
|
C#
|
mit
|
Microsoft/msbuild,mono/msbuild,mono/msbuild,AndyGerlicher/msbuild,cdmihai/msbuild,rainersigwald/msbuild,mono/msbuild,AndyGerlicher/msbuild,jeffkl/msbuild,chipitsine/msbuild,sean-gilliam/msbuild,cdmihai/msbuild,sean-gilliam/msbuild,chipitsine/msbuild,jeffkl/msbuild,cdmihai/msbuild,Microsoft/msbuild,chipitsine/msbuild,chipitsine/msbuild,jeffkl/msbuild,AndyGerlicher/msbuild,AndyGerlicher/msbuild,sean-gilliam/msbuild,rainersigwald/msbuild,jeffkl/msbuild,Microsoft/msbuild,rainersigwald/msbuild,mono/msbuild,Microsoft/msbuild,rainersigwald/msbuild,cdmihai/msbuild,sean-gilliam/msbuild
|
ad684ec651cf819802cfa3f30d89a95bd87751cf
|
Source/Lib/TraktApiSharp/Utils/Json.cs
|
Source/Lib/TraktApiSharp/Utils/Json.cs
|
namespace TraktApiSharp.Utils
{
using Newtonsoft.Json;
using System.Threading.Tasks;
internal static class Json
{
internal static readonly JsonSerializerSettings DEFAULT_JSON_SETTINGS
= new JsonSerializerSettings
{
Formatting = Formatting.None,
NullValueHandling = NullValueHandling.Ignore
};
internal static string Serialize(object value)
{
return JsonConvert.SerializeObject(value, DEFAULT_JSON_SETTINGS);
}
internal static TResult Deserialize<TResult>(string value)
{
return JsonConvert.DeserializeObject<TResult>(value, DEFAULT_JSON_SETTINGS);
}
internal static async Task<string> SerializeAsync(object value)
{
return await Task.Run(() => JsonConvert.SerializeObject(value, DEFAULT_JSON_SETTINGS));
}
internal static async Task<TResult> DeserializeAsync<TResult>(string value)
{
return await Task.Run(() => JsonConvert.DeserializeObject<TResult>(value, DEFAULT_JSON_SETTINGS));
}
}
}
|
namespace TraktApiSharp.Utils
{
using Newtonsoft.Json;
internal static class Json
{
internal static readonly JsonSerializerSettings DEFAULT_JSON_SETTINGS
= new JsonSerializerSettings
{
Formatting = Formatting.None,
NullValueHandling = NullValueHandling.Ignore
};
internal static string Serialize(object value)
{
return JsonConvert.SerializeObject(value, DEFAULT_JSON_SETTINGS);
}
internal static TResult Deserialize<TResult>(string value)
{
return JsonConvert.DeserializeObject<TResult>(value, DEFAULT_JSON_SETTINGS);
}
}
}
|
Remove async helper methods for json serialization.
|
Remove async helper methods for json serialization.
|
C#
|
mit
|
henrikfroehling/TraktApiSharp
|
746244df5da515243866d03167c8986ecb72cac7
|
ExampleClients/dotnet/UDIR.PAS2.Example.Client/UDIR.PAS2.OAuth.Client/AuthorizationServer.cs
|
ExampleClients/dotnet/UDIR.PAS2.Example.Client/UDIR.PAS2.OAuth.Client/AuthorizationServer.cs
|
using System;
namespace UDIR.PAS2.OAuth.Client
{
internal class AuthorizationServer
{
public AuthorizationServer(Uri baseAddress)
{
BaseAddress = baseAddress;
TokenEndpoint = new Uri(baseAddress, "/connect/token").ToString();
}
public AuthorizationServer(string baseAddress) : this(new Uri(baseAddress))
{
}
public string TokenEndpoint { get; }
public Uri BaseAddress { get; }
}
}
|
using System;
namespace UDIR.PAS2.OAuth.Client
{
internal class AuthorizationServer
{
public AuthorizationServer(Uri baseAddress)
{
BaseAddress = baseAddress;
TokenEndpoint = new Uri(baseAddress, "/connect/token").ToString();
}
public AuthorizationServer(string baseAddress) : this(new Uri(baseAddress))
{
}
public string TokenEndpoint { get; private set; }
public Uri BaseAddress { get; private set; }
}
}
|
Use private accessor for property
|
Use private accessor for property
|
C#
|
apache-2.0
|
Utdanningsdirektoratet/PAS2-Public,Utdanningsdirektoratet/PAS2-Public,Utdanningsdirektoratet/PAS2-Public,Utdanningsdirektoratet/PAS2-Public
|
88d98a47fdedb091e14c9f63c0c25bf4b52975f8
|
M101DotNet/Program.cs
|
M101DotNet/Program.cs
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using Newtonsoft.Json;
namespace M101DotNet
{
public class Program
{
public static void Main(string[] args)
{
MainAsync(args).Wait();
Console.WriteLine();
Console.WriteLine("Press Enter");
Console.ReadLine();
}
static async Task MainAsync(string[] args)
{
var connectionString = "mongodb://localhost:27017";
var client = new MongoClient(connectionString);
var db = client.GetDatabase("test");
var person = new Person
{
Name = "Jones",
Age = 30,
Colors = new List<string> {"red", "blue"},
Pets = new List<Pet>
{
new Pet
{
Name = "Puffy",
Type = "Pig"
}
}
};
Console.WriteLine(person);
// using (var writer = new JsonWriter(Console.Out))
// {
// BsonSerializer.Serialize(writer, person);
// };
}
}
}
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.IO;
namespace M101DotNet
{
public class Program
{
public static void Main(string[] args)
{
MainAsync(args).Wait();
Console.WriteLine();
Console.WriteLine("Press Enter");
Console.ReadLine();
}
static async Task MainAsync(string[] args)
{
var connectionString = "mongodb://localhost:27017";
var client = new MongoClient(connectionString);
var db = client.GetDatabase("test");
var person = new Person
{
Name = "Jones",
Age = 30,
Colors = new List<string> {"red", "blue"},
Pets = new List<Pet>
{
new Pet
{
Name = "Puffy",
Type = "Pig"
}
}
};
Console.WriteLine(person);
using (var writer = new JsonWriter(Console.Out))
{
BsonSerializer.Serialize(writer, person);
};
}
}
}
|
Use builtin MongoDB Bson serialization
|
Use builtin MongoDB Bson serialization
|
C#
|
mit
|
peterblazejewicz/m101DotNet-vNext,peterblazejewicz/m101DotNet-vNext
|
42b071bb9d18bcf13ccd41ac6dd3a768720b08a6
|
Mono.Debugger.Cli/Commands/ThreadsCommand.cs
|
Mono.Debugger.Cli/Commands/ThreadsCommand.cs
|
using System.Collections.Generic;
using Mono.Debugger.Cli.Debugging;
using Mono.Debugger.Cli.Logging;
namespace Mono.Debugger.Cli.Commands
{
public sealed class ThreadsCommand : ICommand
{
public string Name
{
get { return "Threads"; }
}
public string Description
{
get { return "Lists all active threads."; }
}
public IEnumerable<string> Arguments
{
get { return Argument.None(); }
}
public void Execute(CommandArguments args)
{
var session = SoftDebugger.Session;
if (SoftDebugger.State == DebuggerState.Null)
{
Logger.WriteErrorLine("No session active.");
return;
}
if (SoftDebugger.State == DebuggerState.Initialized)
{
Logger.WriteErrorLine("No process active.");
return;
}
var threads = session.VirtualMachine.GetThreads();
foreach (var thread in threads)
Logger.WriteInfoLine("[{0}] {1}: {2}", thread.Id, thread.Name, thread.ThreadState);
}
}
}
|
using System.Collections.Generic;
using Mono.Debugger.Cli.Debugging;
using Mono.Debugger.Cli.Logging;
namespace Mono.Debugger.Cli.Commands
{
public sealed class ThreadsCommand : ICommand
{
public string Name
{
get { return "Threads"; }
}
public string Description
{
get { return "Lists all active threads."; }
}
public IEnumerable<string> Arguments
{
get { return Argument.None(); }
}
public void Execute(CommandArguments args)
{
var session = SoftDebugger.Session;
if (SoftDebugger.State == DebuggerState.Null)
{
Logger.WriteErrorLine("No session active.");
return;
}
if (SoftDebugger.State == DebuggerState.Initialized)
{
Logger.WriteErrorLine("No process active.");
return;
}
var threads = session.VirtualMachine.GetThreads();
foreach (var thread in threads)
{
var id = thread.Id.ToString();
if (thread.IsThreadPoolThread)
id += " (TP)";
Logger.WriteInfoLine("[{0}: {1}] {2}: {3}", thread.Domain.FriendlyName, id, thread.Name, thread.ThreadState);
}
}
}
}
|
Add a little more info to the thread listing.
|
Add a little more info to the thread listing.
|
C#
|
mit
|
GunioRobot/sdb-cli,GunioRobot/sdb-cli
|
daf90e6bcf30df4fa1caee7500650d7b4944a77e
|
src/Assent/Reporters/DiffPrograms/BeyondCompareDiffProgram.cs
|
src/Assent/Reporters/DiffPrograms/BeyondCompareDiffProgram.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Assent.Reporters.DiffPrograms
{
public class BeyondCompareDiffProgram : DiffProgramBase
{
static BeyondCompareDiffProgram()
{
var paths = new List<string>();
if (DiffReporter.IsWindows)
{
paths.AddRange(WindowsProgramFilePaths
.SelectMany(p =>
new[]
{
$@"{p}\Beyond Compare 4\BCompare.exe",
$@"{p}\Beyond Compare 3\BCompare.exe"
})
.ToArray());
}
else
{
paths.Add("/usr/bin/bcompare");
}
DefaultSearchPaths = paths;
}
public static readonly IReadOnlyList<string> DefaultSearchPaths;
public BeyondCompareDiffProgram() : base(DefaultSearchPaths)
{
}
public BeyondCompareDiffProgram(IReadOnlyList<string> searchPaths)
: base(searchPaths)
{
}
protected override string CreateProcessStartArgs(string receivedFile, string approvedFile)
{
var defaultArgs = base.CreateProcessStartArgs(receivedFile, approvedFile);
var argChar = DiffReporter.IsWindows ? "/" : "-";
return $"{defaultArgs} {argChar}solo" ;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Assent.Reporters.DiffPrograms
{
public class BeyondCompareDiffProgram : DiffProgramBase
{
static BeyondCompareDiffProgram()
{
var paths = new List<string>();
if (DiffReporter.IsWindows)
{
paths.AddRange(WindowsProgramFilePaths
.SelectMany(p =>
new[]
{
$@"{p}\Beyond Compare 4\BCompare.exe",
$@"{p}\Beyond Compare 3\BCompare.exe"
})
.ToArray());
}
else
{
paths.Add("/usr/bin/bcompare");
paths.Add("/usr/local/bin/bcompare");
}
DefaultSearchPaths = paths;
}
public static readonly IReadOnlyList<string> DefaultSearchPaths;
public BeyondCompareDiffProgram() : base(DefaultSearchPaths)
{
}
public BeyondCompareDiffProgram(IReadOnlyList<string> searchPaths)
: base(searchPaths)
{
}
protected override string CreateProcessStartArgs(string receivedFile, string approvedFile)
{
var defaultArgs = base.CreateProcessStartArgs(receivedFile, approvedFile);
var argChar = DiffReporter.IsWindows ? "/" : "-";
return $"{defaultArgs} {argChar}solo" ;
}
}
}
|
Add OSX default install location for BeyondCompare.
|
Add OSX default install location for BeyondCompare.
|
C#
|
mit
|
droyad/Assent
|
54d0880efb9db929d89ba15b601d5be41e333029
|
elbsms_console/Program.cs
|
elbsms_console/Program.cs
|
using System;
using elbsms_core;
namespace elbsms_console
{
class Program
{
static void Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("Usage: elbsms_console <path to rom>");
return;
}
string romPath = args[0];
Cartridge cartridge = Cartridge.LoadFromFile(romPath);
MasterSystem masterSystem = new MasterSystem(cartridge);
try
{
while (true)
{
masterSystem.SingleStep();
}
}
catch (NotImplementedException ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
|
using System;
using System.Diagnostics;
using elbsms_core;
namespace elbsms_console
{
class Program
{
static void Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("Usage: elbsms_console <path to rom>");
return;
}
string romPath = args[0];
Cartridge cartridge = Cartridge.LoadFromFile(romPath);
MasterSystem masterSystem = new MasterSystem(cartridge);
Console.WriteLine($"Starting: {DateTime.Now}");
Console.WriteLine();
ulong instructionCount = 0;
var sw = Stopwatch.StartNew();
try
{
while (true)
{
instructionCount++;
masterSystem.SingleStep();
}
}
catch (NotImplementedException ex)
{
Console.WriteLine(ex.Message);
}
sw.Stop();
Console.WriteLine();
Console.WriteLine($"Finished: {DateTime.Now}");
Console.WriteLine($"Elapsed: {sw.ElapsedMilliseconds}ms Instructions: {instructionCount}, Instructions/ms: {instructionCount/(double)sw.ElapsedMilliseconds}");
}
}
}
|
Add some simple runtime stats while implementing the Z80 core
|
Add some simple runtime stats while implementing the Z80 core
|
C#
|
mit
|
eightlittlebits/elbsms
|
d071230bcfa9d18fe24be6137f3afc0a50485040
|
src/SharedAssemblyInfo.cs
|
src/SharedAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyProduct("SqlStreamStore")]
[assembly: AssemblyCopyright("Copyright Damian Hickey & Contributors 2015 - 2016")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
|
using System.Reflection;
[assembly: AssemblyProduct("SqlStreamStore")]
[assembly: AssemblyCopyright("Copyright Damian Hickey & Contributors 2015 - 2016")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
|
Make the next release version 0.1.1 (bug fixes)
|
Make the next release version 0.1.1 (bug fixes)
|
C#
|
mit
|
SQLStreamStore/SQLStreamStore,damianh/SqlStreamStore,damianh/Cedar.EventStore,danbarua/Cedar.EventStore,SQLStreamStore/SQLStreamStore
|
f3d68c0ea9173c43514e072d4df0680a7d76da7e
|
Program.cs
|
Program.cs
|
namespace Cash_Flow_Projection
{
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using Serilog.Core;
public class Program
{
public static LoggingLevelSwitch LogLevel { get; } = new LoggingLevelSwitch(Serilog.Events.LogEventLevel.Information);
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureLogging((context, builder) =>
{
Log.Logger =
new LoggerConfiguration()
.Enrich.FromLogContext()
.Enrich.WithProperty("Application", context.HostingEnvironment.ApplicationName)
.Enrich.WithProperty("Environment", context.HostingEnvironment.EnvironmentName)
.Enrich.WithProperty("Version", $"{typeof(Startup).Assembly.GetName().Version}")
.WriteTo.Seq(serverUrl: "https://logs.redleg.app", apiKey: context.Configuration.GetValue<string>("Seq:ApiKey"), compact: true, controlLevelSwitch: LogLevel)
.MinimumLevel.ControlledBy(LogLevel)
.CreateLogger();
builder.AddSerilog();
});
}
}
|
namespace Cash_Flow_Projection
{
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using Serilog.Core;
public class Program
{
public static LoggingLevelSwitch LogLevel { get; } = new LoggingLevelSwitch(Serilog.Events.LogEventLevel.Information);
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.ConfigureLogging((context, builder) =>
{
Log.Logger =
new LoggerConfiguration()
.Enrich.FromLogContext()
.Enrich.WithProperty("Application", context.HostingEnvironment.ApplicationName)
.Enrich.WithProperty("Environment", context.HostingEnvironment.EnvironmentName)
.Enrich.WithProperty("Version", $"{typeof(Startup).Assembly.GetName().Version}")
.WriteTo.Seq(serverUrl: "https://logs.redleg.app", apiKey: context.Configuration.GetValue<string>("Seq:ApiKey"), controlLevelSwitch: LogLevel)
.MinimumLevel.ControlledBy(LogLevel)
.CreateLogger();
builder.AddSerilog();
});
}
}
|
Move Seq 'Compact' flag, default
|
Move Seq 'Compact' flag, default
|
C#
|
mit
|
mattgwagner/Cash-Flow-Projection,mattgwagner/Cash-Flow-Projection,mattgwagner/Cash-Flow-Projection,mattgwagner/Cash-Flow-Projection
|
a0cdd62579f89432e3e36e55b8e9b3aa19399044
|
Program.cs
|
Program.cs
|
using ARSoft.Tools.Net.Dns;
using System;
using System.Net;
using System.Net.Sockets;
namespace DNSRootServerResolver
{
public class Program
{
public static void Main(string[] args)
{
using (var server = new DnsServer(IPAddress.Any, 25, 25, DnsServerHandler))
{
server.Start();
string command;
while ((command = Console.ReadLine()) != "exit")
{
if (command == "clear")
{
DNS.GlobalCache.Clear();
}
}
}
}
public static DnsMessageBase DnsServerHandler(DnsMessageBase dnsMessageBase, IPAddress clientAddress, ProtocolType protocolType)
{
DnsMessage query = dnsMessageBase as DnsMessage;
foreach (var question in query.Questions)
{
switch (question.RecordType)
{
case RecordType.A:
query.AnswerRecords.AddRange(DNS.Resolve(question.Name)); break;
case RecordType.Ptr:
{
if (question.Name == "1.0.0.127.in-addr.arpa")
{
query.AnswerRecords.Add(new PtrRecord("127.0.0.1", 172800 /*2 days*/, "localhost"));
}
}; break;
}
}
return query;
}
}
}
|
using ARSoft.Tools.Net.Dns;
using System;
using System.Net;
using System.Net.Sockets;
namespace DNSRootServerResolver
{
public class Program
{
public static void Main(string[] args)
{
using (var server = new DnsServer(IPAddress.Any, 25, 25, DnsServerHandler))
{
server.Start();
string command;
while ((command = Console.ReadLine()) != "exit")
{
if (command == "clear")
{
DNS.GlobalCache.Clear();
}
}
}
}
public static DnsMessageBase DnsServerHandler(DnsMessageBase dnsMessageBase, IPAddress clientAddress, ProtocolType protocolType)
{
DnsMessage query = dnsMessageBase as DnsMessage;
foreach (var question in query.Questions)
{
Console.WriteLine(question);
switch (question.RecordType)
{
case RecordType.A:
case RecordType.Mx:
query.AnswerRecords.AddRange(DNS.Resolve(question.Name, question.RecordType, question.RecordClass)); break;
case RecordType.Ptr:
{
if (question.Name == "1.0.0.127.in-addr.arpa")
{
query.AnswerRecords.Add(new PtrRecord("127.0.0.1", 172800 /*2 days*/, "localhost"));
}
}; break;
default:
{
query.ReturnCode = ReturnCode.NotImplemented;
Console.WriteLine("Unknown record type: " + question.RecordType + " (class: " + question.RecordClass + ", " + question.Name + ")");
} break;
}
}
return query;
}
}
}
|
Add mx handling and not implemented if non supported type request
|
Add mx handling and not implemented if non supported type request
|
C#
|
mit
|
fiinix00/DNSRootServerResolver
|
c8853406afb9e79d5cf14919db0f2ca25557c0cd
|
Assets/MixedRealityToolkit.SDK/Features/Input/Handlers/TouchHandler.cs
|
Assets/MixedRealityToolkit.SDK/Features/Input/Handlers/TouchHandler.cs
|
using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TouchHandler : MonoBehaviour, IMixedRealityTouchHandler
{
#region Event handlers
public TouchEvent OnTouchStarted = new TouchEvent();
public TouchEvent OnTouchCompleted = new TouchEvent();
public TouchEvent OnTouchUpdated = new TouchEvent();
#endregion
void IMixedRealityTouchHandler.OnTouchCompleted(HandTrackingInputEventData eventData)
{
OnTouchCompleted.Invoke(eventData);
}
void IMixedRealityTouchHandler.OnTouchStarted(HandTrackingInputEventData eventData)
{
OnTouchStarted.Invoke(eventData);
}
void IMixedRealityTouchHandler.OnTouchUpdated(HandTrackingInputEventData eventData)
{
OnTouchUpdated.Invoke(eventData);
}
}
|
using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Input
{
public class TouchHandler : MonoBehaviour, IMixedRealityTouchHandler
{
#region Event handlers
public TouchEvent OnTouchStarted = new TouchEvent();
public TouchEvent OnTouchCompleted = new TouchEvent();
public TouchEvent OnTouchUpdated = new TouchEvent();
#endregion
void IMixedRealityTouchHandler.OnTouchCompleted(HandTrackingInputEventData eventData)
{
OnTouchCompleted.Invoke(eventData);
}
void IMixedRealityTouchHandler.OnTouchStarted(HandTrackingInputEventData eventData)
{
OnTouchStarted.Invoke(eventData);
}
void IMixedRealityTouchHandler.OnTouchUpdated(HandTrackingInputEventData eventData)
{
OnTouchUpdated.Invoke(eventData);
}
}
}
|
Add missing namespace to resolve asset retargeting failures
|
Add missing namespace to resolve asset retargeting failures
|
C#
|
mit
|
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
|
9703304537027e9feed29e6515be098c57c660b5
|
Test/Hatfield.EnviroData.DataAcquisition.ESDAT.Test/Converters/ESDATDataConverterTest.cs
|
Test/Hatfield.EnviroData.DataAcquisition.ESDAT.Test/Converters/ESDATDataConverterTest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Hatfield.EnviroData.DataAcquisition.ESDAT.Test.Converters
{
class ESDATDataConverterTest
{
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Moq;
using Hatfield.EnviroData.Core;
using Hatfield.EnviroData.DataAcquisition.ESDAT;
using Hatfield.EnviroData.DataAcquisition.ESDAT.Converters;
namespace Hatfield.EnviroData.DataAcquisition.ESDAT.Test.Converters
{
[TestFixture]
public class ESDATConverterTest
{
// See https://github.com/HatfieldConsultants/Hatfield.EnviroData.Core/wiki/Loading-ESDAT-data-into-ODM2#actions for expected values
[Test]
public void ESDATConverterConvertToODMActionActionTest()
{
var mockDbContext = new Mock<IDbContext>().Object;
var esdatConverter = new ESDATConverter(mockDbContext);
ESDATModel esdatModel = new ESDATModel();
DateTime sampledDateTime = DateTime.Now;
esdatModel.SampleFileData.SampledDateTime = sampledDateTime;
var action = esdatConverter.ConvertToODMAction(esdatModel);
Assert.AreEqual(action.ActionID, 0);
Assert.AreEqual(action.ActionTypeCV, "specimenCollection");
Assert.AreEqual(action.BeginDateTime, sampledDateTime);
Assert.AreEqual(action.EndDateTime, null);
Assert.AreEqual(action.EndDateTimeUTCOffset, null);
Assert.AreEqual(action.ActionDescription, null);
Assert.AreEqual(action.ActionFileLink, null);
}
}
}
|
Implement ESDATModel test for OSM2.Actions
|
Implement ESDATModel test for OSM2.Actions
|
C#
|
mpl-2.0
|
kgarsuta/Hatfield.EnviroData.DataAcquisition,gvassas/Hatfield.EnviroData.DataAcquisition,HatfieldConsultants/Hatfield.EnviroData.DataAcquisition
|
a77df68909defb3bf62223d7bb8187b160cd9642
|
Bonobo.Git.Server/Security/ADRepositoryPermissionService.cs
|
Bonobo.Git.Server/Security/ADRepositoryPermissionService.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Bonobo.Git.Server.Data;
using Bonobo.Git.Server.Models;
using Microsoft.Practices.Unity;
namespace Bonobo.Git.Server.Security
{
public class ADRepositoryPermissionService : IRepositoryPermissionService
{
[Dependency]
public IRepositoryRepository Repository { get; set; }
[Dependency]
public IRoleProvider RoleProvider { get; set; }
[Dependency]
public ITeamRepository TeamRepository { get; set; }
public bool AllowsAnonymous(string repositoryName)
{
return Repository.GetRepository(repositoryName).AnonymousAccess;
}
public bool HasPermission(string username, string repositoryName)
{
bool result = true;
RepositoryModel repositoryModel = Repository.GetRepository(repositoryName);
result &= repositoryModel.Users.Contains(username, StringComparer.OrdinalIgnoreCase);
result &= repositoryModel.Administrators.Contains(username, StringComparer.OrdinalIgnoreCase);
result &= RoleProvider.GetRolesForUser(username).Contains(Definitions.Roles.Administrator);
result &= TeamRepository.GetTeams(username).Any(x => repositoryModel.Teams.Contains(x.Name, StringComparer.OrdinalIgnoreCase));
return result;
}
public bool IsRepositoryAdministrator(string username, string repositoryName)
{
bool result = true;
result &= Repository.GetRepository(repositoryName).Administrators.Contains(username, StringComparer.OrdinalIgnoreCase);
result &= RoleProvider.GetRolesForUser(username).Contains(Definitions.Roles.Administrator);
return result;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Bonobo.Git.Server.Data;
using Bonobo.Git.Server.Models;
using Microsoft.Practices.Unity;
namespace Bonobo.Git.Server.Security
{
public class ADRepositoryPermissionService : IRepositoryPermissionService
{
[Dependency]
public IRepositoryRepository Repository { get; set; }
[Dependency]
public IRoleProvider RoleProvider { get; set; }
[Dependency]
public ITeamRepository TeamRepository { get; set; }
public bool AllowsAnonymous(string repositoryName)
{
return Repository.GetRepository(repositoryName).AnonymousAccess;
}
public bool HasPermission(string username, string repositoryName)
{
bool result = false;
RepositoryModel repositoryModel = Repository.GetRepository(repositoryName);
result |= repositoryModel.Users.Contains(username, StringComparer.OrdinalIgnoreCase);
result |= repositoryModel.Administrators.Contains(username, StringComparer.OrdinalIgnoreCase);
result |= RoleProvider.GetRolesForUser(username).Contains(Definitions.Roles.Administrator);
result |= TeamRepository.GetTeams(username).Any(x => repositoryModel.Teams.Contains(x.Name, StringComparer.OrdinalIgnoreCase));
return result;
}
public bool IsRepositoryAdministrator(string username, string repositoryName)
{
bool result = false;
result |= Repository.GetRepository(repositoryName).Administrators.Contains(username, StringComparer.OrdinalIgnoreCase);
result |= RoleProvider.GetRolesForUser(username).Contains(Definitions.Roles.Administrator);
return result;
}
}
}
|
Fix repository permission checks. Yes, that was stupid.
|
Fix repository permission checks. Yes, that was stupid.
|
C#
|
mit
|
Webmine/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,Acute-sales-ltd/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,larshg/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,crowar/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,RedX2501/Bonobo-Git-Server,gencer/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,Ollienator/Bonobo-Git-Server,willdean/Bonobo-Git-Server,lkho/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,willdean/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,crowar/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,larshg/Bonobo-Git-Server,crowar/Bonobo-Git-Server,gencer/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,braegelno5/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,Webmine/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,forgetz/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,gencer/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,crowar/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,willdean/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,crowar/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,larshg/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,lkho/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,lkho/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,Ollienator/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,igoryok-zp/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,Webmine/Bonobo-Git-Server,larshg/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,crowar/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,gencer/Bonobo-Git-Server,willdean/Bonobo-Git-Server,willdean/Bonobo-Git-Server,lkho/Bonobo-Git-Server
|
3778250fa467246b1ba031e5f73d253437b2e893
|
ExpressionToCodeTest/AnonymousObjectFormattingTest.cs
|
ExpressionToCodeTest/AnonymousObjectFormattingTest.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using Xunit;
namespace ExpressionToCodeTest
{
public class AnonymousObjectFormattingTest
{
[Fact]
public void AnonymousObjectsRenderAsCode()
{
Assert.Equal("new {\n A = 1,\n Foo = \"Bar\",\n}", ObjectToCode.ComplexObjectToPseudoCode(new { A = 1, Foo = "Bar", }));
}
[Fact]
public void AnonymousObjectsInArray()
{
Assert.Equal("new[] {\n new {\n Val = 3,\n },\n new {\n Val = 42,\n },\n}", ObjectToCode.ComplexObjectToPseudoCode(new[] { new { Val = 3, }, new { Val = 42 } }));
}
[Fact]
public void EnumerableInAnonymousObject()
{
Assert.Equal("new {\n Nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...},\n}", ObjectToCode.ComplexObjectToPseudoCode(new { Nums = Enumerable.Range(1, 13) }));
}
[Fact]
public void EnumInAnonymousObject()
{
Assert.Equal("new {\n Enum = ConsoleKey.A,\n}", ObjectToCode.ComplexObjectToPseudoCode(new { Enum = ConsoleKey.A }));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using Xunit;
namespace ExpressionToCodeTest
{
public class AnonymousObjectFormattingTest
{
[Fact]
public void AnonymousObjectsRenderAsCode()
{
Assert.Equal("new {\n A = 1,\n Foo = \"Bar\",\n}", ObjectToCode.ComplexObjectToPseudoCode(new { A = 1, Foo = "Bar", }));
}
[Fact]
public void AnonymousObjectsInArray()
{
Assert.Equal("new[] {\n new {\n Val = 3,\n },\n new {\n Val = 42,\n },\n}", ObjectToCode.ComplexObjectToPseudoCode(new[] { new { Val = 3, }, new { Val = 42 } }));
}
[Fact]
public void EnumerableInAnonymousObject()
{
Assert.Equal("new {\n Nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...},\n}", ExpressionToCodeConfiguration.DefaultAssertionConfiguration.ComplexObjectToPseudoCode(new { Nums = Enumerable.Range(1, 13) }));
}
[Fact]
public void EnumInAnonymousObject()
{
Assert.Equal("new {\n Enum = ConsoleKey.A,\n}", ObjectToCode.ComplexObjectToPseudoCode(new { Enum = ConsoleKey.A }));
}
}
}
|
Fix test to use the appropriate config
|
Fix test to use the appropriate config
|
C#
|
apache-2.0
|
asd-and-Rizzo/ExpressionToCode,EamonNerbonne/ExpressionToCode
|
416a43f0b155cc8d6bd885428cde90d6b0e26a1a
|
windows/TweetDuck/Updates/UpdateInstaller.cs
|
windows/TweetDuck/Updates/UpdateInstaller.cs
|
using System;
using System.ComponentModel;
using System.Diagnostics;
using TweetDuck.Configuration;
using TweetLib.Core;
using TweetLib.Utils.Static;
namespace TweetDuck.Updates {
sealed class UpdateInstaller {
private string Path { get; }
public UpdateInstaller(string path) {
this.Path = path;
}
public bool Launch() {
// ProgramPath has a trailing backslash
string arguments = "/SP- /SILENT /FORCECLOSEAPPLICATIONS /UPDATEPATH=\"" + App.ProgramPath + "\" /RUNARGS=\"" + Arguments.GetCurrentForInstallerCmd() + "\"" + (App.IsPortable ? " /PORTABLE=1" : "");
bool runElevated = !App.IsPortable || !FileUtils.CheckFolderWritePermission(App.ProgramPath);
try {
using (Process.Start(new ProcessStartInfo {
FileName = Path,
Arguments = arguments,
Verb = runElevated ? "runas" : string.Empty,
ErrorDialog = true
})) {
return true;
}
} catch (Win32Exception e) when (e.NativeErrorCode == 0x000004C7) { // operation canceled by the user
return false;
} catch (Exception e) {
App.ErrorHandler.HandleException("Update Installer Error", "Could not launch update installer.", true, e);
return false;
}
}
}
}
|
using System;
using System.ComponentModel;
using System.Diagnostics;
using TweetDuck.Configuration;
using TweetLib.Core;
using TweetLib.Utils.Static;
namespace TweetDuck.Updates {
sealed class UpdateInstaller {
private string Path { get; }
public UpdateInstaller(string path) {
this.Path = path;
}
public bool Launch() {
// ProgramPath has a trailing backslash
string arguments = "/SP- /SILENT /FORCECLOSEAPPLICATIONS /UPDATEPATH=\"" + App.ProgramPath + "\" /RUNARGS=\"" + Arguments.GetCurrentForInstallerCmd() + "\"" + (App.IsPortable ? " /PORTABLE=1" : "");
bool runElevated = !App.IsPortable || !FileUtils.CheckFolderWritePermission(App.ProgramPath);
try {
using (Process.Start(new ProcessStartInfo {
FileName = Path,
Arguments = arguments,
Verb = runElevated ? "runas" : string.Empty,
UseShellExecute = true,
ErrorDialog = true
})) {
return true;
}
} catch (Win32Exception e) when (e.NativeErrorCode == 0x000004C7) { // operation canceled by the user
return false;
} catch (Exception e) {
App.ErrorHandler.HandleException("Update Installer Error", "Could not launch update installer.", true, e);
return false;
}
}
}
}
|
Fix update installer not running as administrator due to breaking change in .NET
|
Fix update installer not running as administrator due to breaking change in .NET
|
C#
|
mit
|
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
|
a141186aaad99ffd0017505da0298040efcda794
|
src/Hqub.Lastfm/Configure.cs
|
src/Hqub.Lastfm/Configure.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Hqub.Lastfm
{
public static class Configure
{
/// <summary>
/// Set value delay between requests.
/// </summary>
public static int Delay { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Hqub.Lastfm
{
public static class Configure
{
static Configure()
{
Delay = 1000;
}
/// <summary>
/// Set value delay between requests.
/// </summary>
public static int Delay { get; set; }
}
}
|
Set default delay value = 1000
|
Set default delay value = 1000
|
C#
|
mit
|
avatar29A/Last.fm
|
9f23080cf8df6d2e74d7ee695b6b40dc1055fa63
|
src/Stripe.net/Services/SubscriptionItems/SubscriptionItemPriceDataRecurringOptions.cs
|
src/Stripe.net/Services/SubscriptionItems/SubscriptionItemPriceDataRecurringOptions.cs
|
namespace Stripe
{
using System.Collections.Generic;
using Newtonsoft.Json;
public class SubscriptionItemPriceDataRecurringOptions : INestedOptions
{
/// <summary>
/// Specifies a usage aggregation strategy for prices where <see cref="UsageType"/> is
/// <c>metered</c>. Allowed values are <c>sum</c> for summing up all usage during a period,
/// <c>last_during_period</c> for picking the last usage record reported within a period,
/// <c>last_ever</c> for picking the last usage record ever (across period bounds) or
/// <c>max</c> which picks the usage record with the maximum reported usage during a
/// period. Defaults to <c>sum</c>.
/// </summary>
[JsonProperty("aggregate_usage")]
public string AggregateUsage { get; set; }
/// <summary>
/// he frequency at which a subscription is billed. One of <c>day</c>, <c>week</c>,
/// <c>month</c> or <c>year</c>.
/// </summary>
[JsonProperty("interval")]
public string Interval { get; set; }
/// <summary>
/// The number of intervals (specified in the <see cref="Interval"/> property) between
/// subscription billings.
/// </summary>
[JsonProperty("interval_count")]
public long? IntervalCount { get; set; }
/// <summary>
/// Default number of trial days when subscribing a customer to this price using
/// <c>trial_from_price=true</c>.
/// </summary>
[JsonProperty("trial_period_days")]
public long? TrialPeriodDays { get; set; }
/// <summary>
/// Configures how the quantity per period should be determined, can be either
/// <c>metered</c> or <c>licensed</c>. <c>licensed</c> will automatically bill the quantity
/// set for a price when adding it to a subscription, <c>metered</c> will aggregate the
/// total usage based on usage records. Defaults to <c>licensed</c>.
/// </summary>
[JsonProperty("usage_type")]
public string UsageType { get; set; }
}
}
|
namespace Stripe
{
using System.Collections.Generic;
using Newtonsoft.Json;
public class SubscriptionItemPriceDataRecurringOptions : INestedOptions
{
/// <summary>
/// he frequency at which a subscription is billed. One of <c>day</c>, <c>week</c>,
/// <c>month</c> or <c>year</c>.
/// </summary>
[JsonProperty("interval")]
public string Interval { get; set; }
/// <summary>
/// The number of intervals (specified in the <see cref="Interval"/> property) between
/// subscription billings.
/// </summary>
[JsonProperty("interval_count")]
public long? IntervalCount { get; set; }
}
}
|
Fix parameters supported in `Recurring` for `PriceData` across the API
|
Fix parameters supported in `Recurring` for `PriceData` across the API
|
C#
|
apache-2.0
|
stripe/stripe-dotnet
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.