commit
stringlengths 40
40
| subject
stringlengths 4
1.73k
| repos
stringlengths 5
127k
| old_file
stringlengths 2
751
| new_file
stringlengths 2
751
| new_contents
stringlengths 1
8.98k
| old_contents
stringlengths 0
6.59k
| license
stringclasses 13
values | lang
stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
ae6093ba483c135a04ce3b5ac5f1d07820eb5765
|
Fix Upgrade
|
signumsoftware/framework,signumsoftware/framework
|
Signum.Upgrade/Upgrades/Upgrade_20201123_Typescript41.cs
|
Signum.Upgrade/Upgrades/Upgrade_20201123_Typescript41.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace Signum.Upgrade.Upgrades
{
class Upgrade_20201123_Typescript41 : CodeUpgradeBase
{
public override string Description => "Update to Typescript 4.1";
public override string SouthwindCommitHash => "60d43b2f94249ff9ef0ee36eaecc1b7fc8f65c71";
public override void Execute(UpgradeContext uctx)
{
uctx.ChangeCodeFile("Southwind.React/package.json", file =>
{
file.UpdateNpmPackage("ts-loader", "8.0.11");
file.UpdateNpmPackage("typescript", "4.1.2");
});
uctx.ChangeCodeFile("Southwind.React/Southwind.React.csproj", file =>
{
file.UpdateNugetReference("Microsoft.TypeScript.MSBuild", "4.1.2");
});
uctx.ChangeCodeFile("Southwind.React/tsconfig.json", file =>
{
file.RemoveAllLines(a => a.Contains(@"""baseUrl"": ""."","));
file.Replace("\"*\": [", "temp123");
file.Replace("\"*\"", "\"./*\"");
file.Replace("temp123", "\"*\": [");
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace Signum.Upgrade.Upgrades
{
class Upgrade_20201123_Typescript41 : CodeUpgradeBase
{
public override string Description => "Update to Typescript 4.1";
public override string SouthwindCommitHash => "60d43b2f94249ff9ef0ee36eaecc1b7fc8f65c71";
public override void Execute(UpgradeContext uctx)
{
uctx.ChangeCodeFile("Southwind.React/package.json", file =>
{
file.UpdateNpmPackage("ts-loader", "8.0.11");
file.UpdateNpmPackage("typescript", "4.1.2");
});
uctx.ChangeCodeFile("Southwind.React/Southwind.React.csproj", file =>
{
file.UpdateNugetReference("Microsoft.TypeScript.MSBuild", "4.1.2");
});
uctx.ChangeCodeFile("Southwind.React/tsconfig.json", file =>
{
file.RemoveAllLines(a => a.Contains(@"""baseUrl"": ""."","));
file.Replace("\"*\"", "\"./*\"");
});
}
}
}
|
mit
|
C#
|
d20fda003bfe731784592b73e8b3f722ecd2c2ae
|
remove redundant code
|
adamralph/xbehave.net,modulexcite/xbehave.net,xbehave/xbehave.net,mvalipour/xbehave.net,modulexcite/xbehave.net,hitesh97/xbehave.net,hitesh97/xbehave.net,mvalipour/xbehave.net
|
src/Xbehave.2.Execution/Shims/ExceptionExtensions.cs
|
src/Xbehave.2.Execution/Shims/ExceptionExtensions.cs
|
// <copyright file="ExceptionExtensions.cs" company="xBehave.net contributors">
// Copyright (c) xBehave.net contributors. All rights reserved.
// </copyright>
namespace Xbehave.Execution.Shims
{
using System;
using System.Reflection;
internal static class ExceptionExtensions
{
public static Exception Unwrap(this Exception ex)
{
while (true)
{
var tiex = ex as TargetInvocationException;
if (tiex == null)
{
return ex;
}
ex = tiex.InnerException;
}
}
}
}
|
// <copyright file="ExceptionExtensions.cs" company="xBehave.net contributors">
// Copyright (c) xBehave.net contributors. All rights reserved.
// </copyright>
namespace Xbehave.Execution.Shims
{
using System;
using System.Reflection;
using System.Runtime.ExceptionServices;
internal static class ExceptionExtensions
{
public static void RethrowWithNoStackTraceLoss(this Exception ex)
{
ExceptionDispatchInfo.Capture(ex).Throw();
}
public static Exception Unwrap(this Exception ex)
{
while (true)
{
var tiex = ex as TargetInvocationException;
if (tiex == null)
{
return ex;
}
ex = tiex.InnerException;
}
}
}
}
|
mit
|
C#
|
dd1fccbe5ac603c6ba46dc0bd47aeceff5f5dcfb
|
fix unit tests warnings
|
asbjornu/GitVersion,GitTools/GitVersion,GitTools/GitVersion,asbjornu/GitVersion
|
src/GitVersion.MsBuild.Tests/Helpers/MsBuildExeFixture.cs
|
src/GitVersion.MsBuild.Tests/Helpers/MsBuildExeFixture.cs
|
using Buildalyzer;
using Buildalyzer.Environment;
using GitTools.Testing;
using GitVersion.Core.Tests;
using GitVersion.Core.Tests.Helpers;
using GitVersion.Helpers;
#if NET48
using GitVersion.Extensions;
#endif
using Microsoft.Build.Framework;
using Microsoft.Build.Logging;
using Microsoft.Build.Utilities.ProjectCreation;
namespace GitVersion.MsBuild.Tests.Helpers;
public class MsBuildExeFixture
{
private readonly RepositoryFixtureBase fixture;
private KeyValuePair<string, string?>[]? environmentVariables;
public void WithEnv(params KeyValuePair<string, string?>[] envs) => this.environmentVariables = envs;
public const string OutputTarget = "GitVersionOutput";
private readonly AnalyzerManager manager = new();
private readonly string ProjectPath;
public MsBuildExeFixture(RepositoryFixtureBase fixture, string workingDirectory = "")
{
this.fixture = fixture;
this.ProjectPath = PathHelper.Combine(workingDirectory, "app.csproj");
var versionFile = PathHelper.Combine(workingDirectory, "gitversion.json");
fixture.WriteVersionVariables(versionFile);
}
public MsBuildExeFixtureResult Execute()
{
var analyzer = this.manager.GetProject(this.ProjectPath);
var output = new StringWriter();
analyzer.AddBuildLogger(new ConsoleLogger(LoggerVerbosity.Normal, output.Write, null, null));
var environmentOptions = new EnvironmentOptions { DesignTime = false };
environmentOptions.TargetsToBuild.Clear();
environmentOptions.TargetsToBuild.Add(OutputTarget);
if (this.environmentVariables != null)
{
foreach (var (key, value) in this.environmentVariables)
{
analyzer.SetEnvironmentVariable(key, value);
}
}
var results = analyzer.Build(environmentOptions);
return new MsBuildExeFixtureResult(this.fixture)
{
ProjectPath = ProjectPath,
Output = output.ToString(),
MsBuild = results
};
}
public void CreateTestProject(Action<ProjectCreator> extendProject)
{
var project = RuntimeHelper.IsCoreClr()
? ProjectCreator.Templates.SdkCsproj(this.ProjectPath)
: ProjectCreator.Templates.LegacyCsproj(this.ProjectPath, targetFrameworkVersion: "v4.8", toolsVersion: "15.0");
extendProject(project);
project.Save();
}
}
|
using Buildalyzer;
using Buildalyzer.Environment;
using GitTools.Testing;
using GitVersion.Core.Tests;
using GitVersion.Core.Tests.Helpers;
using GitVersion.Helpers;
#if NET48
using GitVersion.Extensions;
#endif
using Microsoft.Build.Framework;
using Microsoft.Build.Logging;
using Microsoft.Build.Utilities.ProjectCreation;
namespace GitVersion.MsBuild.Tests.Helpers;
public class MsBuildExeFixture
{
private readonly RepositoryFixtureBase fixture;
private KeyValuePair<string, string?>[]? environmentVariables;
public void WithEnv(params KeyValuePair<string, string?>[] envs) => this.environmentVariables = envs;
public const string OutputTarget = "GitVersionOutput";
private readonly AnalyzerManager manager = new();
private readonly string ProjectPath;
public MsBuildExeFixture(RepositoryFixtureBase fixture, string workingDirectory = "")
{
this.fixture = fixture;
this.ProjectPath = PathHelper.Combine(workingDirectory, "app.csproj");
var versionFile = PathHelper.Combine(workingDirectory, "gitversion.json");
fixture.WriteVersionVariables(versionFile);
}
public MsBuildExeFixtureResult Execute()
{
var analyzer = this.manager.GetProject(this.ProjectPath);
var output = new StringWriter();
analyzer.AddBuildLogger(new ConsoleLogger(LoggerVerbosity.Normal, output.Write, null, null));
var environmentOptions = new EnvironmentOptions { DesignTime = false };
environmentOptions.TargetsToBuild.Clear();
environmentOptions.TargetsToBuild.Add(OutputTarget);
if (this.environmentVariables != null)
{
foreach (var (key, value) in this.environmentVariables)
{
analyzer.SetEnvironmentVariable(key, value);
}
}
var results = analyzer.Build(environmentOptions);
return new MsBuildExeFixtureResult(this.fixture)
{
ProjectPath = ProjectPath,
Output = output.ToString(),
MsBuild = results
};
}
public void CreateTestProject(Action<ProjectCreator> extendProject)
{
var project = RuntimeHelper.IsCoreClr()
? ProjectCreator.Templates.SdkCsproj(this.ProjectPath)
: ProjectCreator.Templates.LegacyCsproj(this.ProjectPath, defaultTargets: null, targetFrameworkVersion: "v4.8", toolsVersion: "15.0");
extendProject(project);
project.Save();
}
}
|
mit
|
C#
|
e39b08e4f1f12198e3ffa6601978c81cab922fc7
|
Bump version for release
|
Icy0ne/clilauncher,evem8/clilauncher
|
EVEm8.CliLauncher/Properties/AssemblyInfo.cs
|
EVEm8.CliLauncher/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("EVEm8 CLI Launcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("EVEm8")]
[assembly: AssemblyProduct("EVEm8.CliLauncher")]
[assembly: AssemblyCopyright("Copyright © 2015 Kali Izia")]
[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("c63c9d01-00ae-43ca-a079-bd286299c7ff")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EVEm8 CLI Launcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("EVEm8")]
[assembly: AssemblyProduct("EVEm8.CliLauncher")]
[assembly: AssemblyCopyright("Copyright © 2015 Kali Izia")]
[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("c63c9d01-00ae-43ca-a079-bd286299c7ff")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
mit
|
C#
|
ecd331f4c8e8734b175148794e6cfb5dfc712cc8
|
Fix variable name.
|
fixie/fixie,Duohong/fixie,JakeGinnivan/fixie,KevM/fixie,bardoloi/fixie,EliotJones/fixie,bardoloi/fixie
|
src/Fixie.Console/Program.cs
|
src/Fixie.Console/Program.cs
|
using System;
using System.Linq;
using System.Reflection;
namespace Fixie.Console
{
using Console = System.Console;
class Program
{
const int FatalError = -1;
static int Main(string[] args)
{
try
{
if (args.Length != 1)
{
Console.WriteLine("Usage: Fixie.Console [assembly_file]");
return FatalError;
}
var assemblyFile = args.Single();
var result = Execute(assemblyFile);
return result.Failed;
}
catch (Exception ex)
{
using (Foreground.Red)
Console.WriteLine("Fatal Error: {0}", ex);
return FatalError;
}
}
static Result Execute(string assemblyFile)
{
var assembly = Assembly.LoadFrom(assemblyFile);
var listener = new ConsoleListener();
var suite = new Suite(assembly);
var result = suite.Execute(listener);
Console.WriteLine("{0} total, {1} failed", result.Total, result.Failed);
return result;
}
}
}
|
using System;
using System.Linq;
using System.Reflection;
namespace Fixie.Console
{
using Console = System.Console;
class Program
{
const int FatalError = -1;
static int Main(string[] args)
{
try
{
if (args.Length != 1)
{
Console.WriteLine("Usage: Fixie.Console [assembly_file]");
return FatalError;
}
var assemblyFile = args.Single();
var result = Execute(assemblyFile);
return result.Failed;
}
catch (Exception ex)
{
using (Foreground.Red)
Console.WriteLine("Fatal Error: {0}", ex);
return FatalError;
}
}
static Result Execute(string assemblyFile)
{
var assembly = Assembly.LoadFrom(assemblyFile);
var listener = new ConsoleListener();
var convention = new Suite(assembly);
var result = convention.Execute(listener);
Console.WriteLine("{0} total, {1} failed", result.Total, result.Failed);
return result;
}
}
}
|
mit
|
C#
|
5d443db0230fcf379a72f1ada55bc4d0d5caa8dd
|
Handle resize
|
florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho
|
Bindings/Forms/IosSurfaceRenderer.cs
|
Bindings/Forms/IosSurfaceRenderer.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Urho.Forms;
using System.Runtime.InteropServices;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using UIKit;
[assembly: ExportRendererAttribute(typeof(UrhoSurface), typeof(IosSurfaceRenderer))]
namespace Urho.Forms
{
public class IosSurfaceRenderer : ViewRenderer<UrhoSurface, IosUrhoSurface>
{
protected override void OnElementChanged(ElementChangedEventArgs<UrhoSurface> e)
{
if (e.NewElement != null) {
var surface = new IosUrhoSurface();
surface.BackgroundColor = UIColor.Black;
e.NewElement.UrhoApplicationLauncher = surface.Launcher;
SetNativeControl(surface);
}
}
}
public class IosUrhoSurface : UIView
{
static TaskCompletionSource<Application> applicationTaskSource;
static readonly SemaphoreSlim launcherSemaphore = new SemaphoreSlim(1);
static Urho.iOS.UrhoSurface surface;
static Urho.Application app;
internal async Task<Urho.Application> Launcher(Type type, ApplicationOptions options)
{
await launcherSemaphore.WaitAsync();
if (app != null)
{
app.Exit();
}
applicationTaskSource = new TaskCompletionSource<Application>();
Urho.Application.Started += UrhoApplicationStarted;
if (surface != null)
{
surface.RemoveFromSuperview ();
}
surface = new Urho.iOS.UrhoSurface(this.Bounds);
surface.AutoresizingMask = UIViewAutoresizing.All;
this.Add(surface);
await surface.InitializeTask;
app = Urho.Application.CreateInstance(type, options);
app.Run();
return await applicationTaskSource.Task;
}
void UrhoApplicationStarted()
{
Urho.Application.Started -= UrhoApplicationStarted;
applicationTaskSource?.TrySetResult(app);
launcherSemaphore.Release();
}
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
using Urho.Forms;
using System.Runtime.InteropServices;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using UIKit;
[assembly: ExportRendererAttribute(typeof(UrhoSurface), typeof(IosSurfaceRenderer))]
namespace Urho.Forms
{
public class IosSurfaceRenderer : ViewRenderer<UrhoSurface, IosUrhoSurface>
{
protected override void OnElementChanged(ElementChangedEventArgs<UrhoSurface> e)
{
if (e.NewElement != null) {
var surface = new IosUrhoSurface();
surface.BackgroundColor = UIColor.Black;
e.NewElement.UrhoApplicationLauncher = surface.Launcher;
SetNativeControl(surface);
}
}
}
public class IosUrhoSurface : UIView
{
static TaskCompletionSource<Application> applicationTaskSource;
static readonly SemaphoreSlim launcherSemaphore = new SemaphoreSlim(1);
static Urho.iOS.UrhoSurface surface;
static Urho.Application app;
internal async Task<Urho.Application> Launcher(Type type, ApplicationOptions options)
{
await launcherSemaphore.WaitAsync();
if (app != null)
{
app.Exit();
}
applicationTaskSource = new TaskCompletionSource<Application>();
Urho.Application.Started += UrhoApplicationStarted;
if (surface != null)
{
surface.RemoveFromSuperview ();
//app.Graphics.Release (false, false);
}
this.Add(surface = new Urho.iOS.UrhoSurface(this.Bounds));
await surface.InitializeTask;
app = Urho.Application.CreateInstance(type, options);
app.Run();
return await applicationTaskSource.Task;
}
void UrhoApplicationStarted()
{
Urho.Application.Started -= UrhoApplicationStarted;
applicationTaskSource?.TrySetResult(app);
launcherSemaphore.Release();
}
}
}
|
mit
|
C#
|
2d62706010629bc22fe38aa33ba4a1dd0a50ae79
|
Set the standard message.
|
cdman/continuous-integration-demo,cdman/continuous-integration-demo,cdman/continuous-integration-demo
|
CDDemo/Controllers/HomeController.cs
|
CDDemo/Controllers/HomeController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace CDDemo.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Hello World!";
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your app description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace CDDemo.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your app description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
}
|
apache-2.0
|
C#
|
2269b17c0ec1783eab1a42710e87db7f863771f3
|
Modify main program to work with port again
|
Zyrio/ictus,Zyrio/ictus
|
src/Yio/Program.cs
|
src/Yio/Program.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Yio.Utilities;
namespace Yio
{
public class Program
{
private static int _port { get; set; }
public static void Main(string[] args)
{
Console.OutputEncoding = System.Text.Encoding.Unicode;
StartupUtilities.WriteStartupMessage(StartupUtilities.GetRelease(), ConsoleColor.Cyan);
if (!File.Exists("appsettings.json")) {
StartupUtilities.WriteFailure("configuration is missing");
Environment.Exit(1);
}
StartupUtilities.WriteInfo("setting port");
if(args == null || args.Length == 0)
{
_port = 5100;
StartupUtilities.WriteSuccess("port set to " + _port + " (default)");
}
else
{
_port = args[0] == null ? 5100 : Int32.Parse(args[0]);
StartupUtilities.WriteSuccess("port set to " + _port + " (user defined)");
}
StartupUtilities.WriteInfo("starting App");
BuildWebHost().Run();
Console.ResetColor();
}
public static IWebHost BuildWebHost() =>
WebHost.CreateDefaultBuilder()
.UseUrls("http://0.0.0.0:" + _port.ToString() + "/")
.UseStartup<Startup>()
.Build();
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Yio.Utilities;
namespace Yio
{
public class Program
{
private static int _port { get; set; }
public static void Main(string[] args)
{
Console.OutputEncoding = System.Text.Encoding.Unicode;
StartupUtilities.WriteStartupMessage(StartupUtilities.GetRelease(), ConsoleColor.Cyan);
if (!File.Exists("appsettings.json")) {
StartupUtilities.WriteFailure("configuration is missing");
Environment.Exit(1);
}
StartupUtilities.WriteInfo("setting port");
if(args == null || args.Length == 0)
{
_port = 5100;
StartupUtilities.WriteSuccess("port set to " + _port + " (default)");
}
else
{
_port = args[0] == null ? 5100 : Int32.Parse(args[0]);
StartupUtilities.WriteSuccess("port set to " + _port + " (user defined)");
}
StartupUtilities.WriteInfo("starting App");
BuildWebHost(args).Run();
Console.ResetColor();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseUrls("http://0.0.0.0:" + _port.ToString() + "/")
.UseStartup<Startup>()
.Build();
}
}
|
mit
|
C#
|
0b7ca1af9d7c8abe8d6d91c4f4ead083699f9fb6
|
Allow both the Login() and the Logout() methods in the AuthController te be overridden
|
hanssens/ravendb.identity
|
Source/Hanssens.Net.Identity.RavenDb/Controllers/AuthController.cs
|
Source/Hanssens.Net.Identity.RavenDb/Controllers/AuthController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Hanssens.Net.Identity.RavenDb.Models;
using WebMatrix.WebData;
namespace Hanssens.Net.Identity.RavenDb.Controllers
{
/// The AuthController is responsible for logging in and logging off the users.
/// </summary>
[AllowAnonymous]
public class AuthController : Controller
{
[HttpGet]
public virtual ActionResult Login()
{
var model = new Login();
return View(model);
}
[HttpPost]
public virtual ActionResult Login(Login model)
{
if (!ModelState.IsValid) return View("Login", model);
// Verify the provided credentials
var authorized = WebSecurity.Login(model.Username, model.Password, persistCookie: false);
if (!authorized)
{
ModelState.AddModelError("Username", "Authorization_InvalidUsernamePasswordCombination");
return View("Login", model);
}
return Redirect("~/");
}
[Authorize]
public virtual ActionResult Logout()
{
WebSecurity.Logout();
Session.Clear();
return RedirectToAction("Login");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Hanssens.Net.Identity.RavenDb.Models;
using WebMatrix.WebData;
namespace Hanssens.Net.Identity.RavenDb.Controllers
{
/// The AuthController is responsible for logging in and logging off the users.
/// </summary>
[AllowAnonymous]
public class AuthController : Controller
{
[HttpGet]
public ActionResult Login()
{
var model = new Login();
return View(model);
}
[HttpPost]
public ActionResult Login(Login model)
{
if (!ModelState.IsValid) return View("Login", model);
// Verify the provided credentials
var authorized = WebSecurity.Login(model.Username, model.Password, persistCookie: false);
if (!authorized)
{
ModelState.AddModelError("Username", "Authorization_InvalidUsernamePasswordCombination");
return View("Login", model);
}
return Redirect("~/");
}
[Authorize]
public ActionResult Logout()
{
WebSecurity.Logout();
Session.Clear();
return RedirectToAction("Login");
}
}
}
|
mit
|
C#
|
b1ba534d787cda26b61f2a3d2386c6612fcf637f
|
Add content to OK.
|
bigfont/webapi-cors
|
CORS/Controllers/ValuesController.cs
|
CORS/Controllers/ValuesController.cs
|
using System.Collections.Generic;
using System.Web.Http;
using System.Web.Http.Cors;
namespace CORS.Controllers
{
public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "This is a CORS request.", "That works from any origin." };
}
// GET api/values/another
[HttpGet]
[EnableCors(origins:"http://www.bigfont.ca", headers:"*", methods: "*")]
public IEnumerable<string> Another()
{
return new string[] { "This is a CORS request.", "It works only from www.bigfont.ca." };
}
public class EstimateQuery
{
public string username { get; set; }
}
public IHttpActionResult GetTitleEstimate([FromUri] EstimateQuery query)
{
// All the values in "query" are null or zero
// Do some stuff with query if there were anything to do
return Ok("Hello world.");
}
}
}
|
using System.Collections.Generic;
using System.Web.Http;
using System.Web.Http.Cors;
namespace CORS.Controllers
{
public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "This is a CORS request.", "That works from any origin." };
}
// GET api/values/another
[HttpGet]
[EnableCors(origins:"http://www.bigfont.ca", headers:"*", methods: "*")]
public IEnumerable<string> Another()
{
return new string[] { "This is a CORS request.", "It works only from www.bigfont.ca." };
}
public class EstimateQuery
{
public string username { get; set; }
}
public IHttpActionResult GetTitleEstimate([FromUri] EstimateQuery query)
{
// All the values in "query" are null or zero
// Do some stuff with query if there were anything to do
return Ok();
}
}
}
|
mit
|
C#
|
5342e870a6241d5337fd33410b9b6813e3ae383e
|
Add null checks and vigorous tests to PauseManager
|
plrusek/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare,uulltt/NitoriWare,NitorInc/NitoriWare,Barleytree/NitoriWare
|
Assets/Scripts/Stage/PauseManager.cs
|
Assets/Scripts/Stage/PauseManager.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class PauseManager : MonoBehaviour
{
public UnityEvent onPause, onUnPause;
[SerializeField]
private bool enableVigorousTesting;
//Whitelisted items won't be affected by pause
public AudioSource[] audioSourceWhitelist;
public MonoBehaviour[] scriptWhitelist;
private bool paused;
private float timeScale;
private List<AudioSource> pausedAudioSources;
private List<MonoBehaviour> disabledScripts;
private float pauseTimer = 0f;
void Start ()
{
paused = false;
}
void Update ()
{
if (enableVigorousTesting && Input.GetKey(KeyCode.P))
pauseTimer -= Time.fixedDeltaTime;
if (Input.GetKeyDown(KeyCode.Escape) || pauseTimer < 0f)
{
if (!paused)
pause();
else
unPause();
pauseTimer = Random.Range(.1f, .2f);
}
}
void pause()
{
timeScale = Time.timeScale;
Time.timeScale = 0f;
AudioSource[] audioSources = FindObjectsOfType(typeof(AudioSource)) as AudioSource[];
pausedAudioSources = new List<AudioSource>();
List<AudioSource> whitelistedAudioSources = new List<AudioSource>(audioSourceWhitelist);
foreach (AudioSource source in audioSources)
{
if (!whitelistedAudioSources.Remove(source) && source.isPlaying)
{
source.Pause();
pausedAudioSources.Add(source);
}
}
MonoBehaviour[] scripts = FindObjectsOfType(typeof(MonoBehaviour)) as MonoBehaviour[];
disabledScripts = new List<MonoBehaviour>();
List<MonoBehaviour> whitelistedScripts = new List<MonoBehaviour>(scriptWhitelist);
foreach( MonoBehaviour script in scripts)
{
if (!whitelistedScripts.Remove(script) && script.enabled && script != this)
{
script.enabled = false;
disabledScripts.Add(script);
}
}
onPause.Invoke();
if (MicrogameController.instance != null)
MicrogameController.instance.onPause.Invoke();
paused = true;
}
void unPause()
{
Time.timeScale = timeScale;
foreach (AudioSource source in pausedAudioSources)
{
if (source != null)
source.UnPause();
}
foreach (MonoBehaviour script in disabledScripts)
{
if (script != null)
script.enabled = true;
}
onUnPause.Invoke();
if (MicrogameController.instance != null)
MicrogameController.instance.onUnPause.Invoke();
paused = false;
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class PauseManager : MonoBehaviour
{
public UnityEvent onPause, onUnPause;
//Whitelisted items won't be affected by pause
public AudioSource[] audioSourceWhitelist;
public MonoBehaviour[] scriptWhitelist;
private bool paused;
private float timeScale;
private List<AudioSource> pausedAudioSources;
private List<MonoBehaviour> disabledScripts;
void Start ()
{
paused = false;
}
void Update ()
{
if (Input.GetKeyDown(KeyCode.Escape))
if (!paused)
pause();
else
unPause();
}
void pause()
{
timeScale = Time.timeScale;
Time.timeScale = 0f;
AudioSource[] audioSources = FindObjectsOfType(typeof(AudioSource)) as AudioSource[];
pausedAudioSources = new List<AudioSource>();
List<AudioSource> whitelistedAudioSources = new List<AudioSource>(audioSourceWhitelist);
foreach (AudioSource source in audioSources)
{
if (!whitelistedAudioSources.Remove(source) && source.isPlaying)
{
source.Pause();
pausedAudioSources.Add(source);
}
}
MonoBehaviour[] scripts = FindObjectsOfType(typeof(MonoBehaviour)) as MonoBehaviour[];
disabledScripts = new List<MonoBehaviour>();
List<MonoBehaviour> whitelistedScripts = new List<MonoBehaviour>(scriptWhitelist);
foreach( MonoBehaviour script in scripts)
{
if (!whitelistedScripts.Remove(script) && script.enabled && script != this)
{
script.enabled = false;
disabledScripts.Add(script);
}
}
onPause.Invoke();
if (MicrogameController.instance != null)
MicrogameController.instance.onPause.Invoke();
paused = true;
}
void unPause()
{
Time.timeScale = timeScale;
foreach (AudioSource source in pausedAudioSources)
{
source.UnPause();
}
foreach (MonoBehaviour script in disabledScripts)
{
script.enabled = true;
}
onUnPause.Invoke();
if (MicrogameController.instance != null)
MicrogameController.instance.onUnPause.Invoke();
paused = false;
}
}
|
mit
|
C#
|
87db663123d9cce14d6f5d4f4b1b11efc5a282cc
|
Return masterpage file object
|
artokai/PnP-PowerShell,Oaden/PnP-PowerShell,OfficeDev/PnP-PowerShell,pschaeflein/PnP-PowerShell,PieterVeenstra/PnP-PowerShell,iiunknown/PnP-PowerShell,kilasuit/PnP-PowerShell,larray/PowerShell,Segelfeldt/PnP-PowerShell
|
Commands/Publishing/AddMasterPage.cs
|
Commands/Publishing/AddMasterPage.cs
|
using System.Management.Automation;
using Microsoft.SharePoint.Client;
using OfficeDevPnP.PowerShell.CmdletHelpAttributes;
namespace OfficeDevPnP.PowerShell.Commands
{
[Cmdlet(VerbsCommon.Add, "SPOMasterPage")]
[CmdletHelp("Adds a Masterpage",
Category = CmdletHelpCategory.Publishing)]
[CmdletExample(
Code = @"PS:> Add-SPOMasterPage -SourceFilePath ""page.master"" -Title ""MasterPage"" -Description ""MasterPage for Web"" -DestinationFolderHierarchy ""SubFolder""",
Remarks = "Adds a MasterPage to the web",
SortOrder = 1)]
public class AddMasterPage : SPOWebCmdlet
{
[Parameter(Mandatory = true, HelpMessage = "Path to the file which will be uploaded")]
public string SourceFilePath = string.Empty;
[Parameter(Mandatory = true, HelpMessage = "Title for the page layout")]
public string Title = string.Empty;
[Parameter(Mandatory = true, HelpMessage = "Description for the page layout")]
public string Description = string.Empty;
[Parameter(Mandatory = false, HelpMessage = "Folder hierarchy where the MasterPage layouts will be deployed")]
public string DestinationFolderHierarchy;
[Parameter(Mandatory = false, HelpMessage = "UiVersion Masterpage. Default = 15")]
public string UiVersion;
[Parameter(Mandatory = false, HelpMessage = "Default CSS file for MasterPage, this Url is SiteRelative")]
public string DefaultCssFile;
protected override void ExecuteCmdlet()
{
if (!System.IO.Path.IsPathRooted(SourceFilePath))
{
SourceFilePath = System.IO.Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, SourceFilePath);
}
var masterPageFile = SelectedWeb.DeployMasterPage(SourceFilePath, Title, Description, UiVersion, DefaultCssFile, DestinationFolderHierarchy);
WriteObject(masterPageFile);
}
}
}
|
using System.Management.Automation;
using Microsoft.SharePoint.Client;
using OfficeDevPnP.PowerShell.CmdletHelpAttributes;
namespace OfficeDevPnP.PowerShell.Commands
{
[Cmdlet(VerbsCommon.Add, "SPOMasterPage")]
[CmdletHelp("Adds a Masterpage",
Category = CmdletHelpCategory.Publishing)]
[CmdletExample(
Code = @"PS:> Add-SPOMasterPage -SourceFilePath ""page.master"" -Title ""MasterPage"" -Description ""MasterPage for Web"" -DestinationFolderHierarchy ""SubFolder""",
Remarks = "Adds a MasterPage to the web",
SortOrder = 1)]
public class AddMasterPage : SPOWebCmdlet
{
[Parameter(Mandatory = true, HelpMessage = "Path to the file which will be uploaded")]
public string SourceFilePath = string.Empty;
[Parameter(Mandatory = true, HelpMessage = "Title for the page layout")]
public string Title = string.Empty;
[Parameter(Mandatory = true, HelpMessage = "Description for the page layout")]
public string Description = string.Empty;
[Parameter(Mandatory = false, HelpMessage = "Folder hierarchy where the MasterPage layouts will be deployed")]
public string DestinationFolderHierarchy;
[Parameter(Mandatory = false, HelpMessage = "UiVersion Masterpage. Default = 15")]
public string UiVersion;
[Parameter(Mandatory = false, HelpMessage = "Default CSS file for MasterPage, this Url is SiteRelative")]
public string DefaultCssFile;
protected override void ExecuteCmdlet()
{
if (!System.IO.Path.IsPathRooted(SourceFilePath))
{
SourceFilePath = System.IO.Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, SourceFilePath);
}
SelectedWeb.DeployMasterPage(SourceFilePath, Title, Description, UiVersion, DefaultCssFile, DestinationFolderHierarchy);
}
}
}
|
mit
|
C#
|
af4a273aeea37461c35bcc6b02b4b082304d4ed8
|
Fix targeting
|
rsdn/CodeJam
|
CodeJam.Main/DisposableExtensions.cs
|
CodeJam.Main/DisposableExtensions.cs
|
using System;
using System.Collections.Generic;
#if TARGETS_NET || LESSTHAN_NETSTANDARD21 || LESSTHAN_NETCOREAPP30
#else
using System.Threading.Tasks;
#endif
using CodeJam.Internal;
using JetBrains.Annotations;
namespace CodeJam
{
/// <summary>The <see cref="IDisposable"/> extensions.</summary>
[PublicAPI]
public static class DisposableExtensions
{
/// <summary>Invokes the dispose for each item in the <paramref name="disposables"/>.</summary>
/// <param name="disposables">The multiple <see cref="IDisposable"/> instances.</param>
/// <exception cref="AggregateException"></exception>
public static void DisposeAll([NotNull, ItemNotNull, InstantHandle] this IEnumerable<IDisposable> disposables)
{
List<Exception> exceptions = null;
foreach (var item in disposables)
{
try
{
item.Dispose();
}
catch (Exception ex)
{
if (exceptions == null)
exceptions = new List<Exception>();
exceptions.Add(ex);
}
}
if (exceptions != null)
throw new AggregateException(exceptions);
}
/// <summary>Invokes the dispose for each item in the <paramref name="disposables"/>.</summary>
/// <param name="disposables">The multiple <see cref="IDisposable"/> instances.</param>
/// <param name="exceptionHandler">The exception handler.</param>
public static void DisposeAll(
[NotNull, ItemNotNull, InstantHandle] this IEnumerable<IDisposable> disposables,
[NotNull, InstantHandle] Func<Exception, bool> exceptionHandler)
{
foreach (var item in disposables)
{
try
{
item.Dispose();
}
catch (Exception ex) when (exceptionHandler(ex))
{
ex.LogToCodeTraceSourceOnCatch(true);
}
}
}
#if TARGETS_NET || LESSTHAN_NETSTANDARD21 || LESSTHAN_NETCOREAPP30
#else
/// <summary>
/// Calls DisposeAsync if <paramref name="disposable"/> implements <see cref="IAsyncDisposable"/>, otherwise
/// calls <see cref="IDisposable.Dispose"/>
/// </summary>
public static async Task DisposeAsync([NotNull] this IDisposable disposable)
{
Code.NotNull(disposable, nameof(disposable));
if (disposable is IAsyncDisposable asyncDisposable)
await asyncDisposable.DisposeAsync();
else
disposable.Dispose();
}
#endif
}
}
|
using System;
using System.Collections.Generic;
#if (TARGETS_NETSTANDARD && !LESSTHAN_NETSTANDARD21) || (TARGETS_NETCOREAPP && !LESSTHAN_NETCOREAPP30)
using System.Threading.Tasks;
#endif
using CodeJam.Internal;
using JetBrains.Annotations;
namespace CodeJam
{
/// <summary>The <see cref="IDisposable"/> extensions.</summary>
[PublicAPI]
public static class DisposableExtensions
{
/// <summary>Invokes the dispose for each item in the <paramref name="disposables"/>.</summary>
/// <param name="disposables">The multiple <see cref="IDisposable"/> instances.</param>
/// <exception cref="AggregateException"></exception>
public static void DisposeAll([NotNull, ItemNotNull, InstantHandle] this IEnumerable<IDisposable> disposables)
{
List<Exception> exceptions = null;
foreach (var item in disposables)
{
try
{
item.Dispose();
}
catch (Exception ex)
{
if (exceptions == null)
exceptions = new List<Exception>();
exceptions.Add(ex);
}
}
if (exceptions != null)
throw new AggregateException(exceptions);
}
/// <summary>Invokes the dispose for each item in the <paramref name="disposables"/>.</summary>
/// <param name="disposables">The multiple <see cref="IDisposable"/> instances.</param>
/// <param name="exceptionHandler">The exception handler.</param>
public static void DisposeAll(
[NotNull, ItemNotNull, InstantHandle] this IEnumerable<IDisposable> disposables,
[NotNull, InstantHandle] Func<Exception, bool> exceptionHandler)
{
foreach (var item in disposables)
{
try
{
item.Dispose();
}
catch (Exception ex) when (exceptionHandler(ex))
{
ex.LogToCodeTraceSourceOnCatch(true);
}
}
}
#if (TARGETS_NETSTANDARD && !LESSTHAN_NETSTANDARD21) || (TARGETS_NETCOREAPP && !LESSTHAN_NETCOREAPP30)
/// <summary>
/// Calls DisposeAsync if <paramref name="disposable"/> implements <see cref="IAsyncDisposable"/>, otherwise
/// calls <see cref="IDisposable.Dispose"/>
/// </summary>
public static async Task DisposeAsync([NotNull] this IDisposable disposable)
{
Code.NotNull(disposable, nameof(disposable));
if (disposable is IAsyncDisposable asyncDisposable)
await asyncDisposable.DisposeAsync();
else
disposable.Dispose();
}
#endif
}
}
|
mit
|
C#
|
aa0e1e41965c3b51fb6a59ce0f8776705fe1cfae
|
Bump version.
|
evgeny-myasishchev/mvc-respond-to
|
RespondTo/Properties/AssemblyInfo.cs
|
RespondTo/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("Mvc.RespondTo")]
[assembly: AssemblyDescription("Provides RoR like respond_to functionality to your ASP.NET MVC controller actions.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RespondTo")]
[assembly: AssemblyCopyright("Copyright © Evgeny Myasishchev 2012")]
[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("5d92e0e7-4aea-43bf-b055-98735d423238")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.1")]
[assembly: AssemblyFileVersion("1.0.1.1")]
|
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("Mvc.RespondTo")]
[assembly: AssemblyDescription("Provides RoR like respond_to functionality to your ASP.NET MVC controller actions.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RespondTo")]
[assembly: AssemblyCopyright("Copyright © Evgeny Myasishchev 2012")]
[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("5d92e0e7-4aea-43bf-b055-98735d423238")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
|
mit
|
C#
|
8b9738875e7494b8b3a9d2ee3eb825b50e82629a
|
Make fax test working
|
ringcentral/ringcentral-csharp
|
RingCentral.Test.Real/MessageTest.cs
|
RingCentral.Test.Real/MessageTest.cs
|
using Newtonsoft.Json;
using NUnit.Framework;
using RingCentral.Http;
using System.Collections.Generic;
namespace RingCentral.Test.Real
{
[TestFixture]
class MessageTest : BaseTest
{
[Test]
public void SMS()
{
var subject = "hello world";
var requestBody = new {
text = subject,
from = new { phoneNumber = Config.Instance.Username },
to = new object[] { new { phoneNumber = Config.Instance.Receiver } }
};
var request = new Request("/restapi/v1.0/account/~/extension/~/sms", JsonConvert.SerializeObject(requestBody));
var response = sdk.Platform.Post(request);
Assert.AreEqual(subject, response.Json["subject"].ToString());
Assert.AreEqual("Outbound", response.Json["direction"].ToString());
Assert.AreEqual("Sent", response.Json["messageStatus"].ToString());
}
[Test]
public void Fax()
{
var requestBody = JsonConvert.SerializeObject(new
{
faxResolution = "High",
coverIndex = 0,
to = new object[] { new { phoneNumber = Config.Instance.Receiver } }
});
var attachments = new List<Attachment>();
var textBytes = System.Text.Encoding.UTF8.GetBytes("hello fax");
var attachment = new Attachment(@"test.txt", "application/octet-stream", textBytes);
attachments.Add(attachment);
var request = new Request("/restapi/v1.0/account/~/extension/~/fax", requestBody, attachments);
var body = request.HttpContent;
Assert.NotNull(body);
var response = sdk.Platform.Post(request);
Assert.AreEqual(true, response.OK);
}
}
}
|
using Newtonsoft.Json;
using NUnit.Framework;
using RingCentral.Http;
using System.Collections.Generic;
namespace RingCentral.Test.Real
{
[TestFixture]
class MessageTest : BaseTest
{
[Test]
public void SMS()
{
var subject = "hello world";
var requestBody = new {
text = subject,
from = new { phoneNumber = Config.Instance.Username },
to = new object[] { new { phoneNumber = Config.Instance.Receiver } }
};
var request = new Http.Request("/restapi/v1.0/account/~/extension/~/sms", JsonConvert.SerializeObject(requestBody));
var response = sdk.Platform.Post(request);
Assert.AreEqual(subject, response.Json["subject"].ToString());
Assert.AreEqual("Outbound", response.Json["direction"].ToString());
Assert.AreEqual("Sent", response.Json["messageStatus"].ToString());
}
[Test]
public void Fax()
{
//var requestBody = JsonConvert.SerializeObject(new
//{
// resolution = "High",
// //coverIndex = 0,
// to = new object[] { new { phoneNumber = Config.Instance.Receiver } }
//});
var requestBody = "{\"resolution\": \"High\", \"to\":[{\"phoneNumber\": \"" + Config.Instance.Receiver + "\"}]}";
var attachments = new List<Attachment>();
var textBytes = System.Text.Encoding.UTF8.GetBytes("hello fax");
var attachment = new Attachment(@"test.txt", "application/octet-stream", textBytes);
attachments.Add(attachment);
var attachment2 = new Attachment(@"test2.txt", "text/plain", textBytes);
attachments.Add(attachment2);
var request = new Request("/restapi/v1.0/account/~/extension/~/fax", requestBody, attachments);
//var body = request.HttpContent;
//Assert.NotNull(body);
var response = sdk.Platform.Post(request);
Assert.AreEqual(true, response.OK);
}
}
}
|
mit
|
C#
|
5108c25fd2bec05e809cf5dff9ddbabd1e262756
|
Use IOwinContext in to pass Request.CallCancelled to repository
|
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
|
Apps/BitChangeSetManager/AspNet/Api/Implementations/BitChangeSetManagerAppMessageHubEvents.cs
|
Apps/BitChangeSetManager/AspNet/Api/Implementations/BitChangeSetManagerAppMessageHubEvents.cs
|
using Bit.Signalr;
using Bit.Signalr.Implementations;
using BitChangeSetManager.DataAccess.Contracts;
using BitChangeSetManager.Model;
using Microsoft.Owin;
using System;
using System.Threading.Tasks;
namespace BitChangeSetManager.Api.Implementations
{
public class BitChangeSetManagerAppMessageHubEvents : DefaultMessageHubEvents
{
public virtual IBitChangeSetManagerRepository<User> UsersRepository { get; set; }
public virtual IOwinContext OwinContext { get; set; }
public override async Task OnConnected(MessagesHub hub)
{
User user = await UsersRepository.GetByIdAsync(OwinContext.Request.CallCancelled, Guid.Parse(UserInformationProvider.GetCurrentUserId()));
await hub.Groups.Add(hub.Context.ConnectionId, user.Culture.ToString());
await base.OnConnected(hub);
}
}
}
|
using Bit.Signalr;
using Bit.Signalr.Implementations;
using BitChangeSetManager.DataAccess;
using BitChangeSetManager.Model;
using System;
using System.Threading;
using System.Threading.Tasks;
using Bit.Data.Contracts;
using BitChangeSetManager.DataAccess.Contracts;
namespace BitChangeSetManager.Api.Implementations
{
public class BitChangeSetManagerAppMessageHubEvents : DefaultMessageHubEvents
{
public virtual IBitChangeSetManagerRepository<User> UsersRepository { get; set; }
public override async Task OnConnected(MessagesHub hub)
{
User user = await UsersRepository.GetByIdAsync(CancellationToken.None, Guid.Parse(UserInformationProvider.GetCurrentUserId()));
await hub.Groups.Add(hub.Context.ConnectionId, user.Culture.ToString());
await base.OnConnected(hub);
}
}
}
|
mit
|
C#
|
3d60906aae3969eb77d40053ae802b5271963585
|
Fix removal of code block space indent for pre with parent div
|
mysticmind/reversemarkdown-net
|
src/ReverseMarkdown/Converters/Div.cs
|
src/ReverseMarkdown/Converters/Div.cs
|
using System;
using HtmlAgilityPack;
namespace ReverseMarkdown.Converters
{
public class Div : ConverterBase
{
public Div(Converter converter) : base(converter)
{
Converter.Register("div", this);
}
public override string Convert(HtmlNode node)
{
var content = TreatChildren(node).Trim();
// if child is a pre tag then Trim in the above step removes the 4 spaces for code block
if (node.ChildNodes.Count > 0 && node.FirstChild.Name == "pre" && !Converter.Config.GithubFlavored)
{
content = $" {content}";
}
return $"{(Td.FirstNodeWithinCell(node) ? "" : Environment.NewLine)}{content}{(Td.LastNodeWithinCell(node) ? "" : Environment.NewLine)}";
}
}
}
|
using System;
using HtmlAgilityPack;
namespace ReverseMarkdown.Converters
{
public class Div : ConverterBase
{
public Div(Converter converter) : base(converter)
{
Converter.Register("div", this);
}
public override string Convert(HtmlNode node)
{
return $"{(Td.FirstNodeWithinCell(node) ? "" : Environment.NewLine)}{TreatChildren(node).Trim()}{(Td.LastNodeWithinCell(node) ? "" : Environment.NewLine)}";
}
}
}
|
mit
|
C#
|
30c8d49ab7588ff55d8674517896c0e04b4d9f04
|
load all entries for now
|
redmanmale/ReverseGeocoder
|
GeoSharp/ReverseGeoCode.cs
|
GeoSharp/ReverseGeoCode.cs
|
using GeoSharp.KDTree;
using System.Collections.Generic;
using System.IO;
//All the geocoding data can be gotten from: http://download.geonames.org/export/dump/
namespace GeoSharp
{
/*
* Hmmm, might be nice to get in a simple version that does country->regoin/province->district/municipality/prefecture
* probably with a nice BVH using a decemated representation from OSM
*/
public class ReverseGeoCode
{
private KDTree<GeoName> Tree;
public ReverseGeoCode(string Database, bool MajorPlacesOnly)
{
using(var db = new FileStream(Database,FileMode.Open))
{
Initialize(db, MajorPlacesOnly);
}
}
public ReverseGeoCode(Stream Input, bool MajorPlacesOnly)
{
Initialize(Input, MajorPlacesOnly);
}
public string NearestPlaceName(double Latitude, double Longitude)
{
return Tree.FindNearest(new GeoName(Latitude, Longitude)).Name;
}
public GeoName NearestPlace(double Latitude, double Longitude)
{
return Tree.FindNearest(new GeoName(Latitude, Longitude));
}
private void Initialize(Stream Input, bool MajorPlacesOnly)
{
List<GeoName> Places = new List<GeoName>();
using (StreamReader db = new StreamReader(Input))
{
string Line;
while (!db.EndOfStream && (Line = db.ReadLine()) != null)
{
var Place = new GeoName(Line);
Places.Add(Place);
}
}
Tree = new KDTree<GeoName>(Places.ToArray());
}
}
}
|
using GeoSharp.KDTree;
using System.Collections.Generic;
using System.IO;
//All the geocoding data can be gotten from: http://download.geonames.org/export/dump/
namespace GeoSharp
{
/*
* Hmmm, might be nice to get in a simple version that does country->regoin/province->district/municipality/prefecture
* probably with a nice BVH using a decemated representation from OSM
*/
public class ReverseGeoCode
{
private KDTree<GeoName> Tree;
public ReverseGeoCode(string Database, bool MajorPlacesOnly)
{
using(var db = new FileStream(Database,FileMode.Open))
{
Initialize(db, MajorPlacesOnly);
}
}
public ReverseGeoCode(Stream Input, bool MajorPlacesOnly)
{
Initialize(Input, MajorPlacesOnly);
}
public string NearestPlaceName(double Latitude, double Longitude)
{
return Tree.FindNearest(new GeoName(Latitude, Longitude)).Name;
}
public GeoName NearestPlace(double Latitude, double Longitude)
{
return Tree.FindNearest(new GeoName(Latitude, Longitude));
}
private void Initialize(Stream Input, bool MajorPlacesOnly)
{
List<GeoName> Places = new List<GeoName>();
using (StreamReader db = new StreamReader(Input))
{
string Line;
while (!db.EndOfStream && (Line = db.ReadLine()) != null)
{
var Place = new GeoName(Line);
if (!MajorPlacesOnly || Place.FeatureClass != GeoFeatureClass.City)
Places.Add(Place);
}
}
Tree = new KDTree<GeoName>(Places.ToArray());
}
}
}
|
mit
|
C#
|
a2c5365bb6971b4da2ce21df137bc7ba413247c8
|
fix compilation for latest Rider sources
|
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
|
src/resharper-unity/Psi/Resolve/UnityEventFunctionReferenceProviderFactory.cs
|
src/resharper-unity/Psi/Resolve/UnityEventFunctionReferenceProviderFactory.cs
|
using System;
using JetBrains.DataFlow;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Caches;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.Resolve;
using JetBrains.ReSharper.Psi.Tree;
namespace JetBrains.ReSharper.Plugins.Unity.Psi.Resolve
{
[ReferenceProviderFactory]
public class UnityEventFunctionReferenceProviderFactory : IReferenceProviderFactory
{
#if RIDER
public UnityEventFunctionReferenceProviderFactory(Lifetime lifetime)
{
Changed = new Signal<IReferenceProviderFactory>(lifetime, GetType().FullName);
}
#endif
#if RIDER
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file, IWordIndex wordIndexForChecks)
#else
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file)
#endif
{
var project = sourceFile.GetProject();
if (project == null || !project.IsUnityProject())
return null;
if (sourceFile.PrimaryPsiLanguage.Is<CSharpLanguage>())
return new UnityEventFunctionReferenceFactory();
return null;
}
#if RIDER
public ISignal<IReferenceProviderFactory> Changed { get; private set; }
#else
public event Action OnChanged;
#endif
}
}
|
using System;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.Resolve;
using JetBrains.ReSharper.Psi.Tree;
namespace JetBrains.ReSharper.Plugins.Unity.Psi.Resolve
{
[ReferenceProviderFactory]
public class UnityEventFunctionReferenceProviderFactory : IReferenceProviderFactory
{
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file)
{
var project = sourceFile.GetProject();
if (project == null || !project.IsUnityProject())
return null;
if (sourceFile.PrimaryPsiLanguage.Is<CSharpLanguage>())
return new UnityEventFunctionReferenceFactory();
return null;
}
public event Action OnChanged;
}
}
|
apache-2.0
|
C#
|
4044aa81eb2f81f442a9243e24b4604ad1c178b3
|
Support src property
|
jcmoyer/Yeena
|
Yeena/PathOfExile/PoEStashTabInfo.cs
|
Yeena/PathOfExile/PoEStashTabInfo.cs
|
// Copyright 2013 J.C. Moyer
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using Newtonsoft.Json;
namespace Yeena.PathOfExile {
[JsonObject]
class PoEStashTabInfo {
[JsonProperty("n")] private readonly string _name;
[JsonProperty("i")] private readonly int _index;
// colour { r, g, b }
[JsonProperty("src")] private readonly string _src;
public string Name {
get { return _name; }
}
public int Index {
get { return _index; }
}
/// <summary>
/// Returns a fully qualified Uri that can be used to access the associated tab's
/// display bitmap. This is the same image displayed on the site's stash browser.
/// </summary>
public Uri ImageUri {
get { return new Uri(PoESite.Uri, _src); }
}
public override string ToString() {
return _name;
}
}
}
|
// Copyright 2013 J.C. Moyer
//
// 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 Newtonsoft.Json;
namespace Yeena.PathOfExile {
[JsonObject]
class PoEStashTabInfo {
[JsonProperty("n")] private readonly string _name;
[JsonProperty("i")] private readonly int _index;
// colour { r, g, b }
// src
public string Name {
get { return _name; }
}
public int Index {
get { return _index; }
}
public override string ToString() {
return _name;
}
}
}
|
apache-2.0
|
C#
|
05252900105993663ed3c073eec15f70539f1598
|
Add Position and Size properties to Rectanclei
|
rhynodegreat/CSharpGameLibrary,rhynodegreat/CSharpGameLibrary,vazgriz/CSharpGameLibrary,vazgriz/CSharpGameLibrary
|
CSharpGameLibrary/Math/Rectanglei.cs
|
CSharpGameLibrary/Math/Rectanglei.cs
|
using System;
using System.Numerics;
namespace CSGL.Math {
public struct Rectanglei {
public int X { get; set; }
public int Y { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public Rectanglei(int x, int y, int width, int height) {
X = x;
Y = y;
Width = width;
Height = height;
}
public Rectanglei(Rectangle rect) {
X = (int)rect.X;
Y = (int)rect.Y;
Width = (int)rect.Width;
Height = (int)rect.Height;
}
public Vector2i Position {
get {
return new Vector2i(X, Y);
}
set {
X = value.X;
Y = value.Y;
}
}
public Vector2i Size {
get {
return new Vector2i(Width, Height);
}
set {
Width = value.X;
Height = value.Y;
}
}
public float Top {
get {
return Y;
}
}
public float Bottom {
get {
return Y + Height;
}
}
public float Left {
get {
return X;
}
}
public float Right {
get {
return X + Width;
}
}
public bool Intersects(Rectanglei other) {
return (X < other.X + other.Width) &&
(X + Width > other.X) &&
(Y < other.Y + other.Height) &&
(Y + Height > other.Y);
}
public bool Intersects(Rectangle other) {
var thisf = new Rectangle(this);
return thisf.Intersects(other);
}
}
}
|
using System;
using System.Numerics;
namespace CSGL.Math {
public struct Rectanglei {
public int X { get; set; }
public int Y { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public Rectanglei(int x, int y, int width, int height) {
X = x;
Y = y;
Width = width;
Height = height;
}
public Rectanglei(Rectangle rect) {
X = (int)rect.X;
Y = (int)rect.Y;
Width = (int)rect.Width;
Height = (int)rect.Height;
}
//public Vector2i
public float Top {
get {
return Y;
}
}
public float Bottom {
get {
return Y + Height;
}
}
public float Left {
get {
return X;
}
}
public float Right {
get {
return X + Width;
}
}
public bool Intersects(Rectanglei other) {
return (X < other.X + other.Width) &&
(X + Width > other.X) &&
(Y < other.Y + other.Height) &&
(Y + Height > other.Y);
}
public bool Intersects(Rectangle other) {
var thisf = new Rectangle(this);
return thisf.Intersects(other);
}
}
}
|
mit
|
C#
|
4add1727b7458b9e36584fafdb753793c41ee447
|
Fix hitsounds not updating immediately after switching skins
|
ppy/osu,peppy/osu,ZLima12/osu,peppy/osu-new,EVAST9919/osu,NeoAdonis/osu,2yangk23/osu,peppy/osu,UselessToucan/osu,johnneijzen/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,johnneijzen/osu,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,ZLima12/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu
|
osu.Game/Skinning/SkinnableSound.cs
|
osu.Game/Skinning/SkinnableSound.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Audio;
namespace osu.Game.Skinning
{
public class SkinnableSound : SkinReloadableDrawable
{
private readonly ISampleInfo[] hitSamples;
private SampleChannel[] channels;
private AudioManager audio;
public SkinnableSound(IEnumerable<ISampleInfo> hitSamples)
{
this.hitSamples = hitSamples.ToArray();
}
public SkinnableSound(ISampleInfo hitSamples)
{
this.hitSamples = new[] { hitSamples };
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
this.audio = audio;
}
public void Play() => channels?.ForEach(c => c.Play());
public override bool IsPresent => Scheduler.HasPendingTasks;
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
{
channels = hitSamples.Select(s =>
{
var ch = loadChannel(s, skin.GetSample);
if (ch == null && allowFallback)
ch = loadChannel(s, audio.Samples.Get);
return ch;
}).Where(c => c != null).ToArray();
}
private SampleChannel loadChannel(ISampleInfo info, Func<string, SampleChannel> getSampleFunction)
{
foreach (var lookup in info.LookupNames)
{
var ch = getSampleFunction($"Gameplay/{lookup}");
if (ch == null)
continue;
ch.Volume.Value = info.Volume / 100.0;
return ch;
}
return null;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
foreach (var c in channels)
c.Dispose();
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Audio;
namespace osu.Game.Skinning
{
public class SkinnableSound : SkinReloadableDrawable
{
private readonly ISampleInfo[] hitSamples;
private SampleChannel[] channels;
private AudioManager audio;
public SkinnableSound(IEnumerable<ISampleInfo> hitSamples)
{
this.hitSamples = hitSamples.ToArray();
}
public SkinnableSound(ISampleInfo hitSamples)
{
this.hitSamples = new[] { hitSamples };
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
this.audio = audio;
}
public void Play() => channels?.ForEach(c => c.Play());
public override bool IsPresent => false; // We don't need to receive updates.
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
{
channels = hitSamples.Select(s =>
{
var ch = loadChannel(s, skin.GetSample);
if (ch == null && allowFallback)
ch = loadChannel(s, audio.Samples.Get);
return ch;
}).Where(c => c != null).ToArray();
}
private SampleChannel loadChannel(ISampleInfo info, Func<string, SampleChannel> getSampleFunction)
{
foreach (var lookup in info.LookupNames)
{
var ch = getSampleFunction($"Gameplay/{lookup}");
if (ch == null)
continue;
ch.Volume.Value = info.Volume / 100.0;
return ch;
}
return null;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
foreach (var c in channels)
c.Dispose();
}
}
}
|
mit
|
C#
|
69e62b3289b1012bf9ef0d2f28467db0980cbde6
|
fix IsValid
|
BigBabay/AsyncConverter,BigBabay/AsyncConverter
|
AsyncConverter/Highlightings/AsyncWaitHighlighting.cs
|
AsyncConverter/Highlightings/AsyncWaitHighlighting.cs
|
using AsyncConverter.Highlightings;
using AsyncConverter.Settings;
using JetBrains.Annotations;
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
[assembly: RegisterConfigurableSeverity(AsyncWaitHighlighting.SeverityId, null, AsyncConverterGroupSettings.Id, "Use async wait instead sync wait.", "Use async wait instead sync wait.", Severity.ERROR)]
namespace AsyncConverter.Highlightings
{
[ConfigurableSeverityHighlighting(SeverityId, CSharpLanguage.Name)]
public class AsyncWaitHighlighting : IHighlighting
{
public IInvocationExpression InvocationExpression { get; }
public IReferenceExpression ReferenceExpression { get; }
public const string SeverityId = "AsyncConverter.AsyncWait";
public AsyncWaitHighlighting([NotNull] IReferenceExpression referenceExpression)
{
ReferenceExpression = referenceExpression;
}
public AsyncWaitHighlighting([NotNull] IInvocationExpression invocationExpression)
{
InvocationExpression = invocationExpression;
}
public bool IsValid() => ReferenceExpression?.IsValid() ?? InvocationExpression.IsValid();
public DocumentRange CalculateRange() => ReferenceExpression?.GetDocumentRange() ?? InvocationExpression.GetDocumentRange();
public string ToolTip => "Use async wait instead sync wait.";
public string ErrorStripeToolTip => "Use async wait.";
}
}
|
using AsyncConverter.Highlightings;
using AsyncConverter.Settings;
using JetBrains.Annotations;
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
[assembly: RegisterConfigurableSeverity(AsyncWaitHighlighting.SeverityId, null, AsyncConverterGroupSettings.Id, "Use async wait instead sync wait.", "Use async wait instead sync wait.", Severity.ERROR)]
namespace AsyncConverter.Highlightings
{
[ConfigurableSeverityHighlighting(SeverityId, CSharpLanguage.Name)]
public class AsyncWaitHighlighting : IHighlighting
{
public IInvocationExpression InvocationExpression { get; }
public IReferenceExpression ReferenceExpression { get; }
public const string SeverityId = "AsyncConverter.AsyncWait";
public AsyncWaitHighlighting([NotNull] IReferenceExpression referenceExpression)
{
ReferenceExpression = referenceExpression;
}
public AsyncWaitHighlighting([NotNull] IInvocationExpression invocationExpression)
{
InvocationExpression = invocationExpression;
}
public bool IsValid() => ReferenceExpression.IsValid();
public DocumentRange CalculateRange() => ReferenceExpression?.GetDocumentRange() ?? InvocationExpression.GetDocumentRange();
public string ToolTip => "Use async wait instead sync wait.";
public string ErrorStripeToolTip => "Use async wait.";
}
}
|
mit
|
C#
|
8b4fca2888da6b3a27ba71ecb1870a5d1d4b6d48
|
Fix bug: When using MailChimpManager Memmbers AddOrUpdateAsync method with a non empty List<MarketingPermissionText>() e.g List<MarketingPermissionText>() {MarketingPermissionText.Email, MarketingPermissionText.CustomizedOnlineAdvertising} the library errors with The given key was not present in the dictionary. (#418)
|
brandonseydel/MailChimp.Net
|
MailChimp.Net/Models/MarketingPermissionText.cs
|
MailChimp.Net/Models/MarketingPermissionText.cs
|
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
namespace MailChimp.Net.Models
{
public enum MarketingPermissionText
{
Email,
DirectMail,
CustomizedOnlineAdvertising
}
public static class MarketingPermissionTextHelpers
{
public static Dictionary<string, MarketingPermissionText> GetMarketingPermissions()
{
var dictionary = new Dictionary<string, MarketingPermissionText>(StringComparer.CurrentCultureIgnoreCase);
var regex = new Regex(@"
(?<=[A-Z])(?=[A-Z][a-z]) |
(?<=[^A-Z])(?=[A-Z]) |
(?<=[A-Za-z])(?=[^A-Za-z])", RegexOptions.IgnorePatternWhitespace);
foreach (MarketingPermissionText marketingPermissionText in Enum.GetValues(typeof(MarketingPermissionText)))
{
dictionary.Add(regex.Replace(marketingPermissionText.ToString(), " "), marketingPermissionText);
}
return dictionary;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
namespace MailChimp.Net.Models
{
public enum MarketingPermissionText
{
Email,
DirectMail,
CustomizedOnlineAdvertising
}
public static class MarketingPermissionTextHelpers
{
public static Dictionary<string, MarketingPermissionText> GetMarketingPermissions()
{
var dictionary = new Dictionary<string, MarketingPermissionText>();
var regex = new Regex(@"
(?<=[A-Z])(?=[A-Z][a-z]) |
(?<=[^A-Z])(?=[A-Z]) |
(?<=[A-Za-z])(?=[^A-Za-z])", RegexOptions.IgnorePatternWhitespace);
foreach (MarketingPermissionText marketingPermissionText in Enum.GetValues(typeof(MarketingPermissionText)))
{
dictionary.Add(regex.Replace(marketingPermissionText.ToString(), " "), marketingPermissionText);
}
return dictionary;
}
}
}
|
mit
|
C#
|
f93da423566c71304226196d3c2f3049aca68bba
|
Add Ascending bool to QueryOrder
|
GNOME/hyena,dufoli/hyena,dufoli/hyena,arfbtwn/hyena,arfbtwn/hyena,GNOME/hyena
|
Hyena/Hyena.Query/QueryOrder.cs
|
Hyena/Hyena.Query/QueryOrder.cs
|
//
// QueryOrder.cs
//
// Authors:
// Gabriel Burt <gburt@novell.com>
// Aaron Bockover <abockover@novell.com>
//
// Copyright (C) 2007-2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Text;
using System.Collections.Generic;
namespace Hyena.Query
{
public class QueryOrder
{
public string Name { get; private set; }
public string Label { get; private set; }
public string OrderSql { get; private set; }
public QueryField Field { get; private set; }
public bool Ascending { get; private set; }
public QueryOrder (string name, string label, string order_sql, QueryField field, bool asc)
{
Name = name;
Label = label;
OrderSql = order_sql;
Field = field;
Ascending = asc;
}
public string ToSql ()
{
return String.Format ("ORDER BY {0}", OrderSql);
}
}
}
|
//
// QueryOrder.cs
//
// Authors:
// Gabriel Burt <gburt@novell.com>
// Aaron Bockover <abockover@novell.com>
//
// Copyright (C) 2007-2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Text;
using System.Collections.Generic;
namespace Hyena.Query
{
public class QueryOrder
{
private string name;
public string Name {
get { return name; }
}
private string label;
public string Label {
get { return label; }
set { label = value; }
}
private string order_sql;
public string OrderSql {
get { return order_sql; }
}
private QueryField field;
public QueryField Field {
get { return field; }
}
public QueryOrder (string name, string label, string order_sql, QueryField field)
{
this.name = name;
this.label = label;
this.order_sql = order_sql;
this.field = field;
}
public string ToSql ()
{
return String.Format ("ORDER BY {0}", order_sql);
}
}
}
|
mit
|
C#
|
70f0b72a330370da7f8b2b2f521a21296812f4eb
|
Update BoolToVisibilityConverter.cs (#93)
|
randigtroja/Flashback
|
Flashback.Uwp/Converters/BoolToVisibilityConverter.cs
|
Flashback.Uwp/Converters/BoolToVisibilityConverter.cs
|
using System;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
namespace FlashbackUwp.Converters
{
public class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
var flag = false;
if (value is bool)
{
flag = (bool)value;
}
else if (value is bool?)
{
var nullable = (bool?)value;
flag = nullable.GetValueOrDefault();
}
if (parameter != null)
{
if (bool.Parse((string)parameter))
{
flag = !flag;
}
}
return flag ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}
|
using System;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
namespace FlashbackUwp.Converters
{
public class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
var flag = false;
if (value is bool)
{
flag = (bool)value;
}
else if (value is bool?)
{
var nullable = (bool?)value;
flag = nullable.GetValueOrDefault();
}
if (parameter != null)
{
if (bool.Parse((string)parameter))
{
flag = !flag;
}
}
if (flag)
{
return Visibility.Visible;
}
else
{
return Visibility.Collapsed;
}
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
33a99eead3e7b12cb54f5e8c6ed2b6df941f081e
|
Update DriverFactory.cs
|
ThebeRising/myTestGit
|
Implementation/DriverFactory.cs
|
Implementation/DriverFactory.cs
|
using System;
using Gauge.CSharp.Lib.Attribute;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.ChromeDriver;
namespace Gauge.Example.Implementation
{
public class DriverFactory
{
public static IWebDriver Driver { get; private set; }
[BeforeSuite]
public void Setup() {
bool useIe;
bool.TryParse(Environment.GetEnvironmentVariable("USE_IE"), out useIe);
if (useIe)
{
Driver=new InternetExplorerDriver();
}
else
{
Driver =new ChromeDriver();
}
}
[AfterSuite]
public void TearDown() {
Driver.Close();
}
}
}
|
using System;
using Gauge.CSharp.Lib.Attribute;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.IE;
namespace Gauge.Example.Implementation
{
public class DriverFactory
{
public static IWebDriver Driver { get; private set; }
[BeforeSuite]
public void Setup() {
bool useIe;
bool.TryParse(Environment.GetEnvironmentVariable("USE_IE"), out useIe);
if (useIe)
{
Driver=new InternetExplorerDriver();
}
else
{
Driver =new FirefoxDriver();
}
}
[AfterSuite]
public void TearDown() {
Driver.Close();
}
}
}
|
apache-2.0
|
C#
|
c7a1553fdfea4bab68065614a65bd4bc20ac6395
|
Move some common test setup code into the test class constructor
|
jasonmalinowski/directoryhash
|
DirectoryHashTests/RecomputeTests.cs
|
DirectoryHashTests/RecomputeTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace DirectoryHash.Tests
{
public class RecomputeTests : IDisposable
{
private readonly TemporaryDirectory temporaryDirectory = new TemporaryDirectory();
void IDisposable.Dispose()
{
temporaryDirectory.Dispose();
}
[Fact]
public void RecomputeOnEmptyDirectory()
{
temporaryDirectory.Run("recompute");
var hashes = HashesXmlFile.ReadFrom(temporaryDirectory.Directory);
Assert.Empty(hashes.HashedDirectory.Directories);
Assert.Empty(hashes.HashedDirectory.Files);
}
[Fact]
public void RecomputeUpdatesTimeStamp()
{
var timeRange = DateTimeRange.CreateSurrounding(
() => temporaryDirectory.Run("recompute"));
var hashes = HashesXmlFile.ReadFrom(temporaryDirectory.Directory);
timeRange.AssertContains(hashes.UpdateTime);
}
[Fact]
public void RecomputeWithFile()
{
var file = temporaryDirectory.CreateFileWithContent("Fox", Encoding.ASCII.GetBytes("The quick brown fox jumps over the lazy dog."));
temporaryDirectory.Run("recompute");
var hashes = HashesXmlFile.ReadFrom(temporaryDirectory.Directory);
var rehashedFile = HashedFile.FromFile(file);
Assert.Equal(rehashedFile, hashes.HashedDirectory.Files["Fox"]);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace DirectoryHash.Tests
{
public class RecomputeTests
{
[Fact]
public void RecomputeOnEmptyDirectory()
{
using (var temporaryDirectory = new TemporaryDirectory())
{
temporaryDirectory.Run("recompute");
var hashes = HashesXmlFile.ReadFrom(temporaryDirectory.Directory);
Assert.Empty(hashes.HashedDirectory.Directories);
Assert.Empty(hashes.HashedDirectory.Files);
}
}
[Fact]
public void RecomputeUpdatesTimeStamp()
{
using (var temporaryDirectory = new TemporaryDirectory())
{
var timeRange = DateTimeRange.CreateSurrounding(
() => temporaryDirectory.Run("recompute"));
var hashes = HashesXmlFile.ReadFrom(temporaryDirectory.Directory);
timeRange.AssertContains(hashes.UpdateTime);
}
}
[Fact]
public void RecomputeWithFile()
{
using (var temporaryDirectory = new TemporaryDirectory())
{
var file = temporaryDirectory.CreateFileWithContent("Fox", Encoding.ASCII.GetBytes("The quick brown fox jumps over the lazy dog."));
temporaryDirectory.Run("recompute");
var hashes = HashesXmlFile.ReadFrom(temporaryDirectory.Directory);
var rehashedFile = HashedFile.FromFile(file);
Assert.Equal(rehashedFile, hashes.HashedDirectory.Files["Fox"]);
}
}
}
}
|
mit
|
C#
|
621968c1fe8ed34c8d8fb39261897fe5138872de
|
Fix signature
|
cwensley/maccore,jorik041/maccore,mono/maccore
|
src/ObjCRuntime/NSStringMarshal.cs
|
src/ObjCRuntime/NSStringMarshal.cs
|
using System.Runtime.InteropServices;
using System;
using MonoMac.Foundation;
namespace MonoMac.ObjCRuntime {
[StructLayout (LayoutKind.Sequential)]
public unsafe struct NSStringStruct {
public IntPtr ClassPtr;
public int Flags;
public char *UnicodePtr;
public int Length;
// The class pointer that we picked at runtime
public readonly static IntPtr ReferencePtr;
static NSStringStruct ()
{
using (var k = new NSString (""))
ReferencePtr = Marshal.ReadIntPtr (k.Handle);
}
}
}
|
using System.Runtime.InteropServices;
using System;
using MonoMac.Foundation;
namespace MonoMac.ObjCRuntime {
public unsafe struct NSStringStruct {
public IntPtr ClassPtr;
public int Flags;
public char *UnicodePtr;
public int Length;
// The class pointer that we picked at runtime
public readonly static IntPtr ReferencePtr;
static NSStringStruct ()
{
using (var k = new NSString (""))
ReferencePtr = Marshal.ReadIntPtr (k.Handle);
}
}
}
|
apache-2.0
|
C#
|
2d41ab4f5093b353bed66d2e12d75ad93c4cbc5d
|
fix json1
|
askeip/tasks
|
JsonConversion/JsonConverter.cs
|
JsonConversion/JsonConverter.cs
|
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace JsonConversion
{
public class JsonConverter : IJsonConverter
{
public string Convert(string json)
{
var warehouseV2 = JsonConvert.DeserializeObject<WarehouseV2>(json);
var productsV3 =
warehouseV2.Products.Select(
prod =>
new ProductV3
{
Id = int.Parse(prod.Key),
Count = prod.Value.Count,
Name = prod.Value.Name,
Price = prod.Value.Price,
Dimensions = prod.Value.Size == null
? null
: new Dimensions
{
H = prod.Value.Size[0],
W = prod.Value.Size[1],
L = prod.Value.Size[2]
}
});
var warehouseV3 = new WarehouseV3
{
Version = warehouseV2.Version,
Products = productsV3.ToList()
};
return JsonConvert.SerializeObject(warehouseV3,
Formatting.None,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
});
}
}
}
|
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace JsonConversion
{
public class JsonConverter : IJsonConverter
{
public string Convert(string json)
{
var warehouseV2 = JsonConvert.DeserializeObject<WarehouseV2>(json);
var productsV3 =
warehouseV2.Products.Select(
prod =>
new ProductV3
{
Id = int.Parse(prod.Key),
Count = prod.Value.Count,
Name = prod.Value.Name,
Price = prod.Value.Price
});
var warehouseV3 = new WarehouseV3
{
Version = "2",
Products = productsV3.ToList()
};
return JsonConvert.SerializeObject(warehouseV3,
Formatting.None,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
});
}
}
}
|
mit
|
C#
|
efa7e5cb7d8b22f73e3bbf44b12d92faa3c45c01
|
Adjust radius.
|
Nabile-Rahmani/osu,Drezi126/osu,tacchinotacchi/osu,ppy/osu,ZLima12/osu,RedNesto/osu,NeoAdonis/osu,naoey/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,DrabWeb/osu,EVAST9919/osu,EVAST9919/osu,peppy/osu-new,johnneijzen/osu,DrabWeb/osu,2yangk23/osu,NeoAdonis/osu,UselessToucan/osu,DrabWeb/osu,nyaamara/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,Damnae/osu,naoey/osu,johnneijzen/osu,ZLima12/osu,NeoAdonis/osu,osu-RP/osu-RP,Frontear/osuKyzer,peppy/osu,naoey/osu,2yangk23/osu,ppy/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu
|
osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs
|
osu.Game.Modes.Taiko/Objects/TaikoHitObject.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.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Modes.Objects;
namespace osu.Game.Modes.Taiko.Objects
{
public abstract class TaikoHitObject : HitObject
{
/// <summary>
/// HitCircle radius.
/// </summary>
public const float CIRCLE_RADIUS = 42f;
/// <summary>
/// The time to scroll in the HitObject.
/// </summary>
public double PreEmpt;
/// <summary>
/// Whether this HitObject is a "strong" type.
/// Strong hit objects give more points for hitting the hit object with both keys.
/// </summary>
public bool IsStrong;
/// <summary>
/// Whether this HitObject is in Kiai time.
/// </summary>
public bool Kiai { get; protected set; }
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(timing, difficulty);
PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000;
ControlPoint overridePoint;
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;
if (overridePoint != null)
Kiai |= overridePoint.KiaiMode;
}
}
}
|
// 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.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Modes.Objects;
namespace osu.Game.Modes.Taiko.Objects
{
public abstract class TaikoHitObject : HitObject
{
/// <summary>
/// HitCircle radius.
/// </summary>
public const float CIRCLE_RADIUS = 51;
/// <summary>
/// The time to scroll in the HitObject.
/// </summary>
public double PreEmpt;
/// <summary>
/// Whether this HitObject is a "strong" type.
/// Strong hit objects give more points for hitting the hit object with both keys.
/// </summary>
public bool IsStrong;
/// <summary>
/// Whether this HitObject is in Kiai time.
/// </summary>
public bool Kiai { get; protected set; }
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(timing, difficulty);
PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000;
ControlPoint overridePoint;
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;
if (overridePoint != null)
Kiai |= overridePoint.KiaiMode;
}
}
}
|
mit
|
C#
|
5a76ed4000075aecd01fa0c3583709d6d34f811c
|
Fix LegacyFilesystemReader Filenames property.
|
UselessToucan/osu,smoogipoo/osu,DrabWeb/osu,johnneijzen/osu,2yangk23/osu,naoey/osu,Nabile-Rahmani/osu,smoogipooo/osu,peppy/osu,johnneijzen/osu,DrabWeb/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,EVAST9919/osu,ppy/osu,ZLima12/osu,Frontear/osuKyzer,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,smoogipoo/osu,naoey/osu,naoey/osu,ZLima12/osu,2yangk23/osu,DrabWeb/osu,NeoAdonis/osu,ppy/osu,peppy/osu,Drezi126/osu,UselessToucan/osu,ppy/osu
|
osu.Game/Beatmaps/IO/LegacyFilesystemReader.cs
|
osu.Game/Beatmaps/IO/LegacyFilesystemReader.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.Framework.IO.File;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace osu.Game.Beatmaps.IO
{
/// <summary>
/// Reads an extracted legacy beatmap from disk.
/// </summary>
public class LegacyFilesystemReader : ArchiveReader
{
private readonly string path;
public LegacyFilesystemReader(string path)
{
this.path = path;
}
public override Stream GetStream(string name) => File.OpenRead(Path.Combine(path, name));
public override void Dispose()
{
// no-op
}
public override IEnumerable<string> Filenames => Directory.GetFiles(path, "*", SearchOption.AllDirectories).Select(f => FileSafety.GetRelativePath(f, path)).ToArray();
public override Stream GetUnderlyingStream() => null;
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace osu.Game.Beatmaps.IO
{
/// <summary>
/// Reads an extracted legacy beatmap from disk.
/// </summary>
public class LegacyFilesystemReader : ArchiveReader
{
private readonly string path;
public LegacyFilesystemReader(string path)
{
this.path = path;
}
public override Stream GetStream(string name) => File.OpenRead(Path.Combine(path, name));
public override void Dispose()
{
// no-op
}
public override IEnumerable<string> Filenames => Directory.GetFiles(path, "*", SearchOption.AllDirectories).Select(Path.GetFileName).ToArray();
public override Stream GetUnderlyingStream() => null;
}
}
|
mit
|
C#
|
6ea0cc91554faff24d5c540c8c5bfebef0c14f74
|
Throw on unexpected data
|
mycroes/SupportManager,mycroes/SupportManager,mycroes/SupportManager
|
MYCroes.ATCommands/ATCommand.cs
|
MYCroes.ATCommands/ATCommand.cs
|
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace MYCroes.ATCommands
{
public class ATCommand
{
private const string AT_OK = "OK";
private const string AT_ERROR = "ERROR";
public string Command { get; }
public IEnumerable<ATCommandArgument> Arguments { get; }
public ATCommand(string command, IEnumerable<ATCommandArgument> arguments)
{
Command = command;
Arguments = arguments;
}
public ATCommand(string command, params ATCommandArgument[] arguments)
: this(command, arguments.AsEnumerable())
{
}
public static implicit operator string (ATCommand atCommand)
{
return atCommand.Command + "=" + string.Join(",", atCommand.Arguments);
}
public IAsyncEnumerable<string> Execute(Stream stream)
{
var chat = new ATChat(stream);
return ExecuteCore(chat);
}
protected virtual async IAsyncEnumerable<string> ExecuteCore(ATChat chat)
{
await WriteCommand(chat);
await foreach (var line in ReadResponse(chat)) yield return line;
}
protected async IAsyncEnumerable<string> ReadResponse(ATChat chat)
{
string responsePrefix = Command + ": ";
var lines = new List<string>();
await foreach (var line in chat.ReadLines())
{
lines.Add(line);
if (line.StartsWith(responsePrefix))
{
yield return line.Substring(responsePrefix.Length);
continue;
}
if (line == AT_OK) yield break;
throw new ATCommandException(lines);
}
throw new ATCommandException(lines);
}
protected async Task WriteCommand(ATChat chat)
{
await chat.WriteLine("AT" + Command + "=" + string.Join(",", Arguments));
}
}
}
|
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace MYCroes.ATCommands
{
public class ATCommand
{
private const string AT_OK = "OK";
private const string AT_ERROR = "ERROR";
public string Command { get; }
public IEnumerable<ATCommandArgument> Arguments { get; }
public ATCommand(string command, IEnumerable<ATCommandArgument> arguments)
{
Command = command;
Arguments = arguments;
}
public ATCommand(string command, params ATCommandArgument[] arguments)
: this(command, arguments.AsEnumerable())
{
}
public static implicit operator string (ATCommand atCommand)
{
return atCommand.Command + "=" + string.Join(",", atCommand.Arguments);
}
public IAsyncEnumerable<string> Execute(Stream stream)
{
var chat = new ATChat(stream);
return ExecuteCore(chat);
}
protected virtual async IAsyncEnumerable<string> ExecuteCore(ATChat chat)
{
await WriteCommand(chat);
await foreach (var line in ReadResponse(chat)) yield return line;
}
protected async IAsyncEnumerable<string> ReadResponse(ATChat chat)
{
string responsePrefix = Command + ": ";
var lines = new List<string>();
await foreach (var line in chat.ReadLines())
{
lines.Add(line);
if (line.StartsWith(responsePrefix))
{
yield return line.Substring(responsePrefix.Length);
continue;
}
if (line == AT_OK) yield break;
if (line.Contains(AT_ERROR))
{
throw new ATCommandException(lines);
}
}
throw new ATCommandException(lines);
}
protected async Task WriteCommand(ATChat chat)
{
await chat.WriteLine("AT" + Command + "=" + string.Join(",", Arguments));
}
}
}
|
mit
|
C#
|
208de3dd1aa5f0de33c44bc024dc5122eb455208
|
Fix ProjectN build breaks (#3859)
|
gregkalapos/corert,yizhang82/corert,gregkalapos/corert,shrah/corert,yizhang82/corert,krytarowski/corert,yizhang82/corert,shrah/corert,krytarowski/corert,krytarowski/corert,gregkalapos/corert,shrah/corert,krytarowski/corert,shrah/corert,yizhang82/corert,gregkalapos/corert
|
src/System.Private.Interop/src/Internal/Runtime/CompilerHelpers/RuntimeInteropData.ProjectN.cs
|
src/System.Private.Interop/src/Internal/Runtime/CompilerHelpers/RuntimeInteropData.ProjectN.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Internal.Runtime.Augments;
using Internal.NativeFormat;
using Internal.Runtime.TypeLoader;
using Internal.Reflection.Execution;
using System.Runtime.InteropServices;
namespace Internal.Runtime.CompilerHelpers
{
internal partial class RuntimeInteropData : InteropCallbacks
{
public override bool TryGetMarshallerDataForDelegate(RuntimeTypeHandle delegateTypeHandle, out McgPInvokeDelegateData data)
{
return McgModuleManager.GetPInvokeDelegateData(delegateTypeHandle, out data);
}
#region "Struct Data"
public override bool TryGetStructUnmarshalStub(RuntimeTypeHandle structureTypeHandle, out IntPtr unmarshalStub)
{
return McgModuleManager.TryGetStructUnmarshalStub(structureTypeHandle, out unmarshalStub);
}
public override bool TryGetStructMarshalStub(RuntimeTypeHandle structureTypeHandle, out IntPtr marshalStub)
{
return McgModuleManager.TryGetStructMarshalStub(structureTypeHandle, out marshalStub);
}
public override bool TryGetDestroyStructureStub(RuntimeTypeHandle structureTypeHandle, out IntPtr destroyStructureStub, out bool hasInvalidLayout)
{
return McgModuleManager.TryGetDestroyStructureStub(structureTypeHandle, out destroyStructureStub, out hasInvalidLayout);
}
public override bool TryGetStructFieldOffset(RuntimeTypeHandle structureTypeHandle, string fieldName, out bool structExists, out uint offset)
{
return McgModuleManager.TryGetStructFieldOffset(structureTypeHandle, fieldName, out structExists, out offset);
}
public override bool TryGetStructUnsafeStructSize(RuntimeTypeHandle structureTypeHandle, out int size)
{
RuntimeTypeHandle unsafeStructType;
size = 0;
if (McgModuleManager.TryGetStructUnsafeStructType(structureTypeHandle, out unsafeStructType))
{
size = unsafeStructType.GetValueTypeSize();
return true;
}
return false;
}
#endregion
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Internal.Runtime.Augments;
using Internal.NativeFormat;
using Internal.Runtime.TypeLoader;
using Internal.Reflection.Execution;
using System.Runtime.InteropServices;
namespace Internal.Runtime.CompilerHelpers
{
internal class RuntimeInteropData : InteropCallbacks
{
public override bool TryGetMarshallerDataForDelegate(RuntimeTypeHandle delegateTypeHandle, out McgPInvokeDelegateData data)
{
return McgModuleManager.GetPInvokeDelegateData(delegateTypeHandle, out data);
}
#region "Struct Data"
public override bool TryGetStructUnmarshalStub(RuntimeTypeHandle structureTypeHandle, out IntPtr unmarshalStub)
{
return McgModuleManager.TryGetStructUnmarshalStub(structureTypeHandle, out unmarshalStub);
}
public override bool TryGetStructMarshalStub(RuntimeTypeHandle structureTypeHandle, out IntPtr marshalStub)
{
return McgModuleManager.TryGetStructMarshalStub(structureTypeHandle, out marshalStub);
}
public override bool TryGetDestroyStructureStub(RuntimeTypeHandle structureTypeHandle, out IntPtr destroyStructureStub, out bool hasInvalidLayout)
{
return McgModuleManager.TryGetDestroyStructureStub(structureTypeHandle, out destroyStructureStub, out hasInvalidLayout);
}
public override bool TryGetStructFieldOffset(RuntimeTypeHandle structureTypeHandle, string fieldName, out bool structExists, out uint offset)
{
return McgModuleManager.TryGetStructFieldOffset(structureTypeHandle, fieldName, out structExists, out offset);
}
public override bool TryGetStructUnsafeStructSize(RuntimeTypeHandle structureTypeHandle, out int size)
{
RuntimeTypeHandle unsafeStructType;
size = 0;
if (McgModuleManager.TryGetStructUnsafeStructType(typeHandle, out unsafeStructType))
{
size = unsafeStructType.GetValueTypeSize();
return true;
}
return false;
}
#endregion
}
}
|
mit
|
C#
|
75bb1aaab1080ae765407de45443d12b00900eb0
|
Update IMongoDatabaseProvider.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/Mongo/IMongoDatabaseProvider.cs
|
TIKSN.Core/Data/Mongo/IMongoDatabaseProvider.cs
|
using MongoDB.Driver;
namespace TIKSN.Data.Mongo
{
public interface IMongoDatabaseProvider
{
IMongoDatabase GetDatabase();
}
}
|
using MongoDB.Driver;
namespace TIKSN.Data.Mongo
{
public interface IMongoDatabaseProvider
{
IMongoDatabase GetDatabase();
}
}
|
mit
|
C#
|
860fc40a2f9c81b0cac39b9678cd44a82e19cc70
|
Update InternetConnectivityState.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Network/InternetConnectivityState.cs
|
TIKSN.Core/Network/InternetConnectivityState.cs
|
using System;
using System.Collections.Generic;
namespace TIKSN.Network
{
public class InternetConnectivityState : IEqualityComparer<InternetConnectivityState>,
IEquatable<InternetConnectivityState>
{
public InternetConnectivityState(bool isInternetAvailable, bool isWiFiAvailable,
bool isCellularNetworkAvailable)
{
this.IsInternetAvailable = isInternetAvailable;
this.IsWiFiAvailable = isWiFiAvailable;
this.IsCellularNetworkAvailable = isCellularNetworkAvailable;
}
public bool IsCellularNetworkAvailable { get; }
public bool IsInternetAvailable { get; }
public bool IsWiFiAvailable { get; }
public bool Equals(InternetConnectivityState x, InternetConnectivityState y) =>
ReferenceEquals(x, null) ? ReferenceEquals(y, null) : x.Equals(y);
public int GetHashCode(InternetConnectivityState obj) => this.IsInternetAvailable.GetHashCode() ^
this.IsWiFiAvailable.GetHashCode() ^
this.IsCellularNetworkAvailable.GetHashCode();
public bool Equals(InternetConnectivityState other)
{
if (ReferenceEquals(other, null))
{
return false;
}
return this.IsInternetAvailable == other.IsInternetAvailable &&
this.IsWiFiAvailable == other.IsWiFiAvailable &&
this.IsCellularNetworkAvailable == other.IsCellularNetworkAvailable;
}
}
}
|
using System;
using System.Collections.Generic;
namespace TIKSN.Network
{
public class InternetConnectivityState : IEqualityComparer<InternetConnectivityState>, IEquatable<InternetConnectivityState>
{
public InternetConnectivityState(bool isInternetAvailable, bool isWiFiAvailable, bool isCellularNetworkAvailable)
{
IsInternetAvailable = isInternetAvailable;
IsWiFiAvailable = isWiFiAvailable;
IsCellularNetworkAvailable = isCellularNetworkAvailable;
}
public bool IsCellularNetworkAvailable { get; private set; }
public bool IsInternetAvailable { get; private set; }
public bool IsWiFiAvailable { get; private set; }
public bool Equals(InternetConnectivityState x, InternetConnectivityState y)
{
return ReferenceEquals(x, null) ? ReferenceEquals(y, null) : x.Equals(y);
}
public bool Equals(InternetConnectivityState other)
{
if (ReferenceEquals(other, null))
return false;
return IsInternetAvailable == other.IsInternetAvailable &&
IsWiFiAvailable == other.IsWiFiAvailable &&
IsCellularNetworkAvailable == other.IsCellularNetworkAvailable;
}
public int GetHashCode(InternetConnectivityState obj)
{
return
IsInternetAvailable.GetHashCode() ^
IsWiFiAvailable.GetHashCode() ^
IsCellularNetworkAvailable.GetHashCode();
}
}
}
|
mit
|
C#
|
d47605b6dd738ab47b1124822baf4e5da44c900f
|
Add doc comment
|
heejaechang/roslyn,jaredpar/roslyn,KevinRansom/roslyn,Shiney/roslyn,CyrusNajmabadi/roslyn,michalhosala/roslyn,AnthonyDGreen/roslyn,jaredpar/roslyn,leppie/roslyn,nguerrera/roslyn,swaroop-sridhar/roslyn,tannergooding/roslyn,Pvlerick/roslyn,tvand7093/roslyn,mavasani/roslyn,MatthieuMEZIL/roslyn,robinsedlaczek/roslyn,bkoelman/roslyn,ljw1004/roslyn,lorcanmooney/roslyn,MattWindsor91/roslyn,TyOverby/roslyn,OmarTawfik/roslyn,KirillOsenkov/roslyn,xasx/roslyn,kelltrick/roslyn,KevinH-MS/roslyn,pdelvo/roslyn,cston/roslyn,tmeschter/roslyn,lorcanmooney/roslyn,robinsedlaczek/roslyn,KiloBravoLima/roslyn,zooba/roslyn,jeffanders/roslyn,Hosch250/roslyn,TyOverby/roslyn,aelij/roslyn,jamesqo/roslyn,MatthieuMEZIL/roslyn,eriawan/roslyn,AArnott/roslyn,dotnet/roslyn,AmadeusW/roslyn,MattWindsor91/roslyn,bbarry/roslyn,KiloBravoLima/roslyn,shyamnamboodiripad/roslyn,VSadov/roslyn,budcribar/roslyn,davkean/roslyn,bbarry/roslyn,akrisiun/roslyn,yeaicc/roslyn,KiloBravoLima/roslyn,natidea/roslyn,abock/roslyn,stephentoub/roslyn,bkoelman/roslyn,jcouv/roslyn,CaptainHayashi/roslyn,physhi/roslyn,dpoeschl/roslyn,a-ctor/roslyn,physhi/roslyn,khyperia/roslyn,natidea/roslyn,Giftednewt/roslyn,mmitche/roslyn,srivatsn/roslyn,jmarolf/roslyn,mattwar/roslyn,AArnott/roslyn,amcasey/roslyn,brettfo/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,MichalStrehovsky/roslyn,jamesqo/roslyn,ErikSchierboom/roslyn,mavasani/roslyn,MatthieuMEZIL/roslyn,zooba/roslyn,shyamnamboodiripad/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,akrisiun/roslyn,AlekseyTs/roslyn,diryboy/roslyn,gafter/roslyn,amcasey/roslyn,mavasani/roslyn,DustinCampbell/roslyn,OmarTawfik/roslyn,eriawan/roslyn,akrisiun/roslyn,genlu/roslyn,orthoxerox/roslyn,ljw1004/roslyn,amcasey/roslyn,xasx/roslyn,jhendrixMSFT/roslyn,Hosch250/roslyn,heejaechang/roslyn,orthoxerox/roslyn,KevinRansom/roslyn,MattWindsor91/roslyn,diryboy/roslyn,AlekseyTs/roslyn,wvdd007/roslyn,jcouv/roslyn,gafter/roslyn,michalhosala/roslyn,xasx/roslyn,mmitche/roslyn,tmeschter/roslyn,tmat/roslyn,AmadeusW/roslyn,sharadagrawal/Roslyn,tvand7093/roslyn,nguerrera/roslyn,MichalStrehovsky/roslyn,rgani/roslyn,tmeschter/roslyn,Pvlerick/roslyn,leppie/roslyn,yeaicc/roslyn,mgoertz-msft/roslyn,paulvanbrenk/roslyn,srivatsn/roslyn,AmadeusW/roslyn,robinsedlaczek/roslyn,weltkante/roslyn,vslsnap/roslyn,nguerrera/roslyn,sharadagrawal/Roslyn,CaptainHayashi/roslyn,eriawan/roslyn,jeffanders/roslyn,xoofx/roslyn,KevinH-MS/roslyn,drognanar/roslyn,jeffanders/roslyn,brettfo/roslyn,sharwell/roslyn,ericfe-ms/roslyn,paulvanbrenk/roslyn,lorcanmooney/roslyn,tmat/roslyn,drognanar/roslyn,tannergooding/roslyn,rgani/roslyn,dotnet/roslyn,genlu/roslyn,AArnott/roslyn,jasonmalinowski/roslyn,rgani/roslyn,mattscheffer/roslyn,dpoeschl/roslyn,vslsnap/roslyn,agocke/roslyn,panopticoncentral/roslyn,agocke/roslyn,bartdesmet/roslyn,KirillOsenkov/roslyn,jaredpar/roslyn,panopticoncentral/roslyn,weltkante/roslyn,kelltrick/roslyn,physhi/roslyn,ErikSchierboom/roslyn,jkotas/roslyn,cston/roslyn,sharadagrawal/Roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,AnthonyDGreen/roslyn,khyperia/roslyn,natidea/roslyn,CyrusNajmabadi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tannergooding/roslyn,KevinRansom/roslyn,a-ctor/roslyn,pdelvo/roslyn,mattscheffer/roslyn,vslsnap/roslyn,CaptainHayashi/roslyn,OmarTawfik/roslyn,Shiney/roslyn,KevinH-MS/roslyn,MichalStrehovsky/roslyn,michalhosala/roslyn,davkean/roslyn,dpoeschl/roslyn,kelltrick/roslyn,reaction1989/roslyn,wvdd007/roslyn,panopticoncentral/roslyn,MattWindsor91/roslyn,Shiney/roslyn,balajikris/roslyn,ericfe-ms/roslyn,VSadov/roslyn,a-ctor/roslyn,reaction1989/roslyn,xoofx/roslyn,mmitche/roslyn,aelij/roslyn,agocke/roslyn,jmarolf/roslyn,Hosch250/roslyn,reaction1989/roslyn,AlekseyTs/roslyn,TyOverby/roslyn,cston/roslyn,ErikSchierboom/roslyn,stephentoub/roslyn,DustinCampbell/roslyn,jhendrixMSFT/roslyn,mattscheffer/roslyn,srivatsn/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,jmarolf/roslyn,abock/roslyn,dotnet/roslyn,KirillOsenkov/roslyn,wvdd007/roslyn,tvand7093/roslyn,bbarry/roslyn,leppie/roslyn,swaroop-sridhar/roslyn,orthoxerox/roslyn,budcribar/roslyn,paulvanbrenk/roslyn,Giftednewt/roslyn,bkoelman/roslyn,gafter/roslyn,zooba/roslyn,stephentoub/roslyn,jamesqo/roslyn,budcribar/roslyn,DustinCampbell/roslyn,mattwar/roslyn,jkotas/roslyn,ericfe-ms/roslyn,sharwell/roslyn,xoofx/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,balajikris/roslyn,genlu/roslyn,bartdesmet/roslyn,ljw1004/roslyn,AnthonyDGreen/roslyn,abock/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,yeaicc/roslyn,Giftednewt/roslyn,drognanar/roslyn,jkotas/roslyn,diryboy/roslyn,VSadov/roslyn,bartdesmet/roslyn,jcouv/roslyn,davkean/roslyn,mattwar/roslyn,khyperia/roslyn,pdelvo/roslyn,jhendrixMSFT/roslyn,aelij/roslyn,swaroop-sridhar/roslyn,Pvlerick/roslyn,brettfo/roslyn,tmat/roslyn,balajikris/roslyn
|
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Presentation/ICompletionSetFactory.cs
|
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Presentation/ICompletionSetFactory.cs
|
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Presentation
{
/// <summary>
/// We have two implementations of ICompletionSet that are specific to different VS versions
/// because the newer one lights up new functionality from the platform. This let's the
/// presenter create the right one.
/// </summary>
internal interface ICompletionSetFactory
{
ICompletionSet CreateCompletionSet(
CompletionPresenterSession completionPresenterSession,
ITextView textView,
ITextBuffer subjectBuffer);
}
}
|
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion.Presentation
{
internal interface ICompletionSetFactory
{
ICompletionSet CreateCompletionSet(
CompletionPresenterSession completionPresenterSession,
ITextView textView,
ITextBuffer subjectBuffer);
}
}
|
mit
|
C#
|
5f0e1bdf77261b84238a8ca84a79052a213c97d9
|
Test we can commit gain
|
TheTalkingDev/Kata.Solved.GildedRose.CSharp,dtro-devuk/Kata.Solved.GildedRose.CSharp
|
src/Kata.GildedRose.CSharp.Unit.Tests/Factories/UpdateStockItemStrategy/UpdateItemStrategyFactory.cs
|
src/Kata.GildedRose.CSharp.Unit.Tests/Factories/UpdateStockItemStrategy/UpdateItemStrategyFactory.cs
|
using Kata.GildedRose.CSharp.Domain;
namespace Kata.GildedRose.CSharp.Unit.Tests.Factories.UpdateStockItemStrategy
{
public class UpdateItemStrategyFactory : IUpdateItemStrategyFactory
{
public IStockItemUpdateStrategy Create(Item stockItem)
{
switch (item.Name)
{
case "Aged Brie":
_updateStrategy = new AgedBrieUpdateStrategy();
break;
case "Backstage passes to a TAFKAL80ETC concert":
_updateStrategy = new BackStagePassesUpdateStrategy();
break;
case "Sulfuras, Hand of Ragnaros":
_updateStrategy = new LegendaryItemsUpdateStratgey();
break;
default:
_updateStrategy = new StandardItemsUpdateStrategy();
break;
}
}
}
}
|
using Kata.GildedRose.CSharp.Domain;
namespace Kata.GildedRose.CSharp.Unit.Tests.Factories.UpdateStockItemStrategy
{
public class UpdateItemStrategyFactory : IUpdateItemStrategyFactory
{
public IStockItemUpdateStrategy Create(Item stockItem)
{
return new AgedBrieUpdateStrategy();
}
}
}
|
mit
|
C#
|
7d55cf4d9f63fc60fdef50038ea5839b17083fd7
|
change AttributeTargets for FromServiceAttribute
|
AspectCore/Lite,AspectCore/AspectCore-Framework,AspectCore/Abstractions,AspectCore/AspectCore-Framework
|
src/AspectCore.Lite/Abstractions/Injections/FromServiceAttribute.cs
|
src/AspectCore.Lite/Abstractions/Injections/FromServiceAttribute.cs
|
using System;
namespace AspectCore.Lite.Abstractions
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public sealed class FromServiceAttribute : Attribute
{
}
}
|
using System;
namespace AspectCore.Lite.Abstractions
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed class FromServiceAttribute : Attribute
{
}
}
|
mit
|
C#
|
00323530371f586fe86153d7fe82018e4add2e4a
|
modify checksignature.cs
|
JeffreySu/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,wanddy/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,down4u/WeiXinMPSDK,mc7246/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,down4u/WeiXinMPSDK,mc7246/WeiXinMPSDK,down4u/WeiXinMPSDK,wanddy/WeiXinMPSDK,JeffreySu/WxOpen,JeffreySu/WxOpen,jiehanlin/WeiXinMPSDK,lishewen/WeiXinMPSDK,lishewen/WeiXinMPSDK,wanddy/WeiXinMPSDK,mc7246/WeiXinMPSDK,lishewen/WeiXinMPSDK,JeffreySu/WeiXinMPSDK
|
Senparc.Weixin.MP/Senparc.Weixin.MP/CheckSignature.cs
|
Senparc.Weixin.MP/Senparc.Weixin.MP/CheckSignature.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Web.Security;
namespace Senparc.Weixin.MP
{
public class CheckSignature
{
public static readonly string Token = "weixin";//必须和公众平台的token设置一致,或在方法中指定
/// <summary>
/// 检查签名是否正确
/// </summary>
/// <param name="signature"></param>
/// <param name="timestamp"></param>
/// <param name="nonce"></param>
/// <param name="token"></param>
/// <returns></returns>
public static bool Check(string signature, string timestamp, string nonce, string token = null)
{
return signature == GetSignature(timestamp, nonce, token);
}
/// <summary>
/// 返回正确的签名
/// </summary>
/// <param name="timestamp"></param>
/// <param name="nonce"></param>
/// <param name="token"></param>
/// <returns></returns>
public static string GetSignature(string timestamp, string nonce, string token = null)
{
token = token ?? Token;
var arr = new[] { CheckSignature.Token, timestamp, nonce }.OrderBy(z => z).ToArray();
var arrString = string.Join("", arr);
//var enText = FormsAuthentication.HashPasswordForStoringInConfigFile(arrString, "SHA1");//使用System.Web.Security程序集
var sha1 = System.Security.Cryptography.SHA1.Create();
var sha1Arr = sha1.ComputeHash(Encoding.UTF8.GetBytes(arrString));
StringBuilder enText = new StringBuilder();
foreach (var b in sha1Arr)
{
enText.AppendFormat("{0:x2}", b);
}
return enText.ToString();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Web.Security;
namespace Senparc.Weixin.MP
{
public class CheckSignature
{
public static readonly string Token = "weixin";//必须和公众平台的token设置一致,或在方法中指定
public static bool Check(string signature, string timestamp, string nonce, string token = null)
{
return signature == GetSignature(timestamp, nonce, token);
}
public static string GetSignature(string timestamp, string nonce, string token = null)
{
token = token ?? Token;
var arr = new[] { CheckSignature.Token, timestamp, nonce }.OrderBy(z => z).ToArray();
var arrString = string.Join("", arr);
//var enText = FormsAuthentication.HashPasswordForStoringInConfigFile(arrString, "SHA1");//使用System.Web.Security程序集
var sha1 = System.Security.Cryptography.SHA1.Create();
var sha1Arr = sha1.ComputeHash(Encoding.UTF8.GetBytes(arrString));
StringBuilder enText = new StringBuilder();
foreach (var b in sha1Arr)
{
enText.AppendFormat("{0:x2}", b);
}
return enText.ToString();
}
}
}
|
apache-2.0
|
C#
|
3a0cf3126f46517137a73f48abdccf4d6c9cddbf
|
Update ICosmosTableRepository.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/CosmosTable/ICosmosTableRepository.cs
|
TIKSN.Core/Data/CosmosTable/ICosmosTableRepository.cs
|
using Microsoft.Azure.Cosmos.Table;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.CosmosTable
{
public interface ICosmosTableRepository<T> where T : ITableEntity
{
Task AddAsync(T entity, CancellationToken cancellationToken);
Task AddOrMergeAsync(T entity, CancellationToken cancellationToken);
Task AddOrReplaceAsync(T entity, CancellationToken cancellationToken);
Task DeleteAsync(T entity, CancellationToken cancellationToken);
Task MergeAsync(T entity, CancellationToken cancellationToken);
Task ReplaceAsync(T entity, CancellationToken cancellationToken);
}
}
|
using Microsoft.Azure.Cosmos.Table;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.CosmosTable
{
public interface IAzureTableStorageRepository<T> where T : ITableEntity
{
Task AddAsync(T entity, CancellationToken cancellationToken);
Task AddOrMergeAsync(T entity, CancellationToken cancellationToken);
Task AddOrReplaceAsync(T entity, CancellationToken cancellationToken);
Task DeleteAsync(T entity, CancellationToken cancellationToken);
Task MergeAsync(T entity, CancellationToken cancellationToken);
Task ReplaceAsync(T entity, CancellationToken cancellationToken);
}
}
|
mit
|
C#
|
bc5a7c8d5a92b165ab97596fe42a9fd63e21b31b
|
remove temp feature not implemented (the Not operator will be implemented later in another way)
|
rhwy/nlist
|
NList.Core/NList.Core/ForElements.cs
|
NList.Core/NList.Core/ForElements.cs
|
// The MIT License (MIT)
//
// Copyright (c) 2014 Rui Carvalho
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// ==============================================================================
namespace NList.Core
{
using System;
using System.Collections.Generic;
public class ForElements
{
public static ListElementsWrapper<T> In<T> (IEnumerable<T> source)
{
return new ListElementsWrapper<T> (source);
}
}
}
|
// The MIT License (MIT)
//
// Copyright (c) 2014 Rui Carvalho
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// ==============================================================================
namespace NList.Core
{
using System;
using System.Collections.Generic;
public class ForElements
{
public static ListElementsWrapper<T> In<T> (IEnumerable<T> source)
{
return new ListElementsWrapper<T> (source);
}
public static dynamic NotIn<T> (List<T> source)
{
throw new NotImplementedException ();
}
}
}
|
mit
|
C#
|
6b113188777d342e3925fadf07378ba76fd0da4c
|
include .net maui
|
planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin
|
src/Firehose.Web/Extensions/SyndicationItemExtensions.cs
|
src/Firehose.Web/Extensions/SyndicationItemExtensions.cs
|
using System.Linq;
using System.ServiceModel.Syndication;
namespace Firehose.Web.Extensions
{
public static class SyndicationItemExtensions
{
public static bool ApplyDefaultFilter(this SyndicationItem item)
{
if (item == null)
return false;
var hasXamarinCategory = false;
var hasXamarinKeywords = false;
if (item.Categories.Count > 0)
{
hasXamarinCategory = item.Categories.Any(category =>
category.Name.ToLowerInvariant().Contains("xamarin") || category.Name.ToLowerInvariant().Contains(".net maui"));
}
if (item.ElementExtensions.Count > 0)
{
var element = item.ElementExtensions.FirstOrDefault(e => e.OuterName == "keywords");
if (element != null)
{
var keywords = element.GetObject<string>();
hasXamarinKeywords = keywords.ToLowerInvariant().Contains("xamarin") || keywords.ToLowerInvariant().Contains(".net maui");
}
}
var hasXamarinTitle = (item.Title?.Text.ToLowerInvariant().Contains("xamarin") ?? false) || (item.Title?.Text.ToLowerInvariant().Contains(".net maui") ?? false);
return hasXamarinTitle || hasXamarinCategory || hasXamarinKeywords;
}
public static string ToHtml(this SyndicationContent content)
{
var textSyndicationContent = content as TextSyndicationContent;
if (textSyndicationContent != null)
{
return textSyndicationContent.Text;
}
return content.ToString();
}
}
}
|
using System.Linq;
using System.ServiceModel.Syndication;
namespace Firehose.Web.Extensions
{
public static class SyndicationItemExtensions
{
public static bool ApplyDefaultFilter(this SyndicationItem item)
{
if (item == null)
return false;
var hasXamarinCategory = false;
var hasXamarinKeywords = false;
if (item.Categories.Count > 0)
{
hasXamarinCategory = item.Categories.Any(category =>
category.Name.ToLowerInvariant().Contains("xamarin"));
}
if (item.ElementExtensions.Count > 0)
{
var element = item.ElementExtensions.FirstOrDefault(e => e.OuterName == "keywords");
if (element != null)
{
var keywords = element.GetObject<string>();
hasXamarinKeywords = keywords.ToLowerInvariant().Contains("xamarin");
}
}
var hasXamarinTitle = item.Title?.Text.ToLowerInvariant().Contains("xamarin") ?? false;
return hasXamarinTitle || hasXamarinCategory || hasXamarinKeywords;
}
public static string ToHtml(this SyndicationContent content)
{
var textSyndicationContent = content as TextSyndicationContent;
if (textSyndicationContent != null)
{
return textSyndicationContent.Text;
}
return content.ToString();
}
}
}
|
mit
|
C#
|
98b6ddd105268ad3ab5d32904ae359db42183f1d
|
Add missing title attribute
|
martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site,martincostello/alexa-london-travel-site
|
src/LondonTravel.Site/Views/Shared/_SignInPartial.cshtml
|
src/LondonTravel.Site/Views/Shared/_SignInPartial.cshtml
|
@inject Microsoft.AspNetCore.Identity.SignInManager<LondonTravelUser> SignInManager
@{
string displayName = User.GetDisplayName();
string avatarUrl = User.GetAvatarUrl(Url.CdnContent("avatar.png", Options));
}
@if (SignInManager.IsSignedIn(User))
{
<form asp-route="@SiteRoutes.SignOut" method="post" class="navbar-right">
<ul class="nav navbar-nav navbar-right">
<li>
<a asp-route="@SiteRoutes.Manage" title="@SR.ManageLinkAltText" data-ga-label="Manage Account Navbar">
@displayName
<lazyimg alt="@displayName" title="@displayName" src="@avatarUrl" aria-hidden="true" />
<noscript>
<img alt="@displayName" title="@displayName" src="@avatarUrl" aria-hidden="true" />
</noscript>
</a>
</li>
<li>
<button type="submit" class="btn btn-link navbar-btn navbar-link" title="@SR.SignOutLinkText" data-ga-label="Sign-Out Navbar">
@SR.SignOutLinkText
<i class="fa fa-sign-out" aria-hidden="true"></i>
</button>
</li>
</ul>
</form>
}
else
{
<ul class="nav navbar-nav navbar-right">
<li><a asp-route="@SiteRoutes.SignIn" rel="nofollow" title="@SR.SignInLinkAltText" data-ga-label="Sign-In Navbar">@SR.SignInLinkText</a></li>
<li><a asp-route="@SiteRoutes.Register" title="@SR.RegisterLinkAltText" data-ga-label="Register Navbar">@SR.RegisterLinkText</a></li>
</ul>
}
|
@inject Microsoft.AspNetCore.Identity.SignInManager<LondonTravelUser> SignInManager
@{
string displayName = User.GetDisplayName();
string avatarUrl = User.GetAvatarUrl(Url.CdnContent("avatar.png", Options));
}
@if (SignInManager.IsSignedIn(User))
{
<form asp-route="@SiteRoutes.SignOut" method="post" class="navbar-right">
<ul class="nav navbar-nav navbar-right">
<li>
<a asp-route="@SiteRoutes.Manage" title="@SR.ManageLinkAltText" data-ga-label="Manage Account Navbar">
@displayName
<lazyimg alt="@displayName" title="@displayName" src="@avatarUrl" aria-hidden="true" />
<noscript>
<img alt="@displayName" title="@displayName" src="@avatarUrl" aria-hidden="true" />
</noscript>
</a>
</li>
<li>
<button type="submit" class="btn btn-link navbar-btn navbar-link" data-ga-label="Sign-Out Navbar">
@SR.SignOutLinkText
<i class="fa fa-sign-out" aria-hidden="true"></i>
</button>
</li>
</ul>
</form>
}
else
{
<ul class="nav navbar-nav navbar-right">
<li><a asp-route="@SiteRoutes.SignIn" rel="nofollow" title="@SR.SignInLinkAltText" data-ga-label="Sign-In Navbar">@SR.SignInLinkText</a></li>
<li><a asp-route="@SiteRoutes.Register" title="@SR.RegisterLinkAltText" data-ga-label="Register Navbar">@SR.RegisterLinkText</a></li>
</ul>
}
|
apache-2.0
|
C#
|
bd9ece58e61fd808e8f579b1817a287126f27b1f
|
Add DebuggerStepThrough attribute to SystemClock.AddCycles
|
eightlittlebits/elbsms
|
elbsms_core/SystemClock.cs
|
elbsms_core/SystemClock.cs
|
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace elbsms_core
{
class SystemClock
{
public ulong Timestamp;
[DebuggerStepThrough]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddCycles(uint cycleCount)
{
Timestamp += cycleCount;
}
}
}
|
using System.Runtime.CompilerServices;
namespace elbsms_core
{
class SystemClock
{
public ulong Timestamp;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddCycles(uint cycleCount)
{
Timestamp += cycleCount;
}
}
}
|
mit
|
C#
|
f2ce788454abb0200cb49afebe67600e9133228e
|
Revert "Included call to base.WarmUp()."
|
KodrAus/Nimbus,NimbusAPI/Nimbus,NimbusAPI/Nimbus,KodrAus/Nimbus,KodrAus/Nimbus
|
src/Extensions/Nimbus.Transports.InProcess/MessageSendersAndReceivers/InProcessQueueReceiver.cs
|
src/Extensions/Nimbus.Transports.InProcess/MessageSendersAndReceivers/InProcessQueueReceiver.cs
|
using System.Threading;
using System.Threading.Tasks;
using Nimbus.ConcurrentCollections;
using Nimbus.Configuration.Settings;
using Nimbus.Infrastructure;
using Nimbus.Infrastructure.MessageSendersAndReceivers;
using Nimbus.Transports.InProcess.QueueManagement;
namespace Nimbus.Transports.InProcess.MessageSendersAndReceivers
{
internal class InProcessQueueReceiver : ThrottlingMessageReceiver
{
private readonly string _queuePath;
private readonly InProcessMessageStore _messageStore;
private readonly ThreadSafeLazy<AsyncBlockingCollection<NimbusMessage>> _messageQueue;
public InProcessQueueReceiver(string queuePath,
ConcurrentHandlerLimitSetting concurrentHandlerLimit,
InProcessMessageStore messageStore,
IGlobalHandlerThrottle globalHandlerThrottle,
ILogger logger) : base(concurrentHandlerLimit, globalHandlerThrottle, logger)
{
_queuePath = queuePath;
_messageStore = messageStore;
_messageQueue = new ThreadSafeLazy<AsyncBlockingCollection<NimbusMessage>>(() => _messageStore.GetOrCreateMessageQueue(_queuePath));
}
public override string ToString()
{
return _queuePath;
}
protected override Task WarmUp()
{
return Task.Run(() => _messageQueue.EnsureValueCreated());
}
protected override async Task<NimbusMessage> Fetch(CancellationToken cancellationToken)
{
var nimbusMessage = await _messageQueue.Value.Take(cancellationToken);
return nimbusMessage;
}
}
}
|
using System.Threading;
using System.Threading.Tasks;
using Nimbus.ConcurrentCollections;
using Nimbus.Configuration.Settings;
using Nimbus.Infrastructure;
using Nimbus.Infrastructure.MessageSendersAndReceivers;
using Nimbus.Transports.InProcess.QueueManagement;
namespace Nimbus.Transports.InProcess.MessageSendersAndReceivers
{
internal class InProcessQueueReceiver : ThrottlingMessageReceiver
{
private readonly string _queuePath;
private readonly InProcessMessageStore _messageStore;
private readonly ThreadSafeLazy<AsyncBlockingCollection<NimbusMessage>> _messageQueue;
public InProcessQueueReceiver(string queuePath,
ConcurrentHandlerLimitSetting concurrentHandlerLimit,
InProcessMessageStore messageStore,
IGlobalHandlerThrottle globalHandlerThrottle,
ILogger logger) : base(concurrentHandlerLimit, globalHandlerThrottle, logger)
{
_queuePath = queuePath;
_messageStore = messageStore;
_messageQueue = new ThreadSafeLazy<AsyncBlockingCollection<NimbusMessage>>(() => _messageStore.GetOrCreateMessageQueue(_queuePath));
}
public override string ToString()
{
return _queuePath;
}
protected override Task WarmUp()
{
_messageQueue.EnsureValueCreated();
return base.WarmUp();
}
protected override async Task<NimbusMessage> Fetch(CancellationToken cancellationToken)
{
var nimbusMessage = await _messageQueue.Value.Take(cancellationToken);
return nimbusMessage;
}
}
}
|
mit
|
C#
|
da3a53993409d2e3d843d4778516fb03e5cfa1c0
|
Fix dispatch guard for Resolving
|
Miruken-DotNet/Miruken
|
Source/Miruken/Callback/Resolving.cs
|
Source/Miruken/Callback/Resolving.cs
|
namespace Miruken.Callback
{
using System;
using System.Diagnostics;
using Policy;
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
public class Resolving : Inquiry, IInferCallback
{
private readonly object _callback;
private bool _handled;
public Resolving(object key, object callback)
: base(key, callback as Inquiry, true)
{
_callback = callback
?? throw new ArgumentNullException(nameof(callback));
}
object IInferCallback.InferCallback()
{
return this;
}
public override bool CanDispatch(
object target, MemberDispatch dispatcher)
{
return base.CanDispatch(target, dispatcher) &&
(_callback as IDispatchCallbackGuard)
?.CanDispatch(target, dispatcher) != false;
}
protected override bool IsSatisfied(
object resolution, bool greedy, IHandler composer)
{
if (_handled && !greedy) return true;
return _handled = Handler.Dispatch(
resolution, _callback, ref greedy, composer)
|| _handled;
}
private string DebuggerDisplay => $"Resolving | {Key} => {_callback}";
}
}
|
namespace Miruken.Callback
{
using System;
using System.Diagnostics;
using Policy;
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
public class Resolving : Inquiry, IInferCallback
{
private readonly object _callback;
private bool _handled;
public Resolving(object key, object callback)
: base(key, callback as Inquiry, true)
{
_callback = callback
?? throw new ArgumentNullException(nameof(callback));
}
object IInferCallback.InferCallback()
{
return this;
}
public override bool CanDispatch(
object target, MemberDispatch dispatcher)
{
return (_callback as IDispatchCallbackGuard)
?.CanDispatch(target, dispatcher) != false;
}
protected override bool IsSatisfied(
object resolution, bool greedy, IHandler composer)
{
if (_handled && !greedy) return true;
return _handled = Handler.Dispatch(
resolution, _callback, ref greedy, composer)
|| _handled;
}
private string DebuggerDisplay => $"Resolving | {Key} => {_callback}";
}
}
|
mit
|
C#
|
aa76e63ccd64c9f22bfdc8082674a31bd7f9ab8a
|
Fix the xunitdiscoverertests
|
OpenCoverUI/OpenCover.UI,MelleKoning/OpenCover.UI
|
OpenCover.UI.TestDiscoverer.Tests/XUnit/XUnitDiscovererTests.cs
|
OpenCover.UI.TestDiscoverer.Tests/XUnit/XUnitDiscovererTests.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using OpenCover.UI.Model.Test;
using OpenCover.UI.TestDiscoverer.TestResources.xUnit;
namespace OpenCover.UI.TestDiscoverer.Tests.XUnit
{
[Ignore]
[TestFixture]
class XUnitDiscovererTests : DiscovererTestsBase
{
[TestCase(typeof(RegularxUnitTestClass), "RegularTestMethod")]
public void Discover_Finds_Regular_Test_Fixture_And_Method(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod)
{
AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.XUnit);
}
[TestCase(typeof(RegularxUnitTestClass.SubTestClass), "RegularSubTestClassMethod")]
[TestCase(typeof(RegularxUnitTestClass.SubTestClass.Sub2NdTestClass), "RegularSub2NdTestClassMethod")]
public void Discover_Finds_Sub_Test_Fixtures_And_Methods(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod)
{
AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod, TestType.XUnit);
}
}
}
|
using System;
using NUnit.Framework;
using OpenCover.UI.TestDiscoverer.TestResources.Xunit;
//using OpenCover.UI.TestDiscoverer.TestResources.Xunit;
namespace OpenCover.UI.TestDiscoverer.Tests.XUnit
{
public class XUnitDiscovererTests: DiscovererTestsBase
{
[TestCase(typeof(RegularFacts), "RegularTestMethod")]
public void Discover_Finds_Regular_Test_Fixture_And_Method(Type testFixtureInAssemblyToDiscoverTestsIn, string expectedNameOfFirstTestMethod)
{
AssertDiscoveredMethod(testFixtureInAssemblyToDiscoverTestsIn, expectedNameOfFirstTestMethod);
}
}
}
|
mit
|
C#
|
63050990df0f3e8cd18d46641b11b2e62357cc43
|
Add MeetingId to ConsultationParticipantRequest
|
SnapMD/connectedcare-sdk,dhawalharsora/connectedcare-sdk
|
SnapMD.VirtualCare.ApiModels/ConsultationParticipantResponse.cs
|
SnapMD.VirtualCare.ApiModels/ConsultationParticipantResponse.cs
|
using System;
namespace SnapMD.VirtualCare.ApiModels
{
public class ConsultationParticipantResponse: ConsultationParticipantRequest
{
public Guid PersonId { get; set; }
/// <summary>
/// The id of consultation meeting (chat)
/// </summary>
public Guid? MeetingId { get; set; }
}
}
|
using System;
namespace SnapMD.VirtualCare.ApiModels
{
public class ConsultationParticipantResponse: ConsultationParticipantRequest
{
public Guid PersonId { get; set; }
}
}
|
apache-2.0
|
C#
|
7313c26a660bc0de717837911fc23f5770c7c313
|
Fix WinUI demo null ref exception after cancelling file picker.
|
helix-toolkit/helix-toolkit,holance/helix-toolkit
|
Source/Examples/WinUI/ModelViewer/Services/FilePickerService.cs
|
Source/Examples/WinUI/ModelViewer/Services/FilePickerService.cs
|
using System;
using System.Threading.Tasks;
using Microsoft.UI.Xaml;
using Windows.Storage.Pickers;
namespace ModelViewer.Services;
public sealed class FilePickerService
{
public async Task<string> StartFilePicker(string filters)
{
var tokens = filters.Split(';', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
return await StartFilePicker(tokens);
}
public async Task<string> StartFilePicker(string[] filters)
{
var picker = new FileOpenPicker
{
ViewMode = PickerViewMode.Thumbnail,
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
};
// Pass in the current WinUI window and get its handle
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(App.GetService<Window>());
WinRT.Interop.InitializeWithWindow.Initialize(picker, hwnd);
foreach (var filter in filters)
{
if (filter == ".mesh.xml") { continue; }
picker.FileTypeFilter.Add(filter);
}
return await picker.PickSingleFileAsync().AsTask().ContinueWith((result) => {
return result is null || result.Result is null ? string.Empty : result.Result.Path;
});
}
}
|
using System;
using System.Threading.Tasks;
using Microsoft.UI.Xaml;
using Windows.Storage.Pickers;
namespace ModelViewer.Services;
public sealed class FilePickerService
{
public async Task<string> StartFilePicker(string filters)
{
var tokens = filters.Split(';', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
return await StartFilePicker(tokens);
}
public async Task<string> StartFilePicker(string[] filters)
{
var picker = new FileOpenPicker
{
ViewMode = PickerViewMode.Thumbnail,
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
};
// Pass in the current WinUI window and get its handle
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(App.GetService<Window>());
WinRT.Interop.InitializeWithWindow.Initialize(picker, hwnd);
foreach (var filter in filters)
{
if (filter == ".mesh.xml") { continue; }
picker.FileTypeFilter.Add(filter);
}
return await picker.PickSingleFileAsync().AsTask().ContinueWith((result) => {
return result is null ? string.Empty : result.Result.Path;
});
}
}
|
mit
|
C#
|
dbaa16288caf2dd4576aff773d25d2a293dfcf9f
|
Disable CanSubmitToSILJiraAutomatedTestProject test on Linux
|
StephenMcConnel/BloomDesktop,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,JohnThomson/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,gmartin7/myBloomFork,andrew-polk/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,JohnThomson/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,andrew-polk/BloomDesktop,BloomBooks/BloomDesktop,andrew-polk/BloomDesktop,BloomBooks/BloomDesktop,gmartin7/myBloomFork,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,andrew-polk/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork
|
src/BloomTests/ProblemReporterDialogTests.cs
|
src/BloomTests/ProblemReporterDialogTests.cs
|
// Copyright (c) 2014-2015 SIL International
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System;
using System.Reflection;
using NUnit.Framework;
using Bloom.MiscUI;
namespace BloomTests
{
[TestFixture]
[Category("RequiresUI")]
public class ProblemReporterDialogTests
{
class ProblemReporterDialogDouble: ProblemReporterDialog
{
public ProblemReporterDialogDouble(): base(null, null)
{
Success = true;
_youTrackProjectKey = "AUT";
this.Load += (sender, e) =>
{
_description.Text = "Created by unit test of " + Assembly.GetAssembly(this.GetType()).FullName;
_okButton_Click(sender, e);
};
}
public bool Success { get; private set; }
protected override void UpdateDisplay()
{
if (_state == State.Success)
Close();
}
protected override void ChangeState(State state)
{
if (state == State.CouldNotAutomaticallySubmit)
{
Success = false;
Close();
}
base.ChangeState(state);
}
}
/// <summary>
/// This is just a smoke-test that will notify us if the SIL JIRA stops working with the API we're relying on.
/// It sends reports to https://jira.sil.org/browse/AUT
/// </summary>
[Test]
[Platform(Exclude = "Linux", Reason = "YouTrackSharp is too Windows-centric")]
public void CanSubmitToSILJiraAutomatedTestProject()
{
using (var dlg = new ProblemReporterDialogDouble())
{
dlg.ShowDialog();
Assert.That(dlg.Success, Is.True, "Automatic submission of issue failed");
}
}
}
}
|
// Copyright (c) 2014-2015 SIL International
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System;
using System.Reflection;
using NUnit.Framework;
using Bloom.MiscUI;
namespace BloomTests
{
[TestFixture]
[Category("RequiresUI")]
public class ProblemReporterDialogTests
{
class ProblemReporterDialogDouble: ProblemReporterDialog
{
public ProblemReporterDialogDouble(): base(null, null)
{
Success = true;
_youTrackProjectKey = "AUT";
this.Load += (sender, e) =>
{
_description.Text = "Created by unit test of " + Assembly.GetAssembly(this.GetType()).FullName;
_okButton_Click(sender, e);
};
}
public bool Success { get; private set; }
protected override void UpdateDisplay()
{
if (_state == State.Success)
Close();
}
protected override void ChangeState(State state)
{
if (state == State.CouldNotAutomaticallySubmit)
{
Success = false;
Close();
}
base.ChangeState(state);
}
}
/// <summary>
/// This is just a smoke-test that will notify us if the SIL JIRA stops working with the API we're relying on.
/// It sends reports to https://jira.sil.org/browse/AUT
/// </summary>
[Test]
public void CanSubmitToSILJiraAutomatedTestProject()
{
using (var dlg = new ProblemReporterDialogDouble())
{
dlg.ShowDialog();
Assert.That(dlg.Success, Is.True, "Automatic submission of issue failed");
}
}
}
}
|
mit
|
C#
|
d4ec648e5483f90a94fb995645ce6d8dfdc1cb2b
|
update version.
|
tangxuehua/equeue,geffzhang/equeue,Aaron-Liu/equeue,Aaron-Liu/equeue,tangxuehua/equeue,tangxuehua/equeue,geffzhang/equeue
|
src/EQueue/Properties/AssemblyInfo.cs
|
src/EQueue/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.8")]
[assembly: AssemblyFileVersion("1.0.8")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.7")]
[assembly: AssemblyFileVersion("1.0.7")]
|
mit
|
C#
|
b16ca059ca594f07c5df8b59e308767428aa9bdc
|
Add filters added via FluentMvc before filters added via attributes.
|
stormid/FluentMvc,stormid/FluentMvc,stormid/FluentMvc,stormid/FluentMvc
|
src/FluentMvc/ActionFilterRegistry.cs
|
src/FluentMvc/ActionFilterRegistry.cs
|
namespace FluentMvc
{
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Configuration;
public class ActionFilterRegistry : AbstractRegistry<ActionFilterRegistryItem, ActionFilterSelector>, IActionFilterRegistry
{
private IFluentMvcObjectFactory objectFactory;
public ActionFilterRegistry(IFluentMvcObjectFactory objectFactory)
{
SetObjectFactory(objectFactory);
}
public void AddFiltersTo(FilterInfo baseFilters, ActionFilterSelector selector)
{
var applicableFilters = FindForSelector(selector);
FilterAndAddFilters(baseFilters.ActionFilters, applicableFilters);
FilterAndAddFilters(baseFilters.AuthorizationFilters, applicableFilters);
FilterAndAddFilters(baseFilters.ExceptionFilters, applicableFilters);
FilterAndAddFilters(baseFilters.ResultFilters, applicableFilters);
}
public void SetObjectFactory(IFluentMvcObjectFactory factory)
{
objectFactory = factory;
}
private void FilterAndAddFilters<T>(IList<T> baseFiltersList, IEnumerable<ActionFilterRegistryItem> applicableFilters)
{
IList<T> filtersToAdd = new List<T>();
foreach (var item in FilterActionFilters<T>(applicableFilters))
{
var filter = CreateFilter<T>(item);
BuildUp(filter);
filtersToAdd.Add(filter);
}
foreach (var filter in filtersToAdd.Reverse())
{
baseFiltersList.Insert(0, filter);
}
}
private void BuildUp<T>(T filter)
{
objectFactory.BuildUpProperties<T>(filter);
}
private T CreateFilter<T>(RegistryItem item)
{
return item.Create<T>(objectFactory);
}
private IEnumerable<ActionFilterRegistryItem> FilterActionFilters<T>(IEnumerable<ActionFilterRegistryItem> applicableFilters)
{
return applicableFilters.Where(i => (typeof(T)).IsAssignableFrom(i.Type));
}
}
}
|
namespace FluentMvc
{
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Configuration;
public class ActionFilterRegistry : AbstractRegistry<ActionFilterRegistryItem, ActionFilterSelector>, IActionFilterRegistry
{
private IFluentMvcObjectFactory objectFactory;
public ActionFilterRegistry(IFluentMvcObjectFactory objectFactory)
{
SetObjectFactory(objectFactory);
}
public void AddFiltersTo(FilterInfo baseFilters, ActionFilterSelector selector)
{
var applicableFilters = FindForSelector(selector);
FilterAndAddFilters(baseFilters.ActionFilters, applicableFilters);
FilterAndAddFilters(baseFilters.AuthorizationFilters, applicableFilters);
FilterAndAddFilters(baseFilters.ExceptionFilters, applicableFilters);
FilterAndAddFilters(baseFilters.ResultFilters, applicableFilters);
}
public void SetObjectFactory(IFluentMvcObjectFactory factory)
{
objectFactory = factory;
}
private void FilterAndAddFilters<T>(ICollection<T> baseFiltersList, IEnumerable<ActionFilterRegistryItem> applicableFilters)
{
foreach (var item in FilterActionFilters<T>(applicableFilters))
{
var filter = CreateFilter<T>(item);
BuildUp(filter);
AddFilter(baseFiltersList, filter);
}
}
private void BuildUp<T>(T filter)
{
objectFactory.BuildUpProperties<T>(filter);
}
private void AddFilter<T>(ICollection<T> baseFiltersList, T filter)
{
baseFiltersList.Add(filter);
}
private T CreateFilter<T>(RegistryItem item)
{
return item.Create<T>(objectFactory);
}
private IEnumerable<ActionFilterRegistryItem> FilterActionFilters<T>(IEnumerable<ActionFilterRegistryItem> applicableFilters)
{
return applicableFilters.Where(i => (typeof(T)).IsAssignableFrom(i.Type));
}
}
}
|
apache-2.0
|
C#
|
fea3540e4849d48e8f66bd3bc6e79a8cedf1bc8d
|
upgrade tu version 2.0.0
|
hossmi/qtfk
|
QTFK.Core/Properties/AssemblyInfo.cs
|
QTFK.Core/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QTFK.Core")]
[assembly: AssemblyDescription("Quick Tools for Funny Koding")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hossmi")]
[assembly: AssemblyProduct("QTFK.Core")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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("8c740adf-e4e1-444a-a9f0-2e40b174260f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QTFK.Core")]
[assembly: AssemblyDescription("Quick Tools for Funny Koding")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hossmi")]
[assembly: AssemblyProduct("QTFK.Core")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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("8c740adf-e4e1-444a-a9f0-2e40b174260f")]
// 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.6.0")]
[assembly: AssemblyFileVersion("1.6.0")]
|
mit
|
C#
|
651b8a3435fc8789a3f2b3c36d426b37eea2f642
|
Add test case for deserialization of recipients as msisdns array
|
messagebird/csharp-rest-api
|
Tests/UnitTests/MessageBirdUnitTests/Resources/MessagesTests.cs
|
Tests/UnitTests/MessageBirdUnitTests/Resources/MessagesTests.cs
|
using MessageBird.Objects;
using MessageBird.Resources;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace MessageBirdTests.Resources
{
[TestClass()]
public class MessagesTests
{
[TestMethod()]
public void DeserializeAndSerialize()
{
const string JsonResultFromCreateMessage = @"{
'id':'e7028180453e8a69d318686b17179500',
'href':'https:\/\/rest.messagebird.com\/messages\/e7028180453e8a69d318686b17179500',
'direction':'mt',
'type':'sms',
'originator':'MsgBirdSms',
'body':'Welcome to MessageBird',
'reference':null,
'validity':null,
'gateway':56,
'typeDetails':{
},
'datacoding':'plain',
'mclass':1,
'scheduledDatetime':null,
'createdDatetime':'2014-08-11T11:18:53+00:00',
'recipients':{
'totalCount':1,
'totalSentCount':1,
'totalDeliveredCount':0,
'totalDeliveryFailedCount':0,
'items':[
{
'recipient':31612345678,
'status':'sent',
'statusDatetime':'2014-08-11T11:18:53+00:00'
}
]
}
}";
Recipients recipients = new Recipients();
Message message = new Message("", "", recipients);
Messages messages = new Messages(message);
messages.Deserialize(JsonResultFromCreateMessage);
Message messageResult = messages.Object as Message;
string messageResultString = messageResult.ToString();
JsonConvert.DeserializeObject<Message>(messageResultString); // check if Deserialize/Serialize cycle works.
}
[TestMethod()]
public void DeserializeRecipientsAsMsisdnsArray()
{
var recipients = new Recipients();
recipients.AddRecipient(31612345678);
var message = new Message("MsgBirdSms", "Welcome to MessageBird", recipients);
var messages = new Messages(message);
string serializedMessage = messages.Serialize();
messages.Deserialize(serializedMessage);
}
}
}
|
using MessageBird.Objects;
using MessageBird.Resources;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace MessageBirdTests.Resources
{
[TestClass()]
public class MessagesTests
{
[TestMethod()]
public void DeserializeAndSerialize()
{
const string JsonResultFromCreateMessage = @"{
'id':'e7028180453e8a69d318686b17179500',
'href':'https:\/\/rest.messagebird.com\/messages\/e7028180453e8a69d318686b17179500',
'direction':'mt',
'type':'sms',
'originator':'MsgBirdSms',
'body':'Welcome to MessageBird',
'reference':null,
'validity':null,
'gateway':56,
'typeDetails':{
},
'datacoding':'plain',
'mclass':1,
'scheduledDatetime':null,
'createdDatetime':'2014-08-11T11:18:53+00:00',
'recipients':{
'totalCount':1,
'totalSentCount':1,
'totalDeliveredCount':0,
'totalDeliveryFailedCount':0,
'items':[
{
'recipient':31612345678,
'status':'sent',
'statusDatetime':'2014-08-11T11:18:53+00:00'
}
]
}
}";
Recipients recipients = new Recipients();
Message message = new Message("", "", recipients);
Messages messages = new Messages(message);
messages.Deserialize(JsonResultFromCreateMessage);
Message messageResult = messages.Object as Message;
string messageResultString = messageResult.ToString();
JsonConvert.DeserializeObject<Message>(messageResultString); // check if Deserialize/Serialize cycle works.
}
}
}
|
isc
|
C#
|
0fe656b943c4579dbb04db0ff99f119fbd4ddaf6
|
fix test
|
coe-google-apps-support/Mailman,coe-google-apps-support/Mailman,coe-google-apps-support/Mailman
|
src/Mailman.Tests/MockEmailService.cs
|
src/Mailman.Tests/MockEmailService.cs
|
using Mailman.Services;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Mailman.Tests
{
public class MockEmailService : IEmailService
{
public MockEmailService()
{
SentEmails = new List<Email>();
}
public IList<Email> SentEmails { get; }
public Task SendEmailAsync(IEnumerable<string> to, IEnumerable<string> cc, IEnumerable<string> bcc, string subject, string body)
{
SentEmails.Add(new Email(to, cc, bcc, subject, body));
return Task.CompletedTask;
}
public class Email
{
public Email(IEnumerable<string> to, IEnumerable<string> cc, IEnumerable<string> bcc, string subject, string body)
{
To = to;
Cc = cc;
Bcc = bcc;
Subject = subject;
Body = body;
}
public IEnumerable<string> To { get; private set; }
public IEnumerable<string> Cc { get; private set; }
public IEnumerable<string> Bcc { get; private set; }
public string Subject { get; private set; }
public string Body { get; private set; }
}
}
}
|
using Mailman.Services;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Mailman.Tests
{
public class MockEmailService : IEmailService
{
public MockEmailService()
{
SentEmails = new List<Email>();
}
public IList<Email> SentEmails { get; }
public Task SendEmailAsync(string to, string cc, string bcc, string subject, string body)
{
SentEmails.Add(new Email(to, cc, bcc, subject, body));
return Task.CompletedTask;
}
public Task SendEmailAsync(IEnumerable<string> to, IEnumerable<string> cc, IEnumerable<string> bcc, string subject, string body)
{
throw new NotImplementedException();
}
public class Email
{
public Email(string to, string cc, string bcc, string subject, string body)
{
To = to;
Cc = cc;
Bcc = bcc;
Subject = subject;
Body = body;
}
public string To { get; private set; }
public string Cc { get; private set; }
public string Bcc { get; private set; }
public string Subject { get; private set; }
public string Body { get; private set; }
}
}
}
|
mit
|
C#
|
35bc61492fdb85cdab02c1940a8bbf963e9c26c9
|
Improve the correctness of ParserQueryTest's Next parser by acknowledging that there may not be a next character to consume, while also ensuring that when the return type of Peek changes to ReadOnlySpan<char> this parser will not need further attention.
|
plioi/parsley
|
src/Parsley.Tests/ParserQueryTests.cs
|
src/Parsley.Tests/ParserQueryTests.cs
|
using System.Globalization;
namespace Parsley.Tests;
class ParserQueryTests
{
static readonly Parser<char> Next = input =>
{
var next = input.Peek(1);
if (next.Length == 1)
{
char c = next[0];
input.Advance(1);
return new Parsed<char>(c, input.Position);
}
return new Error<char>(input.Position, ErrorMessage.Expected("character"));
};
public void CanBuildParserWhichSimulatesSuccessfulParsingOfGivenValueWithoutConsumingInput()
{
var parser = 1.SucceedWithThisValue();
parser.PartiallyParses("input", "input").Value.ShouldBe(1);
}
public void CanBuildParserFromSingleSimplerParser()
{
var parser = from x in Next
select char.ToUpper(x, CultureInfo.InvariantCulture);
parser.PartiallyParses("xy", "y").Value.ShouldBe('X');
}
public void CanBuildParserFromOrderedSequenceOfSimplerParsers()
{
var parser = (from a in Next
from b in Next
from c in Next
select $"{a}{b}{c}".ToUpper(CultureInfo.InvariantCulture));
parser.PartiallyParses("abcdef", "def").Value.ShouldBe("ABC");
}
public void PropogatesErrorsWithoutRunningRemainingParsers()
{
var Fail = Grammar<string>.Fail;
(from _ in Fail
from x in Next
from y in Next
select Tuple.Create(x, y)).FailsToParse("xy", "xy", "(1, 1): Parse error.");
(from x in Next
from _ in Fail
from y in Next
select Tuple.Create(x, y)).FailsToParse("xy", "y", "(1, 2): Parse error.");
(from x in Next
from y in Next
from _ in Fail
select Tuple.Create(x, y)).FailsToParse("xy", "", "(1, 3): Parse error.");
}
}
|
using System.Globalization;
namespace Parsley.Tests;
class ParserQueryTests
{
static readonly Parser<string> Next = input =>
{
var next = input.Peek(1);
input.Advance(1);
return new Parsed<string>(next, input.Position);
};
public void CanBuildParserWhichSimulatesSuccessfulParsingOfGivenValueWithoutConsumingInput()
{
var parser = 1.SucceedWithThisValue();
parser.PartiallyParses("input", "input").Value.ShouldBe(1);
}
public void CanBuildParserFromSingleSimplerParser()
{
var parser = from x in Next
select x.ToUpper(CultureInfo.InvariantCulture);
parser.PartiallyParses("xy", "y").Value.ShouldBe("X");
}
public void CanBuildParserFromOrderedSequenceOfSimplerParsers()
{
var parser = (from a in Next
from b in Next
from c in Next
select (a + b + c).ToUpper(CultureInfo.InvariantCulture));
parser.PartiallyParses("abcdef", "def").Value.ShouldBe("ABC");
}
public void PropogatesErrorsWithoutRunningRemainingParsers()
{
var Fail = Grammar<string>.Fail;
(from _ in Fail
from x in Next
from y in Next
select Tuple.Create(x, y)).FailsToParse("xy", "xy", "(1, 1): Parse error.");
(from x in Next
from _ in Fail
from y in Next
select Tuple.Create(x, y)).FailsToParse("xy", "y", "(1, 2): Parse error.");
(from x in Next
from y in Next
from _ in Fail
select Tuple.Create(x, y)).FailsToParse("xy", "", "(1, 3): Parse error.");
}
}
|
mit
|
C#
|
41b0df1f0e226934b9b787f6e6f1853e2d0ab259
|
Document PoESocketedItem
|
jcmoyer/Yeena
|
Yeena/PathOfExile/PoESocketedItem.cs
|
Yeena/PathOfExile/PoESocketedItem.cs
|
// Copyright 2013 J.C. Moyer
//
// 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.
#pragma warning disable 649
using Newtonsoft.Json;
namespace Yeena.PathOfExile {
/// <summary>
/// Represents an item that has been socketed into another item in Path of Exile.
/// </summary>
[JsonObject]
class PoESocketedItem : PoEItem {
[JsonProperty("socket")]
private readonly int _socket;
[JsonProperty("colour")]
private readonly string _color;
/// <summary>
/// Returns the id of the socket this item has been socketed into.
/// </summary>
public int Socket { get { return _socket; } }
/// <summary>
/// Returns the color of the socket this item has been socketed into.
/// </summary>
public PoESocketColor Color { get { return PoESocketColorUtilities.Parse(_color); } }
}
}
|
// Copyright 2013 J.C. Moyer
//
// 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.
#pragma warning disable 649
using Newtonsoft.Json;
namespace Yeena.PathOfExile {
[JsonObject]
class PoESocketedItem : PoEItem {
[JsonProperty("socket")]
private readonly int _socket;
[JsonProperty("colour")]
private readonly string _color;
public int Socket {
get { return _socket; }
}
public PoESocketColor Color {
get { return PoESocketColorUtilities.Parse(_color); }
}
}
}
|
apache-2.0
|
C#
|
dc28483aac56be90eb9007ac54541b44bc39c03c
|
Remove unnecessary doc comment
|
AArnott/pinvoke,vbfox/pinvoke
|
src/User32/User32+SendMessageTimeoutFlags.cs
|
src/User32/User32+SendMessageTimeoutFlags.cs
|
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
namespace PInvoke
{
/// <content>
/// Contains the <see cref="SendMessageTimeoutFlags"/> nested type.
/// </content>
public partial class User32
{
/// <summary>
/// Possible flag values for <see cref="User32.SendMessageTimeout"/>
/// </summary>
public enum SendMessageTimeoutFlags : int
{
/// <summary>
/// The function returns without waiting for the time-out period to elapse if the receiving thread appears to not respond or "hangs."
/// </summary>
SMTO_ABORTIFHUNG = 0x0002,
/// <summary>
/// Prevents the calling thread from processing any other requests until the function returns.
/// </summary>
SMTO_BLOCK = 0x0001,
/// <summary>
/// The calling thread is not prevented from processing other requests while waiting for the function to return.
/// </summary>
SMTO_NORMAL = 0x0000,
/// <summary>
/// The function does not enforce the time-out period as long as the receiving thread is processing messages.
/// </summary>
SMTO_NOTIMEOUTIFNOTHUNG = 0x0008,
/// <summary>
/// The function should return 0 if the receiving window is destroyed or its owning thread dies while the message is being processed.
/// </summary>
SMTO_ERRORONEXIT = 0x0020
}
}
}
|
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
namespace PInvoke
{
/// <content>
/// Contains the <see cref="SendMessageTimeoutFlags"/> nested type.
/// </content>
public partial class User32
{
/// <summary>
/// Possible flag values for <see cref="User32.SendMessageTimeout"/>
/// Documentation pulled from MSDN.
/// </summary>
public enum SendMessageTimeoutFlags : int
{
/// <summary>
/// The function returns without waiting for the time-out period to elapse if the receiving thread appears to not respond or "hangs."
/// </summary>
SMTO_ABORTIFHUNG = 0x0002,
/// <summary>
/// Prevents the calling thread from processing any other requests until the function returns.
/// </summary>
SMTO_BLOCK = 0x0001,
/// <summary>
/// The calling thread is not prevented from processing other requests while waiting for the function to return.
/// </summary>
SMTO_NORMAL = 0x0000,
/// <summary>
/// The function does not enforce the time-out period as long as the receiving thread is processing messages.
/// </summary>
SMTO_NOTIMEOUTIFNOTHUNG = 0x0008,
/// <summary>
/// The function should return 0 if the receiving window is destroyed or its owning thread dies while the message is being processed.
/// </summary>
SMTO_ERRORONEXIT = 0x0020
}
}
}
|
mit
|
C#
|
729f6c54b3d4ada26becf767925391b45ad03a88
|
test path fix
|
BigBabay/AsyncConverter,BigBabay/AsyncConverter
|
AsyncConverter.Tests/QuickFixes/ReturnNullToTaskAvailabilityTests.cs
|
AsyncConverter.Tests/QuickFixes/ReturnNullToTaskAvailabilityTests.cs
|
using System.IO;
using System.Linq;
using JetBrains.ReSharper.FeaturesTestFramework.Intentions;
using JetBrains.ReSharper.TestFramework;
using NUnit.Framework;
namespace AsyncConverter.Tests.QuickFixes
{
[TestFixture]
[TestNetFramework4]
public class ReturnNullToTaskAvailabilityTests : QuickFixAvailabilityTestBase
{
protected override string RelativeTestDataPath => @"ReturnNullToTaskAvailabilityTests";
[TestCaseSource(nameof(FileNames))]
public void Test(string fileName)
{
DoTestFiles(fileName);
}
private TestCaseData[] FileNames()
{
return Directory
.GetFiles(@"..\..\..\..\Test\Data\" + RelativeTestDataPath, "*.cs")
.Select(x => new TestCaseData(Path.GetFileName(x)))
.ToArray();
}
}
}
|
using System.IO;
using System.Linq;
using JetBrains.ReSharper.FeaturesTestFramework.Intentions;
using JetBrains.ReSharper.TestFramework;
using NUnit.Framework;
namespace AsyncConverter.Tests.QuickFixes
{
[TestFixture]
[TestNetFramework4]
public class ReturnNullToTaskAvailabilityTests : QuickFixAvailabilityTestBase
{
protected override string RelativeTestDataPath => @"ReturnNullToTaskAvailabilityTests";
[TestCaseSource(nameof(FileNames))]
public void Test(string fileName)
{
DoTestFiles(fileName);
}
private TestCaseData[] FileNames()
{
return Directory
.GetFiles(@"..\..\..\..\..\Test\Data\" + RelativeTestDataPath, "*.cs")
.Select(x => new TestCaseData(Path.GetFileName(x)))
.ToArray();
}
}
}
|
mit
|
C#
|
98e34eb97a5757dfab529d1d7610d012bab65868
|
Fix #12, show posts with no category
|
tylerlrhodes/bagombo,tylerlrhodes/bagombo,tylerlrhodes/bagombo
|
src/Bagombo.Data/Query/EFCoreQueryHandlers/GetAllPostsByCategoryViewModelEFQH.cs
|
src/Bagombo.Data/Query/EFCoreQueryHandlers/GetAllPostsByCategoryViewModelEFQH.cs
|
using Bagombo.Data.Query.Queries;
using Bagombo.EFCore;
using Bagombo.Models;
using Bagombo.Models.ViewModels.Home;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bagombo.Data.Query.EFCoreQueryHandlers
{
public class GetAllPostsByCategoryViewModelEFQH : EFQHBase, IQueryHandlerAsync<GetAllPostsByCategoryViewModelQuery, AllPostsViewModel>
{
public GetAllPostsByCategoryViewModelEFQH(BlogDbContext context) : base(context)
{
}
public async Task<AllPostsViewModel> HandleAsync(GetAllPostsByCategoryViewModelQuery query)
{
var categories = await _context.Categories.AsNoTracking().ToListAsync();
var viewCategories = new List<PostsByCategoryViewModel>();
foreach (var c in categories)
{
var bpcs = await _context.BlogPostCategory
.AsNoTracking()
.Where(bp => bp.CategoryId == c.Id && bp.BlogPost.Public == true && bp.BlogPost.PublishOn < DateTime.Now)
.Include(bpc => bpc.BlogPost)
.ThenInclude(bp => bp.Author)
.ToListAsync();
var vpbc = new PostsByCategoryViewModel()
{
Category = c,
Posts = bpcs.Select(bp => bp.BlogPost).ToList()
};
viewCategories.Add(vpbc);
}
var NoCategory = new Category()
{
Name = "No Category"
};
var ncbps = await _context.BlogPosts.AsNoTracking()
.Include(bpc => bpc.BlogPostCategory)
.Where(bpc => bpc.BlogPostCategory.Count == 0)
.Include(bp => bp.Author)
.ToListAsync();
var ncvpbc = new PostsByCategoryViewModel()
{
Category = NoCategory,
Posts = ncbps
};
viewCategories.Add(ncvpbc);
return new AllPostsViewModel()
{
PostsByDate = null,
SortBy = 1,
Categories = viewCategories ?? new List<PostsByCategoryViewModel>()
};
}
}
}
|
using Bagombo.Data.Query.Queries;
using Bagombo.EFCore;
using Bagombo.Models.ViewModels.Home;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bagombo.Data.Query.EFCoreQueryHandlers
{
public class GetAllPostsByCategoryViewModelEFQH : EFQHBase, IQueryHandlerAsync<GetAllPostsByCategoryViewModelQuery, AllPostsViewModel>
{
public GetAllPostsByCategoryViewModelEFQH(BlogDbContext context) : base(context)
{
}
public async Task<AllPostsViewModel> HandleAsync(GetAllPostsByCategoryViewModelQuery query)
{
var categories = await _context.Categories.AsNoTracking().ToListAsync();
var viewCategories = new List<PostsByCategoryViewModel>();
foreach (var c in categories)
{
var bpcs = await _context.BlogPostCategory
.AsNoTracking()
.Where(bp => bp.CategoryId == c.Id && bp.BlogPost.Public == true && bp.BlogPost.PublishOn < DateTime.Now)
.Include(bpc => bpc.BlogPost)
.ThenInclude(bp => bp.Author)
.ToListAsync();
var vpbc = new PostsByCategoryViewModel()
{
Category = c,
Posts = bpcs.Select(bp => bp.BlogPost).ToList()
};
viewCategories.Add(vpbc);
}
return new AllPostsViewModel()
{
PostsByDate = null,
SortBy = 1,
Categories = viewCategories ?? new List<PostsByCategoryViewModel>()
};
}
}
}
|
mit
|
C#
|
b12e1e05d32d72f96f846a68ab8f0ba689294497
|
move unknownhost name to constant
|
Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnetcore,Microsoft/ApplicationInsights-aspnet5,Microsoft/ApplicationInsights-aspnetcore
|
src/Microsoft.ApplicationInsights.AspNetCore/Extensions/HttpRequestExtensions.cs
|
src/Microsoft.ApplicationInsights.AspNetCore/Extensions/HttpRequestExtensions.cs
|
namespace Microsoft.ApplicationInsights.AspNetCore.Extensions
{
using System;
using System.Text;
using Microsoft.AspNetCore.Http;
/// <summary>
/// Set of extension methods for Microsoft.AspNetCore.Http.HttpRequest
/// </summary>
public static class HttpRequestExtensions
{
private const string UnknownHostName = "UNKNOWN-HOST";
/// <summary>
/// Gets http request Uri from request object
/// </summary>
/// <param name="request">The <see cref="HttpRequest"/></param>
/// <returns>A New Uri object representing request Uri</returns>
public static Uri GetUri(this HttpRequest request)
{
if (null == request)
{
throw new ArgumentNullException("request");
}
if (true == string.IsNullOrWhiteSpace(request.Scheme))
{
throw new ArgumentException("Http request Scheme is not specified");
}
string hostName = request.Host.HasValue ? request.Host.ToString() : UnknownHostName;
var builder = new StringBuilder();
builder.Append(request.Scheme)
.Append("://")
.Append(hostName);
if (true == request.Path.HasValue)
{
builder.Append(request.Path.Value);
}
if (true == request.QueryString.HasValue)
{
builder.Append(request.QueryString);
}
return new Uri(builder.ToString());
}
}
}
|
namespace Microsoft.ApplicationInsights.AspNetCore.Extensions
{
using System;
using System.Text;
using Microsoft.AspNetCore.Http;
/// <summary>
/// Set of extension methods for Microsoft.AspNetCore.Http.HttpRequest
/// </summary>
public static class HttpRequestExtensions
{
/// <summary>
/// Gets http request Uri from request object
/// </summary>
/// <param name="request">The <see cref="HttpRequest"/></param>
/// <returns>A New Uri object representing request Uri</returns>
public static Uri GetUri(this HttpRequest request)
{
string unknownHostName = "UNKNOWN-HOST";
if (null == request)
{
throw new ArgumentNullException("request");
}
if (true == string.IsNullOrWhiteSpace(request.Scheme))
{
throw new ArgumentException("Http request Scheme is not specified");
}
string hostName = request.Host.HasValue ? request.Host.ToString() : unknownHostName;
var builder = new StringBuilder();
builder.Append(request.Scheme)
.Append("://")
.Append(hostName);
if (true == request.Path.HasValue)
{
builder.Append(request.Path.Value);
}
if (true == request.QueryString.HasValue)
{
builder.Append(request.QueryString);
}
return new Uri(builder.ToString());
}
}
}
|
mit
|
C#
|
89c5294c367c3688011f936cc486f2f8a1410954
|
Format suggestions
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Gui/Controls/TransactionDetails/Models/InOutInfoTuple.cs
|
WalletWasabi.Gui/Controls/TransactionDetails/Models/InOutInfoTuple.cs
|
using System;
namespace WalletWasabi.Gui.Controls.TransactionDetails.Models
{
public readonly struct InOutInfoTuple : IEquatable<InOutInfoTuple>
{
public InOutInfoTuple(AddressAmountTuple input, AddressAmountTuple output)
{
Input = input;
Output = output;
}
public AddressAmountTuple Input { get; }
public AddressAmountTuple Output { get; }
public static bool operator ==(InOutInfoTuple x, InOutInfoTuple y) => x.Equals(y);
public static bool operator !=(InOutInfoTuple x, InOutInfoTuple y) => !(x == y);
public bool Equals(InOutInfoTuple other) =>
(Input, Output) == (other.Input, other.Output);
public override bool Equals(object other) =>
((InOutInfoTuple)other).Equals(this) == true;
public override int GetHashCode() =>
HashCode.Combine(Input, Output);
}
}
|
using System;
namespace WalletWasabi.Gui.Controls.TransactionDetails.Models
{
public readonly struct InOutInfoTuple : IEquatable<InOutInfoTuple>
{
public InOutInfoTuple(AddressAmountTuple input, AddressAmountTuple output)
{
Input = input;
Output = output;
}
public AddressAmountTuple Input { get; }
public AddressAmountTuple Output { get; }
public static bool operator ==(InOutInfoTuple x, InOutInfoTuple y) => x.Equals(y);
public static bool operator !=(InOutInfoTuple x, InOutInfoTuple y) => !(x == y);
public bool Equals(InOutInfoTuple other) =>
(Input, Output) == (other.Input, other.Output);
public override bool Equals(object other) =>
((InOutInfoTuple)other).Equals(this) == true;
public override int GetHashCode() =>
HashCode.Combine(Input, Output);
}
}
|
mit
|
C#
|
dbc522aedea4e0cf3e5b36b07e4e5f04d36f4b0c
|
Remove weird using
|
UselessToucan/osu,smoogipoo/osu,ppy/osu,ppy/osu,ppy/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu
|
osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs
|
osu.Game.Tests/Visual/Editing/TestSceneEditorBeatmapCreation.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.IO;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Tests.Resources;
using SharpCompress.Archives;
using SharpCompress.Archives.Zip;
namespace osu.Game.Tests.Visual.Editing
{
public class TestSceneEditorBeatmapCreation : EditorTestScene
{
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
protected override bool EditorComponentsReady => Editor.ChildrenOfType<SetupScreen>().FirstOrDefault()?.IsLoaded == true;
public override void SetUpSteps()
{
AddStep("set dummy", () => Beatmap.Value = new DummyWorkingBeatmap(Audio, null));
base.SetUpSteps();
}
[Test]
public void TestCreateNewBeatmap()
{
AddStep("add random hitobject", () => EditorBeatmap.Metadata.Title = Guid.NewGuid().ToString());
AddStep("save beatmap", () => Editor.Save());
AddAssert("new beatmap persisted", () => EditorBeatmap.BeatmapInfo.ID > 0);
}
[Test]
public void TestAddAudioTrack()
{
AddAssert("switch track to real track", () =>
{
var setup = Editor.ChildrenOfType<SetupScreen>().First();
var temp = TestResources.GetTestBeatmapForImport();
string extractedFolder = $"{temp}_extracted";
Directory.CreateDirectory(extractedFolder);
using (var zip = ZipArchive.Open(temp))
zip.WriteToDirectory(extractedFolder);
bool success = setup.ChangeAudioTrack(Path.Combine(extractedFolder, "03. Renatus - Soleily 192kbps.mp3"));
File.Delete(temp);
Directory.Delete(extractedFolder, true);
return success;
});
AddAssert("track length changed", () => Beatmap.Value.Track.Length > 60000);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.IO;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Storyboards;
using osu.Game.Tests.Resources;
using SharpCompress.Archives;
using SharpCompress.Archives.Zip;
namespace osu.Game.Tests.Visual.Editing
{
public class TestSceneEditorBeatmapCreation : EditorTestScene
{
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
protected override bool EditorComponentsReady => Editor.ChildrenOfType<SetupScreen>().FirstOrDefault()?.IsLoaded == true;
public override void SetUpSteps()
{
AddStep("set dummy", () => Beatmap.Value = new DummyWorkingBeatmap(Audio, null));
base.SetUpSteps();
}
[Test]
public void TestCreateNewBeatmap()
{
AddStep("add random hitobject", () => EditorBeatmap.Metadata.Title = Guid.NewGuid().ToString());
AddStep("save beatmap", () => Editor.Save());
AddAssert("new beatmap persisted", () => EditorBeatmap.BeatmapInfo.ID > 0);
}
[Test]
public void TestAddAudioTrack()
{
AddAssert("switch track to real track", () =>
{
var setup = Editor.ChildrenOfType<SetupScreen>().First();
var temp = TestResources.GetTestBeatmapForImport();
string extractedFolder = $"{temp}_extracted";
Directory.CreateDirectory(extractedFolder);
using (var zip = ZipArchive.Open(temp))
zip.WriteToDirectory(extractedFolder);
bool success = setup.ChangeAudioTrack(Path.Combine(extractedFolder, "03. Renatus - Soleily 192kbps.mp3"));
File.Delete(temp);
Directory.Delete(extractedFolder, true);
return success;
});
AddAssert("track length changed", () => Beatmap.Value.Track.Length > 60000);
}
}
}
|
mit
|
C#
|
448023430c5bccc546ec76cbd036df1d1482e960
|
Make sealed
|
mgoertz-msft/roslyn,ErikSchierboom/roslyn,ErikSchierboom/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,bartdesmet/roslyn,genlu/roslyn,physhi/roslyn,tmat/roslyn,gafter/roslyn,bartdesmet/roslyn,jmarolf/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,diryboy/roslyn,diryboy/roslyn,brettfo/roslyn,weltkante/roslyn,aelij/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,davkean/roslyn,diryboy/roslyn,wvdd007/roslyn,mavasani/roslyn,gafter/roslyn,tmat/roslyn,ErikSchierboom/roslyn,AmadeusW/roslyn,reaction1989/roslyn,dotnet/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,wvdd007/roslyn,weltkante/roslyn,aelij/roslyn,physhi/roslyn,jmarolf/roslyn,tannergooding/roslyn,jmarolf/roslyn,KirillOsenkov/roslyn,mavasani/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,AmadeusW/roslyn,AmadeusW/roslyn,brettfo/roslyn,tmat/roslyn,dotnet/roslyn,panopticoncentral/roslyn,eriawan/roslyn,heejaechang/roslyn,davkean/roslyn,eriawan/roslyn,KevinRansom/roslyn,mgoertz-msft/roslyn,panopticoncentral/roslyn,brettfo/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,AlekseyTs/roslyn,reaction1989/roslyn,dotnet/roslyn,KevinRansom/roslyn,gafter/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,jasonmalinowski/roslyn,davkean/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,genlu/roslyn,eriawan/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn,sharwell/roslyn,KevinRansom/roslyn,mavasani/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,physhi/roslyn,stephentoub/roslyn,tannergooding/roslyn,reaction1989/roslyn
|
src/Workspaces/Remote/ServiceHub/Services/DesignerAttribute/RemoteDesignerAttributeIncrementalAnalyzerProvider.cs
|
src/Workspaces/Remote/ServiceHub/Services/DesignerAttribute/RemoteDesignerAttributeIncrementalAnalyzerProvider.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using Microsoft.CodeAnalysis.SolutionCrawler;
namespace Microsoft.CodeAnalysis.Remote
{
/// <remarks>Note: this is explicitly <b>not</b> exported. We don't want the <see
/// cref="RemoteWorkspace"/> to automatically load this. Instead, VS waits until it is ready
/// and then calls into OOP to tell it to start analyzing the solution. At that point we'll get
/// created and added to the solution crawler.
/// </remarks>
internal sealed class RemoteDesignerAttributeIncrementalAnalyzerProvider : IIncrementalAnalyzerProvider
{
private readonly RemoteEndPoint _endPoint;
public RemoteDesignerAttributeIncrementalAnalyzerProvider(RemoteEndPoint endPoint)
{
_endPoint = endPoint;
}
public IIncrementalAnalyzer CreateIncrementalAnalyzer(Workspace workspace)
=> new RemoteDesignerAttributeIncrementalAnalyzer(workspace, _endPoint);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using Microsoft.CodeAnalysis.SolutionCrawler;
namespace Microsoft.CodeAnalysis.Remote
{
/// <remarks>Note: this is explicitly <b>not</b> exported. We don't want the <see
/// cref="RemoteWorkspace"/> to automatically load this. Instead, VS waits until it is ready
/// and then calls into OOP to tell it to start analyzing the solution. At that point we'll get
/// created and added to the solution crawler.
/// </remarks>
internal class RemoteDesignerAttributeIncrementalAnalyzerProvider : IIncrementalAnalyzerProvider
{
private readonly RemoteEndPoint _endPoint;
public RemoteDesignerAttributeIncrementalAnalyzerProvider(RemoteEndPoint endPoint)
{
_endPoint = endPoint;
}
public IIncrementalAnalyzer CreateIncrementalAnalyzer(Workspace workspace)
=> new RemoteDesignerAttributeIncrementalAnalyzer(workspace, _endPoint);
}
}
|
mit
|
C#
|
16c698677a08d1fe1ea0ab0af52f3619775ffb43
|
add distinct data containers to confirmmigrationstatus
|
stankovski/azure-powershell,dulems/azure-powershell,stankovski/azure-powershell,naveedaz/azure-powershell,nemanja88/azure-powershell,dominiqa/azure-powershell,jianghaolu/azure-powershell,zhencui/azure-powershell,pomortaz/azure-powershell,haocs/azure-powershell,jasper-schneider/azure-powershell,dulems/azure-powershell,alfantp/azure-powershell,juvchan/azure-powershell,AzureRT/azure-powershell,zhencui/azure-powershell,tonytang-microsoft-com/azure-powershell,oaastest/azure-powershell,tonytang-microsoft-com/azure-powershell,alfantp/azure-powershell,Matt-Westphal/azure-powershell,rohmano/azure-powershell,juvchan/azure-powershell,devigned/azure-powershell,atpham256/azure-powershell,akurmi/azure-powershell,krkhan/azure-powershell,bgold09/azure-powershell,PashaPash/azure-powershell,stankovski/azure-powershell,ClogenyTechnologies/azure-powershell,DeepakRajendranMsft/azure-powershell,seanbamsft/azure-powershell,pomortaz/azure-powershell,ankurchoubeymsft/azure-powershell,naveedaz/azure-powershell,chef-partners/azure-powershell,pankajsn/azure-powershell,seanbamsft/azure-powershell,hungmai-msft/azure-powershell,stankovski/azure-powershell,jianghaolu/azure-powershell,juvchan/azure-powershell,oaastest/azure-powershell,yantang-msft/azure-powershell,hovsepm/azure-powershell,devigned/azure-powershell,krkhan/azure-powershell,ClogenyTechnologies/azure-powershell,nemanja88/azure-powershell,atpham256/azure-powershell,SarahRogers/azure-powershell,AzureRT/azure-powershell,zhencui/azure-powershell,Matt-Westphal/azure-powershell,AzureAutomationTeam/azure-powershell,PashaPash/azure-powershell,rhencke/azure-powershell,hovsepm/azure-powershell,rhencke/azure-powershell,yantang-msft/azure-powershell,jianghaolu/azure-powershell,TaraMeyer/azure-powershell,pelagos/azure-powershell,oaastest/azure-powershell,jasper-schneider/azure-powershell,DeepakRajendranMsft/azure-powershell,AzureRT/azure-powershell,mayurid/azure-powershell,seanbamsft/azure-powershell,atpham256/azure-powershell,krkhan/azure-powershell,tonytang-microsoft-com/azure-powershell,ankurchoubeymsft/azure-powershell,Matt-Westphal/azure-powershell,arcadiahlyy/azure-powershell,pelagos/azure-powershell,yadavbdev/azure-powershell,pankajsn/azure-powershell,arcadiahlyy/azure-powershell,rohmano/azure-powershell,hungmai-msft/azure-powershell,yoavrubin/azure-powershell,dominiqa/azure-powershell,pelagos/azure-powershell,SarahRogers/azure-powershell,zhencui/azure-powershell,enavro/azure-powershell,PashaPash/azure-powershell,yadavbdev/azure-powershell,devigned/azure-powershell,arcadiahlyy/azure-powershell,hungmai-msft/azure-powershell,naveedaz/azure-powershell,SarahRogers/azure-powershell,mayurid/azure-powershell,shuagarw/azure-powershell,alfantp/azure-powershell,TaraMeyer/azure-powershell,arcadiahlyy/azure-powershell,hungmai-msft/azure-powershell,devigned/azure-powershell,pomortaz/azure-powershell,rohmano/azure-powershell,yadavbdev/azure-powershell,krkhan/azure-powershell,jasper-schneider/azure-powershell,DeepakRajendranMsft/azure-powershell,Matt-Westphal/azure-powershell,jtlibing/azure-powershell,seanbamsft/azure-powershell,yantang-msft/azure-powershell,krkhan/azure-powershell,yantang-msft/azure-powershell,enavro/azure-powershell,atpham256/azure-powershell,devigned/azure-powershell,TaraMeyer/azure-powershell,rhencke/azure-powershell,ankurchoubeymsft/azure-powershell,AzureAutomationTeam/azure-powershell,enavro/azure-powershell,zaevans/azure-powershell,bgold09/azure-powershell,yoavrubin/azure-powershell,enavro/azure-powershell,DeepakRajendranMsft/azure-powershell,arcadiahlyy/azure-powershell,PashaPash/azure-powershell,zaevans/azure-powershell,jtlibing/azure-powershell,rhencke/azure-powershell,rohmano/azure-powershell,mayurid/azure-powershell,CamSoper/azure-powershell,stankovski/azure-powershell,shuagarw/azure-powershell,yantang-msft/azure-powershell,yoavrubin/azure-powershell,bgold09/azure-powershell,jianghaolu/azure-powershell,naveedaz/azure-powershell,mayurid/azure-powershell,zhencui/azure-powershell,AzureAutomationTeam/azure-powershell,rohmano/azure-powershell,shuagarw/azure-powershell,haocs/azure-powershell,yoavrubin/azure-powershell,dominiqa/azure-powershell,yantang-msft/azure-powershell,atpham256/azure-powershell,PashaPash/azure-powershell,dominiqa/azure-powershell,akurmi/azure-powershell,pankajsn/azure-powershell,TaraMeyer/azure-powershell,bgold09/azure-powershell,ClogenyTechnologies/azure-powershell,akurmi/azure-powershell,shuagarw/azure-powershell,haocs/azure-powershell,jianghaolu/azure-powershell,chef-partners/azure-powershell,TaraMeyer/azure-powershell,oaastest/azure-powershell,CamSoper/azure-powershell,devigned/azure-powershell,naveedaz/azure-powershell,zaevans/azure-powershell,tonytang-microsoft-com/azure-powershell,zaevans/azure-powershell,AzureAutomationTeam/azure-powershell,pankajsn/azure-powershell,AzureRT/azure-powershell,SarahRogers/azure-powershell,chef-partners/azure-powershell,yadavbdev/azure-powershell,haocs/azure-powershell,jasper-schneider/azure-powershell,jasper-schneider/azure-powershell,pankajsn/azure-powershell,SarahRogers/azure-powershell,tonytang-microsoft-com/azure-powershell,akurmi/azure-powershell,dulems/azure-powershell,dominiqa/azure-powershell,DeepakRajendranMsft/azure-powershell,hovsepm/azure-powershell,akurmi/azure-powershell,zhencui/azure-powershell,rhencke/azure-powershell,AzureAutomationTeam/azure-powershell,zaevans/azure-powershell,pelagos/azure-powershell,naveedaz/azure-powershell,yadavbdev/azure-powershell,ankurchoubeymsft/azure-powershell,CamSoper/azure-powershell,hovsepm/azure-powershell,AzureRT/azure-powershell,hungmai-msft/azure-powershell,ClogenyTechnologies/azure-powershell,chef-partners/azure-powershell,krkhan/azure-powershell,dulems/azure-powershell,pelagos/azure-powershell,atpham256/azure-powershell,pomortaz/azure-powershell,alfantp/azure-powershell,nemanja88/azure-powershell,ankurchoubeymsft/azure-powershell,juvchan/azure-powershell,oaastest/azure-powershell,AzureAutomationTeam/azure-powershell,rohmano/azure-powershell,CamSoper/azure-powershell,seanbamsft/azure-powershell,pankajsn/azure-powershell,pomortaz/azure-powershell,chef-partners/azure-powershell,shuagarw/azure-powershell,jtlibing/azure-powershell,AzureRT/azure-powershell,nemanja88/azure-powershell,CamSoper/azure-powershell,Matt-Westphal/azure-powershell,seanbamsft/azure-powershell,enavro/azure-powershell,haocs/azure-powershell,jtlibing/azure-powershell,nemanja88/azure-powershell,ClogenyTechnologies/azure-powershell,juvchan/azure-powershell,hovsepm/azure-powershell,yoavrubin/azure-powershell,mayurid/azure-powershell,hungmai-msft/azure-powershell,alfantp/azure-powershell,bgold09/azure-powershell,dulems/azure-powershell,jtlibing/azure-powershell
|
src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Migration/ConfirmAzureStorSimpleLegacyVolumeContainerStatus.cs
|
src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/Migration/ConfirmAzureStorSimpleLegacyVolumeContainerStatus.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.
// ----------------------------------------------------------------------------------
using Microsoft.WindowsAzure.Commands.StorSimple.Properties;
using Microsoft.WindowsAzure.Management.StorSimple;
using Microsoft.WindowsAzure.Management.StorSimple.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets
{
[Cmdlet(VerbsLifecycle.Confirm, "AzureStorSimpleLegacyVolumeContainerStatus")]
public class ConfirmAzureStorSimpleLegacyVolumeContainerStatus : StorSimpleCmdletBase
{
[Parameter(Mandatory = true, Position = 0, HelpMessage = StorSimpleCmdletHelpMessage.MigrationConfigId)]
[ValidateNotNullOrEmpty]
public string LegacyConfigId { get; set; }
[Parameter(Mandatory = true, Position = 1, HelpMessage = StorSimpleCmdletHelpMessage.MigrationOperation)]
[ValidateSet("Commit", "Rollback", IgnoreCase = true)]
public string MigrationOperation { get; set; }
[Parameter(Mandatory = false, Position = 2,
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
public string[] LegacyContainerNames { get; set; }
public override void ExecuteCmdlet()
{
try
{
var confirmMigrationRequest = new MigrationConfirmStatusRequest();
confirmMigrationRequest.Operation =
(MigrationOperation) Enum.Parse(typeof (MigrationOperation), MigrationOperation, true);
confirmMigrationRequest.DataContainerNameList = (null != LegacyContainerNames)
? new List<string>(LegacyContainerNames.ToList().Distinct(StringComparer.OrdinalIgnoreCase))
: new List<string>();
var status = StorSimpleClient.ConfirmLegacyVolumeContainerStatus(LegacyConfigId, confirmMigrationRequest);
MigrationCommonModelFormatter opFormatter = new MigrationCommonModelFormatter();
WriteObject(opFormatter.GetResultMessage(Resources.ConfirmMigrationSuccessMessage, status));
}
catch (Exception except)
{
this.HandleException(except);
}
}
}
}
|
// ----------------------------------------------------------------------------------
//
// 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.
// ----------------------------------------------------------------------------------
using Microsoft.WindowsAzure.Commands.StorSimple.Properties;
using Microsoft.WindowsAzure.Management.StorSimple;
using Microsoft.WindowsAzure.Management.StorSimple.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets
{
[Cmdlet(VerbsLifecycle.Confirm, "AzureStorSimpleLegacyVolumeContainerStatus")]
public class ConfirmAzureStorSimpleLegacyVolumeContainerStatus : StorSimpleCmdletBase
{
[Parameter(Mandatory = true, Position = 0, HelpMessage = StorSimpleCmdletHelpMessage.MigrationConfigId)]
[ValidateNotNullOrEmpty]
public string LegacyConfigId { get; set; }
[Parameter(Mandatory = true, Position = 1, HelpMessage = StorSimpleCmdletHelpMessage.MigrationOperation)]
[ValidateSet("Commit", "Rollback", IgnoreCase = true)]
public string MigrationOperation { get; set; }
[Parameter(Mandatory = false, Position = 2,
HelpMessage = StorSimpleCmdletHelpMessage.MigrationLegacyDataContainers)]
public string[] LegacyContainerNames { get; set; }
public override void ExecuteCmdlet()
{
try
{
var confirmMigrationRequest = new MigrationConfirmStatusRequest();
confirmMigrationRequest.Operation =
(MigrationOperation) Enum.Parse(typeof (MigrationOperation), MigrationOperation, true);
confirmMigrationRequest.DataContainerNameList = (null != LegacyContainerNames)
? new List<string>(LegacyContainerNames.ToList().Distinct())
: new List<string>();
var status = StorSimpleClient.ConfirmLegacyVolumeContainerStatus(LegacyConfigId, confirmMigrationRequest);
MigrationCommonModelFormatter opFormatter = new MigrationCommonModelFormatter();
WriteObject(opFormatter.GetResultMessage(Resources.ConfirmMigrationSuccessMessage, status));
}
catch (Exception except)
{
this.HandleException(except);
}
}
}
}
|
apache-2.0
|
C#
|
4c199104c5ba44c8e914f793c230e29287b5b403
|
Update aspnetcore mvc plaintext (#5038)
|
zloster/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,jamming/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,jamming/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,zloster/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,jamming/FrameworkBenchmarks,jamming/FrameworkBenchmarks,zloster/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,zloster/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,zloster/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,zloster/FrameworkBenchmarks,jamming/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,zloster/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,zloster/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,jamming/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,jamming/FrameworkBenchmarks,zloster/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,zloster/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,zloster/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,jamming/FrameworkBenchmarks,zloster/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,jamming/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,jamming/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,zloster/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,zloster/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,sagenschneider/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,zloster/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,jamming/FrameworkBenchmarks,stefanocasazza/FrameworkBenchmarks,jamming/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,jamming/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,zloster/FrameworkBenchmarks,jamming/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,zloster/FrameworkBenchmarks,zloster/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,jaguililla/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,MTDdk/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks
|
frameworks/CSharp/aspnetcore/Benchmarks/Controllers/HomeController.cs
|
frameworks/CSharp/aspnetcore/Benchmarks/Controllers/HomeController.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.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Benchmarks.Controllers
{
[Route("mvc")]
public class HomeController : Controller
{
[HttpGet("plaintext")]
public IActionResult Plaintext()
{
return new PlainTextActionResult();
}
[HttpGet("json")]
[Produces("application/json")]
public object Json()
{
return new { message = "Hello, World!" };
}
[HttpGet("view")]
public ViewResult Index()
{
return View();
}
private class PlainTextActionResult : IActionResult
{
private static readonly byte[] _helloWorldPayload = Encoding.UTF8.GetBytes("Hello, World!");
public Task ExecuteResultAsync(ActionContext context)
{
var response = context.HttpContext.Response;
response.StatusCode = StatusCodes.Status200OK;
response.ContentType = "text/plain";
var payloadLength = _helloWorldPayload.Length;
response.ContentLength = payloadLength;
return response.Body.WriteAsync(_helloWorldPayload, 0, payloadLength);
}
}
}
}
|
// 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.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Benchmarks.Controllers
{
[Route("mvc")]
public class HomeController : Controller
{
[HttpGet("plaintext")]
public IActionResult Plaintext()
{
return new PlainTextActionResult();
}
[HttpGet("json")]
[Produces("application/json")]
public object Json()
{
return new { message = "Hello, World!" };
}
[HttpGet("view")]
public ViewResult Index()
{
return View();
}
private class PlainTextActionResult : IActionResult
{
private static readonly byte[] _helloWorldPayload = Encoding.UTF8.GetBytes("Hello, World!");
public Task ExecuteResultAsync(ActionContext context)
{
context.HttpContext.Response.StatusCode = StatusCodes.Status200OK;
context.HttpContext.Response.ContentType = "text/plain";
context.HttpContext.Response.ContentLength = _helloWorldPayload.Length;
return context.HttpContext.Response.Body.WriteAsync(_helloWorldPayload, 0, _helloWorldPayload.Length);
}
}
}
}
|
bsd-3-clause
|
C#
|
e406793eea3364f904fc02e2c260d24c3ddfde06
|
Fix generic parameter
|
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
|
resharper/resharper-unity/test/src/Unity.Tests/Unity/CSharp/Intentions/QuickFixes/PreferAddressByIdToGraphicsParamsQuickFixTests.cs
|
resharper/resharper-unity/test/src/Unity.Tests/Unity/CSharp/Intentions/QuickFixes/PreferAddressByIdToGraphicsParamsQuickFixTests.cs
|
using JetBrains.ReSharper.FeaturesTestFramework.Intentions;
using JetBrains.ReSharper.Plugins.Tests.Unity.CSharp.Daemon.Stages.Analysis;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Errors;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.QuickFixes;
using NUnit.Framework;
namespace JetBrains.ReSharper.Plugins.Tests.Unity.CSharp.Intentions.QuickFixes
{
[TestUnity]
public class PreferAddressByIdToGraphicsParamsQuickFixAvailabilityTests : CSharpHighlightingTestBase<PreferAddressByIdToGraphicsParamsWarning>
{
protected override string RelativeTestDataPath => @"CSharp\Intentions\QuickFixes\PreferAddressByIdToGraphicsParams\Availability";
[Test] public void NameOfTest() { DoNamedTest(); }
[Test] public void LocalConstantTest() { DoNamedTest(); }
}
[TestUnity]
public class PreferAddressByIdToGraphicsParamsQuickFixTests : QuickFixTestBase<PreferAddressByIdToGraphicsParamsQuickFix>
{
protected override string RelativeTestDataPath => @"CSharp\Intentions\QuickFixes\PreferAddressByIdToGraphicsParams";
protected override bool AllowHighlightingOverlap => true;
[Test] public void SimpleTest() { DoNamedTest(); }
[Test] public void UnderscoreNameTest() { DoNamedTest(); }
[Test] public void NewNameTest() { DoNamedTest(); }
[Test] public void ReuseTest() { DoNamedTest(); }
[Test] public void ReuseFailedCreateNewTest() { DoNamedTest(); }
[Test] public void ReuseConflictNameTest() { DoNamedTest(); }
[Test] public void NestedClassTest() { DoNamedTest(); }
[Test] public void WithoutUnityNamespaceTest() { DoNamedTest(); }
[Test] public void InvalidLiteralForPropertyNameTest() { DoNamedTest(); }
[Test] public void ShaderPropertyTest() { DoNamedTest(); }
[Test] public void AnimatorPropertyTest() { DoNamedTest(); }
[Test] public void ConstantValueReuseTest() { DoNamedTest(); }
[Test] public void ConstantValueConcatReuseTest() { DoNamedTest(); }
[Test] public void PropertyReuseTest() { DoNamedTest(); }
[Test] public void StructTest() { DoNamedTest(); }
[Test] public void NestedReuseTest() { DoNamedTest(); }
[Test] public void ConstConcatCreateFieldTest() { DoNamedTest(); }
[Test] public void PartialClassTest() { DoNamedTest(); }
[Test] public void UniqueNameTest() { DoNamedTest(); }
}
}
|
using JetBrains.ReSharper.FeaturesTestFramework.Intentions;
using JetBrains.ReSharper.Plugins.Tests.Unity.CSharp.Daemon.Stages.Analysis;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Errors;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.QuickFixes;
using NUnit.Framework;
namespace JetBrains.ReSharper.Plugins.Tests.Unity.CSharp.Intentions.QuickFixes
{
[TestUnity]
public class PreferAddressByIdToGraphicsParamsQuickFixAvailabilityTests : CSharpHighlightingTestBase<PreferGenericMethodOverloadWarning>
{
protected override string RelativeTestDataPath => @"CSharp\Intentions\QuickFixes\PreferAddressByIdToGraphicsParams\Availability";
[Test] public void NameOfTest() { DoNamedTest(); }
[Test] public void LocalConstantTest() { DoNamedTest(); }
}
[TestUnity]
public class PreferAddressByIdToGraphicsParamsQuickFixTests : QuickFixTestBase<PreferAddressByIdToGraphicsParamsQuickFix>
{
protected override string RelativeTestDataPath => @"CSharp\Intentions\QuickFixes\PreferAddressByIdToGraphicsParams";
protected override bool AllowHighlightingOverlap => true;
[Test] public void SimpleTest() { DoNamedTest(); }
[Test] public void UnderscoreNameTest() { DoNamedTest(); }
[Test] public void NewNameTest() { DoNamedTest(); }
[Test] public void ReuseTest() { DoNamedTest(); }
[Test] public void ReuseFailedCreateNewTest() { DoNamedTest(); }
[Test] public void ReuseConflictNameTest() { DoNamedTest(); }
[Test] public void NestedClassTest() { DoNamedTest(); }
[Test] public void WithoutUnityNamespaceTest() { DoNamedTest(); }
[Test] public void InvalidLiteralForPropertyNameTest() { DoNamedTest(); }
[Test] public void ShaderPropertyTest() { DoNamedTest(); }
[Test] public void AnimatorPropertyTest() { DoNamedTest(); }
[Test] public void ConstantValueReuseTest() { DoNamedTest(); }
[Test] public void ConstantValueConcatReuseTest() { DoNamedTest(); }
[Test] public void PropertyReuseTest() { DoNamedTest(); }
[Test] public void StructTest() { DoNamedTest(); }
[Test] public void NestedReuseTest() { DoNamedTest(); }
[Test] public void ConstConcatCreateFieldTest() { DoNamedTest(); }
[Test] public void PartialClassTest() { DoNamedTest(); }
[Test] public void UniqueNameTest() { DoNamedTest(); }
}
}
|
apache-2.0
|
C#
|
9536c324fa3853bfeff8c29b54d3258ad1998509
|
Rename aborted -> fired
|
ppy/osu,johnneijzen/osu,naoey/osu,smoogipoo/osu,naoey/osu,ZLima12/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu-new,UselessToucan/osu,peppy/osu,johnneijzen/osu,naoey/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,DrabWeb/osu,EVAST9919/osu,UselessToucan/osu,ppy/osu,DrabWeb/osu,2yangk23/osu,NeoAdonis/osu,UselessToucan/osu,smoogipoo/osu,ZLima12/osu,2yangk23/osu,DrabWeb/osu,ppy/osu,peppy/osu,EVAST9919/osu
|
osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs
|
osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual
{
public class TestCaseHoldToConfirmOverlay : OsuTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ExitConfirmOverlay) };
public TestCaseHoldToConfirmOverlay()
{
bool fired = false;
var firedText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Fired!",
TextSize = 50,
Alpha = 0,
};
var overlay = new TestHoldToConfirmOverlay
{
Action = () =>
{
fired = true;
firedText.FadeTo(1).Then().FadeOut(1000);
}
};
Children = new Drawable[]
{
overlay,
firedText
};
AddStep("start confirming", () => overlay.Begin());
AddStep("abort confirming", () => overlay.Abort());
AddAssert("ensure aborted", () => !fired);
AddStep("start confirming", () => overlay.Begin());
AddUntilStep(() => fired, "wait until confirmed");
}
private class TestHoldToConfirmOverlay : ExitConfirmOverlay
{
protected override bool AllowMultipleFires => true;
public void Begin() => BeginConfirm();
public void Abort() => AbortConfirm();
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual
{
public class TestCaseHoldToConfirmOverlay : OsuTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ExitConfirmOverlay) };
public TestCaseHoldToConfirmOverlay()
{
bool fired = false;
var abortText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Aborted!",
TextSize = 50,
Alpha = 0,
};
var overlay = new TestHoldToConfirmOverlay
{
Action = () =>
{
fired = true;
abortText.FadeTo(1).Then().FadeOut(1000);
}
};
Children = new Drawable[]
{
overlay,
abortText
};
AddStep("start confirming", () => overlay.Begin());
AddStep("abort confirming", () => overlay.Abort());
AddAssert("ensure aborted", () => !fired);
AddStep("start confirming", () => overlay.Begin());
AddUntilStep(() => fired, "wait until confirmed");
}
private class TestHoldToConfirmOverlay : ExitConfirmOverlay
{
protected override bool AllowMultipleFires => true;
public void Begin() => BeginConfirm();
public void Abort() => AbortConfirm();
}
}
}
|
mit
|
C#
|
3eead65a2b4b4ec85bcbc4dccd91ddf665d4cb3a
|
Test commit
|
ravi-msi/practicegit,ravi-msi/practicegit,ravi-msi/practicegit
|
PracticeGit/PracticeGit/Views/Home/Index.cshtml
|
PracticeGit/PracticeGit/Views/Home/Index.cshtml
|
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>ASP.NET Web API is a framework that makes it easy to build HTTP services that reach
a broad range of clients, including browsers and mobile devices. ASP.NET Web API
is an ideal platform for building RESTful applications on the .NET Framework.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301870">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301871">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301872">Learn more »</a></p>
</div>
</div>
<div class="row"> New row -- added text
</div>
<div class="row">
New row for test
</div>
|
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>ASP.NET Web API is a framework that makes it easy to build HTTP services that reach
a broad range of clients, including browsers and mobile devices. ASP.NET Web API
is an ideal platform for building RESTful applications on the .NET Framework.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301870">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301871">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301872">Learn more »</a></p>
</div>
</div>
<div class="row"> New row -- added text
</div>
|
mit
|
C#
|
56260d6a0d35c9afba1dfe2f6e41c0dffa42f332
|
Fix embedded native widgets
|
mminns/xwt,mono/xwt,mminns/xwt,antmicro/xwt,iainx/xwt,lytico/xwt,cra0zy/xwt,akrisiun/xwt,hwthomas/xwt,residuum/xwt,directhex/xwt,hamekoz/xwt,TheBrainTech/xwt,steffenWi/xwt
|
Xwt.Gtk/Xwt.GtkBackend/EmbeddedWidgetBackend.cs
|
Xwt.Gtk/Xwt.GtkBackend/EmbeddedWidgetBackend.cs
|
//
// EmbeddedWidgetBackend.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2013 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Xwt.Backends;
namespace Xwt.GtkBackend
{
public class EmbeddedWidgetBackend: WidgetBackend, IEmbeddedWidgetBackend
{
public EmbeddedWidgetBackend ()
{
}
public void SetContent (object nativeWidget)
{
if (nativeWidget is Gtk.Widget) {
Widget = (Gtk.Widget)nativeWidget;
return;
}
// Check if it is an NSView
Type nsView = Type.GetType ("AppKit.NSView, Xamarin.Mac", false);
if (nsView != null && nsView.IsInstanceOfType (nativeWidget)) {
Widget = GtkMacInterop.NSViewToGtkWidget (nativeWidget);
Widget.Show ();
return;
}
}
}
}
|
//
// EmbeddedWidgetBackend.cs
//
// Author:
// Lluis Sanchez <lluis@xamarin.com>
//
// Copyright (c) 2013 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Xwt.Backends;
namespace Xwt.GtkBackend
{
public class EmbeddedWidgetBackend: WidgetBackend, IEmbeddedWidgetBackend
{
public EmbeddedWidgetBackend ()
{
}
public void SetContent (object nativeWidget)
{
if (nativeWidget is Gtk.Widget) {
Widget = (Gtk.Widget)nativeWidget;
return;
}
// Check if it is an NSView
Type nsView = Type.GetType ("MonoMac.AppKit.NSView, MonoMac", false);
if (nsView != null && nsView.IsInstanceOfType (nativeWidget)) {
Widget = GtkMacInterop.NSViewToGtkWidget (nativeWidget);
Widget.Show ();
return;
}
}
}
}
|
mit
|
C#
|
42b237804ead35744c8da0a194c241b67c372adf
|
Update CrossSheetReference.cs
|
smartsheet-platform/smartsheet-csharp-sdk,smartsheet-platform/smartsheet-csharp-sdk
|
main/Smartsheet/Api/Models/CrossSheetReference.cs
|
main/Smartsheet/Api/Models/CrossSheetReference.cs
|
// #[license]
// SmartsheetClient SDK for C#
// %%
// Copyright (C) 2018 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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Smartsheet.Api.Models
{
public class CrossSheetReference : NamedModel
{
/// <summary>
/// the final column in the reference block
/// </summary>
private long? endColumnId;
/// <summary>
/// the last row in the reference block
/// </summary>
private long? endRowId;
/// <summary>
/// the source sheet Id for the reference block
/// </summary>
private long? sourceSheetId;
/// <summary>
/// the first row of the reference block
/// </summary>
private long? startColumnId;
/// <summary>
/// the first row of the reference block
/// </summary>
private long? startRowId;
/// <summary>
/// the status of the cross-sheet reference
/// </summary>
private CrossSheetReferenceStatus? status;
/// <summary>
/// Get the last column Id in the cross-sheet reference block
/// </summary>
public long? EndColumnId
{
get { return endColumnId; }
set { endColumnId = value; }
}
/// <summary>
/// Get the last row Id in the cross-sheet reference block
/// </summary>
public long? EndRowId
{
get { return endRowId; }
set { endRowId = value; }
}
/// <summary>
/// Get the source sheet Id in the cross-sheet reference block
/// </summary>
public long? SourceSheetId
{
get { return sourceSheetId; }
set { sourceSheetId = value; }
}
/// <summary>
/// Get the first column Id in the cross-sheet reference block
/// </summary>
public long? StartColumnId
{
get { return startColumnId; }
set { startColumnId = value; }
}
/// <summary>
/// Get the first row Id in the cross-sheet reference block
/// </summary>
public long? StartRowId
{
get { return startRowId; }
set { startRowId = value; }
}
/// <summary>
/// Get the status of the cross-sheet reference block
/// </summary>
public CrossSheetReferenceStatus? Status
{
get { return status; }
set { status = value; }
}
}
}
|
// #[license]
// SmartsheetClient SDK for C#
// %%
// Copyright (C) 2018 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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Smartsheet.Api.Models
{
public class CrossSheetReference : NamedModel
{
/// <summary>
/// the final column in the reference block
/// </summary>
private long? endColumnId;
/// <summary>
/// the last row in the reference block
/// </summary>
private long? endRowId;
/// <summary>
/// the source sheed ID for the reference block
/// </summary>
private long? sourceSheetId;
/// <summary>
/// the first row of the reference block
/// </summary>
private long? startColumnId;
/// <summary>
/// the first row of the reference block
/// </summary>
private long? startRowId;
/// <summary>
/// the status of the cross sheet reference
/// </summary>
private CrossSheetReferenceStatus? status;
/// <summary>
/// Get the last column ID in the cross sheet reference block
/// </summary>
public long? EndColumnId
{
get { return endColumnId; }
set { endColumnId = value; }
}
/// <summary>
/// Get the last row ID in the cross sheet reference block
/// </summary>
public long? EndRowId
{
get { return endRowId; }
set { endRowId = value; }
}
/// <summary>
/// Get the source sheet ID in the cross sheet reference block
/// </summary>
public long? SourceSheetId
{
get { return sourceSheetId; }
set { sourceSheetId = value; }
}
/// <summary>
/// Get the first column ID in the cross sheet reference block
/// </summary>
public long? StartColumnId
{
get { return startColumnId; }
set { startColumnId = value; }
}
/// <summary>
/// Get the first row ID in the cross sheet reference block
/// </summary>
public long? StartRowId
{
get { return startRowId; }
set { startRowId = value; }
}
/// <summary>
/// Get the status of the cross sheet reference block
/// </summary>
public CrossSheetReferenceStatus? Status
{
get { return status; }
set { status = value; }
}
}
}
|
apache-2.0
|
C#
|
2f9a52c0a24b2a7ccf27ee1f31a9019a25976699
|
fix brushesmaplist
|
VitalickS/BrightSharp.Toolkit,VitalickS/BrightSharp.Toolkit
|
BrightSharp.Ui.Tests/BrushesMapList.cs
|
BrightSharp.Ui.Tests/BrushesMapList.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Media;
namespace BrightSharp.Ui.Tests
{
public class BrushesMapList : Dictionary<string, object>
{
public BrushesMapList() {
var dic = Application.Current.Resources.MergedDictionaries.FirstOrDefault(x => x.Source != null && x.Source.OriginalString.Contains("style."));
if (dic == null) return;
foreach (string key in dic.Keys.OfType<string>().OrderBy(x => x)) {
var value = Application.Current.TryFindResource(key);
if (value != null) {
bool isBorder = key.Contains("Border");
if (value is Color col) {
Add(key, new { Type = "C", Brush = new SolidColorBrush(col), IsBorder = isBorder });
}
else if (value is Brush br) {
Add(key, new { Type = "Br", Brush = br, IsBorder = isBorder });
}
}
}
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Media;
namespace BrightSharp.Ui.Tests
{
public class BrushesMapList : Dictionary<string, object>
{
public BrushesMapList() {
var dic = Application.Current.Resources.MergedDictionaries.First();
foreach (string key in dic.Keys.OfType<string>().OrderBy(x => x)) {
var value = Application.Current.TryFindResource(key);
if (value != null) {
bool isBorder = key.Contains("Border");
if (value is Color col) {
Add(key, new { Type = "C", Brush = new SolidColorBrush(col), IsBorder = isBorder });
}
else if (value is Brush br) {
Add(key, new { Type = "Br", Brush = br, IsBorder = isBorder });
}
}
}
}
}
}
|
mit
|
C#
|
c07f3f25af5ace2d0896c493ad786ca787465b8e
|
fix description
|
CIMEL/CIMEL,baikangwang/Aeronet
|
CIMEL.Chart/Properties/AssemblyInfo.cs
|
CIMEL.Chart/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// 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("大气气溶胶光学参数处理软件(适用于CIMEL太阳光度计数据处理)")]
[assembly: AssemblyDescription("大气气溶胶光学参数处理软件\r\n适用于CIMEL太阳光度计数据反演软件")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Developed and Designed by AYFY")]
[assembly: AssemblyProduct("大气气溶胶光学参数处理软件")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("99fd81db-6c34-49c0-b4eb-52d1e428b497")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.18188")]
[assembly: AssemblyFileVersion("1.2.0.18188")]
[assembly: NeutralResourcesLanguageAttribute("zh-CN")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// 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("大气气溶胶光学参数处理软件(适用于CIMEL太阳光度计数据处理)")]
[assembly: AssemblyDescription("大气气溶胶光学参数处理软件\n适用于CIMEL太阳光度计数据反演软件")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Developed and Designed by AYFY")]
[assembly: AssemblyProduct("大气气溶胶光学参数处理软件")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("99fd81db-6c34-49c0-b4eb-52d1e428b497")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.18188")]
[assembly: AssemblyFileVersion("1.2.0.18188")]
[assembly: NeutralResourcesLanguageAttribute("zh-CN")]
|
apache-2.0
|
C#
|
a93bea94ccb2d688a3ef95520c39362579dca8de
|
Fix flaky test
|
alexvictoor/BrowserLog,alexvictoor/BrowserLog,alexvictoor/BrowserLog
|
BrowserLog.Tests/TinyServer/LineParserTest.cs
|
BrowserLog.Tests/TinyServer/LineParserTest.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BrowserLog.TinyServer;
using NFluent;
using NUnit.Framework;
namespace BrowserLog.TinyServer
{
public class LineParserTest
{
[Test]
[Timeout(100)]
public async void Should_parse_one_line()
{
// given
byte[] buffer = Encoding.ASCII.GetBytes("first line\n\n");
var stream = new MemoryStream(buffer);
var parser = new LineParser();
// when
var lines = await parser.Parse(stream, CancellationToken.None);
// then
Check.That(lines).HasSize(1);
Check.That(lines.ElementAt(0)).IsEqualTo("first line");
}
[Test]
public async void Should_parse_two_lines()
{
// given
byte[] buffer = Encoding.ASCII.GetBytes("first line\nsecond line\n\n");
var stream = new MemoryStream(buffer);
var parser = new LineParser();
// when
var lines = await parser.Parse(stream, CancellationToken.None);
// then
Check.That(lines).HasSize(2);
Check.That(lines.ElementAt(0)).IsEqualTo("first line");
Check.That(lines.ElementAt(1)).IsEqualTo("second line");
}
[Test]
[Timeout(2000)]
public async void Should_parse_lines_till_cancelled()
{
// given
byte[] buffer = Encoding.ASCII.GetBytes("first line\nsecond");
var stream = new MemoryStream(buffer);
var parser = new LineParser();
// when
var source = new CancellationTokenSource();
var parsingTask = Task.Run(() => parser.Parse(stream, source.Token));
await Task.Delay(200);
source.Cancel();
await Task.Delay(1000);
// then
Check.That(parsingTask.Status).IsNotEqualTo(TaskStatus.Running);
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BrowserLog.TinyServer;
using NFluent;
using NUnit.Framework;
namespace BrowserLog.TinyServer
{
public class LineParserTest
{
[Test]
[Timeout(100)]
public async void Should_parse_one_line()
{
// given
byte[] buffer = Encoding.ASCII.GetBytes("first line\n\n");
var stream = new MemoryStream(buffer);
var parser = new LineParser();
// when
var lines = await parser.Parse(stream, CancellationToken.None);
// then
Check.That(lines).HasSize(1);
Check.That(lines.ElementAt(0)).IsEqualTo("first line");
}
[Test]
public async void Should_parse_two_lines()
{
// given
byte[] buffer = Encoding.ASCII.GetBytes("first line\nsecond line\n\n");
var stream = new MemoryStream(buffer);
var parser = new LineParser();
// when
var lines = await parser.Parse(stream, CancellationToken.None);
// then
Check.That(lines).HasSize(2);
Check.That(lines.ElementAt(0)).IsEqualTo("first line");
Check.That(lines.ElementAt(1)).IsEqualTo("second line");
}
[Test]
[Timeout(1000)]
public async void Should_parse_lines_till_cancelled()
{
// given
byte[] buffer = Encoding.ASCII.GetBytes("first line\nsecond");
var stream = new MemoryStream(buffer);
var parser = new LineParser();
// when
var source = new CancellationTokenSource();
var parsingTask = Task.Run(() => parser.Parse(stream, source.Token));
await Task.Delay(200);
source.Cancel();
await Task.Delay(200);
var lines = parsingTask.Result;
// then
Check.That(lines).HasSize(1);
Check.That(lines.ElementAt(0)).IsEqualTo("first line");
}
}
}
|
apache-2.0
|
C#
|
5da12d03dfb7beff4fa844c2729ae42711b6d154
|
Update version
|
karpach/debug-attach-manager
|
DebugAttachHistory/Properties/AssemblyInfo.cs
|
DebugAttachHistory/Properties/AssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Resources;
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("Debug Attach Manager")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Viktar Karpach")]
[assembly: AssemblyProduct("Debug Attach Manager")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: NeutralResourcesLanguage("en-US")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.0.08201.0")]
[assembly: AssemblyFileVersion("2.0.08201.0")]
|
using System;
using System.Reflection;
using System.Resources;
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("Debug Attach Manager")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Viktar Karpach")]
[assembly: AssemblyProduct("Debug Attach Manager")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: NeutralResourcesLanguage("en-US")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.10.03191.0")]
[assembly: AssemblyFileVersion("1.10.03191.0")]
|
apache-2.0
|
C#
|
08fe9fec45a5dfec8a63cff7f55d5b0401ce583c
|
use all concordion:commands as lower case
|
ShaKaRee/concordion-net,concordion/concordion-net,concordion/concordion-net,ShaKaRee/concordion-net,concordion/concordion-net,ShaKaRee/concordion-net
|
Concordion/Internal/CommandRegistry.cs
|
Concordion/Internal/CommandRegistry.cs
|
// Copyright 2009 Jeffrey Cameron
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Concordion.Api;
namespace Concordion.Internal
{
public class CommandRegistry : ICommandFactory
{
#region Fields
private IDictionary<string, ICommand> m_commandMap;
#endregion
#region Constructors
public CommandRegistry()
{
m_commandMap = new Dictionary<string, ICommand>();
}
#endregion
#region Methods
public CommandRegistry Register(string namespaceURI, string commandName, ICommand command)
{
m_commandMap.Add(MakeKey(namespaceURI, commandName), command);
return this;
}
private string MakeKey(string namespaceURI, string commandName)
{
return namespaceURI + " " + commandName.ToLower();
}
#endregion
#region ICommandFactory Members
public ICommand CreateCommand(string namespaceUri, string commandName)
{
return m_commandMap[MakeKey(namespaceUri, commandName)];
}
#endregion
}
}
|
// Copyright 2009 Jeffrey Cameron
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Concordion.Api;
namespace Concordion.Internal
{
public class CommandRegistry : ICommandFactory
{
#region Fields
private IDictionary<string, ICommand> m_commandMap;
#endregion
#region Constructors
public CommandRegistry()
{
m_commandMap = new Dictionary<string, ICommand>();
}
#endregion
#region Methods
public CommandRegistry Register(string namespaceURI, string commandName, ICommand command)
{
m_commandMap.Add(MakeKey(namespaceURI, commandName), command);
return this;
}
private string MakeKey(string namespaceURI, string commandName)
{
return namespaceURI + " " + commandName;
}
#endregion
#region ICommandFactory Members
public ICommand CreateCommand(string namespaceUri, string commandName)
{
return m_commandMap[MakeKey(namespaceUri, commandName)];
}
#endregion
}
}
|
apache-2.0
|
C#
|
8f12fb6867a6efa436aa5b8b6c24ecb9776558f7
|
Update test to make sure this is working
|
gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT,gordonwatts/LINQtoROOT
|
LINQToTTree/LINQToTTreeLib.Tests/ExecutionCommon/LocalBashHelpersTest.cs
|
LINQToTTree/LINQToTTreeLib.Tests/ExecutionCommon/LocalBashHelpersTest.cs
|
using LINQToTTreeLib.ExecutionCommon;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LINQToTTreeLib.Tests.ExecutionCommon
{
/// <summary>
/// Check to see if we can do basic ROOT stuff.
/// </summary>
[TestClass]
public class LocalBashHelpersTest
{
[TestInitialize]
public void Setup()
{
LocalBashExecutor.ResetCommandLineExecutor();
LocalBashExecutor.ResetLocalBashExecutor();
}
[TestCleanup]
public void Cleanup()
{
LocalBashExecutor.ResetCommandLineExecutor();
LocalBashExecutor.ResetLocalBashExecutor();
}
[TestMethod]
public void BashRunBasicCommand()
{
string bashCmds = "ls\n";
List<string> results = new List<string>();
LocalBashExecutor.AddLogEndpoint(s => results.Add(s));
LocalBashHelpers.RunBashCommand("testmeout", bashCmds, s => Console.WriteLine(s), verbose: true);
Assert.AreNotEqual(0, results.Count);
}
[TestMethod]
public void BashRunSimpleROOT()
{
var cmds = new StringBuilder();
cmds.AppendLine("TH1F *h = new TH1F(\"hi\", \"there\", 10, 0.0, 10.0);");
cmds.AppendLine("h->Print();");
List<string> results = new List<string>();
LocalBashExecutor.AddLogEndpoint(s => results.Add(s));
LocalBashHelpers.RunROOTInBash("test", cmds.ToString(), new System.IO.DirectoryInfo(System.IO.Path.GetTempPath()));
Assert.AreNotEqual(0, results.Count);
}
}
}
|
using LINQToTTreeLib.ExecutionCommon;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LINQToTTreeLib.Tests.ExecutionCommon
{
/// <summary>
/// Check to see if we can do basic ROOT stuff.
/// </summary>
[TestClass]
public class LocalBashHelpersTest
{
[TestInitialize]
public void Setup()
{
LocalBashExecutor.ResetCommandLineExecutor();
LocalBashExecutor.ResetLocalBashExecutor();
}
[TestCleanup]
public void Cleanup()
{
LocalBashExecutor.ResetCommandLineExecutor();
LocalBashExecutor.ResetLocalBashExecutor();
}
[TestMethod]
public void BashRunBasicCommand()
{
string bashCmds = "ls\n";
List<string> results = new List<string>();
LocalBashExecutor.AddLogEndpoint(s => results.Add(s));
LocalBashHelpers.RunBashCommand("testmeout", bashCmds);
Assert.AreNotEqual(0, results.Count);
}
[TestMethod]
public void BashRunSimpleROOT()
{
var cmds = new StringBuilder();
cmds.AppendLine("TH1F *h = new TH1F(\"hi\", \"there\", 10, 0.0, 10.0);");
cmds.AppendLine("h->Print();");
List<string> results = new List<string>();
LocalBashExecutor.AddLogEndpoint(s => results.Add(s));
LocalBashHelpers.RunROOTInBash("test", cmds.ToString(), new System.IO.DirectoryInfo(System.IO.Path.GetTempPath()));
Assert.AreNotEqual(0, results.Count);
}
}
}
|
lgpl-2.1
|
C#
|
6bb37f20522f23a0c0b851e9db9ecf2d419418f3
|
Add IsEmpty IEnumerable<T> extension method
|
smarkets/IronSmarkets
|
IronSmarkets/Extensions/IEnumerable.cs
|
IronSmarkets/Extensions/IEnumerable.cs
|
// Copyright (c) 2011 Smarkets Limited
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace IronSmarkets.Extensions
{
internal static class EnumerableExtensions
{
public static void ForAll<T>(
this IEnumerable<T> sequence,
Action<T> action)
{
foreach (T item in sequence)
action(item);
}
public static bool IsEmpty<T>(this IEnumerable<T> sequence)
{
if (sequence == null)
throw new ArgumentNullException("sequence");
var gcollection = sequence as ICollection<T>;
if (gcollection != null)
return gcollection.Count == 0;
var collection = sequence as ICollection;
if (collection != null)
return collection.Count == 0;
return !sequence.Any();
}
}
}
|
// Copyright (c) 2011 Smarkets Limited
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections.Generic;
namespace IronSmarkets.Extensions
{
internal static class EnumerableExtensions
{
public static void ForAll<T>(
this IEnumerable<T> sequence,
Action<T> action)
{
foreach (T item in sequence)
action(item);
}
}
}
|
mit
|
C#
|
97ce36ac7ffc97fca64ebdbbc9a0ce16a2fe11c7
|
Update StopTranscriptCmdlet.cs summary comment (#15349)
|
PaulHigin/PowerShell,TravisEz13/PowerShell,daxian-dbw/PowerShell,JamesWTruher/PowerShell-1,JamesWTruher/PowerShell-1,daxian-dbw/PowerShell,JamesWTruher/PowerShell-1,JamesWTruher/PowerShell-1,TravisEz13/PowerShell,PaulHigin/PowerShell,daxian-dbw/PowerShell,TravisEz13/PowerShell,PaulHigin/PowerShell,daxian-dbw/PowerShell,PaulHigin/PowerShell,TravisEz13/PowerShell
|
src/Microsoft.PowerShell.ConsoleHost/host/msh/StopTranscriptCmdlet.cs
|
src/Microsoft.PowerShell.ConsoleHost/host/msh/StopTranscriptCmdlet.cs
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Management.Automation;
using System.Management.Automation.Internal;
namespace Microsoft.PowerShell.Commands
{
/// <summary>
/// Implements the stop-transcript cmdlet.
/// </summary>
[Cmdlet(VerbsLifecycle.Stop, "Transcript", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2096798")]
[OutputType(typeof(string))]
public sealed class StopTranscriptCommand : PSCmdlet
{
/// <summary>
/// Stops the transcription.
/// </summary>
protected override
void
BeginProcessing()
{
try
{
string outFilename = Host.UI.StopTranscribing();
if (outFilename != null)
{
PSObject outputObject = new PSObject(
StringUtil.Format(TranscriptStrings.TranscriptionStopped, outFilename));
outputObject.Properties.Add(new PSNoteProperty("Path", outFilename));
WriteObject(outputObject);
}
}
catch (Exception e)
{
throw PSTraceSource.NewInvalidOperationException(
e, TranscriptStrings.ErrorStoppingTranscript, e.Message);
}
}
}
}
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Management.Automation;
using System.Management.Automation.Internal;
namespace Microsoft.PowerShell.Commands
{
/// <summary>
/// Implements the stop-transcript cmdlet.
/// </summary>
[Cmdlet(VerbsLifecycle.Stop, "Transcript", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2096798")]
[OutputType(typeof(string))]
public sealed class StopTranscriptCommand : PSCmdlet
{
/// <summary>
/// Starts the transcription.
/// </summary>
protected override
void
BeginProcessing()
{
try
{
string outFilename = Host.UI.StopTranscribing();
if (outFilename != null)
{
PSObject outputObject = new PSObject(
StringUtil.Format(TranscriptStrings.TranscriptionStopped, outFilename));
outputObject.Properties.Add(new PSNoteProperty("Path", outFilename));
WriteObject(outputObject);
}
}
catch (Exception e)
{
throw PSTraceSource.NewInvalidOperationException(
e, TranscriptStrings.ErrorStoppingTranscript, e.Message);
}
}
}
}
|
mit
|
C#
|
5ccdd2b203512f9a6cb00947546b5474bfcd46a2
|
Mask the osu! beatsnap grid
|
NeoAdonis/osu,UselessToucan/osu,peppy/osu,johnneijzen/osu,smoogipoo/osu,peppy/osu-new,UselessToucan/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,EVAST9919/osu,EVAST9919/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu,ppy/osu,2yangk23/osu,peppy/osu,johnneijzen/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,smoogipooo/osu
|
osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs
|
osu.Game.Rulesets.Osu/Edit/OsuDistanceSnapGrid.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Compose.Components;
namespace osu.Game.Rulesets.Osu.Edit
{
public class OsuDistanceSnapGrid : CircularDistanceSnapGrid
{
public OsuDistanceSnapGrid(OsuHitObject hitObject)
: base(hitObject, hitObject.StackedEndPosition)
{
Masking = true;
}
protected override float GetVelocity(double time, ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(time);
DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(time);
double scoringDistance = OsuHitObject.BASE_SCORING_DISTANCE * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;
return (float)(scoringDistance / timingPoint.BeatLength);
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Compose.Components;
namespace osu.Game.Rulesets.Osu.Edit
{
public class OsuDistanceSnapGrid : CircularDistanceSnapGrid
{
public OsuDistanceSnapGrid(OsuHitObject hitObject)
: base(hitObject, hitObject.StackedEndPosition)
{
}
protected override float GetVelocity(double time, ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(time);
DifficultyControlPoint difficultyPoint = controlPointInfo.DifficultyPointAt(time);
double scoringDistance = OsuHitObject.BASE_SCORING_DISTANCE * difficulty.SliderMultiplier * difficultyPoint.SpeedMultiplier;
return (float)(scoringDistance / timingPoint.BeatLength);
}
}
}
|
mit
|
C#
|
9822a092c4f11c46f8e185d029772eb5ef71d934
|
Add localization for enum
|
ppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu
|
osu.Game/Overlays/Comments/CommentReportReason.cs
|
osu.Game/Overlays/Comments/CommentReportReason.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.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Comments
{
public enum CommentReportReason
{
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.ReportOptionsInsults))]
Insults,
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.ReportOptionsSpam))]
Spam,
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.ReportOptionsUnwantedContent))]
UnwantedContent,
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.ReportOptionsNonsense))]
Nonsense,
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.ReportOptionsOther))]
Other
}
}
|
// 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.
namespace osu.Game.Overlays.Comments
{
public enum CommentReportReason
{
Insults,
Spam,
UnwantedContent,
Nonsense,
Other
}
}
|
mit
|
C#
|
974feee6a8827c2c115a2c066a7e0bf689e7c75c
|
Add version and copyright info
|
frabert/SharpPhysFS
|
SharpPhysFS/Properties/AssemblyInfo.cs
|
SharpPhysFS/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("SharpPhysFS")]
[assembly: AssemblyDescription("Managed wrapper around PhysFS")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Francesco Bertolaccini")]
[assembly: AssemblyProduct("SharpPhysFS")]
[assembly: AssemblyCopyright("Copyright © 2015 Francesco Bertolaccini")]
[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("1e8d0656-fbd5-4f97-b634-584943b13af2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SharpPhysFS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharpPhysFS")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1e8d0656-fbd5-4f97-b634-584943b13af2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
mit
|
C#
|
21a906e9a4aa85a8406dd366252e2e59f83e2aa1
|
Remove cancellation token
|
martincostello/api,martincostello/api,martincostello/api
|
src/API/Program.cs
|
src/API/Program.cs
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Program.cs" company="https://martincostello.com/">
// Martin Costello (c) 2016
// </copyright>
// <summary>
// Program.cs
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace MartinCostello.Api
{
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
/// <summary>
/// A class representing the entry-point to the application. This class cannot be inherited.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry-point to the application.
/// </summary>
/// <param name="args">The arguments to the application.</param>
/// <returns>
/// The exit code from the application.
/// </returns>
public static int Main(string[] args)
{
try
{
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddCommandLine(args)
.Build();
var builder = new WebHostBuilder()
.UseKestrel()
.UseConfiguration(configuration)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>();
using (var host = builder.Build())
{
host.Run();
}
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine($"Unhandled exception: {ex}");
return -1;
}
}
}
}
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Program.cs" company="https://martincostello.com/">
// Martin Costello (c) 2016
// </copyright>
// <summary>
// Program.cs
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace MartinCostello.Api
{
using System;
using System.IO;
using System.Threading;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
/// <summary>
/// A class representing the entry-point to the application. This class cannot be inherited.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry-point to the application.
/// </summary>
/// <param name="args">The arguments to the application.</param>
/// <returns>
/// The exit code from the application.
/// </returns>
public static int Main(string[] args)
{
try
{
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddCommandLine(args)
.Build();
var builder = new WebHostBuilder()
.UseKestrel()
.UseConfiguration(configuration)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>();
using (CancellationTokenSource tokenSource = new CancellationTokenSource())
{
Console.CancelKeyPress += (_, e) =>
{
tokenSource.Cancel();
e.Cancel = true;
};
using (var host = builder.Build())
{
host.Run(tokenSource.Token);
}
return 0;
}
}
catch (Exception ex)
{
Console.Error.WriteLine($"Unhandled exception: {ex}");
return -1;
}
}
}
}
|
mit
|
C#
|
fa61a112aac3891c19f1f720c9a9018a1c3677aa
|
Remove redundant parenthesis
|
luizbon/VisualStudio,github/VisualStudio,github/VisualStudio,github/VisualStudio,HeadhunterXamd/VisualStudio
|
src/GitHub.App/Caches/CacheIndex.cs
|
src/GitHub.App/Caches/CacheIndex.cs
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reactive.Linq;
using Akavache;
using NullGuard;
namespace GitHub.Caches
{
public class CacheIndex
{
public static CacheIndex Create(string key)
{
return new CacheIndex { IndexKey = key };
}
public CacheIndex()
{
Keys = new List<string>();
}
public IObservable<CacheIndex> AddAndSave(IBlobCache cache, string indexKey, CacheItem item,
DateTimeOffset? absoluteExpiration = null)
{
var k = string.Format(CultureInfo.InvariantCulture, "{0}|{1}", IndexKey, item.Key);
if (!Keys.Contains(k))
Keys.Add(k);
UpdatedAt = DateTimeOffset.UtcNow;
return cache.InsertObject(IndexKey, this, absoluteExpiration)
.Select(x => this);
}
public static IObservable<CacheIndex> AddAndSaveToIndex(IBlobCache cache, string indexKey, CacheItem item,
DateTimeOffset? absoluteExpiration = null)
{
return cache.GetOrCreateObject(indexKey, () => Create(indexKey))
.Do(index =>
{
var k = string.Format(CultureInfo.InvariantCulture, "{0}|{1}", index.IndexKey, item.Key);
if (!index.Keys.Contains(k))
index.Keys.Add(k);
index.UpdatedAt = DateTimeOffset.UtcNow;
})
.SelectMany(index => cache.InsertObject(index.IndexKey, index, absoluteExpiration)
.Select(x => index));
}
[AllowNull]
public string IndexKey {[return: AllowNull] get; set; }
public List<string> Keys { get; set; }
public DateTimeOffset UpdatedAt { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reactive.Linq;
using Akavache;
using NullGuard;
namespace GitHub.Caches
{
public class CacheIndex
{
public static CacheIndex Create(string key)
{
return new CacheIndex() { IndexKey = key };
}
public CacheIndex()
{
Keys = new List<string>();
}
public IObservable<CacheIndex> AddAndSave(IBlobCache cache, string indexKey, CacheItem item,
DateTimeOffset? absoluteExpiration = null)
{
var k = string.Format(CultureInfo.InvariantCulture, "{0}|{1}", IndexKey, item.Key);
if (!Keys.Contains(k))
Keys.Add(k);
UpdatedAt = DateTimeOffset.UtcNow;
return cache.InsertObject(IndexKey, this, absoluteExpiration)
.Select(x => this);
}
public static IObservable<CacheIndex> AddAndSaveToIndex(IBlobCache cache, string indexKey, CacheItem item,
DateTimeOffset? absoluteExpiration = null)
{
return cache.GetOrCreateObject(indexKey, () => Create(indexKey))
.Do(index =>
{
var k = string.Format(CultureInfo.InvariantCulture, "{0}|{1}", index.IndexKey, item.Key);
if (!index.Keys.Contains(k))
index.Keys.Add(k);
index.UpdatedAt = DateTimeOffset.UtcNow;
})
.SelectMany(index => cache.InsertObject(index.IndexKey, index, absoluteExpiration)
.Select(x => index));
}
[AllowNull]
public string IndexKey {[return: AllowNull] get; set; }
public List<string> Keys { get; set; }
public DateTimeOffset UpdatedAt { get; set; }
}
}
|
mit
|
C#
|
80d9f0ac6bc46bee5e41f837ee23fd975782e49f
|
Add all reference in imported override directive
|
apexrichard/ConfuserEx,arpitpanwar/ConfuserEx,AgileJoshua/ConfuserEx,modulexcite/ConfuserEx,fretelweb/ConfuserEx,yeaicc/ConfuserEx,KKKas/ConfuserEx,Desolath/ConfuserEx3,jbeshir/ConfuserEx,manojdjoshi/ConfuserEx,engdata/ConfuserEx,timnboys/ConfuserEx,Desolath/Confuserex,Immortal-/ConfuserEx,farmaair/ConfuserEx
|
Confuser.Renamer/References/OverrideDirectiveReference.cs
|
Confuser.Renamer/References/OverrideDirectiveReference.cs
|
using System;
using System.Linq;
using Confuser.Core;
using dnlib.DotNet;
namespace Confuser.Renamer.References {
internal class OverrideDirectiveReference : INameReference<MethodDef> {
readonly VTableSlot baseSlot;
readonly VTableSlot thisSlot;
public OverrideDirectiveReference(VTableSlot thisSlot, VTableSlot baseSlot) {
this.thisSlot = thisSlot;
this.baseSlot = baseSlot;
}
void AddImportReference(ConfuserContext context, INameService service, ModuleDef module, MethodDef method, MemberRef methodRef) {
if (method.Module != module && context.Modules.Contains((ModuleDefMD)method.Module)) {
var declType = (TypeRef)methodRef.DeclaringType.ScopeType;
service.AddReference(method.DeclaringType, new TypeRefReference(declType, method.DeclaringType));
service.AddReference(method, new MemberRefReference(methodRef, method));
var typeRefs = methodRef.MethodSig.Params.SelectMany(param => param.FindTypeRefs()).ToList();
typeRefs.AddRange(methodRef.MethodSig.RetType.FindTypeRefs());
foreach (var typeRef in typeRefs) {
var def = typeRef.ResolveTypeDefThrow();
if (def.Module != module && context.Modules.Contains((ModuleDefMD)def.Module))
service.AddReference(def, new TypeRefReference((TypeRef)typeRef, def));
}
}
}
public bool UpdateNameReference(ConfuserContext context, INameService service) {
MethodDef method = thisSlot.MethodDef;
IMethod target;
if (baseSlot.MethodDefDeclType is GenericInstSig) {
var declType = (GenericInstSig)baseSlot.MethodDefDeclType;
target = new MemberRefUser(method.Module, baseSlot.MethodDef.Name, baseSlot.MethodDef.MethodSig, declType.ToTypeDefOrRef());
target = (IMethod)new Importer(method.Module, ImporterOptions.TryToUseTypeDefs).Import(target);
}
else {
target = baseSlot.MethodDef;
if (target.Module != method.Module)
target = (IMethod)new Importer(method.Module, ImporterOptions.TryToUseTypeDefs).Import(baseSlot.MethodDef);
}
if (target is MemberRef)
AddImportReference(context, service, method.Module, baseSlot.MethodDef, (MemberRef)target);
if (method.Overrides.Any(impl =>
new SigComparer().Equals(impl.MethodDeclaration.MethodSig, target.MethodSig) &&
new SigComparer().Equals(impl.MethodDeclaration.DeclaringType.ResolveTypeDef(), target.DeclaringType.ResolveTypeDef())))
return true;
method.Overrides.Add(new MethodOverride(method, (IMethodDefOrRef)target));
return true;
}
public bool ShouldCancelRename() {
return baseSlot.MethodDefDeclType is GenericInstSig && thisSlot.MethodDef.Module.IsClr20;
}
}
}
|
using System;
using System.Linq;
using Confuser.Core;
using dnlib.DotNet;
namespace Confuser.Renamer.References {
internal class OverrideDirectiveReference : INameReference<MethodDef> {
readonly VTableSlot baseSlot;
readonly VTableSlot thisSlot;
public OverrideDirectiveReference(VTableSlot thisSlot, VTableSlot baseSlot) {
this.thisSlot = thisSlot;
this.baseSlot = baseSlot;
}
public bool UpdateNameReference(ConfuserContext context, INameService service) {
MethodDef method = thisSlot.MethodDef;
IMethodDefOrRef target;
if (baseSlot.MethodDefDeclType is GenericInstSig) {
var declType = (GenericInstSig)baseSlot.MethodDefDeclType;
target = new MemberRefUser(method.Module, baseSlot.MethodDef.Name, baseSlot.MethodDef.MethodSig, declType.ToTypeDefOrRef());
target = (IMethodDefOrRef)new Importer(method.Module, ImporterOptions.TryToUseTypeDefs).Import(target);
}
else {
target = baseSlot.MethodDef;
if (target.Module != method.Module)
target = (IMethodDefOrRef)new Importer(method.Module, ImporterOptions.TryToUseTypeDefs).Import(baseSlot.MethodDef);
}
if (target is MemberRef)
service.AddReference(baseSlot.MethodDef, new MemberRefReference((MemberRef)target, baseSlot.MethodDef));
if (method.Overrides.Any(impl =>
new SigComparer().Equals(impl.MethodDeclaration.MethodSig, target.MethodSig) &&
new SigComparer().Equals(impl.MethodDeclaration.DeclaringType.ResolveTypeDef(), target.DeclaringType.ResolveTypeDef())))
return true;
method.Overrides.Add(new MethodOverride(method, target));
return true;
}
public bool ShouldCancelRename() {
return baseSlot.MethodDefDeclType is GenericInstSig && thisSlot.MethodDef.Module.IsClr20;
}
}
}
|
mit
|
C#
|
46dacd8eddc1356e3096816c07361b8c6c567d3d
|
Update AssemblyFileVersion for Microsoft.Rest.ClientRuntime.Azure.Authentication (#12937)
|
AsrOneSdk/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,stankovski/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,markcowl/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,stankovski/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net
|
sdk/mgmtcommon/Auth/Az.Auth/Az.Authentication/Properties/AssemblyInfo.cs
|
sdk/mgmtcommon/Auth/Az.Auth/Az.Authentication/Properties/AssemblyInfo.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Microsoft Rest Azure Client Runtime Authentication")]
[assembly: AssemblyDescription("Client authentication infrastructure for Azure client libraries.")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.4.1.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: CLSCompliant(false)]
[assembly: ComVisible(false)]
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Microsoft Rest Azure Client Runtime Authentication")]
[assembly: AssemblyDescription("Client authentication infrastructure for Azure client libraries.")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.4.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: CLSCompliant(false)]
[assembly: ComVisible(false)]
|
mit
|
C#
|
0024edb10802ef4fc752d47ae23893fa3749f5a7
|
add missing model: NuGetPackagesExtendedNuGetPackageSymbols
|
lvermeulen/ProGet.Net
|
src/ProGet.Net/Native/Models/NuGetPackagesExtendedNuGetPackageSymbols.cs
|
src/ProGet.Net/Native/Models/NuGetPackagesExtendedNuGetPackageSymbols.cs
|
using System.Collections.Generic;
// ReSharper disable InconsistentNaming
namespace ProGet.Net.Native.Models
{
public class NuGetPackagesExtendedNuGetPackageSymbols
{
public List<NuGetPackageExtended> NuGetPackages_Extended { get; set; }
public List<NuGetPackageSymbols> NuGetPackageSymbols { get; set; }
}
}
|
namespace ProGet.Net.Native.Models
{
public class NuGetPackagesExtendedNuGetPackageSymbols
{
}
}
|
mit
|
C#
|
872c0b84af6c6f9ef317ce9ed1d337899c855e63
|
Fix error
|
12joan/hangman
|
row.cs
|
row.cs
|
using System;
using System.Collections.Generic;
namespace Hangman {
public class Row {
public Cell[] Cells;
public Row(Cell[] cells) {
Cells = cells;
}
public string Draw(int width) {
// return new String(' ', width - Text.Length) + Text;
return String.Join("\n", Lines());
}
private string[] Lines() {
var lines = new List<string>();
for (var i = 0; i < MaxCellDepth(); i++) {
var line = LineAtIndex(i);
lines.Add(String.Join("", line));
}
return lines.ToArray();
}
private string LineAtIndex(int index) {
var line = new List<string>();
int usedSpace = 0;
foreach (var cell in Cells) {
var part = cell.LineAtIndex(index);
line.Add(part);
usedSpace += part.Length;
}
return String.Join("", line);
}
private int MaxCellDepth() {
int max = 0;
foreach (var cell in Cells) {
max = Math.Max(max, cell.Depth());
}
return max;
}
}
}
|
using System;
using System.Collections.Generic;
namespace Hangman {
public class Row {
public Cell[] Cells;
public Row(Cell[] cells) {
Cells = cells;
}
public string Draw(int width) {
// return new String(' ', width - Text.Length) + Text;
return String.Join("\n", Lines());
}
private string[] Lines() {
var lines = new List<string>();
for (var i = 0; i < MaxCellDepth(); i++) {
var line = LineAtIndex(i);
lines.Add(String.Join("", line));
}
return lines.ToArray();
}
private string LineAtIndex(int index) {
var line = new List<string>();
int usedSpace = 0;
foreach (var cell in Cells) {
var part = cell.LineAtIndex(index);
line.Add(part);
usedSpace += part.Length;
}
return line;
}
private int MaxCellDepth() {
int max = 0;
foreach (var cell in Cells) {
max = Math.Max(max, cell.Depth());
}
return max;
}
}
}
|
unlicense
|
C#
|
d38ea6467564b15b192c43a6adaaf089ce8dfb4c
|
Throw exitCode non zero exception
|
jeremytammik/RevitLookup
|
Build/Build.Installer.cs
|
Build/Build.Installer.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using Nuke.Common;
partial class Build
{
Target CreateInstaller => _ => _
.TriggeredBy(Compile)
.Produces(ArtifactsDirectory / "*.msi")
.Executes(() =>
{
var installerProject = BuilderExtensions.GetProject(Solution, InstallerProject);
var buildDirectories = GetBuildDirectories();
var configurations = GetConfigurations(InstallerConfiguration);
var releasesDirectory = Solution.Directory / "Releases";
var releasesInfos = new DirectoryInfo(releasesDirectory).EnumerateDirectories().Select(info => info.FullName).ToList();
foreach (var directoryGroup in buildDirectories)
{
var directories = directoryGroup.ToList();
var exeArguments = BuildExeArguments(directories.Select(info => info.FullName).Concat(releasesInfos).ToList());
var exeFile = installerProject.GetExecutableFile(configurations, directories);
if (string.IsNullOrEmpty(exeFile))
{
Logger.Warn($"No installer executable was found for these packages:\n {string.Join("\n", directories)}");
continue;
}
var proc = new Process();
proc.StartInfo.FileName = exeFile;
proc.StartInfo.Arguments = exeArguments;
proc.Start();
proc.WaitForExit();
if (proc.ExitCode != 0) throw new Exception("The installer creation failed.");
}
});
string BuildExeArguments(IReadOnlyList<string> args)
{
var argumentBuilder = new StringBuilder();
for (var i = 0; i < args.Count; i++)
{
if (i > 0) argumentBuilder.Append(' ');
var value = args[i];
if (value.Contains(' ')) value = $"\"{value}\"";
argumentBuilder.Append(value);
}
return argumentBuilder.ToString();
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using Nuke.Common;
partial class Build
{
Target CreateInstaller => _ => _
.TriggeredBy(Compile)
.Produces(ArtifactsDirectory / "*.msi")
.Executes(() =>
{
var installerProject = BuilderExtensions.GetProject(Solution, InstallerProject);
var buildDirectories = GetBuildDirectories();
var configurations = GetConfigurations(InstallerConfiguration);
var releasesDirectory = Solution.Directory / "Releases";
var releasesInfos = new DirectoryInfo(releasesDirectory).EnumerateDirectories().Select(info => info.FullName).ToList();
foreach (var directoryGroup in buildDirectories)
{
var directories = directoryGroup.ToList();
var exeArguments = BuildExeArguments(directories.Select(info => info.FullName).Concat(releasesInfos).ToList());
var exeFile = installerProject.GetExecutableFile(configurations, directories);
if (string.IsNullOrEmpty(exeFile))
{
Logger.Warn($"No installer executable was found for these packages:\n {string.Join("\n", directories)}");
continue;
}
var proc = new Process();
proc.StartInfo.FileName = exeFile;
proc.StartInfo.Arguments = exeArguments;
proc.Start();
proc.WaitForExit();
}
});
string BuildExeArguments(IReadOnlyList<string> args)
{
var argumentBuilder = new StringBuilder();
for (var i = 0; i < args.Count; i++)
{
if (i > 0) argumentBuilder.Append(' ');
var value = args[i];
if (value.Contains(' ')) value = $"\"{value}\"";
argumentBuilder.Append(value);
}
return argumentBuilder.ToString();
}
}
|
mit
|
C#
|
83656d838835349b2ac4751a036b2cc0f19b160a
|
Remove unnecessary properties
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi.Fluent/ViewModels/AddWallet/ConfirmRecoveryWordsViewModel.cs
|
WalletWasabi.Fluent/ViewModels/AddWallet/ConfirmRecoveryWordsViewModel.cs
|
using DynamicData;
using DynamicData.Binding;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using System.Windows.Input;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
public class ConfirmRecoveryWordsViewModel : RoutableViewModel
{
private readonly ReadOnlyObservableCollection<RecoveryWordViewModel> _confirmationWords;
private readonly SourceList<RecoveryWordViewModel> _confirmationWordsSourceList;
public ConfirmRecoveryWordsViewModel(NavigationStateViewModel navigationState, List<RecoveryWordViewModel> mnemonicWords, KeyManager keyManager, WalletManager walletManager)
: base(navigationState, NavigationTarget.Dialog)
{
_confirmationWordsSourceList = new SourceList<RecoveryWordViewModel>();
var finishCommandCanExecute =
_confirmationWordsSourceList
.Connect()
.ObserveOn(RxApp.MainThreadScheduler)
.WhenValueChanged(x => x.IsConfirmed)
.Select(x => !_confirmationWordsSourceList.Items.Any(x => !x.IsConfirmed));
FinishCommand = ReactiveCommand.Create(
() =>
{
walletManager.AddWallet(keyManager);
navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear();
},
finishCommandCanExecute);
_confirmationWordsSourceList
.Connect()
.ObserveOn(RxApp.MainThreadScheduler)
.OnItemAdded(x => x.Reset())
.Sort(SortExpressionComparer<RecoveryWordViewModel>.Ascending(x => x.Index))
.Bind(out _confirmationWords)
.Subscribe();
SelectRandomConfirmationWords(mnemonicWords);
}
public ReadOnlyObservableCollection<RecoveryWordViewModel> ConfirmationWords => _confirmationWords;
public ICommand FinishCommand { get; }
private void SelectRandomConfirmationWords(List<RecoveryWordViewModel> mnemonicWords)
{
var random = new Random();
while (_confirmationWordsSourceList.Count != 4)
{
var word = mnemonicWords[random.Next(0, 12)];
if (!_confirmationWordsSourceList.Items.Contains(word))
{
_confirmationWordsSourceList.Add(word);
}
}
}
}
}
|
using DynamicData;
using DynamicData.Binding;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using System.Windows.Input;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.AddWallet
{
public class ConfirmRecoveryWordsViewModel : RoutableViewModel
{
private readonly ReadOnlyObservableCollection<RecoveryWordViewModel> _confirmationWords;
private readonly SourceList<RecoveryWordViewModel> _confirmationWordsSourceList;
public ConfirmRecoveryWordsViewModel(NavigationStateViewModel navigationState, List<RecoveryWordViewModel> mnemonicWords, KeyManager keyManager, WalletManager walletManager)
: base(navigationState, NavigationTarget.Dialog)
{
_confirmationWordsSourceList = new SourceList<RecoveryWordViewModel>();
var finishCommandCanExecute =
_confirmationWordsSourceList
.Connect()
.ObserveOn(RxApp.MainThreadScheduler)
.WhenValueChanged(x => x.IsConfirmed)
.Select(x => !_confirmationWordsSourceList.Items.Any(x => !x.IsConfirmed));
FinishCommand = ReactiveCommand.Create(
() =>
{
walletManager.AddWallet(keyManager);
navigationState.DialogScreen?.Invoke().Router.NavigationStack.Clear();
},
finishCommandCanExecute);
_confirmationWordsSourceList
.Connect()
.ObserveOn(RxApp.MainThreadScheduler)
.OnItemAdded(x => x.Reset())
.Sort(SortExpressionComparer<RecoveryWordViewModel>.Ascending(x => x.Index))
.Bind(out _confirmationWords)
.Subscribe();
SelectRandomConfirmationWords(mnemonicWords);
}
public string UrlPathSegment { get; } = "";
public IScreen HostScreen { get; }
public ReadOnlyObservableCollection<RecoveryWordViewModel> ConfirmationWords => _confirmationWords;
public ICommand FinishCommand { get; }
private void SelectRandomConfirmationWords(List<RecoveryWordViewModel> mnemonicWords)
{
var random = new Random();
while (_confirmationWordsSourceList.Count != 4)
{
var word = mnemonicWords[random.Next(0, 12)];
if (!_confirmationWordsSourceList.Items.Contains(word))
{
_confirmationWordsSourceList.Add(word);
}
}
}
}
}
|
mit
|
C#
|
02a60fc4d35bfb6cf728afcba84afd91f3d91af3
|
Update mvx init for android
|
aritchie/userdialogs
|
src/Acr.MvvmCross.Plugins.UserDialogs.Droid/Plugin.cs
|
src/Acr.MvvmCross.Plugins.UserDialogs.Droid/Plugin.cs
|
using System;
using Cirrious.CrossCore;
using Cirrious.CrossCore.Droid.Platform;
using Cirrious.CrossCore.Plugins;
using Acr.UserDialogs;
namespace Acr.MvvmCross.Plugins.UserDialogs.Droid {
public class Plugin : IMvxPlugin {
public void Load() {
Acr.UserDialogs.UserDialogs.Instance = new AppCompatUserDialogsImpl(() => Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity);
Mvx.RegisterSingleton(Acr.UserDialogs.UserDialogs.Instance);
}
}
}
|
using System;
using Cirrious.CrossCore;
using Cirrious.CrossCore.Droid.Platform;
using Cirrious.CrossCore.Plugins;
using Acr.UserDialogs;
namespace Acr.MvvmCross.Plugins.UserDialogs.Droid {
public class Plugin : IMvxPlugin {
public void Load() {
Mvx.CallbackWhenRegistered<IMvxAndroidCurrentTopActivity>(x => {
Acr.UserDialogs.UserDialogs.Instance = new AppCompatUserDialogsImpl(() => Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity);
Mvx.RegisterSingleton(Acr.UserDialogs.UserDialogs.Instance);
});
}
}
}
|
mit
|
C#
|
09449c679f8eb0f676665f6bd17d6219613151d8
|
Add DokanOptions comments as summary
|
TrabacchinLuigi/dokan-dotnet,magol/dokan-dotnet,dokan-dev/dokan-dotnet,dokan-dev/dokan-dotnet,magol/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,viciousviper/dokan-dotnet,TrabacchinLuigi/dokan-dotnet,magol/dokan-dotnet,viciousviper/dokan-dotnet,viciousviper/dokan-dotnet,dokan-dev/dokan-dotnet
|
DokanNet/DokanOptions.cs
|
DokanNet/DokanOptions.cs
|
using System;
namespace DokanNet
{
/// <summary>
/// Dokan mount options used to describe dokan device behaviour.
/// </summary>
[Flags]
public enum DokanOptions : long
{
/// <summary>Enable ouput debug message</summary>
DebugMode = 1,
/// <summary>Enable ouput debug message to stderr</summary>
StderrOutput = 2,
/// <summary>Use alternate stream</summary>
AltStream = 4,
/// <summary>Enable mount drive as write-protected.</summary>
WriteProtection = 8,
/// <summary>Use network drive - Dokan network provider need to be installed.</summary>
NetworkDrive = 16,
/// <summary>Use removable drive</summary>
RemovableDrive = 32,
/// <summary>Use mount manager</summary>
MountManager = 64,
/// <summary>Mount the drive on current session only</summary>
CurrentSession = 128,
/// <summary>Fixed Driver</summary>
FixedDrive = 0,
}
}
|
using System;
namespace DokanNet
{
[Flags]
public enum DokanOptions : long
{
DebugMode = 1, // ouput debug message
StderrOutput = 2, // ouput debug message to stderr
AltStream = 4, // use alternate stream
WriteProtection = 8, // mount drive as write-protected.
NetworkDrive = 16, // use network drive, you need to install Dokan network provider.
RemovableDrive = 32, // use removable drive
MountManager = 64, // use mount manager
CurrentSession = 128, // mount the drive on current session only
FixedDrive = 0,
}
}
|
mit
|
C#
|
b46c985e9d974c587f1638bc5e738e04a8a631a8
|
Update namespace
|
charlenni/Mapsui,pauldendulk/Mapsui,charlenni/Mapsui
|
Samples/Mapsui.Samples.Common/Maps/Special/KeepWithinExtentSample.cs
|
Samples/Mapsui.Samples.Common/Maps/Special/KeepWithinExtentSample.cs
|
using Mapsui.Projection;
using Mapsui.UI;
using Mapsui.Utilities;
namespace Mapsui.Samples.Common.Maps.Special
{
public class KeepWithinExtentSample : ISample
{
public string Name => "Keep Within Extent";
public string Category => "Special";
public void Setup(IMapControl mapControl)
{
mapControl.Map = CreateMap();
}
public static Map CreateMap()
{
var map = new Map();
map.Layers.Add(OpenStreetMap.CreateTileLayer());
map.Limiter = new ViewportLimiterKeepWithin
{
PanLimits = GetLimitsOfMadagaskar()
};
return map;
}
private static MRect GetLimitsOfMadagaskar()
{
var (minX, minY) = SphericalMercator.FromLonLat(41.8, -27.2);
var (maxX, maxY) = SphericalMercator.FromLonLat(52.5, -11.6);
return new MRect(minX, minY, maxX, maxY);
}
}
}
|
using Mapsui.Projection;
using Mapsui.UI;
using Mapsui.Utilities;
namespace Mapsui.Samples.Common.Maps
{
public class KeepWithinExtentSample : ISample
{
public string Name => "Keep Within Extent";
public string Category => "Special";
public void Setup(IMapControl mapControl)
{
mapControl.Map = CreateMap();
}
public static Map CreateMap()
{
var map = new Map();
map.Layers.Add(OpenStreetMap.CreateTileLayer());
map.Limiter = new ViewportLimiterKeepWithin
{
PanLimits = GetLimitsOfMadagaskar()
};
return map;
}
private static MRect GetLimitsOfMadagaskar()
{
var (minX, minY) = SphericalMercator.FromLonLat(41.8, -27.2);
var (maxX, maxY) = SphericalMercator.FromLonLat(52.5, -11.6);
return new MRect(minX, minY, maxX, maxY);
}
}
}
|
mit
|
C#
|
d6113889d26ec7d1bdef2b9a3dbc3a8183dd7c8e
|
remove unnecessary using
|
Kingloo/Pingy
|
src/Gui/MainWindow.xaml.cs
|
src/Gui/MainWindow.xaml.cs
|
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Pingy.Model;
namespace Pingy.Gui
{
public partial class MainWindow : Window
{
private readonly MainWindowViewModel vm = null;
public MainWindow(MainWindowViewModel viewModel)
{
if (viewModel is null) { throw new ArgumentNullException(nameof(viewModel)); }
InitializeComponent();
vm = viewModel;
DataContext = vm;
}
private async void Window_Loaded(object sender, RoutedEventArgs e)
{
await vm.LoadAsync();
await vm.PingAllAsync();
}
private async void Window_KeyDown(object sender, KeyEventArgs e)
{
switch (e.Key)
{
case Key.F5:
await vm.PingAllAsync();
break;
case Key.F11:
vm.OpenFile();
break;
case Key.F12:
await vm.LoadAsync();
await vm.PingAllAsync();
break;
case Key.Escape:
Close();
break;
default:
break;
}
}
private async void Grid_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
if ((PingBase)((Grid)sender).DataContext is PingBase ping)
{
await vm.PingAsync(ping);
}
}
}
}
|
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Pingy.Model;
namespace Pingy.Gui
{
public partial class MainWindow : Window
{
private readonly MainWindowViewModel vm = null;
public MainWindow(MainWindowViewModel viewModel)
{
if (viewModel is null) { throw new ArgumentNullException(nameof(viewModel)); }
InitializeComponent();
vm = viewModel;
DataContext = vm;
}
private async void Window_Loaded(object sender, RoutedEventArgs e)
{
await vm.LoadAsync();
await vm.PingAllAsync();
}
private async void Window_KeyDown(object sender, KeyEventArgs e)
{
switch (e.Key)
{
case Key.F5:
await vm.PingAllAsync();
break;
case Key.F11:
vm.OpenFile();
break;
case Key.F12:
await vm.LoadAsync();
await vm.PingAllAsync();
break;
case Key.Escape:
Close();
break;
default:
break;
}
}
private async void Grid_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
if ((PingBase)((Grid)sender).DataContext is PingBase ping)
{
await vm.PingAsync(ping);
}
}
}
}
|
unlicense
|
C#
|
bd13ed4afaa2f08b418f2f9ea234f73d2f2f71a6
|
Revert "Remove unnecessary condition from RemoveMember.cs"
|
GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples
|
iam/api/Access/RemoveMember.cs
|
iam/api/Access/RemoveMember.cs
|
// Copyright 2019 Google Inc.
//
// 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.
// [START iam_modify_policy_remove_member]
using System.Linq;
using Google.Apis.CloudResourceManager.v1.Data;
public partial class AccessManager
{
public static Policy RemoveMember(Policy policy, string role, string member)
{
var binding = policy.Bindings.First(x => x.Role == role);
if(binding.Members != null && binding.Members.Contains(member))
{
binding.Members.Remove(member);
}
return policy;
}
}
// [END iam_modify_policy_remove_member]
|
// Copyright 2019 Google Inc.
//
// 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.
// [START iam_modify_policy_remove_member]
using System.Linq;
using Google.Apis.CloudResourceManager.v1.Data;
public partial class AccessManager
{
public static Policy RemoveMember(Policy policy, string role, string member)
{
var binding = policy.Bindings.First(x => x.Role == role);
binding.Members.Remove(member);
return policy;
}
}
// [END iam_modify_policy_remove_member]
|
apache-2.0
|
C#
|
6294473783195c226ecb43f812a6817c87395aeb
|
Make `InvocationShape` deconstructible
|
Moq/moq4,ocoanet/moq4
|
src/Moq/InvocationShape.cs
|
src/Moq/InvocationShape.cs
|
// Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD.
// All rights reserved. Licensed under the BSD 3-Clause License; see License.txt.
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Moq
{
/// <summary>
/// Describes the "shape" of an invocation against which concrete <see cref="Invocation"/>s can be matched.
/// </summary>
internal readonly struct InvocationShape
{
public readonly LambdaExpression Expression;
public readonly MethodInfo Method;
public readonly IReadOnlyList<Expression> Arguments;
private readonly IMatcher[] argumentMatchers;
public InvocationShape(LambdaExpression expression, MethodInfo method, IReadOnlyList<Expression> arguments)
{
this.Expression = expression;
this.Method = method;
this.Arguments = arguments;
this.argumentMatchers = MatcherFactory.CreateMatchers(arguments, method.GetParameters());
}
public void Deconstruct(out LambdaExpression expression, out MethodInfo method, out IReadOnlyList<Expression> arguments)
{
expression = this.Expression;
method = this.Method;
arguments = this.Arguments;
}
public bool IsMatch(Invocation invocation)
{
var arguments = invocation.Arguments;
if (this.argumentMatchers.Length != arguments.Length)
{
return false;
}
if (invocation.Method != this.Method && !this.IsOverride(invocation.Method))
{
return false;
}
for (int i = 0, n = this.argumentMatchers.Length; i < n; ++i)
{
if (this.argumentMatchers[i].Matches(arguments[i]) == false)
{
return false;
}
}
return true;
}
private bool IsOverride(MethodInfo invocationMethod)
{
var method = this.Method;
if (!method.DeclaringType.IsAssignableFrom(invocationMethod.DeclaringType))
{
return false;
}
if (!method.Name.Equals(invocationMethod.Name, StringComparison.Ordinal))
{
return false;
}
if (method.ReturnType != invocationMethod.ReturnType)
{
return false;
}
if (method.IsGenericMethod || invocationMethod.IsGenericMethod)
{
if (!method.GetGenericArguments().CompareTo(invocationMethod.GetGenericArguments(), exact: false))
{
return false;
}
}
else
{
if (!invocationMethod.GetParameterTypes().CompareTo(method.GetParameterTypes(), exact: true))
{
return false;
}
}
return true;
}
}
}
|
// Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD.
// All rights reserved. Licensed under the BSD 3-Clause License; see License.txt.
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Moq
{
/// <summary>
/// Describes the "shape" of an invocation against which concrete <see cref="Invocation"/>s can be matched.
/// </summary>
internal readonly struct InvocationShape
{
public readonly LambdaExpression Expression;
public readonly MethodInfo Method;
public readonly IReadOnlyList<Expression> Arguments;
private readonly IMatcher[] argumentMatchers;
public InvocationShape(LambdaExpression expression, MethodInfo method, IReadOnlyList<Expression> arguments)
{
this.Expression = expression;
this.Method = method;
this.Arguments = arguments;
this.argumentMatchers = MatcherFactory.CreateMatchers(arguments, method.GetParameters());
}
public bool IsMatch(Invocation invocation)
{
var arguments = invocation.Arguments;
if (this.argumentMatchers.Length != arguments.Length)
{
return false;
}
if (invocation.Method != this.Method && !this.IsOverride(invocation.Method))
{
return false;
}
for (int i = 0, n = this.argumentMatchers.Length; i < n; ++i)
{
if (this.argumentMatchers[i].Matches(arguments[i]) == false)
{
return false;
}
}
return true;
}
private bool IsOverride(MethodInfo invocationMethod)
{
var method = this.Method;
if (!method.DeclaringType.IsAssignableFrom(invocationMethod.DeclaringType))
{
return false;
}
if (!method.Name.Equals(invocationMethod.Name, StringComparison.Ordinal))
{
return false;
}
if (method.ReturnType != invocationMethod.ReturnType)
{
return false;
}
if (method.IsGenericMethod || invocationMethod.IsGenericMethod)
{
if (!method.GetGenericArguments().CompareTo(invocationMethod.GetGenericArguments(), exact: false))
{
return false;
}
}
else
{
if (!invocationMethod.GetParameterTypes().CompareTo(method.GetParameterTypes(), exact: true))
{
return false;
}
}
return true;
}
}
}
|
bsd-3-clause
|
C#
|
ac3cfdf330d617c43b50fabe498c504acbf5d30e
|
Add GetProject, GetSolutionFolder, SolutionFolders, and Projects to SolutionFolder
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Common/ProjectModel/SolutionFolder.cs
|
source/Nuke.Common/ProjectModel/SolutionFolder.cs
|
// Copyright 2019 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
namespace Nuke.Common.ProjectModel
{
[PublicAPI]
public class SolutionFolder : PrimitiveProject
{
internal static readonly Guid Guid = Guid.Parse("2150E333-8FDC-42A3-9474-1A3956D46DE8");
public SolutionFolder(
Solution solution,
Guid projectId,
string name,
IDictionary<string, string> items)
: base(solution, projectId, name, Guid)
{
Items = items;
}
public IDictionary<string, string> Items { get; set; }
public IReadOnlyCollection<SolutionFolder> SolutionFolders => Solution.AllSolutionFolders.Where(x => x.SolutionFolder == this).ToList();
public IReadOnlyCollection<Project> Projects => Solution.AllProjects.Where(x => x.SolutionFolder == this).ToList();
[CanBeNull]
public SolutionFolder GetSolutionFolder(string name)
{
return SolutionFolders.SingleOrDefault(x => name.Equals(x.Name, StringComparison.Ordinal));
}
[CanBeNull]
public Project GetProject(string name)
{
return Projects.SingleOrDefault(x => name.Equals(x.Name, StringComparison.Ordinal));
}
internal override string RelativePath => Name;
}
}
|
// Copyright 2019 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
namespace Nuke.Common.ProjectModel
{
[PublicAPI]
public class SolutionFolder : PrimitiveProject
{
internal static readonly Guid Guid = Guid.Parse("2150E333-8FDC-42A3-9474-1A3956D46DE8");
public SolutionFolder(
Solution solution,
Guid projectId,
string name,
IDictionary<string, string> items)
: base(solution, projectId, name, Guid)
{
Items = items;
}
public IDictionary<string, string> Items { get; set; }
internal override string RelativePath => Name;
}
}
|
mit
|
C#
|
474e48d8a6dfdcbcad9755e39c0e5c34b72be9c9
|
Fix out of range bug in sequence task.
|
marcotmp/BehaviorTree
|
Assets/Scripts/BehaviorTree/Composites/Sequence.cs
|
Assets/Scripts/BehaviorTree/Composites/Sequence.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Sequence : CompositeTask {
private int taskIndex = 0;
public Sequence(string name) : base(name) { }
override public ReturnCode Update()
{
var returnCode = tasks[taskIndex].Update();
if (returnCode == ReturnCode.Succeed)
{
taskIndex++;
if (taskIndex >= tasks.Count)
return ReturnCode.Succeed;
else
return ReturnCode.Running;
}
else
{
return returnCode;
}
}
public override void Restart()
{
taskIndex = 0;
base.Restart();
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Sequence : CompositeTask {
private int taskIndex = 0;
public Sequence(string name) : base(name) { }
override public ReturnCode Update()
{
var returnCode = tasks[taskIndex].Update();
if (returnCode == ReturnCode.Succeed)
{
taskIndex++;
if (taskIndex > tasks.Count)
return ReturnCode.Succeed;
else
return ReturnCode.Running;
}
else
{
return returnCode;
}
}
public override void Restart()
{
taskIndex = 0;
base.Restart();
}
}
|
unlicense
|
C#
|
81d994abeda12ff1e0ddf635c77363f82ae96b4f
|
Change ChatMessageNotification's LabelText
|
smoogipoo/osu,peppy/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu-new,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,ppy/osu,peppy/osu,ppy/osu
|
osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.cs
|
osu.Game/Overlays/Settings/Sections/Online/AlertsAndPrivacySettings.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.Configuration;
namespace osu.Game.Overlays.Settings.Sections.Online
{
public class AlertsAndPrivacySettings : SettingsSubsection
{
protected override string Header => "Alerts and Privacy";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = "Show a notification popup when someone says your name",
Bindable = config.GetBindable<bool>(OsuSetting.ChatHighlightName)
},
new SettingsCheckbox
{
LabelText = "Show private message notifications",
Bindable = config.GetBindable<bool>(OsuSetting.ChatMessageNotification)
},
};
}
}
}
|
// 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.Configuration;
namespace osu.Game.Overlays.Settings.Sections.Online
{
public class AlertsAndPrivacySettings : SettingsSubsection
{
protected override string Header => "Alerts and Privacy";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = "Show a notification popup when someone says your name",
Bindable = config.GetBindable<bool>(OsuSetting.ChatHighlightName)
},
new SettingsCheckbox
{
LabelText = "Show chat message notifications",
Bindable = config.GetBindable<bool>(OsuSetting.ChatMessageNotification)
},
};
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.