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 |
|---|---|---|---|---|---|---|---|---|
40f84ac4384d7bcf4108f50a00594eaff3477cfa | Add function for distance in spherical metric. | roice3/Honeycombs | code/R3/R3.Core/Geometry/Spherical2D.cs | code/R3/R3.Core/Geometry/Spherical2D.cs | namespace R3.Geometry
{
using Math = System.Math;
using R3.Core;
using System.Diagnostics;
public static class Spherical2D
{
// The next two methods mimic Don's stuff for the hyperbolic plane.
public static double
s2eNorm( double sNorm )
{
//if( double.IsNaN( sNorm ) )
// return 1.0;
return Math.Tan( .5 * sNorm );
}
public static double
e2sNorm( double eNorm )
{
return 2 * Math.Atan( eNorm );
}
/// <summary>
/// Sphere geometry is implicit. A radius 1 sphere with the center at the origin.
/// </summary>
public static Vector3D SphereToPlane( Vector3D spherePoint )
{
Vector3D projected = spherePoint.CentralProject( 1.0 );
return projected;
}
/// <summary>
/// Sphere geometry is implicit. A radius 1 sphere with the center at the origin.
/// </summary>
public static Vector3D PlaneToSphere( Vector3D planePoint )
{
planePoint.Z = 0; // Just to be safe.
double magSquared = planePoint.MagSquared();
Vector3D result = new Vector3D(
2 * planePoint.X / ( 1.0 + magSquared ),
2 * planePoint.Y / ( 1.0 + magSquared ),
( magSquared - 1.0 ) / ( magSquared + 1.0 ) );
return result;
}
/// <summary>
/// Calculates the two poles of a great circle defined by two points.
/// </summary>
public static void GreatCirclePole( Vector3D sphereCenter, Vector3D p1, Vector3D p2,
out Vector3D pole1, out Vector3D pole2 )
{
double sphereRadius = p1.Dist( sphereCenter );
Debug.Assert( Tolerance.Equal( sphereRadius, p2.Dist( sphereCenter ) ) );
Vector3D v1 = p1 - sphereCenter;
Vector3D v2 = p2 - sphereCenter;
pole1 = v1.Cross( v2 ) + sphereCenter;
pole2 = v2.Cross( v1 ) + sphereCenter;
}
/// <summary>
/// Same as above, but with implicit sphere geometry. A radius 1 sphere with the center at the origin.
/// </summary>
public static void GreatCirclePole( Vector3D p1, Vector3D p2,
out Vector3D pole1, out Vector3D pole2 )
{
GreatCirclePole( new Vector3D( 0, 0, 0 ), p1, p2, out pole1, out pole2 );
}
/// <summary>
/// Spherical distance between two points on the plane.
/// </summary>
public static double SDist( Vector3D p1, Vector3D p2 )
{
p1 = PlaneToSphere( p1 );
p2 = PlaneToSphere( p2 );
return p1.AngleTo( p2 );
}
}
}
| namespace R3.Geometry
{
using Math = System.Math;
using R3.Core;
using System.Diagnostics;
public static class Spherical2D
{
// The next two methods mimic Don's stuff for the hyperbolic plane.
public static double
s2eNorm( double sNorm )
{
//if( double.IsNaN( sNorm ) )
// return 1.0;
return Math.Tan( .5 * sNorm );
}
public static double
e2sNorm( double eNorm )
{
return 2 * Math.Atan( eNorm );
}
/// <summary>
/// Sphere geometry is implicit. A radius 1 sphere with the center at the origin.
/// </summary>
public static Vector3D SphereToPlane( Vector3D spherePoint )
{
Vector3D projected = spherePoint.CentralProject( 1.0 );
return projected;
}
/// <summary>
/// Sphere geometry is implicit. A radius 1 sphere with the center at the origin.
/// </summary>
public static Vector3D PlaneToSphere( Vector3D planePoint )
{
planePoint.Z = 0; // Just to be safe.
double magSquared = planePoint.MagSquared();
Vector3D result = new Vector3D(
2 * planePoint.X / ( 1.0 + magSquared ),
2 * planePoint.Y / ( 1.0 + magSquared ),
( magSquared - 1.0 ) / ( magSquared + 1.0 ) );
return result;
}
/// <summary>
/// Calculates the two poles of a great circle defined by two points.
/// </summary>
public static void GreatCirclePole( Vector3D sphereCenter, Vector3D p1, Vector3D p2,
out Vector3D pole1, out Vector3D pole2 )
{
double sphereRadius = p1.Dist( sphereCenter );
Debug.Assert( Tolerance.Equal( sphereRadius, p2.Dist( sphereCenter ) ) );
Vector3D v1 = p1 - sphereCenter;
Vector3D v2 = p2 - sphereCenter;
pole1 = v1.Cross( v2 ) + sphereCenter;
pole2 = v2.Cross( v1 ) + sphereCenter;
}
/// <summary>
/// Same as above, but with implicit sphere geometry. A radius 1 sphere with the center at the origin.
/// </summary>
public static void GreatCirclePole( Vector3D p1, Vector3D p2,
out Vector3D pole1, out Vector3D pole2 )
{
GreatCirclePole( new Vector3D( 0, 0, 0 ), p1, p2, out pole1, out pole2 );
}
}
}
| mit | C# |
4e01abc37ce9c908e0fe341f62eec0e83c81fa92 | fix broken on purpose build | Isantipov/mqpi,Isantipov/mqpi | mqpi/Controllers/MockedController.cs | mqpi/Controllers/MockedController.cs | using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace mqpi.Controllers
{
[Route("api/{type}")]
public class MockedController : Controller
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(MockedController));
// GET api/values
[HttpGet]
public IEnumerable<dynamic> Get(string type)
{
log.Info($"GET {type}");
return new dynamic[]{};
}
// GET api/values/5
[HttpGet("{id}")]
public ActionResult Get(string type, int id)
{
log.Info($"GET {type} id = {id}");
return new NotFoundObjectResult($"{type} with id='{id}' was not found");
}
// POST api/values
[HttpPost]
public object Post(string type, [FromBody]dynamic value)
{
var random = new Random(DateTime.UtcNow.Second);
value.Id = random.Next();
return value;
}
// PUT api/values/5
[HttpPut("{id}")]
public dynamic Put(string type, [FromBody]dynamic value, int id)
{
if (value.Id != id)
{
return new BadRequestObjectResult("Id in the object must match id in URI");
}
return value;
}
// DELETE api/values/5
[HttpDelete("{id}")]
public ActionResult Delete(string type, int id)
{
return Ok($"{type} {id} has been removed");
}
}
}
| using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace mqpi.Controllers
{
[Route("api/{type}")]
public class MockedController : Controller
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(MockedController));
// GET api/values
[HttpGet]
public IEnumerable<dynamic> Get(string type)
{
log.Info($"GET {type}");
return new dynamic[]{;
}
// GET api/values/5
[HttpGet("{id}")]
public ActionResult Get(string type, int id)
{
log.Info($"GET {type} id = {id}");
return new NotFoundObjectResult($"{type} with id='{id}' was not found");
}
// POST api/values
[HttpPost]
public object Post(string type, [FromBody]dynamic value)
{
var random = new Random(DateTime.UtcNow.Second);
value.Id = random.Next();
return value;
}
// PUT api/values/5
[HttpPut("{id}")]
public dynamic Put(string type, [FromBody]dynamic value, int id)
{
if (value.Id != id)
{
return new BadRequestObjectResult("Id in the object must match id in URI");
}
return value;
}
// DELETE api/values/5
[HttpDelete("{id}")]
public ActionResult Delete(string type, int id)
{
return Ok($"{type} {id} has been removed");
}
}
}
| mit | C# |
e633cd48e2cbea97d91d5a21b09e3e5b14aebc2c | fix in-game website link. fixes #33 | erosson/orbitris,erosson/orbitris,erosson/orbitris,erosson/orbitris | Assets/MainMenu.cs | Assets/MainMenu.cs | using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
public AudioClip select;
public AudioClip cancel;
public OptionsMenu optionsMenu;
private string url = "http://erosson.org/games/orbitris";
void OnGUI() {
DebugUtil.ScaleGUI();
GUILayout.BeginArea(new Rect(DebugUtil.ScreenWidth/4, DebugUtil.ScreenHeight/2, DebugUtil.ScreenWidth/2, DebugUtil.ScreenHeight/2));
if (GUILayout.Button("Play")) {
Play();
}
if (GUILayout.Button("Options")) {
Options();
}
if (GUILayout.Button("Feedback")) {
Feedback();
}
if (GUILayout.Button("Website")) {
Web();
}
// Exit button does nothing in the web player
if (!Application.isWebPlayer && !Application.isEditor) {
if (GUILayout.Button("Exit")) {
Exit();
}
}
GUILayout.EndArea();
}
void Update () {
if (Input.GetKeyDown(KeyCode.Escape)) {
Exit();
}
}
private void Play () {
// Singletons are icky, but needed to play the sound properly after the menu's destroyed by loadlevel
Music.Instance.audio.PlayOneShot(select);
Application.LoadLevel("Game");
}
private void Feedback () {
Music.Instance.audio.PlayOneShot(select);
// TODO redirect from orbitris.zealgame.com/feedback
Application.OpenURL("https://docs.google.com/a/erosson.org/forms/d/12V9Vz-lRQvMuMg91p_AEgeOHcjgDxPt399t_MIHFVig/viewform");
}
private void Web () {
Music.Instance.audio.PlayOneShot(select);
Application.OpenURL(url);
}
private void Options () {
Music.Instance.audio.PlayOneShot(select);
enabled = false;
optionsMenu.enabled = true;
}
private void Exit() {
Music.Instance.audio.PlayOneShot(cancel);
Application.Quit();
}
}
| using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
public AudioClip select;
public AudioClip cancel;
public OptionsMenu optionsMenu;
private string url = "http://orbitris.zealgame.com";
void OnGUI() {
DebugUtil.ScaleGUI();
GUILayout.BeginArea(new Rect(DebugUtil.ScreenWidth/4, DebugUtil.ScreenHeight/2, DebugUtil.ScreenWidth/2, DebugUtil.ScreenHeight/2));
if (GUILayout.Button("Play")) {
Play();
}
if (GUILayout.Button("Options")) {
Options();
}
if (GUILayout.Button("Feedback")) {
Feedback();
}
if (GUILayout.Button(url)) {
Web();
}
// Exit button does nothing in the web player
if (!Application.isWebPlayer && !Application.isEditor) {
if (GUILayout.Button("Exit")) {
Exit();
}
}
GUILayout.EndArea();
}
void Update () {
if (Input.GetKeyDown(KeyCode.Escape)) {
Exit();
}
}
private void Play () {
// Singletons are icky, but needed to play the sound properly after the menu's destroyed by loadlevel
Music.Instance.audio.PlayOneShot(select);
Application.LoadLevel("Game");
}
private void Feedback () {
Music.Instance.audio.PlayOneShot(select);
// TODO redirect from orbitris.zealgame.com/feedback
Application.OpenURL("https://docs.google.com/a/erosson.org/forms/d/12V9Vz-lRQvMuMg91p_AEgeOHcjgDxPt399t_MIHFVig/viewform");
}
private void Web () {
Music.Instance.audio.PlayOneShot(select);
Application.OpenURL(url);
}
private void Options () {
Music.Instance.audio.PlayOneShot(select);
enabled = false;
optionsMenu.enabled = true;
}
private void Exit() {
Music.Instance.audio.PlayOneShot(cancel);
Application.Quit();
}
}
| mit | C# |
59f3a778cf97eb8009849f94a232c8b9c03f3e4d | Simplify test for build | webprofusion/Certify | src/Certify.Tests/Certify.Core.Tests.Unit/MigrationManagerTests.cs | src/Certify.Tests/Certify.Core.Tests.Unit/MigrationManagerTests.cs | using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Certify.Config.Migration;
using Certify.Core.Management;
using Certify.Management;
using Certify.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Certify.Core.Tests.Unit
{
[TestClass]
public class MigrationManagerTests
{
[TestMethod, Description("Ensure managed cert and bundle exported")]
public async Task TestPerformExport()
{
// setup
var migrationManager = new MigrationManager(new ItemManager(), new CredentialsManager(), new ServerProviderMock());
// export
var export = await migrationManager.PerformExport(new ManagedCertificateFilter { }, new ExportSettings { EncryptionSecret = "secret" }, isPreview: false);
// assert
Assert.AreEqual(1, export.FormatVersion);
Assert.IsNotNull(export.Description);
Assert.IsNotNull(export.SourceName);
Assert.IsNotNull(export.Content);
Assert.IsNotNull(export.Content.ManagedCertificates);
//Assert.IsTrue(export.Content.CertificateFiles.Count > 0);
}
[TestMethod, Description("Ensure bundled certs can be decrypted")]
public async Task TestDecryptExportedCerts()
{
// setup
var migrationManager = new MigrationManager(new ItemManager(), new CredentialsManager(), new ServerProviderMock());
// export
var export = await migrationManager.PerformExport(new ManagedCertificateFilter { }, new ExportSettings { EncryptionSecret = "secret" }, isPreview: false);
var import = await migrationManager.PerformImport(export, new ImportSettings { EncryptionSecret = "secret" }, isPreviewMode: true);
// assert
Assert.IsNotNull(export);
Assert.IsNotNull(import);
//Assert.IsTrue(import.FirstOrDefault(s => s.Key == "CertFiles").Substeps.Count > 0);
}
public string GetMarkdownPreviewFromSteps(List<ActionStep> steps)
{
return "";
}
}
}
| using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Certify.Config.Migration;
using Certify.Core.Management;
using Certify.Management;
using Certify.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Certify.Core.Tests.Unit
{
[TestClass]
public class MigrationManagerTests
{
[TestMethod, Description("Ensure managed cert and bundle exported")]
public async Task TestPerformExport()
{
// setup
var migrationManager = new MigrationManager(new ItemManager(), new CredentialsManager(), new ServerProviderMock());
// export
var export = await migrationManager.PerformExport(new ManagedCertificateFilter { }, new ExportSettings { EncryptionSecret = "secret" }, isPreview: false);
// assert
Assert.AreEqual(1, export.FormatVersion);
Assert.IsNotNull(export.Description);
Assert.IsNotNull(export.SourceName);
Assert.IsNotNull(export.Content);
Assert.IsNotNull(export.Content.ManagedCertificates);
//Assert.IsTrue(export.Content.CertificateFiles.Count > 0);
}
[TestMethod, Description("Ensure bundled certs can be decrypted")]
public async Task TestDecryptExportedCerts()
{
// setup
var migrationManager = new MigrationManager(new ItemManager(), new CredentialsManager(), new ServerProviderMock());
// export
var export = await migrationManager.PerformExport(new ManagedCertificateFilter { }, new ExportSettings { EncryptionSecret = "secret" }, isPreview: false);
var import = await migrationManager.PerformImport(export, new ImportSettings { EncryptionSecret = "secret" }, isPreviewMode: true);
// assert
Assert.IsTrue(export.Content.CertificateFiles.Count > 0);
Assert.IsTrue(import.FirstOrDefault(s => s.Key == "CertFiles").Substeps.Count > 0);
}
public string GetMarkdownPreviewFromSteps(List<ActionStep> steps)
{
return "";
}
}
}
| mit | C# |
b185d91ec335a29b75a6cd3bbf79816ce72f6bd9 | Format CSV values using invariant culture | vendolis/EDDiscovery,jeoffman/EDDiscovery,jeoffman/EDDiscovery,vendolis/EDDiscovery,mwerle/EDDiscovery,jthorpe4/EDDiscovery,jgoode/EDDiscovery,mwerle/EDDiscovery,jgoode/EDDiscovery | EDDiscovery/Export/ExportBase.cs | EDDiscovery/Export/ExportBase.cs | using EDDiscovery.EliteDangerous;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Globalization;
using System.Linq;
using System.Text;
namespace EDDiscovery.Export
{
public enum CSVFormat
{
USA_UK = 0,
EU = 1,
}
public abstract class ExportBase
{
protected string delimiter = ",";
protected CultureInfo formatculture;
private CSVFormat csvformat;
public bool IncludeHeader;
public CSVFormat Csvformat
{
get
{
return csvformat;
}
set
{
csvformat = value;
if (csvformat == CSVFormat.EU)
{
delimiter = ";";
formatculture = new System.Globalization.CultureInfo("sv");
}
else
{
delimiter = ",";
formatculture = new System.Globalization.CultureInfo("en-US");
}
}
}
abstract public bool ToCSV(string filename);
abstract public bool GetData(EDDiscoveryForm _discoveryForm);
protected string MakeValueCsvFriendly(object value)
{
if (value == null) return delimiter;
if (value is INullable && ((INullable)value).IsNull) return delimiter;
if (value is DateTime)
{
if (((DateTime)value).TimeOfDay.TotalSeconds == 0)
return ((DateTime)value).ToString("yyyy-MM-dd") + delimiter; ;
return ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss") + delimiter; ;
}
string output = Convert.ToString(value, CultureInfo.InvariantCulture);
if (output.Contains(",") || output.Contains("\""))
output = '"' + output.Replace("\"", "\"\"") + '"';
return output + delimiter;
}
}
}
| using EDDiscovery.EliteDangerous;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Globalization;
using System.Linq;
using System.Text;
namespace EDDiscovery.Export
{
public enum CSVFormat
{
USA_UK = 0,
EU = 1,
}
public abstract class ExportBase
{
protected string delimiter = ",";
protected CultureInfo formatculture;
private CSVFormat csvformat;
public bool IncludeHeader;
public CSVFormat Csvformat
{
get
{
return csvformat;
}
set
{
csvformat = value;
if (csvformat == CSVFormat.EU)
{
delimiter = ";";
formatculture = new System.Globalization.CultureInfo("sv");
}
else
{
delimiter = ",";
formatculture = new System.Globalization.CultureInfo("en-US");
}
}
}
abstract public bool ToCSV(string filename);
abstract public bool GetData(EDDiscoveryForm _discoveryForm);
protected string MakeValueCsvFriendly(object value)
{
if (value == null) return delimiter;
if (value is INullable && ((INullable)value).IsNull) return delimiter;
if (value is DateTime)
{
if (((DateTime)value).TimeOfDay.TotalSeconds == 0)
return ((DateTime)value).ToString("yyyy-MM-dd") + delimiter; ;
return ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss") + delimiter; ;
}
string output = value.ToString();
if (output.Contains(",") || output.Contains("\""))
output = '"' + output.Replace("\"", "\"\"") + '"';
return output + delimiter;
}
}
}
| apache-2.0 | C# |
a15ba1b29ad5418700cdb5527f5a1046e5c5872e | Implement Point4 methods | turtle-box-games/leaf-csharp | Leaf/Leaf/Types/Point4.cs | Leaf/Leaf/Types/Point4.cs | using System;
namespace Leaf.Types
{
/// <summary>
/// Storage for a four-dimensional point or size.
/// The values are integers.
/// This type has an X, Y, Z, and W value.
/// </summary>
public struct Point4
{
private readonly int _x, _y, _z, _w;
/// <summary>
/// Offset along the x-axis.
/// </summary>
public int X
{
get { return _x; }
}
/// <summary>
/// Offset along the y-axis.
/// </summary>
public int Y
{
get { return _y; }
}
/// <summary>
/// Offset along the z-axis.
/// </summary>
public int Z
{
get { return _z; }
}
/// <summary>
/// Offset along the w-axis.
/// </summary>
public int W
{
get { return _w; }
}
/// <summary>
/// Creates a four-dimensional point setting all properties.
/// </summary>
/// <param name="x">Offset along the x-axis.</param>
/// <param name="y">Offset along the y-axis.</param>
/// <param name="z">Offset along the z-axis.</param>
/// <param name="w">Offset along the w-axis.</param>
public Point4(int x, int y, int z, int w)
{
_x = x;
_y = y;
_z = z;
_w = w;
}
}
}
| using System;
namespace Leaf.Types
{
/// <summary>
/// Storage for a four-dimensional point or size.
/// The values are integers.
/// This type has an X, Y, Z, and W value.
/// </summary>
public struct Point4
{
/// <summary>
/// Offset along the x-axis.
/// </summary>
public int X
{
get { throw new NotImplementedException(); }
}
/// <summary>
/// Offset along the y-axis.
/// </summary>
public int Y
{
get { throw new NotImplementedException(); }
}
/// <summary>
/// Offset along the z-axis.
/// </summary>
public int Z
{
get { throw new NotImplementedException(); }
}
/// <summary>
/// Offset along the w-axis.
/// </summary>
public int W
{
get { throw new NotImplementedException(); }
}
/// <summary>
/// Creates a four-dimensional point setting all properties.
/// </summary>
/// <param name="x">Offset along the x-axis.</param>
/// <param name="y">Offset along the y-axis.</param>
/// <param name="z">Offset along the z-axis.</param>
/// <param name="w">Offset along the w-axis.</param>
public Point4(int x, int y, int z, int w)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
a99c5ebfbcb955d952913587ed1a78578fb96c67 | change type of Id in WateringValue model | MCeddy/IoT-core | IoT-Core/Models/WateringValue.cs | IoT-Core/Models/WateringValue.cs | using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace IoT_Core.Models
{
public class WateringValue
{
public ObjectId Id { get; set; }
[BsonDateTimeOptions(Kind = DateTimeKind.Local)]
public DateTime Date { get; set; }
public ObjectId SensorsId { get; set; }
public int Milliseconds { get; set; }
public WateringValue()
{
Date = DateTime.Now;
}
public WateringValue(SensorValues sensors, int milliseconds)
: this()
{
SensorsId = sensors.Id;
Milliseconds = milliseconds;
}
}
}
| using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace IoT_Core.Models
{
public class WateringValue
{
public int Id { get; set; }
[BsonDateTimeOptions(Kind = DateTimeKind.Local)]
public DateTime Date { get; set; }
public ObjectId SensorsId { get; set; }
public int Milliseconds { get; set; }
public WateringValue()
{
Date = DateTime.Now;
}
public WateringValue(SensorValues sensors, int milliseconds)
: this()
{
SensorsId = sensors.Id;
Milliseconds = milliseconds;
}
}
}
| mit | C# |
c127ede07a54c377348f326f326b7f3db229c216 | mark ProgressIndicator as obsolete | Danghor/MahApps.Metro,Evangelink/MahApps.Metro,MahApps/MahApps.Metro,psinl/MahApps.Metro,batzen/MahApps.Metro,ye4241/MahApps.Metro,chuuddo/MahApps.Metro,jumulr/MahApps.Metro,Jack109/MahApps.Metro,pfattisc/MahApps.Metro,p76984275/MahApps.Metro,xxMUROxx/MahApps.Metro | MahApps.Metro/Controls/ProgressIndicator.xaml.cs | MahApps.Metro/Controls/ProgressIndicator.xaml.cs | using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace MahApps.Metro.Controls
{
[Obsolete("The ProgressIndicator is now obsolete, use the MetroProgressBar or ProgressBar instead!")]
public class WidthPercentageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var percentage = Double.Parse(parameter.ToString(), System.Globalization.CultureInfo.InvariantCulture);
return ((double) value)*percentage;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
[Obsolete("The ProgressIndicator is now obsolete, use the MetroProgressBar or ProgressBar instead!")]
public partial class ProgressIndicator
{
public ProgressIndicator()
{
InitializeComponent();
IsVisibleChanged += (s, e) => ((ProgressIndicator)s).StartStopAnimation();
DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(VisibilityProperty, GetType());
dpd.AddValueChanged(this, (s, e) => ((ProgressIndicator)s).StartStopAnimation());
}
public static readonly DependencyProperty ProgressColorProperty = DependencyProperty.RegisterAttached("ProgressColor", typeof(Brush), typeof(ProgressIndicator), new UIPropertyMetadata(null));
public Brush ProgressColor
{
get { return (Brush)GetValue(ProgressColorProperty); }
set { SetValue(ProgressColorProperty, value); }
}
private void StartStopAnimation()
{
bool shouldAnimate = (Visibility == Visibility.Visible && IsVisible);
Dispatcher.BeginInvoke(new Action(() =>
{
var s = Resources["animate"] as Storyboard;
if (s != null)
{
if (shouldAnimate)
s.Begin();
else
s.Stop();
}
}));
}
}
} | using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace MahApps.Metro.Controls
{
public class WidthPercentageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var percentage = Double.Parse(parameter.ToString(), System.Globalization.CultureInfo.InvariantCulture);
return ((double) value)*percentage;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public partial class ProgressIndicator
{
public ProgressIndicator()
{
InitializeComponent();
IsVisibleChanged += (s, e) => ((ProgressIndicator)s).StartStopAnimation();
DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(VisibilityProperty, GetType());
dpd.AddValueChanged(this, (s, e) => ((ProgressIndicator)s).StartStopAnimation());
}
public static readonly DependencyProperty ProgressColorProperty = DependencyProperty.RegisterAttached("ProgressColor", typeof(Brush), typeof(ProgressIndicator), new UIPropertyMetadata(null));
public Brush ProgressColor
{
get { return (Brush)GetValue(ProgressColorProperty); }
set { SetValue(ProgressColorProperty, value); }
}
private void StartStopAnimation()
{
bool shouldAnimate = (Visibility == Visibility.Visible && IsVisible);
Dispatcher.BeginInvoke(new Action(() =>
{
var s = Resources["animate"] as Storyboard;
if (s != null)
{
if (shouldAnimate)
s.Begin();
else
s.Stop();
}
}));
}
}
} | mit | C# |
54728ae20ab9e72edbf7fcabf7298bdf96f02ba8 | Fix to LineCollider DebugRender() | lucas-miranda/Raccoon | Raccoon/Core/Components/Colliders/LineCollider.cs | Raccoon/Core/Components/Colliders/LineCollider.cs | using System;
namespace Raccoon.Components {
public class LineCollider : Collider {
#region Constructors
public LineCollider(Vector2 from, Vector2 to) : base() {
Initialize(from, to);
}
public LineCollider(Vector2 from, Vector2 to, params string[] tags) : base(tags) {
Initialize(from, to);
}
public LineCollider(Vector2 from, Vector2 to, params Enum[] tags) : base(tags) {
Initialize(from, to);
}
public LineCollider(Vector2 length) : base() {
Initialize(Vector2.Zero, length);
}
public LineCollider(Vector2 length, params string[] tags) : base(tags) {
Initialize(Vector2.Zero, length);
}
public LineCollider(Vector2 length, params Enum[] tags) : base(tags) {
Initialize(Vector2.Zero, length);
}
#endregion Constructors
#region Public Properties
public Vector2 From { get; set; }
public Vector2 To { get; set; }
public Vector2 Distance { get { return To - From; } set { To = value + From; } }
public new Size Size { get { return new Size(Distance); } }
public Line Equation { get { return new Line(From, To); } }
#endregion Public Properties
#region Public Methods
public override void DebugRender() {
Graphics.Primitives.LineShape line = Graphic as Graphics.Primitives.LineShape;
line.From = line.Surface.Transform(Position + From, Entity.Surface);
line.To = line.Surface.Transform(Position + To, Entity.Surface);
Graphic.Render();
}
#endregion Public Methods
#region Private Methods
private void Initialize(Vector2 from, Vector2 to) {
From = from;
To = to;
#if DEBUG
Graphic = new Graphics.Primitives.LineShape(Vector2.Right, Color) {
Surface = Game.Instance.Core.DebugSurface
};
#endif
}
#endregion Private Methods
}
}
| using System;
namespace Raccoon.Components {
public class LineCollider : Collider {
#region Constructors
public LineCollider(Vector2 from, Vector2 to) : base() {
Initialize(from, to);
}
public LineCollider(Vector2 from, Vector2 to, params string[] tags) : base(tags) {
Initialize(from, to);
}
public LineCollider(Vector2 from, Vector2 to, params Enum[] tags) : base(tags) {
Initialize(from, to);
}
public LineCollider(Vector2 length) : base() {
Initialize(Vector2.Zero, length);
}
public LineCollider(Vector2 length, params string[] tags) : base(tags) {
Initialize(Vector2.Zero, length);
}
public LineCollider(Vector2 length, params Enum[] tags) : base(tags) {
Initialize(Vector2.Zero, length);
}
#endregion Constructors
#region Public Properties
public Vector2 From { get; set; }
public Vector2 To { get; set; }
public Vector2 Distance { get { return To - From; } set { To = value + From; } }
public new Size Size { get { return new Size(Distance); } }
public Line Equation { get { return new Line(From, To); } }
#endregion Public Properties
#region Public Methods
public override void DebugRender() {
Graphics.Primitives.LineShape line = Graphic as Graphics.Primitives.LineShape;
Graphic.Origin = Origin * Game.Instance.Scale * Game.Instance.Scene.Camera.Zoom;
line.From = Position + From;
line.To = Position + To;
Graphic.Layer = Entity.Layer + 1;
Graphic.Render();
}
#endregion Public Methods
#region Private Methods
private void Initialize(Vector2 from, Vector2 to) {
From = from;
To = to;
#if DEBUG
Graphic = new Graphics.Primitives.LineShape(From * Game.Instance.Scale * Game.Instance.Scene.Camera.Zoom, To * Game.Instance.Scale * Game.Instance.Scene.Camera.Zoom, Color) {
Surface = Game.Instance.Core.DebugSurface
};
#endif
}
#endregion Private Methods
}
}
| mit | C# |
aa16fead9f368319f6f3ca5e023cd2374010f426 | fix directory not found bug | Jeffiy/NewsCollection | NewsCollection.Service/PluginHelper.cs | NewsCollection.Service/PluginHelper.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using NewLife.Log;
using NewsCollection.Core;
using NewsCollection.Plugin;
namespace NewsCollection.Service
{
public static class PluginHelper
{
public static List<ICollect> FindPlugins()
{
List<ICollect> plugins = new List<ICollect>();
//获取插件目录(Plugins)下所有文件
string[] files = Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Plugins"));
//只需要dll结尾的动态链接库
foreach (string file in files.Where(file => file.ToLower().EndsWith(".dll")))
{
try
{
//载入dll
var callingAssembly = Assembly.LoadFrom(file);
var implementors = typeof (ICollect).GetInstantiableImplementors(callingAssembly);
foreach (
var collect in
implementors.Select(type => (ICollect) Activator.CreateInstance(type))
.Where(collect => collect != null))
{
plugins.Add(collect);
XTrace.WriteLine($"Find Plugin: {file}");
}
}
catch (Exception ex)
{
XTrace.WriteException(ex);
}
}
return plugins;
}
}
} | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using NewLife.Log;
using NewsCollection.Core;
using NewsCollection.Plugin;
namespace NewsCollection.Service
{
public static class PluginHelper
{
public static List<ICollect> FindPlugins()
{
List<ICollect> plugins = new List<ICollect>();
//获取插件目录(Plugins)下所有文件
string[] files = Directory.GetFiles(@"Plugins");
//只需要dll结尾的动态链接库
foreach (string file in files.Where(file => file.ToLower().EndsWith(".dll")))
{
try
{
//载入dll
var callingAssembly = Assembly.LoadFrom(file);
var implementors = typeof(ICollect).GetInstantiableImplementors(callingAssembly);
foreach (var collect in implementors.Select(type => (ICollect) Activator.CreateInstance(type)).Where(collect => collect != null))
{
plugins.Add(collect);
XTrace.WriteLine($"Find Plugin: {file}");
}
}
catch (Exception ex)
{
XTrace.WriteException(ex);
}
}
return plugins;
}
}
} | mit | C# |
92ef500d74b74087515dc5bfef31ff429bd415b8 | Update Skill.cs | NinjaVault/NinjaHive,NinjaVault/NinjaHive | NinjaHive.Contract/DTOs/Skill.cs | NinjaHive.Contract/DTOs/Skill.cs | using System;
using System.ComponentModel.DataAnnotations;
namespace NinjaHive.Contract.DTOs
{
public class Skill
{
[Required]
public Guid Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public int Range { get; set; }
[Required]
public int Radius { get; set; }
[Required]
public int target { get; set; }
[Required]
public int targetCount { get; set; }
[Required]
public bool friendly { get; set; }
}
}
| using System;
using System.ComponentModel.DataAnnotations;
namespace NinjaHive.Contract.DTOs
{
public class Skill
{
public Guid Id { get; set; }
[Required]
public string Name { get; set; }
}
}
| apache-2.0 | C# |
52a3cf90a03a09112576b144c42b59957f394b4c | Change the assembly guid | amoeba/PhatACUtil | Properties/AssemblyInfo.cs | 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("ExamplePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("VirindiPlugins")]
[assembly: AssemblyProduct("ExamplePlugin")]
[assembly: AssemblyCopyright("Copyright © VirindiPlugins 2009")]
[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("a10386fe-fe04-450e-99fe-6025177747a9")]
// 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.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ExamplePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("VirindiPlugins")]
[assembly: AssemblyProduct("ExamplePlugin")]
[assembly: AssemblyCopyright("Copyright © VirindiPlugins 2009")]
[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("dc89d755-5664-4f3a-85b2-262cb833bf26")]
// 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.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
64198b198a97b696cca12a6376585744dfeea557 | add description comment for tags | etishor/Metrics.NET,huoxudong125/Metrics.NET,ntent-ad/Metrics.NET,Recognos/Metrics.NET,mnadel/Metrics.NET,cvent/Metrics.NET,DeonHeyns/Metrics.NET,alhardy/Metrics.NET,ntent-ad/Metrics.NET,MetaG8/Metrics.NET,DeonHeyns/Metrics.NET,Liwoj/Metrics.NET,cvent/Metrics.NET,MetaG8/Metrics.NET,Liwoj/Metrics.NET,mnadel/Metrics.NET,alhardy/Metrics.NET,etishor/Metrics.NET,MetaG8/Metrics.NET,Recognos/Metrics.NET,huoxudong125/Metrics.NET | Src/Metrics/MetricTags.cs | Src/Metrics/MetricTags.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace Metrics
{
/// <summary>
/// Collection of tags that can be attached to a metric.
/// </summary>
public struct MetricTags : Utils.IHideObjectMembers
{
private static readonly string[] empty = new string[0];
public static readonly MetricTags None = new MetricTags(Enumerable.Empty<string>());
private readonly string[] tags;
public MetricTags(params string[] tags)
{
this.tags = tags.ToArray();
}
public MetricTags(IEnumerable<string> tags)
: this(tags.ToArray())
{ }
public MetricTags(string commaSeparatedTags)
: this(ToTags(commaSeparatedTags))
{ }
public string[] Tags
{
get
{
return tags ?? empty;
}
}
private static IEnumerable<string> ToTags(string commaSeparatedTags)
{
if (string.IsNullOrWhiteSpace(commaSeparatedTags))
{
return Enumerable.Empty<string>();
}
return commaSeparatedTags.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(t => t.Trim().ToLowerInvariant());
}
public static implicit operator MetricTags(string commaSeparatedTags)
{
return new MetricTags(commaSeparatedTags);
}
public static implicit operator MetricTags(string[] tags)
{
return new MetricTags(tags);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace Metrics
{
public struct MetricTags : Utils.IHideObjectMembers
{
private static readonly string[] empty = new string[0];
public static readonly MetricTags None = new MetricTags(Enumerable.Empty<string>());
private readonly string[] tags;
public MetricTags(params string[] tags)
{
this.tags = tags.ToArray();
}
public MetricTags(IEnumerable<string> tags)
: this(tags.ToArray())
{ }
public MetricTags(string commaSeparatedTags)
: this(ToTags(commaSeparatedTags))
{ }
public string[] Tags
{
get
{
return tags ?? empty;
}
}
private static IEnumerable<string> ToTags(string commaSeparatedTags)
{
if (string.IsNullOrWhiteSpace(commaSeparatedTags))
{
return Enumerable.Empty<string>();
}
return commaSeparatedTags.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(t => t.Trim().ToLowerInvariant());
}
public static implicit operator MetricTags(string commaSeparatedTags)
{
return new MetricTags(commaSeparatedTags);
}
public static implicit operator MetricTags(string[] tags)
{
return new MetricTags(tags);
}
}
}
| apache-2.0 | C# |
468b41904b9d5e9460f8edbcef36e0c1e96e99a9 | Add Vector3d constructor | yanyiyun/LockstepFramework,erebuswolf/LockstepFramework,SnpM/Lockstep-Framework | Core/Simulation/Math/Vector3d.cs | Core/Simulation/Math/Vector3d.cs | using UnityEngine;
using System.Collections;
namespace Lockstep
{
//THIS IS HAPPENING!!!!
public struct Vector3d
{
[FixedNumber]
public long x;
[FixedNumber]
public long y;
[FixedNumber]
public long z; //Height
public Vector3d (long X, long Y, long Z) {
x = X;
y = Y;
z = Z;
}
public void Normalize () {
long magnitude = FixedMath.Sqrt(x * x + y * y + z * z);
x = x.Div(magnitude);
y = y.Div(magnitude);
z = z.Div(magnitude);
}
public Vector2d ToVector2d () {
return new Vector2d(x,y);
}
public Vector3 ToVector3 () {
return new Vector3(x.ToPreciseFloat(),z.ToPreciseFloat(),y.ToPreciseFloat());
}
}
} | using UnityEngine;
using System.Collections;
namespace Lockstep
{
//THIS IS HAPPENING!!!!
public struct Vector3d
{
[FixedNumber]
public long x;
[FixedNumber]
public long y;
[FixedNumber]
public long z; //Height
public void Normalize () {
long magnitude = FixedMath.Sqrt(x * x + y * y + z * z);
x = x.Div(magnitude);
y = y.Div(magnitude);
z = z.Div(magnitude);
}
public Vector2d ToVector2d () {
return new Vector2d(x,y);
}
public Vector3 ToVector3 () {
return new Vector3(x.ToPreciseFloat(),z.ToPreciseFloat(),y.ToPreciseFloat());
}
}
} | mit | C# |
8ddcdc7598a26e959b95085ff60100c4fa1e9d0f | add ImageFlip extensions | lucas-miranda/Raccoon | Raccoon/Core/Definitions/ImageFlip.cs | Raccoon/Core/Definitions/ImageFlip.cs | using System;
namespace Raccoon {
[Flags]
public enum ImageFlip {
None = 0,
Horizontal = 1,
Vertical = 1 << 1,
Both = Horizontal | Vertical
}
public static class ImageFlipExtensions {
public static bool IsHorizontal(this ImageFlip flip) {
return (flip & ImageFlip.Horizontal) == ImageFlip.Horizontal;
}
public static bool IsVertical(this ImageFlip flip) {
return (flip & ImageFlip.Vertical) == ImageFlip.Vertical;
}
public static bool IsBoth(this ImageFlip flip) {
return flip == ImageFlip.Both;
}
public static bool IsNone(this ImageFlip flip) {
return flip == ImageFlip.None;
}
}
}
| using System;
namespace Raccoon {
[Flags]
public enum ImageFlip {
None = 0,
Horizontal = 1,
Vertical = 1 << 1,
Both = Horizontal | Vertical
}
}
| mit | C# |
c0fe72e5710ed114df564da33a795bb545aafcf7 | Bump version to 0.6.0.0 | kenegozi/kudu,kenegozi/kudu,barnyp/kudu,uQr/kudu,shibayan/kudu,YOTOV-LIMITED/kudu,YOTOV-LIMITED/kudu,badescuga/kudu,duncansmart/kudu,shanselman/kudu,sitereactor/kudu,juoni/kudu,WeAreMammoth/kudu-obsolete,dev-enthusiast/kudu,chrisrpatterson/kudu,shrimpy/kudu,EricSten-MSFT/kudu,uQr/kudu,shibayan/kudu,juvchan/kudu,shrimpy/kudu,WeAreMammoth/kudu-obsolete,projectkudu/kudu,MavenRain/kudu,badescuga/kudu,shanselman/kudu,EricSten-MSFT/kudu,bbauya/kudu,puneet-gupta/kudu,duncansmart/kudu,barnyp/kudu,kali786516/kudu,EricSten-MSFT/kudu,sitereactor/kudu,oliver-feng/kudu,MavenRain/kudu,shanselman/kudu,MavenRain/kudu,duncansmart/kudu,sitereactor/kudu,barnyp/kudu,kali786516/kudu,puneet-gupta/kudu,badescuga/kudu,shibayan/kudu,juoni/kudu,shrimpy/kudu,projectkudu/kudu,EricSten-MSFT/kudu,projectkudu/kudu,chrisrpatterson/kudu,uQr/kudu,chrisrpatterson/kudu,kali786516/kudu,YOTOV-LIMITED/kudu,juvchan/kudu,bbauya/kudu,dev-enthusiast/kudu,juvchan/kudu,bbauya/kudu,oliver-feng/kudu,shibayan/kudu,bbauya/kudu,mauricionr/kudu,shibayan/kudu,puneet-gupta/kudu,mauricionr/kudu,uQr/kudu,barnyp/kudu,mauricionr/kudu,badescuga/kudu,shrimpy/kudu,kenegozi/kudu,kali786516/kudu,EricSten-MSFT/kudu,juvchan/kudu,dev-enthusiast/kudu,juvchan/kudu,puneet-gupta/kudu,duncansmart/kudu,MavenRain/kudu,projectkudu/kudu,oliver-feng/kudu,YOTOV-LIMITED/kudu,sitereactor/kudu,puneet-gupta/kudu,WeAreMammoth/kudu-obsolete,badescuga/kudu,oliver-feng/kudu,kenegozi/kudu,sitereactor/kudu,chrisrpatterson/kudu,projectkudu/kudu,dev-enthusiast/kudu,juoni/kudu,mauricionr/kudu,juoni/kudu | Common/CommonAssemblyInfo.cs | Common/CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyCompany("Outercurve Foundation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyVersion("0.6.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
[assembly: AssemblyCompany("Outercurve Foundation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyVersion("0.5.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| apache-2.0 | C# |
d1d60d6f1ffad2c6090e622a218b388b98cd4ba4 | Update Index.cshtml | TheScienceOfCode/Sibelius.Web,TheScienceOfCode/Sibelius.Web,TheScienceOfCode/Sibelius.Web | Sibelius.Web/Views/Posts/Index.cshtml | Sibelius.Web/Views/Posts/Index.cshtml | @{
ViewBag.bodyclass = "dark-body";
ViewBag.ContainerClass = "body-content";
}
<br />
<div class="row">
<div class="col-xs-12">
<center>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Post show -->
<ins class="adsbygoogle"
style="display:block;max-width:970px;width:100%;"
data-ad-client="ca-pub-1426867402604645"
data-ad-slot="3668114410"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<div class="pubdiv"></div>
</center>
</div>
</div>
<br />
<div class="row">
<div class="col-md-4">
<div id="posts-sections">
@{Html.RenderAction("SectionsMenu", "PostsInternal"); }
</div>
</div>
<div class="col-md-8">
<div id="posts-body">
@if (ViewBag.Post == null)
{
Html.RenderAction((string)ViewBag.Action, (string)ViewBag.Controller, (object[])ViewBag.routeValues);
}
else
{
Html.RenderPartial("~/Views/PostsInternal/_Show.cshtml", (Sibelius.Web.Models.Post)ViewBag.Post);
}
</div>
</div>
</div>
@section Scripts {
<script src="~/Scripts/app/posts.js"></script>
}
| @{
ViewBag.bodyclass = "dark-body";
ViewBag.ContainerClass = "body-content";
}
<br />
<div class="row">
<div class="col-xs-12">
<center>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Post show -->
- <ins class="adsbygoogle"
- style="display:block;max-width:970px;width:100%;"
- data-ad-client="ca-pub-1426867402604645"
- data-ad-slot="3668114410"
- data-ad-format="auto"></ins>
<script>
- (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<div class="pubdiv"></div>
</center>
</div>
</div>
<br />
<div class="row">
<div class="col-md-4">
<div id="posts-sections">
@{Html.RenderAction("SectionsMenu", "PostsInternal"); }
</div>
</div>
<div class="col-md-8">
<div id="posts-body">
@if (ViewBag.Post == null)
{
Html.RenderAction((string)ViewBag.Action, (string)ViewBag.Controller, (object[])ViewBag.routeValues);
}
else
{
Html.RenderPartial("~/Views/PostsInternal/_Show.cshtml", (Sibelius.Web.Models.Post)ViewBag.Post);
}
</div>
</div>
</div>
@section Scripts {
<script src="~/Scripts/app/posts.js"></script>
}
| mit | C# |
5e011d7f8215f13bcf24f42f4b14e34b9acdf09a | Remove unused usings | jkonecki/Streamstone,james-andrewsmith/Streamstone | Source/Streamstone/Extensions.cs | Source/Streamstone/Extensions.cs | using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Streamstone
{
static class TaskExtensions
{
public static ConfiguredTaskAwaitable Really(this Task task)
{
return task.ConfigureAwait(false);
}
public static ConfiguredTaskAwaitable<T> Really<T>(this Task<T> task)
{
return task.ConfigureAwait(false);
}
}
static class ExceptionExtensions
{
public static Exception PreserveStackTrace(this Exception ex)
{
var remoteStackTraceString = typeof(Exception)
.GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic);
Debug.Assert(remoteStackTraceString != null);
remoteStackTraceString.SetValue(ex, ex.StackTrace);
return ex;
}
}
} | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
namespace Streamstone
{
static class TaskExtensions
{
public static ConfiguredTaskAwaitable Really(this Task task)
{
return task.ConfigureAwait(false);
}
public static ConfiguredTaskAwaitable<T> Really<T>(this Task<T> task)
{
return task.ConfigureAwait(false);
}
}
static class ExceptionExtensions
{
public static Exception PreserveStackTrace(this Exception ex)
{
var remoteStackTraceString = typeof(Exception)
.GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic);
Debug.Assert(remoteStackTraceString != null);
remoteStackTraceString.SetValue(ex, ex.StackTrace);
return ex;
}
}
} | apache-2.0 | C# |
637febe9b632c3de7d13ee50460151f69e378857 | Fix The GlowWindow in the taskmanager | Danghor/MahApps.Metro,xxMUROxx/MahApps.Metro,psinl/MahApps.Metro,Jack109/MahApps.Metro,batzen/MahApps.Metro,Evangelink/MahApps.Metro,MahApps/MahApps.Metro,jumulr/MahApps.Metro,p76984275/MahApps.Metro,pfattisc/MahApps.Metro,chuuddo/MahApps.Metro,ye4241/MahApps.Metro | MahApps.Metro/Behaviours/GlowWindowBehavior.cs | MahApps.Metro/Behaviours/GlowWindowBehavior.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Interactivity;
using MahApps.Metro.Controls;
namespace MahApps.Metro.Behaviours
{
public class GlowWindowBehavior : Behavior<Window>
{
private GlowWindow left, right, top, bottom;
protected override void OnAttached()
{
base.OnAttached();
this.AssociatedObject.Loaded += (sender, e) =>
{
left = new GlowWindow(this.AssociatedObject, GlowDirection.Left);
right = new GlowWindow(this.AssociatedObject, GlowDirection.Right);
top = new GlowWindow(this.AssociatedObject, GlowDirection.Top);
bottom = new GlowWindow(this.AssociatedObject, GlowDirection.Bottom);
left.Owner = (MetroWindow)sender;
right.Owner = (MetroWindow)sender;
top.Owner = (MetroWindow)sender;
bottom.Owner = (MetroWindow)sender;
Show();
left.Update();
right.Update();
top.Update();
bottom.Update();
};
this.AssociatedObject.Closed += (sender, args) =>
{
if (left != null) left.Close();
if (right != null) right.Close();
if (top != null) top.Close();
if (bottom != null) bottom.Close();
};
}
public void Hide()
{
left.Hide();
right.Hide();
bottom.Hide();
top.Hide();
}
public void Show()
{
left.Show();
right.Show();
top.Show();
bottom.Show();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Interactivity;
using MahApps.Metro.Controls;
namespace MahApps.Metro.Behaviours
{
public class GlowWindowBehavior : Behavior<Window>
{
private GlowWindow left, right, top, bottom;
protected override void OnAttached()
{
base.OnAttached();
this.AssociatedObject.Loaded += (sender, e) =>
{
left = new GlowWindow(this.AssociatedObject, GlowDirection.Left);
right = new GlowWindow(this.AssociatedObject, GlowDirection.Right);
top = new GlowWindow(this.AssociatedObject, GlowDirection.Top);
bottom = new GlowWindow(this.AssociatedObject, GlowDirection.Bottom);
Show();
left.Update();
right.Update();
top.Update();
bottom.Update();
};
this.AssociatedObject.Closed += (sender, args) =>
{
if (left != null) left.Close();
if (right != null) right.Close();
if (top != null) top.Close();
if (bottom != null) bottom.Close();
};
}
public void Hide()
{
left.Hide();
right.Hide();
bottom.Hide();
top.Hide();
}
public void Show()
{
left.Show();
right.Show();
top.Show();
bottom.Show();
}
}
}
| mit | C# |
6db044cc6c5d7a9fb8ef03c1bcfe5b3d37cc85e1 | Fix broken redirect when restoring game on mobile | siege918/quest,siege918/quest,siege918/quest,textadventures/quest,textadventures/quest,F2Andy/quest,siege918/quest,F2Andy/quest,textadventures/quest,textadventures/quest,F2Andy/quest | WebPlayer/Mobile/Default.aspx.cs | WebPlayer/Mobile/Default.aspx.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
namespace WebPlayer.Mobile
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string origUrl = Request.QueryString.Get("origUrl");
int queryPos = origUrl.IndexOf("Play.aspx?");
if (queryPos != -1)
{
var origUrlValues = HttpUtility.ParseQueryString(origUrl.Substring(origUrl.IndexOf("?")));
string id = origUrlValues.Get("id");
if (!string.IsNullOrEmpty(id))
{
Response.Redirect("Play.aspx?id=" + id);
return;
}
string load = origUrlValues.Get("load");
if (!string.IsNullOrEmpty(load))
{
Response.Redirect("Play.aspx?load=" + load);
return;
}
}
Response.Clear();
Response.StatusCode = 404;
Response.End();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
namespace WebPlayer.Mobile
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string origUrl = Request.QueryString.Get("origUrl");
int queryPos = origUrl.IndexOf("Play.aspx?");
if (queryPos != -1)
{
var origUrlValues = HttpUtility.ParseQueryString(origUrl.Substring(origUrl.IndexOf("?")));
string id = origUrlValues.Get("id");
Response.Redirect("Play.aspx?id=" + id);
return;
}
Response.Clear();
Response.StatusCode = 404;
Response.End();
}
}
} | mit | C# |
574e1b9a441a69d6b346c9ba8cbe55045d1713bf | Make units face camera, not match rotation | JapaMala/armok-vision,JapaMala/armok-vision,JapaMala/armok-vision | Assets/MapGen/Units/CameraFacing.cs | Assets/MapGen/Units/CameraFacing.cs | // CameraFacing.cs
// original by Neil Carter (NCarter)
// modified by Hayden Scott-Baron (Dock) - http://starfruitgames.com
// allows specified orientation axis
using UnityEngine;
using System.Collections;
public class CameraFacing : MonoBehaviour
{
Camera referenceCamera;
public enum Axis { up, down, left, right, forward, back };
public bool reverseFace = false;
public bool stayVertical = false;
public Axis axis = Axis.up;
// return a direction based upon chosen axis
public Vector3 GetAxis(Axis refAxis)
{
switch (refAxis)
{
case Axis.down:
return Vector3.down;
case Axis.forward:
return Vector3.forward;
case Axis.back:
return Vector3.back;
case Axis.left:
return Vector3.left;
case Axis.right:
return Vector3.right;
}
// default is Vector3.up
return Vector3.up;
}
void Awake()
{
// if no camera referenced, grab the main camera
if (!referenceCamera)
referenceCamera = Camera.main;
}
void Update()
{
//// rotates the object relative to the camera
//Vector3 targetPos = transform.position + referenceCamera.transform.rotation * (reverseFace ? Vector3.forward : Vector3.back);
//Vector3 targetOrientation = referenceCamera.transform.rotation * GetAxis(axis);
//if (stayVertical)
// targetPos = new Vector3(transform.position.x, transform.position.y, targetPos.z);
////transform.LookAt(targetPos, targetOrientation);
// look at players position with quaternion magic
// code above matches camera rotation, this is position based
transform.rotation = Quaternion.LookRotation(transform.position - referenceCamera.transform.position);
}
} | // CameraFacing.cs
// original by Neil Carter (NCarter)
// modified by Hayden Scott-Baron (Dock) - http://starfruitgames.com
// allows specified orientation axis
using UnityEngine;
using System.Collections;
public class CameraFacing : MonoBehaviour
{
Camera referenceCamera;
public enum Axis { up, down, left, right, forward, back };
public bool reverseFace = false;
public bool stayVertical = false;
public Axis axis = Axis.up;
// return a direction based upon chosen axis
public Vector3 GetAxis(Axis refAxis)
{
switch (refAxis)
{
case Axis.down:
return Vector3.down;
case Axis.forward:
return Vector3.forward;
case Axis.back:
return Vector3.back;
case Axis.left:
return Vector3.left;
case Axis.right:
return Vector3.right;
}
// default is Vector3.up
return Vector3.up;
}
void Awake()
{
// if no camera referenced, grab the main camera
if (!referenceCamera)
referenceCamera = Camera.main;
}
void Update()
{
// rotates the object relative to the camera
Vector3 targetPos = transform.position + referenceCamera.transform.rotation * (reverseFace ? Vector3.forward : Vector3.back);
Vector3 targetOrientation = referenceCamera.transform.rotation * GetAxis(axis);
if (stayVertical)
targetPos = new Vector3(targetPos.x, transform.position.y, targetPos.z);
transform.LookAt(targetPos, targetOrientation);
}
} | mit | C# |
cee73062a70a1a3421f685cfbbbf20287c224172 | Enable all warnings in 'MismatchedFileNameHighlightingTests' and also fix the test bug for the partial class test (missing aux file) | ulrichb/Roflcopter,ulrichb/Roflcopter | Src/Roflcopter.Plugin.Tests/MismatchedFileNames/MismatchedFileNameHighlightingTests.cs | Src/Roflcopter.Plugin.Tests/MismatchedFileNames/MismatchedFileNameHighlightingTests.cs | using System.IO;
using System.Linq;
using JetBrains.Annotations;
using JetBrains.ReSharper.FeaturesTestFramework.Daemon;
using JetBrains.ReSharper.TestFramework;
using NUnit.Framework;
namespace Roflcopter.Plugin.Tests.MismatchedFileNames
{
[TestFixture]
[TestNetFramework4]
public class MismatchedFileNameHighlightingTests : CSharpHighlightingTestBase
{
protected override string RelativeTestDataPath => Path.Combine(base.RelativeTestDataPath, "..");
[Test]
public void SingleClass() => DoNamedTest();
[Test]
public void SingleClassWithWrongName() => DoNamedTest();
[Test]
public void MultipleClasses() => DoNamedTest();
[Test]
public void ClassAndEnum() => DoNamedTest();
[Test]
public void ClassAndInterfacePair() => DoNamedTest();
[Test]
public void ClassAndInterfacePairWithWrongName() => DoNamedTest();
[Test]
public void InterfaceAndClassPair() => DoNamedTest();
[Test]
public void InterfaceAndClassPairWithWrongName() => DoNamedTest();
[Test]
public void PartialClass_partial() => DoNamedTest("PartialClass.InvalidPostfix.cs");
[Test]
public void PartialClass_InvalidPostfix() => DoNamedTest("PartialClass.partial.cs");
protected override void DoTestSolution([NotNull] params string[] fileSet) =>
base.DoTestSolution(fileSet.Select(x => x.Replace('_', '.')).ToArray());
}
}
| using System.IO;
using JetBrains.Annotations;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.FeaturesTestFramework.Daemon;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.TestFramework;
using NUnit.Framework;
using Roflcopter.Plugin.MismatchedFileNames;
namespace Roflcopter.Plugin.Tests.MismatchedFileNames
{
[TestFixture]
[TestNetFramework4]
public class MismatchedFileNameHighlightingTests : CSharpHighlightingTestBase
{
protected override string RelativeTestDataPath => Path.Combine(base.RelativeTestDataPath, "..");
protected override bool HighlightingPredicate([NotNull] IHighlighting highlighting, [CanBeNull] IPsiSourceFile _) =>
highlighting is MismatchedFileNameHighlighting;
[Test]
public void SingleClass() => DoNamedTest();
[Test]
public void SingleClassWithWrongName() => DoNamedTest();
[Test]
public void MultipleClasses() => DoNamedTest();
[Test]
public void ClassAndEnum() => DoNamedTest();
[Test]
public void ClassAndInterfacePair() => DoNamedTest();
[Test]
public void ClassAndInterfacePairWithWrongName() => DoNamedTest();
[Test]
public void InterfaceAndClassPair() => DoNamedTest();
[Test]
public void InterfaceAndClassPairWithWrongName() => DoNamedTest();
[Test]
public void PartialClass_partial() => DoTestSolution(TestName.Replace('_', '.'));
[Test]
public void PartialClass_InvalidPostfix() => DoTestSolution(TestName.Replace('_', '.'));
}
}
| mit | C# |
1e97818892353741ca6b6d93813afcd6e3034452 | Update EnumerableExtensions.cs | keith-hall/Extensions,keith-hall/Extensions | src/EnumerableExtensions.cs | src/EnumerableExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
public static class EnumerableExtensions
{
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng)
{ // http://stackoverflow.com/questions/1287567/is-using-random-and-orderby-a-good-shuffle-algorithm
T[] elements = source.ToArray();
for (int i = elements.Length - 1; i >= 0; i--)
{
// Swap element "i" with a random earlier element it (or itself)
// ... except we don't really need to swap it fully, as we can
// return it immediately, and afterwards it's irrelevant.
int swapIndex = rng.Next(i + 1);
yield return elements[swapIndex];
elements[swapIndex] = elements[i];
}
}
public static bool CountExceeds<T>(this IEnumerable<T> enumerable, int count)
{
return enumerable.Take(count + 1).Count() > count;
}
}
| public static EnumerableExtensions {
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng)
{ // http://stackoverflow.com/questions/1287567/is-using-random-and-orderby-a-good-shuffle-algorithm
T[] elements = source.ToArray();
for (int i = elements.Length - 1; i >= 0; i--) {
// Swap element "i" with a random earlier element it (or itself)
// ... except we don't really need to swap it fully, as we can
// return it immediately, and afterwards it's irrelevant.
int swapIndex = rng.Next(i + 1);
yield return elements[swapIndex];
elements[swapIndex] = elements[i];
}
}
}
public static bool CountExceeds<T> (this IEnumerable<T> enumerable, int count) {
return enumerable.Take(count + 1).Count() > count;
}
}
| apache-2.0 | C# |
1bc9f6129b932d2b1f6022789088b519782c44a8 | add dummy text to admin nav | momcms/MoM,momcms/MoM | MoM.Web/Views/Pages/Admin.cshtml | MoM.Web/Views/Pages/Admin.cshtml | @{
ViewBag.Title = "Administration";
}
<mom-admin>
<div class="container-fluid">
<div class="row">
<div class="col-sm-2 col-md-1 admin-sidebar">
<ul class="nav nav-sidebar">
<li><a href="#" title="Parent"><i class="fa fa-level-up fa-2x"></i></a></li>
<li class="active"><a href="#" title="Content"><i class="fa fa-sitemap fa-2x"></i><p>Content</p></a></li>
<li><a href="#" title="Users"><i class="fa fa-users fa-2x"></i><p>Security</p></a></li>
<li><a href="#" title="Mail and SMS"><i class="fa fa-envelope fa-2x"></i><p>Message</p></a></li>
<li><a href="#" title="Dashboards and Reports"><i class="fa fa-line-chart fa-2x"></i><p>Reports</p></a></li>
<li><a href="#" title="Modules"><i class="fa fa-cubes fa-2x"></i><p>Modules</p></a></li>
<li><a href="#" title="Settings"><i class="fa fa-cogs fa-2x"></i><p>Settings</p></a></li>
</ul>
</div>
<div class="col-sm-10 col-sm-offset-2 col-md-11 col-md-offset-1 admin-main">
<router-outlet></router-outlet>
</div>
</div>
</div>
</mom-admin> | @{
ViewBag.Title = "Administration";
}
<mom-admin>
<div class="container-fluid">
<div class="row">
<div class="col-sm-2 col-md-1 admin-sidebar">
<ul class="nav nav-sidebar">
<li><a href="#" title="Users"><i class="fa fa-level-up fa-2x"></i></a></li>
<li class="active"><a href="#" title="Content"><i class="fa fa-sitemap fa-2x"></i></a></li>
<li><a href="#" title="Users"><i class="fa fa-users fa-2x"></i></a></li>
<li><a href="#" title="Mail and SMS"><i class="fa fa-envelope fa-2x"></i></a></li>
<li><a href="#" title="Dashboards and Reports"><i class="fa fa-line-chart fa-2x"></i></a></li>
<li><a href="#" title="Modules"><i class="fa fa-cubes fa-2x"></i></a></li>
<li><a href="#" title="Settings"><i class="fa fa-cogs fa-2x"></i></a></li>
</ul>
</div>
<div class="col-sm-10 col-sm-offset-2 col-md-11 col-md-offset-1 admin-main">
<router-outlet></router-outlet>
</div>
</div>
</div>
</mom-admin> | mit | C# |
6c312fa18015053b0f0ab57c4590bd8c8a59817d | fix logging bug divide by zero | NicolasDorier/NBitcoin.Indexer,bijakatlykkex/NBitcoin.Indexer,MetacoSA/NBitcoin.Indexer | NBitcoin.Indexer/IndexerTrace.cs | NBitcoin.Indexer/IndexerTrace.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NBitcoin.Indexer
{
class IndexerTrace
{
static TraceSource _Trace = new TraceSource("NBitcoin.Indexer");
internal static void ErrorWhileImportingBlockToAzure(uint256 id, Exception ex)
{
_Trace.TraceEvent(TraceEventType.Error, 0, "Error while importing " + id + " in azure blob : " + Utils.ExceptionToString(ex));
}
internal static void BlockAlreadyUploaded()
{
_Trace.TraceInformation("Block already uploaded");
}
internal static void BlockUploaded(TimeSpan time, int bytes)
{
if(time.TotalSeconds == 0.0)
time = TimeSpan.FromMilliseconds(10);
double speed = (int)((double)bytes / 1024.0) / time.TotalSeconds;
_Trace.TraceInformation("Block uploaded successfully (" + speed.ToString() + " KB/S)");
}
internal static TraceCorrelation NewCorrelation(string activityName)
{
return new TraceCorrelation(_Trace, activityName);
}
internal static void StartingImportAt(DiskBlockPos lastPosition)
{
_Trace.TraceInformation("Starting import at position " + lastPosition);
}
internal static void PositionSaved(DiskBlockPos diskBlockPos)
{
_Trace.TraceInformation("New starting import position : " + diskBlockPos.ToString());
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NBitcoin.Indexer
{
class IndexerTrace
{
static TraceSource _Trace = new TraceSource("NBitcoin.Indexer");
internal static void ErrorWhileImportingBlockToAzure(uint256 id, Exception ex)
{
_Trace.TraceEvent(TraceEventType.Error, 0, "Error while importing " + id + " in azure blob : " + Utils.ExceptionToString(ex));
}
internal static void BlockAlreadyUploaded()
{
_Trace.TraceInformation("Block already uploaded");
}
internal static void BlockUploaded(TimeSpan time, int bytes)
{
double speed = (int)((double)bytes / 1024.0) / time.Seconds;
_Trace.TraceInformation("Block uploaded successfully (" + speed.ToString() + " KB/S)");
}
internal static TraceCorrelation NewCorrelation(string activityName)
{
return new TraceCorrelation(_Trace, activityName);
}
internal static void StartingImportAt(DiskBlockPos lastPosition)
{
_Trace.TraceInformation("Starting import at position " + lastPosition);
}
internal static void PositionSaved(DiskBlockPos diskBlockPos)
{
_Trace.TraceInformation("New starting import position : " + diskBlockPos.ToString());
}
}
}
| mit | C# |
46d91339c56838057f2fd5c2d709aed83ee4e1ae | Update the year 2016 in the AssemblyInfo | noelpush/noelpush | NPush/Properties/AssemblyInfo.cs | NPush/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("NoelPush")]
[assembly: AssemblyDescription("Partagez vos screens via NoelShack.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoelPush")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
//Pour commencer à générer des applications localisables, définissez
//<UICulture>CultureYouAreCodingWith</UICulture> dans votre fichier .csproj
//dans <PropertyGroup>. Par exemple, si vous utilisez le français
//dans vos fichiers sources, définissez <UICulture> à fr-FR. Puis, supprimez les marques de commentaire de
//l'attribut NeutralResourceLanguage ci-dessous. Mettez à jour "fr-FR" dans
//la ligne ci-après pour qu'elle corresponde au paramètre UICulture du fichier projet.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //où se trouvent les dictionnaires de ressources spécifiques à un thème
//(utilisé si une ressource est introuvable dans la page,
// ou dictionnaires de ressources de l'application)
ResourceDictionaryLocation.SourceAssembly //où se trouve le dictionnaire de ressources générique
//(utilisé si une ressource est introuvable dans la page,
// dans l'application ou dans l'un des dictionnaires de ressources spécifiques à un thème)
)]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("13.0.0.0")]
[assembly: AssemblyFileVersion("13.0.0.0")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] | using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("NoelPush")]
[assembly: AssemblyDescription("Partagez vos screens via NoelShack.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoelPush")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
//Pour commencer à générer des applications localisables, définissez
//<UICulture>CultureYouAreCodingWith</UICulture> dans votre fichier .csproj
//dans <PropertyGroup>. Par exemple, si vous utilisez le français
//dans vos fichiers sources, définissez <UICulture> à fr-FR. Puis, supprimez les marques de commentaire de
//l'attribut NeutralResourceLanguage ci-dessous. Mettez à jour "fr-FR" dans
//la ligne ci-après pour qu'elle corresponde au paramètre UICulture du fichier projet.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //où se trouvent les dictionnaires de ressources spécifiques à un thème
//(utilisé si une ressource est introuvable dans la page,
// ou dictionnaires de ressources de l'application)
ResourceDictionaryLocation.SourceAssembly //où se trouve le dictionnaire de ressources générique
//(utilisé si une ressource est introuvable dans la page,
// dans l'application ou dans l'un des dictionnaires de ressources spécifiques à un thème)
)]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("13.0.0.0")]
[assembly: AssemblyFileVersion("13.0.0.0")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] | mit | C# |
b7308f5ed479623e67150e9886450436617410d3 | Fix storyboard videos being offset incorrectly | NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,NeoAdonis/osu,EVAST9919/osu,ppy/osu,smoogipooo/osu,peppy/osu,peppy/osu,peppy/osu-new,smoogipoo/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu | osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs | osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Video;
using osu.Game.Beatmaps;
namespace osu.Game.Storyboards.Drawables
{
public class DrawableStoryboardVideo : CompositeDrawable
{
public readonly StoryboardVideo Video;
private Video video;
public override bool RemoveWhenNotAlive => false;
public DrawableStoryboardVideo(StoryboardVideo video)
{
Video = video;
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader(true)]
private void load(IBindable<WorkingBeatmap> beatmap, TextureStore textureStore)
{
var path = beatmap.Value.BeatmapSetInfo?.Files?.Find(f => f.Filename.Equals(Video.Path, StringComparison.OrdinalIgnoreCase))?.FileInfo.StoragePath;
if (path == null)
return;
var stream = textureStore.GetStream(path);
if (stream == null)
return;
InternalChild = video = new Video(stream, false)
{
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0,
};
}
protected override void LoadComplete()
{
base.LoadComplete();
if (video == null) return;
video.PlaybackPosition = Clock.CurrentTime - Video.StartTime;
using (video.BeginAbsoluteSequence(0))
video.FadeIn(500);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Video;
using osu.Game.Beatmaps;
namespace osu.Game.Storyboards.Drawables
{
public class DrawableStoryboardVideo : CompositeDrawable
{
public readonly StoryboardVideo Video;
private Video video;
public override bool RemoveWhenNotAlive => false;
public DrawableStoryboardVideo(StoryboardVideo video)
{
Video = video;
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader(true)]
private void load(IBindable<WorkingBeatmap> beatmap, TextureStore textureStore)
{
var path = beatmap.Value.BeatmapSetInfo?.Files?.Find(f => f.Filename.Equals(Video.Path, StringComparison.OrdinalIgnoreCase))?.FileInfo.StoragePath;
if (path == null)
return;
var stream = textureStore.GetStream(path);
if (stream == null)
return;
InternalChild = video = new Video(stream, false)
{
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0,
PlaybackPosition = Video.StartTime
};
}
protected override void LoadComplete()
{
base.LoadComplete();
if (video == null) return;
using (video.BeginAbsoluteSequence(0))
video.FadeIn(500);
}
}
}
| mit | C# |
ecf8f05331c7cbb385fa0cfdd80c3c013edf8631 | Revert "Revert "LoginTest is completed"" | oleksandrp1/SeleniumTasks | SeleniumTasksProject1.1/SeleniumTasksProject1.1/InternetExplorer.cs | SeleniumTasksProject1.1/SeleniumTasksProject1.1/InternetExplorer.cs | using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using NUnit.Framework;
namespace SeleniumTasksProject1._1
{
[TestFixture]
public class InternetExplorer
{
private IWebDriver driver;
private WebDriverWait wait;
[SetUp]
public void start()
{
driver = new InternetExplorerDriver();
wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
}
[Test]
public void LoginTestInInternetExplorer()
{
driver.Url = "http://localhost:8082/litecart/admin/";
driver.FindElement(By.Name("username")).SendKeys("admin");
driver.FindElement(By.Name("password")).SendKeys("admin");
driver.FindElement(By.Name("login")).Click();
//wait.Until(ExpectedConditions.TitleIs("My Store"));
}
[TearDown]
public void stop()
{
driver.Quit();
driver = null;
}
}
}
| using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using NUnit.Framework;
namespace SeleniumTasksProject1._1
{
[TestFixture]
public class InternetExplorer
{
private IWebDriver driver;
private WebDriverWait wait;
[SetUp]
public void start()
{
driver = new InternetExplorerDriver();
wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
}
[Test]
public void LoginTestInInternetExplorer()
{
driver.Url = "http://localhost:8082/litecart/admin/";
}
[TearDown]
public void stop()
{
driver.Quit();
driver = null;
}
}
}
| apache-2.0 | C# |
78350ad28fcb51e8d59cae63e039bf71e21c63d5 | change member visibility | runceel/ReactiveProperty,runceel/ReactiveProperty,runceel/ReactiveProperty | Source/ReactiveProperty.NETStandard/Internals/PropertyObservable.cs | Source/ReactiveProperty.NETStandard/Internals/PropertyObservable.cs | using System;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reactive.Subjects;
namespace Reactive.Bindings.Internals
{
internal sealed class PropertyObservable<TProperty> : IObservable<TProperty>, IDisposable
{
private PropertyPathNode RootNode { get; set; }
internal void SetRootNode(PropertyPathNode rootNode)
{
RootNode?.SetCallback(null);
rootNode?.SetCallback(RaisePropertyChanged);
RootNode = rootNode;
}
public TProperty GetPropertyPathValue()
{
var value = RootNode?.GetPropertyPathValue();
return value != null ? (TProperty)value : default;
}
public string Path => RootNode?.Path;
public bool SetPropertyPathValue(TProperty value) => RootNode?.SetPropertyPathValue(value) ?? false;
public void SetSource(INotifyPropertyChanged source) => RootNode?.UpdateSource(source);
private void RaisePropertyChanged() => _propertyChangedSource.OnNext(GetPropertyPathValue());
private readonly Subject<TProperty> _propertyChangedSource = new Subject<TProperty>();
public void Dispose()
{
_propertyChangedSource.Dispose();
RootNode?.Dispose();
RootNode = null;
}
public IDisposable Subscribe(IObserver<TProperty> observer) => _propertyChangedSource.Subscribe(observer);
}
internal static class PropertyObservable
{
public static PropertyObservable<TProperty> CreateFromPropertySelector<TSubject, TProperty>(TSubject subject, Expression<Func<TSubject, TProperty>> propertySelector)
where TSubject : INotifyPropertyChanged
{
if (!(propertySelector.Body is MemberExpression current))
{
throw new ArgumentException();
}
var result = new PropertyObservable<TProperty>();
result.SetRootNode(PropertyPathNode.CreateFromPropertySelector(propertySelector));
result.SetSource(subject);
return result;
}
}
}
| using System;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reactive.Subjects;
namespace Reactive.Bindings.Internals
{
internal sealed class PropertyObservable<TProperty> : IObservable<TProperty>, IDisposable
{
private PropertyPathNode RootNode { get; set; }
internal void SetRootNode(PropertyPathNode rootNode)
{
RootNode?.SetCallback(null);
rootNode?.SetCallback(RaisePropertyChanged);
RootNode = rootNode;
}
public TProperty GetPropertyPathValue()
{
var value = RootNode?.GetPropertyPathValue();
return value != null ? (TProperty)value : default;
}
public string Path => RootNode?.Path;
public bool SetPropertyPathValue(TProperty value) => RootNode?.SetPropertyPathValue(value) ?? false;
public void SetSource(INotifyPropertyChanged source) => RootNode?.UpdateSource(source);
internal void RaisePropertyChanged() => _propertyChangedSource.OnNext(GetPropertyPathValue());
private readonly Subject<TProperty> _propertyChangedSource = new Subject<TProperty>();
public void Dispose()
{
_propertyChangedSource.Dispose();
RootNode?.Dispose();
RootNode = null;
}
public IDisposable Subscribe(IObserver<TProperty> observer) => _propertyChangedSource.Subscribe(observer);
}
internal static class PropertyObservable
{
public static PropertyObservable<TProperty> CreateFromPropertySelector<TSubject, TProperty>(TSubject subject, Expression<Func<TSubject, TProperty>> propertySelector)
where TSubject : INotifyPropertyChanged
{
if (!(propertySelector.Body is MemberExpression current))
{
throw new ArgumentException();
}
var result = new PropertyObservable<TProperty>();
result.SetRootNode(PropertyPathNode.CreateFromPropertySelector(propertySelector));
result.SetSource(subject);
return result;
}
}
}
| mit | C# |
e0187ecf7a3bc913b757767344065226771d5ea3 | Fix for disposing DataContext object. | cube-soft/Cube.Core,cube-soft/Cube.Core | Libraries/Triggers/DisposeAction.cs | Libraries/Triggers/DisposeAction.cs | /* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, 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.
//
/* ------------------------------------------------------------------------- */
using System;
using System.Windows;
using System.Windows.Interactivity;
namespace Cube.Xui.Behaviors
{
/* --------------------------------------------------------------------- */
///
/// DisposeAction
///
/// <summary>
/// DataContext の開放処理を実行する TriggerAction です。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class DisposeAction : TriggerAction<FrameworkElement>
{
/* ----------------------------------------------------------------- */
///
/// Invoke
///
/// <summary>
/// 処理を実行します。
/// </summary>
///
/* ----------------------------------------------------------------- */
protected override void Invoke(object notused)
{
var dc = AssociatedObject.DataContext as IDisposable;
AssociatedObject.DataContext = null;
dc?.Dispose();
}
}
}
| /* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, 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.
//
/* ------------------------------------------------------------------------- */
using System;
using System.Windows;
using System.Windows.Interactivity;
namespace Cube.Xui.Behaviors
{
/* --------------------------------------------------------------------- */
///
/// DisposeAction
///
/// <summary>
/// DataContext の開放処理を実行する TriggerAction です。
/// </summary>
///
/* --------------------------------------------------------------------- */
public class DisposeAction : TriggerAction<FrameworkElement>
{
/* ----------------------------------------------------------------- */
///
/// Invoke
///
/// <summary>
/// 処理を実行します。
/// </summary>
///
/* ----------------------------------------------------------------- */
protected override void Invoke(object notused)
{
if (AssociatedObject.DataContext is IDisposable dc) dc.Dispose();
AssociatedObject.DataContext = null;
}
}
}
| apache-2.0 | C# |
fd70b866560b660726bfca8855599e13ac9dd9a0 | Add missing field to FinishedWarp | HelloKitty/Booma.Proxy | src/Booma.Proxy.Packets.BlockServer/Payloads/Client/Subpayloads/Command60/Sub60FinishedWarpingBurstingPayload.cs | src/Booma.Proxy.Packets.BlockServer/Payloads/Client/Subpayloads/Command60/Sub60FinishedWarpingBurstingPayload.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreecraftCore.Serializer;
namespace Booma.Proxy
{
/// <summary>
/// Payload that tells the server we've finsihed loading/bursting/warping.
/// We should have sent a warp request to the server before this so it should know where we
/// were going.
/// </summary>
[WireDataContract]
[SubCommand60Client(SubCommand60OperationCode.EnterFreshlyWrappedZoneCommand)]
public sealed class Sub60FinishedWarpingBurstingPayload : BlockNetworkCommandEventClientPayload
{
//Packet is empty. Just tells the server we bursted/warped finished.
//TODO: Is this client id?
[WireMember(1)]
private short unk { get; }
public Sub60FinishedWarpingBurstingPayload()
{
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreecraftCore.Serializer;
namespace Booma.Proxy
{
/// <summary>
/// Payload that tells the server we've finsihed loading/bursting/warping.
/// We should have sent a warp request to the server before this so it should know where we
/// were going.
/// </summary>
[WireDataContract]
[SubCommand60Client(SubCommand60OperationCode.EnterFreshlyWrappedZoneCommand)]
public sealed class Sub60FinishedWarpingBurstingPayload : BlockNetworkCommandEventClientPayload
{
//Packet is empty. Just tells the server we bursted/warped finished.
public Sub60FinishedWarpingBurstingPayload()
{
}
}
}
| agpl-3.0 | C# |
26f3a32cd61ba56f4dff1acc38acc67f67782616 | Increase project version number to 0.8 | YevgeniyShunevych/Atata,atata-framework/atata,atata-framework/atata,YevgeniyShunevych/Atata | src/CommonAssemblyInfo.cs | src/CommonAssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Yevgeniy Shunevych")]
[assembly: AssemblyProduct("Atata")]
[assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2016")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.8.0.0")]
[assembly: AssemblyFileVersion("0.8.0.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Yevgeniy Shunevych")]
[assembly: AssemblyProduct("Atata")]
[assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2016")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.7.0.0")]
[assembly: AssemblyFileVersion("0.7.0.0")]
| apache-2.0 | C# |
d8af70e8914c587cdc35dd7d523539ee2ab1a12a | Add DeleteQueryHandlerAsyncShould and one unit test | bcbeatty/allReady,chinwobble/allReady,HamidMosalla/allReady,shanecharles/allReady,HTBox/allReady,BillWagner/allReady,gitChuckD/allReady,GProulx/allReady,mipre100/allReady,mgmccarthy/allReady,MisterJames/allReady,colhountech/allReady,mgmccarthy/allReady,dpaquette/allReady,anobleperson/allReady,colhountech/allReady,VishalMadhvani/allReady,c0g1t8/allReady,dpaquette/allReady,HTBox/allReady,colhountech/allReady,c0g1t8/allReady,bcbeatty/allReady,HamidMosalla/allReady,pranap/allReady,JowenMei/allReady,enderdickerson/allReady,shanecharles/allReady,gitChuckD/allReady,bcbeatty/allReady,c0g1t8/allReady,enderdickerson/allReady,dpaquette/allReady,anobleperson/allReady,binaryjanitor/allReady,MisterJames/allReady,mgmccarthy/allReady,chinwobble/allReady,mipre100/allReady,JowenMei/allReady,chinwobble/allReady,forestcheng/allReady,enderdickerson/allReady,shanecharles/allReady,HTBox/allReady,MisterJames/allReady,binaryjanitor/allReady,colhountech/allReady,jonatwabash/allReady,HTBox/allReady,stevejgordon/allReady,forestcheng/allReady,forestcheng/allReady,gitChuckD/allReady,stevejgordon/allReady,pranap/allReady,stevejgordon/allReady,jonatwabash/allReady,arst/allReady,mgmccarthy/allReady,pranap/allReady,JowenMei/allReady,binaryjanitor/allReady,anobleperson/allReady,BillWagner/allReady,MisterJames/allReady,mipre100/allReady,binaryjanitor/allReady,bcbeatty/allReady,stevejgordon/allReady,forestcheng/allReady,jonatwabash/allReady,HamidMosalla/allReady,VishalMadhvani/allReady,mipre100/allReady,BillWagner/allReady,dpaquette/allReady,VishalMadhvani/allReady,JowenMei/allReady,VishalMadhvani/allReady,GProulx/allReady,jonatwabash/allReady,gitChuckD/allReady,GProulx/allReady,enderdickerson/allReady,arst/allReady,pranap/allReady,chinwobble/allReady,arst/allReady,c0g1t8/allReady,HamidMosalla/allReady,GProulx/allReady,arst/allReady,shanecharles/allReady,BillWagner/allReady,anobleperson/allReady | AllReadyApp/Web-App/AllReady.UnitTest/Areas/Admin/Features/Campaigns/DeleteQueryHandlerAsyncShould.cs | AllReadyApp/Web-App/AllReady.UnitTest/Areas/Admin/Features/Campaigns/DeleteQueryHandlerAsyncShould.cs | using System.Threading.Tasks;
using AllReady.Areas.Admin.Features.Campaigns;
using AllReady.Areas.Admin.ViewModels.Campaign;
using AllReady.Models;
using Xunit;
namespace AllReady.UnitTest.Areas.Admin.Features.Campaigns
{
public class DeleteQueryHandlerAsyncShould : InMemoryContextTest
{
[Fact]
public async Task ReturnTheCorrectVieModel()
{
const int campaignId = 1;
Context.Campaigns.Add(new Campaign { Id = campaignId, ManagingOrganization = new Organization() });
Context.SaveChanges();
var message = new DeleteQueryAsync { CampaignId = campaignId };
var sut = new DeleteQueryHandlerAsync(Context);
var result = await sut.Handle(message);
Assert.IsType<DeleteViewModel>(result);
}
[Fact]
public void ReturnTheCorrectData()
{
}
}
}
| using Xunit;
namespace AllReady.UnitTest.Areas.Admin.Features.Campaigns
{
public class DeleteQueryHandlerAsyncShould
{
[Fact]
public void ReturnTheCorrectVieModel()
{
}
[Fact]
public void ReturnTheCorrectData()
{
}
}
}
| mit | C# |
1e53f5f9aafc0836a34176baead285b3d0e0e409 | Fix the Connect.Initialize typo | getconnect/connect-net-sdk,getconnect/connect-net | src/ConnectSdk/Connect.cs | src/ConnectSdk/Connect.cs | using System.Collections.Generic;
using System.Threading.Tasks;
using ConnectSdk.Config;
namespace ConnectSdk
{
public static class Connect
{
private static IConnect _connect;
public static void Initialize(IConfiguration configuration)
{
_connect = new ConnectClient(configuration);
}
public static void Initialize(IConnect connect)
{
_connect = connect;
}
public static Task<EventPushResponse> Push(string collectionName, object eventData)
{
return _connect.Push(collectionName, eventData);
}
public static Task<EventBatchPushResponse> Push(string collectionName, IEnumerable<object> eventData)
{
return _connect.Push(collectionName, eventData);
}
public static Task Add(string collectionName, object eventData)
{
return _connect.Add(collectionName, eventData);
}
public static Task Add(string collectionName, IEnumerable<object> eventData)
{
return _connect.Add(collectionName, eventData);
}
public static Task<EventBatchPushResponse> PushPending()
{
return _connect.PushPending();
}
}
}
| using System.Collections.Generic;
using System.Threading.Tasks;
using ConnectSdk.Config;
namespace ConnectSdk
{
public static class Connect
{
private static IConnect _connect;
public static void Inititialize(IConfiguration configuration)
{
_connect = new ConnectClient(configuration);
}
public static void Inititialize(IConnect connect)
{
_connect = connect;
}
public static Task<EventPushResponse> Push(string collectionName, object eventData)
{
return _connect.Push(collectionName, eventData);
}
public static Task<EventBatchPushResponse> Push(string collectionName, IEnumerable<object> eventData)
{
return _connect.Push(collectionName, eventData);
}
public static Task Add(string collectionName, object eventData)
{
return _connect.Add(collectionName, eventData);
}
public static Task Add(string collectionName, IEnumerable<object> eventData)
{
return _connect.Add(collectionName, eventData);
}
public static Task<EventBatchPushResponse> PushPending()
{
return _connect.PushPending();
}
}
}
| mit | C# |
322386626be46659340e617ceb5dffaa9848cad4 | Add \n to output. | stpettersens/nGaudi,stpettersens/nGaudi | dist/CLRCheck.cs | dist/CLRCheck.cs | /*
Common Language Runtime (.NET/Mono) checker
@author Sam Saint-Pettersen, 2011
Released into the public domain.
Originally written for use with
the NSIS installation script for nGaudi.
But use as you like. No warranty.
Usage: [mono] CLRCheck.exe
Output: CLR version (e.g. 4.0.30319.1)
Exit code: -1 (neither true or false)
Usage: [mono] CLRCheck.exe <minimal version>
Output: x.x.x_x (CLR version)
Exit code: 0 (false) / 1 (true)(CLR installed, is minimal version or greater)
*/
using System;
using System.Text;
using System.Text.RegularExpressions;
namespace Stpettersens.CLRCheck
{
class CLRCheck
{
static void Main(string[] args)
{
int returned = 1; // Return exit code -1 for neither true or false; default assumption
string detectedVer = String.Format("{0}\n", Environment.Version);
if(args.Length == 1)
{
// TODO
}
Console.Write(detectedVer);
Environment.Exit(returned);
}
}
}
| /*
Common Language Runtime (.NET/Mono) checker
@author Sam Saint-Pettersen, 2011
Released into the public domain.
Originally written for use with
the NSIS installation script for nGaudi.
But use as you like. No warranty.
Usage: [mono] CLRCheck.exe
Output: CLR version (e.g. 4.0.30319.1)
Exit code: -1 (neither true or false)
Usage: [mono] CLRCheck.exe <minimal version>
Output: x.x.x_x (CLR version)
Exit code: 0 (false) / 1 (true)(CLR installed, is minimal version or greater)
*/
using System;
using System.Text;
using System.Text.RegularExpressions;
namespace Stpettersens.CLRCheck
{
class CLRCheck
{
static void Main(string[] args)
{
int returned = 1; // Return exit code -1 for neither true or false; default assumption
string detectedVer = String.Format("{0}", Environment.Version);
if(args.Length == 1)
{
// TODO
}
Console.Write(detectedVer);
Environment.Exit(returned);
}
}
}
| mit | C# |
4db692041ea0d027fdc51017c016585b7deb846c | Fix up spelling of Diagnostics | datalust/seq-api,nblumhardt/seq-api,continuousit/seq-api | src/Seq.Api/Api/SeqConnection.cs | src/Seq.Api/Api/SeqConnection.cs | using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using Seq.Api.Client;
using Seq.Api.Model;
using Seq.Api.Model.Root;
using Seq.Api.ResourceGroups;
namespace Seq.Api
{
public class SeqConnection : ISeqConnection
{
readonly SeqApiClient _client;
readonly ConcurrentDictionary<string, Task<ResourceGroup>> _resourceGroups = new ConcurrentDictionary<string, Task<ResourceGroup>>();
readonly Lazy<Task<RootEntity>> _root;
public SeqConnection(string serverUrl, string apiKey = null)
{
if (serverUrl == null) throw new ArgumentNullException(nameof(serverUrl));
_client = new SeqApiClient(serverUrl, apiKey);
_root = new Lazy<Task<RootEntity>>(() => _client.GetRootAsync());
}
public ApiKeysResourceGroup ApiKeys => new ApiKeysResourceGroup(this);
public AppInstancesResourceGroup AppInstances => new AppInstancesResourceGroup(this);
public AppsResourceGroup Apps => new AppsResourceGroup(this);
public BackupsResourceGroup Backups => new BackupsResourceGroup(this);
public DataResourceGroup Data => new DataResourceGroup(this);
public DiagnosticsResourceGroup Diagnostics => new DiagnosticsResourceGroup(this);
public EventsResourceGroup Events => new EventsResourceGroup(this);
public ExpressionsResourceGroup Expressions => new ExpressionsResourceGroup(this);
public FeedsResourceGroup Feeds => new FeedsResourceGroup(this);
public LicensesResourceGroup Licenses => new LicensesResourceGroup(this);
public PinsResourceGroup Pins => new PinsResourceGroup(this);
public RetentionPoliciesResourceGroup RetentionPolicies => new RetentionPoliciesResourceGroup(this);
public SettingsResourceGroup Settings => new SettingsResourceGroup(this);
public SignalsResourceGroup Signals => new SignalsResourceGroup(this);
public UpdatesResourceGroup Updates => new UpdatesResourceGroup(this);
public UsersResourceGroup Users => new UsersResourceGroup(this);
public WatchesResourceGroup Watches => new WatchesResourceGroup(this);
public async Task<ResourceGroup> LoadResourceGroupAsync(string name)
{
return await _resourceGroups.GetOrAdd(name, ResourceGroupFactory).ConfigureAwait(false);
}
private async Task<ResourceGroup> ResourceGroupFactory(string name)
{
return await _client.GetAsync<ResourceGroup>(await _root.Value, name + "Resources").ConfigureAwait(false);
}
public SeqApiClient Client => _client;
}
}
| using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using Seq.Api.Client;
using Seq.Api.Model;
using Seq.Api.Model.Root;
using Seq.Api.ResourceGroups;
namespace Seq.Api
{
public class SeqConnection : ISeqConnection
{
readonly SeqApiClient _client;
readonly ConcurrentDictionary<string, Task<ResourceGroup>> _resourceGroups = new ConcurrentDictionary<string, Task<ResourceGroup>>();
readonly Lazy<Task<RootEntity>> _root;
public SeqConnection(string serverUrl, string apiKey = null)
{
if (serverUrl == null) throw new ArgumentNullException(nameof(serverUrl));
_client = new SeqApiClient(serverUrl, apiKey);
_root = new Lazy<Task<RootEntity>>(() => _client.GetRootAsync());
}
public ApiKeysResourceGroup ApiKeys => new ApiKeysResourceGroup(this);
public AppInstancesResourceGroup AppInstances => new AppInstancesResourceGroup(this);
public AppsResourceGroup Apps => new AppsResourceGroup(this);
public BackupsResourceGroup Backups => new BackupsResourceGroup(this);
public DataResourceGroup Data => new DataResourceGroup(this);
public DiagnosticsResourceGroup Diagnositcs => new DiagnosticsResourceGroup(this);
public EventsResourceGroup Events => new EventsResourceGroup(this);
public ExpressionsResourceGroup Expressions => new ExpressionsResourceGroup(this);
public FeedsResourceGroup Feeds => new FeedsResourceGroup(this);
public LicensesResourceGroup Licenses => new LicensesResourceGroup(this);
public PinsResourceGroup Pins => new PinsResourceGroup(this);
public RetentionPoliciesResourceGroup RetentionPolicies => new RetentionPoliciesResourceGroup(this);
public SettingsResourceGroup Settings => new SettingsResourceGroup(this);
public SignalsResourceGroup Signals => new SignalsResourceGroup(this);
public UpdatesResourceGroup Updates => new UpdatesResourceGroup(this);
public UsersResourceGroup Users => new UsersResourceGroup(this);
public WatchesResourceGroup Watches => new WatchesResourceGroup(this);
public async Task<ResourceGroup> LoadResourceGroupAsync(string name)
{
return await _resourceGroups.GetOrAdd(name, ResourceGroupFactory).ConfigureAwait(false);
}
private async Task<ResourceGroup> ResourceGroupFactory(string name)
{
return await _client.GetAsync<ResourceGroup>(await _root.Value, name + "Resources").ConfigureAwait(false);
}
public SeqApiClient Client => _client;
}
}
| apache-2.0 | C# |
599deb11b04619168ce5ec892b922b22ccb0efd0 | Convert struct to class | MHeasell/Mappy,MHeasell/Mappy | Mappy/Models/ListViewItem.cs | Mappy/Models/ListViewItem.cs | namespace Mappy.Models
{
using System.Drawing;
public class ListViewItem
{
public ListViewItem(string name, Bitmap image, object tag)
{
this.Name = name;
this.Image = image;
this.Tag = tag;
}
public string Name { get; }
public Bitmap Image { get; }
public object Tag { get; }
}
} | namespace Mappy.Models
{
using System.Drawing;
public struct ListViewItem
{
public ListViewItem(string name, Bitmap image, object tag)
{
this.Name = name;
this.Image = image;
this.Tag = tag;
}
public string Name { get; }
public Bitmap Image { get; }
public object Tag { get; }
}
} | mit | C# |
d4a680913c87087abdd0433b0c05276d85fe30cf | update MethodExecuteLoggerInterceptor | AspectCore/Abstractions,AspectCore/AspectCore-Framework,AspectCore/AspectCore-Framework,AspectCore/Lite | extras/src/AspectCore.Extensions.AspNetCore/Interceptors/MethodExecuteLoggerInterceptor.cs | extras/src/AspectCore.Extensions.AspNetCore/Interceptors/MethodExecuteLoggerInterceptor.cs | using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using AspectCore.DynamicProxy;
using AspectCore.Extensions.Reflection;
using Microsoft.Extensions.Logging;
namespace AspectCore.Extensions.AspNetCore
{
public class MethodExecuteLoggerInterceptor : AbstractInterceptor
{
private static readonly HashSet<string> excepts = new HashSet<string>
{
"Microsoft.Extensions.Logging",
"Microsoft.Extensions.Options",
"IServiceProvider",
"IHttpContextAccessor",
"ITelemetryInitializer",
"IHostingEnvironment"
};
public async override Task Invoke(AspectContext context, AspectDelegate next)
{
var serviceType = context.ServiceMethod.DeclaringType;
if (excepts.Contains(serviceType.Name) || excepts.Contains(serviceType.Namespace) || context.Implementation is ILogger)
{
await context.Invoke(next);
return;
}
var logger = (ILogger<MethodExecuteLoggerInterceptor>)context.ServiceProvider.GetService(typeof(ILogger<MethodExecuteLoggerInterceptor>));
Stopwatch stopwatch = Stopwatch.StartNew();
await context.Invoke(next);
stopwatch.Stop();
logger?.LogInformation("Executed method {0}.{1}.{2} ({3}) in {4}",
context.ServiceMethod.DeclaringType.Namespace,
context.ServiceMethod.DeclaringType.GetReflector().DisplayName,
context.ServiceMethod.Name,
context.ServiceMethod.DeclaringType.Assembly.GetName().Name,
stopwatch.Elapsed
);
}
}
} | using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using AspectCore.DynamicProxy;
using AspectCore.Injector;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace AspectCore.Extensions.AspNetCore
{
public class MethodExecuteLoggerInterceptor : AbstractInterceptor
{
private static readonly HashSet<string> excepts = new HashSet<string>
{
"Microsoft.Extensions.Logging",
"Microsoft.Extensions.Options",
"IServiceProvider",
"IHttpContextAccessor",
"ITelemetryInitializer",
"IHostingEnvironment"
};
public async override Task Invoke(AspectContext context, AspectDelegate next)
{
var serviceType = context.ServiceMethod.DeclaringType;
if (excepts.Contains(serviceType.Name) || excepts.Contains(serviceType.Namespace) || context.Implementation is ILogger)
{
await context.Invoke(next);
return;
}
//await context.Invoke(next);
var logger = (ILogger<MethodExecuteLoggerInterceptor>)context.ServiceProvider.GetService(typeof(ILogger<MethodExecuteLoggerInterceptor>));
Stopwatch stopwatch = Stopwatch.StartNew();
await context.Invoke(next);
stopwatch.Stop();
logger?.LogInformation("Executed method {0}.{1}.{2} ({3}) in {4}",
context.ServiceMethod.DeclaringType.Namespace,
context.ServiceMethod.DeclaringType.Name,
context.ServiceMethod.Name,
context.ServiceMethod.DeclaringType.Assembly.GetName().Name,
stopwatch.Elapsed
);
}
}
} | mit | C# |
7b20d1c948d7b6035f50ba098bc15198ef985c57 | build version: 3.9.71.5 | wiesel78/Canwell.OrmLite.MSAccess2003 | Source/GlobalAssemblyInfo.cs | Source/GlobalAssemblyInfo.cs | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Cake.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Reflection;
[assembly: AssemblyCompany("canwell - IT Solutions")]
[assembly: AssemblyVersion("3.9.71.5")]
[assembly: AssemblyFileVersion("3.9.71.5")]
[assembly: AssemblyInformationalVersion("3.9.71.5")]
[assembly: AssemblyCopyright("Copyright © 2016")]
| //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Cake.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Reflection;
[assembly: AssemblyCompany("canwell - IT Solutions")]
[assembly: AssemblyVersion("3.9.71.4")]
[assembly: AssemblyFileVersion("3.9.71.4")]
[assembly: AssemblyInformationalVersion("3.9.71.4")]
[assembly: AssemblyCopyright("Copyright © 2016")]
| bsd-3-clause | C# |
faf0a7cd576bbd25be1648b8519ca0ed713163fd | Remove deprecated methods | Puzzlepart/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,m-carter1/PnP-Sites-Core,PieterVeenstra/PnP-Sites-Core,phillipharding/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,Oaden/PnP-Sites-Core,phillipharding/PnP-Sites-Core,rajashekarusa/PnP-Sites-Core,comblox/PnP-Sites-Core,OfficeDev/PnP-Sites-Core,rajashekarusa/PnP-Sites-Core,itacs/PnP-Sites-Core,rajashekarusa/PnP-Sites-Core,BobGerman/PnP-Sites-Core,itacs/PnP-Sites-Core,BobGerman/PnP-Sites-Core,m-carter1/PnP-Sites-Core,Oaden/PnP-Sites-Core,Puzzlepart/PnP-Sites-Core,PieterVeenstra/PnP-Sites-Core,comblox/PnP-Sites-Core | Core/OfficeDevPnP.Core/Framework/Provisioning/Deprecated/ObjectHandlers/ProvisioningTemplateApplyingInformation.deprecated.cs | Core/OfficeDevPnP.Core/Framework/Provisioning/Deprecated/ObjectHandlers/ProvisioningTemplateApplyingInformation.deprecated.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers
{
public partial class ProvisioningTemplateApplyingInformation
{
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers
{
public partial class ProvisioningTemplateApplyingInformation
{
[Obsolete("Please don't use this member, insted use MessagesDelegate. This method will be removed in the November release.")]
public ProvisioningMessagesDelegate MessageDelegate
{
get { return (this.MessagesDelegate); }
set { this.MessagesDelegate = value; }
}
}
}
| mit | C# |
1efaa1a6045863facfd6cf4c7b44f5387032f794 | Update UITestFixture.SetUp method | atata-framework/atata-kendoui,atata-framework/atata-kendoui | src/Atata.KendoUI.Tests/UITestFixture.cs | src/Atata.KendoUI.Tests/UITestFixture.cs | using System.Configuration;
using NUnit.Framework;
namespace Atata.KendoUI.Tests
{
[TestFixture]
public abstract class UITestFixture
{
[SetUp]
public void SetUp()
{
string baseUrl = ConfigurationManager.AppSettings["TestAppUrl"];
AtataContext.Configure().
UseChrome().
WithArguments("start-maximized", "disable-infobars", "disable-extensions").
UseBaseUrl(baseUrl).
UseNUnitTestName().
AddNUnitTestContextLogging().
LogNUnitError().
Build();
OnSetUp();
}
protected virtual void OnSetUp()
{
}
[TearDown]
public void TearDown()
{
AtataContext.Current.CleanUp();
}
}
}
| using System.Configuration;
using NUnit.Framework;
namespace Atata.KendoUI.Tests
{
[TestFixture]
public abstract class UITestFixture
{
[SetUp]
public void SetUp()
{
string baseUrl = ConfigurationManager.AppSettings["TestAppUrl"];
AtataContext.Configure().
UseChrome().
WithArguments("disable-extensions", "no-sandbox", "start-maximized").
UseBaseUrl(baseUrl).
UseNUnitTestName().
AddNUnitTestContextLogging().
LogNUnitError().
Build();
OnSetUp();
}
protected virtual void OnSetUp()
{
}
[TearDown]
public void TearDown()
{
AtataContext.Current.CleanUp();
}
}
}
| apache-2.0 | C# |
0c120a231ff49944509c12118620b91c3013b11b | Add auto completer for offer type. | devigned/azure-powershell,AzureAutomationTeam/azure-powershell,devigned/azure-powershell,ClogenyTechnologies/azure-powershell,devigned/azure-powershell,devigned/azure-powershell,naveedaz/azure-powershell,naveedaz/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,devigned/azure-powershell,naveedaz/azure-powershell,devigned/azure-powershell,naveedaz/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,naveedaz/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,naveedaz/azure-powershell | src/ResourceManager/SubscriptionDefinition/Commands.SubscriptionDefinition/Cmdlets/NewAzureRmSubscriptionDefinition.cs | src/ResourceManager/SubscriptionDefinition/Commands.SubscriptionDefinition/Cmdlets/NewAzureRmSubscriptionDefinition.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.Azure.Commands.SubscriptionDefinition.Common;
using Microsoft.Azure.Commands.SubscriptionDefinition.Models;
using Microsoft.Azure.Management.ResourceManager;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Management.Automation.Language;
namespace Microsoft.Azure.Commands.SubscriptionDefinition.Cmdlets
{
[Cmdlet(VerbsCommon.New, "AzureRmSubscriptionDefinition", SupportsShouldProcess = true), OutputType(typeof(PSSubscriptionDefinition))]
public class NewAzureRmSubscriptionDefinition : AzureSubscriptionDefinitionCmdletBase
{
[Parameter(Mandatory = true, HelpMessage = "Id of the management group in which to create the subscription definition.")]
public Guid ManagementGroupId { get; set; }
[Parameter(Mandatory = true, HelpMessage = "Name of the subscription definition.")]
public string Name { get; set; }
[Parameter(Mandatory = true, HelpMessage = "Offer type of the subscription definition.")]
[ArgumentCompleter(typeof(OfferTypeCompleter))]
public RuntimeDefinedParameter OfferType { get; set; }
[Parameter(Mandatory = false, HelpMessage = "Display name of the subscription.")]
public string SubscriptionDisplayName { get; set; }
public override void ExecuteCmdlet()
{
if (this.ShouldProcess(target: this.Name, action: "Create subscription definition"))
{
this.WriteSubscriptionDefinitionObject(this.SubscriptionDefinitionClient.SubscriptionDefinitions.Create(new Microsoft.Azure.Management.ResourceManager.Models.SubscriptionDefinition(
groupId: this.ManagementGroupId.ToString(),
name: this.Name,
ratingContext: new Management.ResourceManager.Models.SubscriptionDefinitionPropertiesRatingContext(this.OfferType.Value.ToString()),
subscriptionDisplayName: this.SubscriptionDisplayName ?? this.Name)));
}
}
private class OfferTypeCompleter : IArgumentCompleter
{
private static readonly string[] KnownOfferTypes = { "MS-AZR-0017P", "MS-AZR-0148P" };
public IEnumerable<CompletionResult> CompleteArgument(string commandName, string parameterName, string wordToComplete, CommandAst commandAst, IDictionary fakeBoundParameters)
{
var pattern = new WildcardPattern(wordToComplete + "*", WildcardOptions.IgnoreCase);
return KnownOfferTypes
.Where(pattern.IsMatch)
.Select(s => new CompletionResult(s));
}
}
}
}
| // ----------------------------------------------------------------------------------
//
// 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.Azure.Commands.SubscriptionDefinition.Common;
using Microsoft.Azure.Commands.SubscriptionDefinition.Models;
using Microsoft.Azure.Management.ResourceManager;
using System;
using System.Management.Automation;
namespace Microsoft.Azure.Commands.SubscriptionDefinition.Cmdlets
{
[Cmdlet(VerbsCommon.New, "AzureRmSubscriptionDefinition", SupportsShouldProcess = true), OutputType(typeof(PSSubscriptionDefinition))]
public class NewAzureRmSubscriptionDefinition : AzureSubscriptionDefinitionCmdletBase
{
[Parameter(Mandatory = true, HelpMessage = "Id of the management group in which to create the subscription definition.")]
public Guid ManagementGroupId { get; set; }
[Parameter(Mandatory = true, HelpMessage = "Name of the subscription definition.")]
public string Name { get; set; }
[Parameter(Mandatory = true, HelpMessage = "Offer type of the subscription definition.")]
public string OfferType { get; set; }
[Parameter(Mandatory = false, HelpMessage = "Display name of the subscription.")]
public string SubscriptionDisplayName { get; set; }
public override void ExecuteCmdlet()
{
if (this.ShouldProcess(target: this.Name, action: "Create subscription definition"))
{
this.WriteSubscriptionDefinitionObject(this.SubscriptionDefinitionClient.SubscriptionDefinitions.Create(new Microsoft.Azure.Management.ResourceManager.Models.SubscriptionDefinition(
groupId: this.ManagementGroupId.ToString(),
name: this.Name,
ratingContext: new Management.ResourceManager.Models.SubscriptionDefinitionPropertiesRatingContext(this.OfferType),
subscriptionDisplayName: this.SubscriptionDisplayName ?? this.Name)));
}
}
}
}
| apache-2.0 | C# |
e1d22e58bfbd03c6d8c198460711860ae1c23fb1 | Simplify queue count text logic | peppy/osu,ppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu | osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs | osu.Game/Screens/OnlinePlay/Multiplayer/Match/Playlist/MultiplayerPlaylistTabControl.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Rooms;
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
{
public class MultiplayerPlaylistTabControl : OsuTabControl<MultiplayerPlaylistDisplayMode>
{
public readonly IBindableList<PlaylistItem> QueueItems = new BindableList<PlaylistItem>();
protected override TabItem<MultiplayerPlaylistDisplayMode> CreateTabItem(MultiplayerPlaylistDisplayMode value)
{
if (value == MultiplayerPlaylistDisplayMode.Queue)
return new QueueTabItem { QueueItems = { BindTarget = QueueItems } };
return base.CreateTabItem(value);
}
private class QueueTabItem : OsuTabItem
{
public readonly IBindableList<PlaylistItem> QueueItems = new BindableList<PlaylistItem>();
public QueueTabItem()
: base(MultiplayerPlaylistDisplayMode.Queue)
{
}
protected override void LoadComplete()
{
base.LoadComplete();
QueueItems.BindCollectionChanged((_, __) => Text.Text = QueueItems.Count > 0 ? $"Queue ({QueueItems.Count})" : "Queue", true);
}
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Rooms;
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
{
public class MultiplayerPlaylistTabControl : OsuTabControl<MultiplayerPlaylistDisplayMode>
{
public readonly IBindableList<PlaylistItem> QueueItems = new BindableList<PlaylistItem>();
protected override TabItem<MultiplayerPlaylistDisplayMode> CreateTabItem(MultiplayerPlaylistDisplayMode value)
{
if (value == MultiplayerPlaylistDisplayMode.Queue)
return new QueueTabItem { QueueItems = { BindTarget = QueueItems } };
return base.CreateTabItem(value);
}
private class QueueTabItem : OsuTabItem
{
public readonly IBindableList<PlaylistItem> QueueItems = new BindableList<PlaylistItem>();
public QueueTabItem()
: base(MultiplayerPlaylistDisplayMode.Queue)
{
}
protected override void LoadComplete()
{
base.LoadComplete();
QueueItems.BindCollectionChanged((_,__) =>
{
Text.Text = $"Queue";
if (QueueItems.Count != 0)
Text.Text += $" ({QueueItems.Count})";
}, true);
}
}
}
}
| mit | C# |
641e89b28aa538e5ed7069a4c8593aa2cadeed65 | Improve error handling | kzu/OctoFlow | src/OctoFlow.Console/Program.cs | src/OctoFlow.Console/Program.cs | /*
Copyright 2014 Daniel Cazzulino
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
*/
namespace OctoFlow
{
using CLAP;
using OctoFlow.Diagnostics;
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
Tracer.Initialize(new TracerManager());
AppDomain.CurrentDomain.UnhandledException += OnDomainUnhandledException;
System.Threading.Tasks.TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
var parser = new Parser<App>();
parser.Register.ErrorHandler(e => Console.WriteLine(e.Exception.Message));
parser.Run(args, new App());
//Parser.Run(args, new App());
#if DEBUG
Console.ReadLine();
#endif
}
private static void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
{
Tracer.Get(typeof(Program)).Error(e.Exception.Flatten(), "Unexpected exception");
Console.WriteLine(e.Exception.Flatten().ToString());
Console.WriteLine("Press [Enter] to exit.");
Console.ReadLine();
Process.GetCurrentProcess().Kill();
}
private static void OnDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Tracer.Get(typeof(Program)).Error((Exception)e.ExceptionObject, "Unexpected exception");
Console.WriteLine(e.ExceptionObject.ToString());
Console.WriteLine("Press [Enter] to exit.");
Console.ReadLine();
Process.GetCurrentProcess().Kill();
}
}
}
| /*
Copyright 2014 Daniel Cazzulino
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
*/
namespace OctoFlow
{
using CLAP;
using OctoFlow.Diagnostics;
using System;
using System.Diagnostics;
using System.Linq;
class Program
{
static void Main(string[] args)
{
Tracer.Initialize(new TracerManager());
Parser.Run(args, new App());
#if DEBUG
Console.ReadLine();
#endif
}
}
}
| apache-2.0 | C# |
2f7edc2596c2ae4d393cb16ebe658ffb515f5fd0 | fix hardcoded blog path in theme | Wyamio/Wyam,Wyamio/Wyam,Wyamio/Wyam | themes/Docs/Samson/_BlogIndex.cshtml | themes/Docs/Samson/_BlogIndex.cshtml | @{
bool fullContent = Model.String(Keys.RelativeFilePath) == $"{@Context.String(DocsKeys.BlogPath)}/index.html" && Model.Get<int>(Keys.CurrentPage) == 1;
foreach(IDocument post in Model.DocumentList(Keys.PageDocuments))
{
<h2><a href="@Context.GetLink(post)">@post.WithoutSettings.String(Keys.Title)</a></h2>
@Html.Partial("_BlogPostDetails", post)
@if(fullContent)
{
<div>
@Html.Raw(post.Content)
</div>
}
else
{
<div>
@Html.Raw(post.String(HtmlKeys.Excerpt))
<a href="@Context.GetLink(post)">Read more...</a>
</div>
}
<hr />
fullContent = false;
}
<nav>
@{
string directory = Model.FilePath(Keys.RelativeFilePath).Directory.FullPath;
}
<ul class="pager">
<li class="previous">
@if(Model.Bool(Keys.HasPreviousPage))
{
string previousPage = Model.Get<int>(Keys.CurrentPage) == 2
? $"/{directory}" : $"/{directory}/page{Model.Get<int>(Keys.CurrentPage) - 1}";
<a href="@previousPage"><span aria-hidden="true">←</span> Newer</a>
}
</li>
<li class="next">
@if(Model.Bool(Keys.HasNextPage))
{
string nextPage = $"/{directory}/page{Model.Get<int>(Keys.CurrentPage) + 1}";
<a href="@nextPage">Older <span aria-hidden="true">→</span></a>
}
</li>
</ul>
</nav>
}
| @{
bool fullContent = Model.String(Keys.RelativeFilePath) == "blog/index.html" && Model.Get<int>(Keys.CurrentPage) == 1;
foreach(IDocument post in Model.DocumentList(Keys.PageDocuments))
{
<h2><a href="@Context.GetLink(post)">@post.WithoutSettings.String(Keys.Title)</a></h2>
@Html.Partial("_BlogPostDetails", post)
@if(fullContent)
{
<div>
@Html.Raw(post.Content)
</div>
}
else
{
<div>
@Html.Raw(post.String(HtmlKeys.Excerpt))
<a href="@Context.GetLink(post)">Read more...</a>
</div>
}
<hr />
fullContent = false;
}
<nav>
@{
string directory = Model.FilePath(Keys.RelativeFilePath).Directory.FullPath;
}
<ul class="pager">
<li class="previous">
@if(Model.Bool(Keys.HasPreviousPage))
{
string previousPage = Model.Get<int>(Keys.CurrentPage) == 2
? $"/{directory}" : $"/{directory}/page{Model.Get<int>(Keys.CurrentPage) - 1}";
<a href="@previousPage"><span aria-hidden="true">←</span> Newer</a>
}
</li>
<li class="next">
@if(Model.Bool(Keys.HasNextPage))
{
string nextPage = $"/{directory}/page{Model.Get<int>(Keys.CurrentPage) + 1}";
<a href="@nextPage">Older <span aria-hidden="true">→</span></a>
}
</li>
</ul>
</nav>
} | mit | C# |
694c2c3ca6c9dcbd4c76876e14c6148f8b411d33 | Improve delete field dialog | leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net | Joinrpg/Views/GameField/Delete.cshtml | Joinrpg/Views/GameField/Delete.cshtml | @model JoinRpg.DataModel.ProjectCharacterField
@{
ViewBag.Title = "Удалить поле персонажа «" + Model.FieldName +"»";
}
<h2>@ViewBag.Title</h2>
<h3>Вы действительно хотите удалить?</h3>
<div>
<h4>@Model.FieldName</h4>
<hr/> @if (Model.WasEverUsed)
{
<p>У некоторых персонажей это поле уже выставлено в какое-то значение. Чтобы предотвратить потерю данных, поле будет спрятано, а не удалено</p>
}
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.ProjectId)
@Html.HiddenFor(model => model.ProjectCharacterFieldId)
<div class="form-actions no-color">
<input type="submit" value="Удалить" class="btn btn-default"/> |
@Html.ActionLink("Назад к списку", "Index", new {Model.ProjectId})
</div>
}
</div>
| @model JoinRpg.DataModel.ProjectCharacterField
@{
ViewBag.Title = "Delete";
}
<h2>Delete</h2>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>ProjectCharacterField</h4>
<hr/>
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.FieldName)
</dt>
<dd>
@Html.DisplayFor(model => model.FieldName)
</dd>
<dt>
</dt>
<dd>
@if (Model.WasEverUsed)
{
<span>У некоторых персонажей это поле уже выставлено в какое-то значение. Чтобы предотвратить потерю данных, поле будет спрятано, а не удалено</span>
}
</dd>
</dl>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.HiddenFor(model => model.ProjectId)
@Html.HiddenFor(model => model.ProjectCharacterFieldId)
<div class="form-actions no-color">
<input type="submit" value="Delete" class="btn btn-default" /> |
@Html.ActionLink("Back to List", "Index")
</div>
}
</div>
| mit | C# |
a3c5c4413a5a5dd2befaf91f4a5842704771a6d6 | update AbstractInterceptorAttribute | AspectCore/Abstractions,AspectCore/AspectCore-Framework,AspectCore/AspectCore-Framework,AspectCore/Lite | datavalidation/AspectCore.Extensions.DataValidation/DataValidationInterceptorAttribute.cs | datavalidation/AspectCore.Extensions.DataValidation/DataValidationInterceptorAttribute.cs | using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using AspectCore.DynamicProxy;
namespace AspectCore.Extensions.DataValidation
{
public class DataValidationInterceptorAttribute : AbstractInterceptorAttribute
{
public override Task Invoke(AspectContext context, AspectDelegate next)
{
var dataValidator
throw new NotImplementedException();
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using AspectCore.DynamicProxy;
namespace AspectCore.Extensions.DataValidation
{
public class DataValidationInterceptorAttribute : AbstractInterceptorAttribute
{
public override Task Invoke(AspectContext context, AspectDelegate next)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
3173addf26023d131ce93e00ced34cb76093ffaf | Clean up TypeConverterAttribute.cs | the-dwyer/corefx,ViktorHofer/corefx,ravimeda/corefx,parjong/corefx,krytarowski/corefx,axelheer/corefx,shimingsg/corefx,YoupHulsebos/corefx,BrennanConroy/corefx,nchikanov/corefx,manu-silicon/corefx,ericstj/corefx,rahku/corefx,alphonsekurian/corefx,twsouthwick/corefx,cydhaselton/corefx,wtgodbe/corefx,mazong1123/corefx,stephenmichaelf/corefx,ericstj/corefx,alexperovich/corefx,Chrisboh/corefx,DnlHarvey/corefx,Jiayili1/corefx,richlander/corefx,cydhaselton/corefx,marksmeltzer/corefx,rubo/corefx,DnlHarvey/corefx,richlander/corefx,shimingsg/corefx,gkhanna79/corefx,stephenmichaelf/corefx,tijoytom/corefx,shimingsg/corefx,shimingsg/corefx,mazong1123/corefx,shimingsg/corefx,billwert/corefx,lggomez/corefx,zhenlan/corefx,jlin177/corefx,MaggieTsang/corefx,shmao/corefx,stone-li/corefx,Petermarcu/corefx,krk/corefx,ptoonen/corefx,manu-silicon/corefx,dsplaisted/corefx,jhendrixMSFT/corefx,weltkante/corefx,jhendrixMSFT/corefx,Ermiar/corefx,mmitche/corefx,manu-silicon/corefx,richlander/corefx,mmitche/corefx,weltkante/corefx,stone-li/corefx,tijoytom/corefx,tijoytom/corefx,twsouthwick/corefx,krytarowski/corefx,richlander/corefx,MaggieTsang/corefx,yizhang82/corefx,YoupHulsebos/corefx,krytarowski/corefx,the-dwyer/corefx,wtgodbe/corefx,Priya91/corefx-1,parjong/corefx,nchikanov/corefx,shmao/corefx,MaggieTsang/corefx,Priya91/corefx-1,iamjasonp/corefx,wtgodbe/corefx,YoupHulsebos/corefx,richlander/corefx,ptoonen/corefx,manu-silicon/corefx,dotnet-bot/corefx,adamralph/corefx,Petermarcu/corefx,ViktorHofer/corefx,parjong/corefx,rubo/corefx,lggomez/corefx,zhenlan/corefx,rahku/corefx,marksmeltzer/corefx,DnlHarvey/corefx,jhendrixMSFT/corefx,mazong1123/corefx,Priya91/corefx-1,ptoonen/corefx,Petermarcu/corefx,ptoonen/corefx,shmao/corefx,rjxby/corefx,mmitche/corefx,krytarowski/corefx,ellismg/corefx,BrennanConroy/corefx,MaggieTsang/corefx,stone-li/corefx,dhoehna/corefx,Ermiar/corefx,gkhanna79/corefx,billwert/corefx,tijoytom/corefx,dhoehna/corefx,nchikanov/corefx,iamjasonp/corefx,Chrisboh/corefx,seanshpark/corefx,cydhaselton/corefx,shmao/corefx,nbarbettini/corefx,dsplaisted/corefx,ericstj/corefx,manu-silicon/corefx,YoupHulsebos/corefx,alexperovich/corefx,axelheer/corefx,billwert/corefx,seanshpark/corefx,iamjasonp/corefx,mazong1123/corefx,nchikanov/corefx,dhoehna/corefx,jhendrixMSFT/corefx,ellismg/corefx,nchikanov/corefx,shimingsg/corefx,stephenmichaelf/corefx,ViktorHofer/corefx,zhenlan/corefx,rahku/corefx,stephenmichaelf/corefx,stephenmichaelf/corefx,DnlHarvey/corefx,Jiayili1/corefx,alexperovich/corefx,jlin177/corefx,ravimeda/corefx,tijoytom/corefx,gkhanna79/corefx,marksmeltzer/corefx,Ermiar/corefx,iamjasonp/corefx,nbarbettini/corefx,mmitche/corefx,yizhang82/corefx,YoupHulsebos/corefx,weltkante/corefx,rahku/corefx,alphonsekurian/corefx,rubo/corefx,elijah6/corefx,shimingsg/corefx,weltkante/corefx,marksmeltzer/corefx,billwert/corefx,mazong1123/corefx,fgreinacher/corefx,elijah6/corefx,nbarbettini/corefx,Petermarcu/corefx,yizhang82/corefx,rjxby/corefx,ravimeda/corefx,elijah6/corefx,weltkante/corefx,elijah6/corefx,Chrisboh/corefx,fgreinacher/corefx,MaggieTsang/corefx,krk/corefx,ptoonen/corefx,ericstj/corefx,alexperovich/corefx,rjxby/corefx,jlin177/corefx,elijah6/corefx,Priya91/corefx-1,krk/corefx,Petermarcu/corefx,mmitche/corefx,yizhang82/corefx,wtgodbe/corefx,iamjasonp/corefx,jhendrixMSFT/corefx,dotnet-bot/corefx,alphonsekurian/corefx,zhenlan/corefx,krytarowski/corefx,Ermiar/corefx,cydhaselton/corefx,gkhanna79/corefx,twsouthwick/corefx,the-dwyer/corefx,billwert/corefx,ellismg/corefx,nbarbettini/corefx,cydhaselton/corefx,elijah6/corefx,gkhanna79/corefx,stone-li/corefx,ViktorHofer/corefx,Jiayili1/corefx,Priya91/corefx-1,ViktorHofer/corefx,billwert/corefx,alexperovich/corefx,Jiayili1/corefx,shmao/corefx,BrennanConroy/corefx,lggomez/corefx,Priya91/corefx-1,fgreinacher/corefx,ellismg/corefx,jlin177/corefx,seanshpark/corefx,dhoehna/corefx,dhoehna/corefx,mmitche/corefx,DnlHarvey/corefx,stone-li/corefx,wtgodbe/corefx,seanshpark/corefx,Chrisboh/corefx,ericstj/corefx,rjxby/corefx,YoupHulsebos/corefx,krk/corefx,lggomez/corefx,zhenlan/corefx,the-dwyer/corefx,Chrisboh/corefx,jhendrixMSFT/corefx,DnlHarvey/corefx,the-dwyer/corefx,seanshpark/corefx,adamralph/corefx,parjong/corefx,rjxby/corefx,fgreinacher/corefx,manu-silicon/corefx,krytarowski/corefx,ViktorHofer/corefx,alphonsekurian/corefx,rubo/corefx,cydhaselton/corefx,JosephTremoulet/corefx,JosephTremoulet/corefx,stone-li/corefx,marksmeltzer/corefx,Ermiar/corefx,ellismg/corefx,krk/corefx,richlander/corefx,axelheer/corefx,ptoonen/corefx,ravimeda/corefx,JosephTremoulet/corefx,rahku/corefx,alexperovich/corefx,Ermiar/corefx,parjong/corefx,lggomez/corefx,rubo/corefx,shmao/corefx,axelheer/corefx,ericstj/corefx,lggomez/corefx,ravimeda/corefx,zhenlan/corefx,elijah6/corefx,rjxby/corefx,JosephTremoulet/corefx,mazong1123/corefx,ravimeda/corefx,iamjasonp/corefx,nbarbettini/corefx,lggomez/corefx,rahku/corefx,alphonsekurian/corefx,nbarbettini/corefx,yizhang82/corefx,axelheer/corefx,ellismg/corefx,twsouthwick/corefx,jhendrixMSFT/corefx,wtgodbe/corefx,stephenmichaelf/corefx,ViktorHofer/corefx,Petermarcu/corefx,iamjasonp/corefx,jlin177/corefx,MaggieTsang/corefx,dotnet-bot/corefx,dotnet-bot/corefx,rahku/corefx,gkhanna79/corefx,nchikanov/corefx,parjong/corefx,twsouthwick/corefx,weltkante/corefx,rjxby/corefx,krk/corefx,dhoehna/corefx,dhoehna/corefx,krytarowski/corefx,parjong/corefx,JosephTremoulet/corefx,YoupHulsebos/corefx,yizhang82/corefx,JosephTremoulet/corefx,zhenlan/corefx,seanshpark/corefx,manu-silicon/corefx,ravimeda/corefx,the-dwyer/corefx,richlander/corefx,Ermiar/corefx,jlin177/corefx,krk/corefx,cydhaselton/corefx,billwert/corefx,twsouthwick/corefx,alphonsekurian/corefx,tijoytom/corefx,twsouthwick/corefx,nbarbettini/corefx,wtgodbe/corefx,MaggieTsang/corefx,dotnet-bot/corefx,Chrisboh/corefx,tijoytom/corefx,weltkante/corefx,jlin177/corefx,nchikanov/corefx,dotnet-bot/corefx,mmitche/corefx,marksmeltzer/corefx,ericstj/corefx,DnlHarvey/corefx,the-dwyer/corefx,Jiayili1/corefx,adamralph/corefx,yizhang82/corefx,Jiayili1/corefx,Jiayili1/corefx,stone-li/corefx,gkhanna79/corefx,mazong1123/corefx,shmao/corefx,marksmeltzer/corefx,JosephTremoulet/corefx,stephenmichaelf/corefx,seanshpark/corefx,ptoonen/corefx,dsplaisted/corefx,axelheer/corefx,dotnet-bot/corefx,alexperovich/corefx,Petermarcu/corefx,alphonsekurian/corefx | src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeConverterAttribute.cs | src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeConverterAttribute.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.
namespace System.ComponentModel
{
/// <devdoc>
/// <para>
/// Specifies what type to use as a converter for the object this
/// attribute is bound to. This class cannot be inherited.
/// </para>
/// </devdoc>
[AttributeUsage(AttributeTargets.All)]
public sealed class TypeConverterAttribute : Attribute
{
private string _typeName;
/// <devdoc>
/// <para>
/// Initializes a new instance of the <see cref='System.ComponentModel.TypeConverterAttribute'/> class,
/// using the specified type as the data converter for the object this attribute is bound to.
/// </para>
/// </devdoc>
public TypeConverterAttribute(Type type)
{
_typeName = type.AssemblyQualifiedName;
}
/// <devdoc>
/// <para>
/// Initializes a new instance of the <see cref='System.ComponentModel.TypeConverterAttribute'/> class,
/// using the specified type name as the data converter for the object this attribute is bound to.
/// </para>
/// </devdoc>
public TypeConverterAttribute(string typeName)
{
_typeName = typeName;
}
/// <devdoc>
/// <para>
/// Gets the fully qualified type name of the <see cref='System.Type'/> to use as a converter for
/// the object this attribute is bound to.
/// </para>
/// </devdoc>
public string ConverterTypeName
{
get
{
return _typeName;
}
}
public override bool Equals(object obj)
{
TypeConverterAttribute other = obj as TypeConverterAttribute;
return (other != null) && other.ConverterTypeName == _typeName;
}
public override int GetHashCode()
{
return _typeName.GetHashCode();
}
}
}
| // 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.Globalization;
namespace System.ComponentModel
{
/// <devdoc>
/// <para>Specifies what type to use as
/// a converter for the object
/// this
/// attribute is bound to. This class cannot
/// be inherited.</para>
/// </devdoc>
[AttributeUsage(AttributeTargets.All)]
public sealed class TypeConverterAttribute : Attribute
{
private string _typeName;
/// <devdoc>
/// <para>Initializes a new instance of the <see cref='System.ComponentModel.TypeConverterAttribute'/> class, using
/// the specified type as the data converter for the object this attribute
/// is bound
/// to.</para>
/// </devdoc>
public TypeConverterAttribute(Type type)
{
_typeName = type.AssemblyQualifiedName;
}
/// <devdoc>
/// <para>Initializes a new instance of the <see cref='System.ComponentModel.TypeConverterAttribute'/> class, using
/// the specified type name as the data converter for the object this attribute is bound to.</para>
/// </devdoc>
public TypeConverterAttribute(string typeName)
{
_typeName = typeName;
}
/// <devdoc>
/// <para>Gets the fully qualified type name of the <see cref='System.Type'/>
/// to use as a converter for the object this attribute
/// is bound to.</para>
/// </devdoc>
public string ConverterTypeName
{
get
{
return _typeName;
}
}
public override bool Equals(object obj)
{
TypeConverterAttribute other = obj as TypeConverterAttribute;
return (other != null) && other.ConverterTypeName == _typeName;
}
public override int GetHashCode()
{
return _typeName.GetHashCode();
}
}
}
| mit | C# |
22b8bb57009bccfd053d2ed0f038bb432795d1d9 | Enable NRT | KevinRansom/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,sharwell/roslyn,sharwell/roslyn,weltkante/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,dotnet/roslyn,weltkante/roslyn,mavasani/roslyn,mavasani/roslyn,diryboy/roslyn,KevinRansom/roslyn,weltkante/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,dotnet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn | src/Analyzers/CSharp/Analyzers/SimplifyBooleanExpression/CSharpSimplifyConditionalDiagnosticAnalyzer.cs | src/Analyzers/CSharp/Analyzers/SimplifyBooleanExpression/CSharpSimplifyConditionalDiagnosticAnalyzer.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.Threading;
using Microsoft.CodeAnalysis.CSharp.LanguageServices;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.SimplifyBooleanExpression;
namespace Microsoft.CodeAnalysis.CSharp.SimplifyBooleanExpression
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
internal class CSharpSimplifyConditionalDiagnosticAnalyzer :
AbstractSimplifyConditionalDiagnosticAnalyzer<
SyntaxKind,
ExpressionSyntax,
ConditionalExpressionSyntax>
{
protected override ISyntaxFacts SyntaxFacts
=> CSharpSyntaxFacts.Instance;
protected override CommonConversion GetConversion(SemanticModel semanticModel, ExpressionSyntax node, CancellationToken cancellationToken)
=> semanticModel.GetConversion(node, cancellationToken).ToCommonConversion();
}
}
| // 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 disable
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.LanguageServices;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.SimplifyBooleanExpression;
namespace Microsoft.CodeAnalysis.CSharp.SimplifyBooleanExpression
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
internal class CSharpSimplifyConditionalDiagnosticAnalyzer :
AbstractSimplifyConditionalDiagnosticAnalyzer<
SyntaxKind,
ExpressionSyntax,
ConditionalExpressionSyntax>
{
protected override ISyntaxFacts SyntaxFacts
=> CSharpSyntaxFacts.Instance;
protected override CommonConversion GetConversion(SemanticModel semanticModel, ExpressionSyntax node, CancellationToken cancellationToken)
=> semanticModel.GetConversion(node, cancellationToken).ToCommonConversion();
}
}
| mit | C# |
7f13c3e0af7d5ec6d2964a4639e62a9579932cf0 | Update FormattingSelectedCharacters.cs | aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET | Examples/CSharp/Formatting/FormattingSelectedCharacters.cs | Examples/CSharp/Formatting/FormattingSelectedCharacters.cs | using System.IO;
using Aspose.Cells;
using System.Drawing;
namespace Aspose.Cells.Examples.Formatting
{
public class FormattingSelectedCharacters
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the first(default) worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];
//Accessing the "A1" cell from the worksheet
Cell cell = worksheet.Cells["A1"];
//Adding some value to the "A1" cell
cell.PutValue("Visit Aspose!");
//Setting the font of selected characters to bold
cell.Characters(6, 7).Font.IsBold = true;
//Setting the font color of selected characters to blue
cell.Characters(6, 7).Font.Color = Color.Blue;
//Saving the Excel file
workbook.Save(dataDir + "book1.out.xls");
//ExEnd:1
}
}
}
| using System.IO;
using Aspose.Cells;
using System.Drawing;
namespace Aspose.Cells.Examples.Formatting
{
public class FormattingSelectedCharacters
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the first(default) worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];
//Accessing the "A1" cell from the worksheet
Cell cell = worksheet.Cells["A1"];
//Adding some value to the "A1" cell
cell.PutValue("Visit Aspose!");
//Setting the font of selected characters to bold
cell.Characters(6, 7).Font.IsBold = true;
//Setting the font color of selected characters to blue
cell.Characters(6, 7).Font.Color = Color.Blue;
//Saving the Excel file
workbook.Save(dataDir + "book1.out.xls");
}
}
} | mit | C# |
e518ee4de8df60af9734aac8dbe715b1e9fd2236 | Downgrade GitLink to latest stable release | cake-contrib/Cake.Recipe,cake-contrib/Cake.Recipe | Cake.Recipe/Content/tools.cake | Cake.Recipe/Content/tools.cake | ///////////////////////////////////////////////////////////////////////////////
// TOOLS
///////////////////////////////////////////////////////////////////////////////
private const string CodecovTool = "#tool nuget:?package=codecov&version=1.0.1";
private const string CoverallsTool = "#tool nuget:?package=coveralls.io&version=1.3.4";
private const string GitReleaseManagerTool = "#tool nuget:?package=gitreleasemanager&version=0.5.0";
private const string GitVersionTool = "#tool nuget:?package=GitVersion.CommandLine&version=3.6.2";
private const string ReSharperTools = "#tool nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2017.1.20170428.83814";
private const string ReSharperReportsTool = "#tool nuget:?package=ReSharperReports&version=0.2.0";
private const string KuduSyncTool = "#tool nuget:?package=KuduSync.NET&version=1.3.1";
private const string WyamTool = "#tool nuget:?package=Wyam&version=0.17.7";
private const string GitLinkTool = "#tool nuget:?package=gitlink&version=2.4.0";
private const string MSBuildExtensionPackTool = "#tool nuget:?package=MSBuild.Extension.Pack&version=1.9.0";
private const string XUnitTool = "#tool nuget:?package=xunit.runner.console&version=2.1.0";
private const string NUnitTool = "#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.1";
private const string OpenCoverTool = "#tool nuget:?package=OpenCover&version=4.6.519";
private const string ReportGeneratorTool = "#tool nuget:?package=ReportGenerator&version=2.4.5";
private const string ReportUnitTool = "#tool nuget:?package=ReportUnit&version=1.2.1";
private const string FixieTool = "#tool nuget:?package=Fixie&version=1.0.2";
Action<string, Action> RequireTool = (tool, action) => {
var script = MakeAbsolute(File(string.Format("./{0}.cake", Guid.NewGuid())));
try
{
System.IO.File.WriteAllText(script.FullPath, tool);
CakeExecuteScript(script);
}
finally
{
if (FileExists(script))
{
DeleteFile(script);
}
}
action();
};
| ///////////////////////////////////////////////////////////////////////////////
// TOOLS
///////////////////////////////////////////////////////////////////////////////
private const string CodecovTool = "#tool nuget:?package=codecov&version=1.0.1";
private const string CoverallsTool = "#tool nuget:?package=coveralls.io&version=1.3.4";
private const string GitReleaseManagerTool = "#tool nuget:?package=gitreleasemanager&version=0.5.0";
private const string GitVersionTool = "#tool nuget:?package=GitVersion.CommandLine&version=3.6.2";
private const string ReSharperTools = "#tool nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2017.1.20170428.83814";
private const string ReSharperReportsTool = "#tool nuget:?package=ReSharperReports&version=0.2.0";
private const string KuduSyncTool = "#tool nuget:?package=KuduSync.NET&version=1.3.1";
private const string WyamTool = "#tool nuget:?package=Wyam&version=0.17.7";
private const string GitLinkTool = "#tool nuget:?package=gitlink&version=2.4.1";
private const string MSBuildExtensionPackTool = "#tool nuget:?package=MSBuild.Extension.Pack&version=1.9.0";
private const string XUnitTool = "#tool nuget:?package=xunit.runner.console&version=2.1.0";
private const string NUnitTool = "#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.1";
private const string OpenCoverTool = "#tool nuget:?package=OpenCover&version=4.6.519";
private const string ReportGeneratorTool = "#tool nuget:?package=ReportGenerator&version=2.4.5";
private const string ReportUnitTool = "#tool nuget:?package=ReportUnit&version=1.2.1";
private const string FixieTool = "#tool nuget:?package=Fixie&version=1.0.2";
Action<string, Action> RequireTool = (tool, action) => {
var script = MakeAbsolute(File(string.Format("./{0}.cake", Guid.NewGuid())));
try
{
System.IO.File.WriteAllText(script.FullPath, tool);
CakeExecuteScript(script);
}
finally
{
if (FileExists(script))
{
DeleteFile(script);
}
}
action();
};
| mit | C# |
a7f6d3da3b9ad6f2bad570d49470b7750d26bebd | Make SdlWindowHandle private | ppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework | osu.Framework/Platform/Sdl/Sdl2GraphicsBackend.cs | osu.Framework/Platform/Sdl/Sdl2GraphicsBackend.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 SDL2;
namespace osu.Framework.Platform.Sdl
{
internal class Sdl2GraphicsBackend : PassthroughGraphicsBackend
{
private IntPtr sdlWindowHandle;
public override bool VerticalSync
{
get => SDL.SDL_GL_GetSwapInterval() != 0;
set => SDL.SDL_GL_SetSwapInterval(value ? 1 : 0);
}
protected override IntPtr CreateContext() => SDL.SDL_GL_CreateContext(sdlWindowHandle);
protected override void MakeCurrent(IntPtr context) => SDL.SDL_GL_MakeCurrent(sdlWindowHandle, context);
public override void SwapBuffers() => SDL.SDL_GL_SwapWindow(sdlWindowHandle);
protected override IntPtr GetProcAddress(string symbol) => SDL.SDL_GL_GetProcAddress(symbol);
public override void Initialise(IWindowBackend windowBackend)
{
if (windowBackend is Sdl2WindowBackend sdlWindowBackend)
sdlWindowHandle = sdlWindowBackend.SdlWindowHandle;
else
throw new ArgumentException("Unsupported window backend.", nameof(windowBackend));
base.Initialise(windowBackend);
}
}
}
| // 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 SDL2;
namespace osu.Framework.Platform.Sdl
{
internal class Sdl2GraphicsBackend : PassthroughGraphicsBackend
{
internal IntPtr SdlWindowHandle;
public override bool VerticalSync
{
get => SDL.SDL_GL_GetSwapInterval() != 0;
set => SDL.SDL_GL_SetSwapInterval(value ? 1 : 0);
}
protected override IntPtr CreateContext() => SDL.SDL_GL_CreateContext(SdlWindowHandle);
protected override void MakeCurrent(IntPtr context) => SDL.SDL_GL_MakeCurrent(SdlWindowHandle, context);
public override void SwapBuffers() => SDL.SDL_GL_SwapWindow(SdlWindowHandle);
protected override IntPtr GetProcAddress(string symbol) => SDL.SDL_GL_GetProcAddress(symbol);
public override void Initialise(IWindowBackend windowBackend)
{
if (windowBackend is Sdl2WindowBackend sdlWindowBackend)
SdlWindowHandle = sdlWindowBackend.SdlWindowHandle;
else
throw new ArgumentException("Unsupported window backend.", nameof(windowBackend));
base.Initialise(windowBackend);
}
}
}
| mit | C# |
08c1a2d4a3885c0408786e9dfdf21fb21e641077 | remove -rc suffix | KevinJump/uSync,KevinJump/uSync,KevinJump/uSync | uSync8.BackOffice/BackOfficeConstants.cs | uSync8.BackOffice/BackOfficeConstants.cs | namespace uSync8.BackOffice
{
public static partial class uSyncBackOfficeConstants
{
public const string ReleaseSuffix = "";
public const string ConfigFile = "uSync8.config";
public static class Priorites
{
public const int USYNC_RESERVED_LOWER = 1000;
public const int USYNC_RESERVED_UPPER = 2000;
public const int DataTypes = USYNC_RESERVED_LOWER + 10;
public const int Templates = USYNC_RESERVED_LOWER + 20;
public const int ContentTypes = USYNC_RESERVED_LOWER + 30;
public const int MediaTypes = USYNC_RESERVED_LOWER + 40;
public const int MemberTypes = USYNC_RESERVED_LOWER + 45;
public const int Languages = USYNC_RESERVED_LOWER + 5;
public const int DictionaryItems = USYNC_RESERVED_LOWER + 6;
public const int Macros = USYNC_RESERVED_LOWER + 70;
public const int Media = USYNC_RESERVED_LOWER + 200;
public const int Content = USYNC_RESERVED_LOWER + 210;
public const int ContentTemplate = USYNC_RESERVED_LOWER + 215;
public const int DomainSettings = USYNC_RESERVED_LOWER + 219;
public const int DataTypeMappings = USYNC_RESERVED_LOWER + 220;
public const int RelationTypes = USYNC_RESERVED_LOWER + 230;
}
public static class Groups
{
public const string Settings = "Settings";
public const string Content = "Content";
public const string Members = "Members";
public const string Users = "Users";
}
}
}
| namespace uSync8.BackOffice
{
public static partial class uSyncBackOfficeConstants
{
public const string ReleaseSuffix = "-rc";
public const string ConfigFile = "uSync8.config";
public static class Priorites
{
public const int USYNC_RESERVED_LOWER = 1000;
public const int USYNC_RESERVED_UPPER = 2000;
public const int DataTypes = USYNC_RESERVED_LOWER + 10;
public const int Templates = USYNC_RESERVED_LOWER + 20;
public const int ContentTypes = USYNC_RESERVED_LOWER + 30;
public const int MediaTypes = USYNC_RESERVED_LOWER + 40;
public const int MemberTypes = USYNC_RESERVED_LOWER + 45;
public const int Languages = USYNC_RESERVED_LOWER + 5;
public const int DictionaryItems = USYNC_RESERVED_LOWER + 6;
public const int Macros = USYNC_RESERVED_LOWER + 70;
public const int Media = USYNC_RESERVED_LOWER + 200;
public const int Content = USYNC_RESERVED_LOWER + 210;
public const int ContentTemplate = USYNC_RESERVED_LOWER + 215;
public const int DomainSettings = USYNC_RESERVED_LOWER + 219;
public const int DataTypeMappings = USYNC_RESERVED_LOWER + 220;
public const int RelationTypes = USYNC_RESERVED_LOWER + 230;
}
public static class Groups
{
public const string Settings = "Settings";
public const string Content = "Content";
public const string Members = "Members";
public const string Users = "Users";
}
}
}
| mpl-2.0 | C# |
10348af50fc26b09ec12fab5f865cdab07dd4e7c | Add a foreach induction variable cast test | jonathanvdc/ecsc | tests/cs/foreach/Foreach.cs | tests/cs/foreach/Foreach.cs | using System;
using System.Collections.Generic;
public class Enumerator
{
public Enumerator() { }
public int Current { get; private set; } = 10;
public bool MoveNext()
{
Current--;
return Current > 0;
}
public void Dispose()
{
Console.WriteLine("Hi!");
}
}
public class Enumerable
{
public Enumerable() { }
public Enumerator GetEnumerator()
{
return new Enumerator();
}
}
public static class Program
{
public static Enumerable StaticEnumerable = new Enumerable();
public static void Main(string[] Args)
{
var col = Args;
foreach (var item in col)
Console.WriteLine(item);
foreach (var item in new List<string>(Args))
Console.WriteLine(item);
foreach (var item in StaticEnumerable)
Console.WriteLine(item);
foreach (string item in new List<object>())
Console.WriteLine(item);
}
}
| using System;
using System.Collections.Generic;
public class Enumerator
{
public Enumerator() { }
public int Current { get; private set; } = 10;
public bool MoveNext()
{
Current--;
return Current > 0;
}
public void Dispose()
{
Console.WriteLine("Hi!");
}
}
public class Enumerable
{
public Enumerable() { }
public Enumerator GetEnumerator()
{
return new Enumerator();
}
}
public static class Program
{
public static Enumerable StaticEnumerable = new Enumerable();
public static void Main(string[] Args)
{
var col = Args;
foreach (var item in col)
Console.WriteLine(item);
foreach (var item in new List<string>(Args))
Console.WriteLine(item);
foreach (var item in StaticEnumerable)
Console.WriteLine(item);
}
}
| mit | C# |
534ed81010699de441a01a2e3936331be0f8112f | Hide iOS home indicator | peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework | osu.Framework.iOS/GameViewController.cs | osu.Framework.iOS/GameViewController.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 CoreGraphics;
using osu.Framework.Platform;
using UIKit;
namespace osu.Framework.iOS
{
internal class GameViewController : UIViewController
{
private readonly IOSGameView gameView;
private readonly GameHost gameHost;
public override bool PrefersStatusBarHidden() => true;
public override bool PrefersHomeIndicatorAutoHidden => true;
public override UIRectEdge PreferredScreenEdgesDeferringSystemGestures => UIRectEdge.All;
public GameViewController(IOSGameView view, GameHost host)
{
View = view;
gameView = view;
gameHost = host;
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
gameHost.Collect();
}
public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
{
coordinator.AnimateAlongsideTransition(_ => { }, _ => UIView.AnimationsEnabled = true);
UIView.AnimationsEnabled = false;
base.ViewWillTransitionToSize(toSize, coordinator);
gameView.RequestResizeFrameBuffer();
}
}
}
| // 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 CoreGraphics;
using osu.Framework.Platform;
using UIKit;
namespace osu.Framework.iOS
{
internal class GameViewController : UIViewController
{
private readonly IOSGameView gameView;
private readonly GameHost gameHost;
public override bool PrefersStatusBarHidden() => true;
public override UIRectEdge PreferredScreenEdgesDeferringSystemGestures => UIRectEdge.All;
public GameViewController(IOSGameView view, GameHost host)
{
View = view;
gameView = view;
gameHost = host;
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
gameHost.Collect();
}
public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
{
coordinator.AnimateAlongsideTransition(_ => { }, _ => UIView.AnimationsEnabled = true);
UIView.AnimationsEnabled = false;
base.ViewWillTransitionToSize(toSize, coordinator);
gameView.RequestResizeFrameBuffer();
}
}
}
| mit | C# |
43843ac5586b2fb5e25292f80c4147e0ebab213c | Remove explicit dispose | EVAST9919/osu,johnneijzen/osu,smoogipoo/osu,peppy/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,naoey/osu,johnneijzen/osu,ppy/osu,UselessToucan/osu,smoogipooo/osu,DrabWeb/osu,NeoAdonis/osu,NeoAdonis/osu,ZLima12/osu,ppy/osu,2yangk23/osu,peppy/osu-new,naoey/osu,DrabWeb/osu,ZLima12/osu,peppy/osu,smoogipoo/osu,DrabWeb/osu,smoogipoo/osu,2yangk23/osu,EVAST9919/osu,NeoAdonis/osu,naoey/osu | osu.Game/Tests/Visual/ScreenTestCase.cs | osu.Game/Tests/Visual/ScreenTestCase.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Screens;
namespace osu.Game.Tests.Visual
{
/// <summary>
/// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions).
/// </summary>
public abstract class ScreenTestCase : OsuTestCase
{
private readonly ScreenStack stack;
[Cached]
private BackgroundScreenStack backgroundStack;
protected ScreenTestCase()
{
Children = new Drawable[]
{
backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both },
stack = new ScreenStack { RelativeSizeAxes = Axes.Both }
};
}
protected void LoadScreen(OsuScreen screen)
{
if (stack.CurrentScreen != null)
stack.Exit();
stack.Push(screen);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Screens;
namespace osu.Game.Tests.Visual
{
/// <summary>
/// A test case which can be used to test a screen (that relies on OnEntering being called to execute startup instructions).
/// </summary>
public abstract class ScreenTestCase : OsuTestCase
{
private readonly ScreenStack stack;
[Cached]
private BackgroundScreenStack backgroundStack;
protected ScreenTestCase()
{
Children = new Drawable[]
{
backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both },
stack = new ScreenStack { RelativeSizeAxes = Axes.Both }
};
}
protected void LoadScreen(OsuScreen screen)
{
if (stack.CurrentScreen != null)
stack.Exit();
stack.Push(screen);
}
protected override void Dispose(bool isDisposing)
{
stack.Dispose();
base.Dispose(isDisposing);
}
}
}
| mit | C# |
7750f36f88295386eff67e0d16742e08de0b8d15 | Remove unnecessary suppressions. | GGG-KILLER/GUtils.NET | GUtils.Net/GlobalSuppressions.cs | GUtils.Net/GlobalSuppressions.cs | /*
* Copyright © 2019 GGG KILLER <gggkiller2@gmail.com>
*
* 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.
*/
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project. Project-level
// suppressions either have no target or are given a specific
// target and scoped to a namespace, type, member, etc.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage ( "Style", "IDE0007:Use implicit type", Justification = "<Pending>", Scope = "member", Target = "~M:GUtils.Net.DownloadClient.DownloadToStreamAsync(System.IO.Stream,System.Int32)~System.Threading.Tasks.Task" )]
| /*
* Copyright © 2019 GGG KILLER <gggkiller2@gmail.com>
*
* 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.
*/
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project. Project-level
// suppressions either have no target or are given a specific
// target and scoped to a namespace, type, member, etc.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage ( "Usage", "CC0074:Make field readonly", Justification = "<Pending>", Scope = "member", Target = "~F:GUtils.Net.DownloadClient.UserAgent" )]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage ( "Style", "IDE0007:Use implicit type", Justification = "<Pending>", Scope = "member", Target = "~M:GUtils.Net.DownloadClient.DownloadToStreamAsync(System.IO.Stream,System.Int32)~System.Threading.Tasks.Task" )]
| mit | C# |
f9660c475a039e1e66d9ab609ebe37f67483ddbf | Fix benchmarking double parsing | nickbabcock/Pfarah,nickbabcock/Pfarah | src/Pfarah.Benchmarks/ParseDouble.cs | src/Pfarah.Benchmarks/ParseDouble.cs | using BenchmarkDotNet.Attributes;
using System.Text;
using System.Globalization;
namespace Pfarah.Benchmarks
{
public class ParseDouble
{
private byte[] data;
private readonly NumberStyles numStyle = NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign;
[Setup]
public void SetupData()
{
data = Encoding.UTF8.GetBytes(Payload);
}
[Params("50", "15.3", "1.000", "0.98765", "abc")]
public string Payload { get; set; }
[Benchmark]
public double? pfarahParseDouble()
{
return Utils.parseDouble(data, data.Length);
}
[Benchmark]
public double? bclParseDouble()
{
double res;
if (double.TryParse(Payload, numStyle, CultureInfo.InvariantCulture, out res))
{
return res;
}
return null;
}
}
}
| using BenchmarkDotNet.Attributes;
using System.Text;
using System.Globalization;
namespace Pfarah.Benchmarks
{
public class ParseDouble
{
private byte[] data;
private readonly NumberStyles numStyle = NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign;
[Setup]
public void SetupData()
{
data = Encoding.UTF8.GetBytes(Payload);
}
[Params("50", "15.3", "1.000", "0.98765", "abc")]
public string Payload { get; set; }
[Benchmark]
public double? pfarahParseDouble()
{
return Utils.parseDouble(data, data.Length);
}
[Benchmark]
public double? bclParseDouble()
{
double res;
if (double.TryParse("3.0000", numStyle, CultureInfo.InvariantCulture, out res))
{
return res;
}
return null;
}
}
}
| mit | C# |
12c8dc958dd4d3e3583d41baa2976efc3d4f0e90 | fix notifica duplicata in aggiungi chiamata | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.SignalR/Sender/GestioneChiamateInCorso/NotificationAddChiamataInCorso.cs | src/backend/SO115App.SignalR/Sender/GestioneChiamateInCorso/NotificationAddChiamataInCorso.cs | //-----------------------------------------------------------------------
// <copyright file="NotificationAddChiamataInCorso.cs" company="CNVVF">
// Copyright (C) 2017 - CNVVF
//
// This file is part of SOVVF.
// SOVVF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// SOVVF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
//-----------------------------------------------------------------------
using DomainModel.CQRS.Commands.ChiamataInCorsoMarker;
using Microsoft.AspNetCore.SignalR;
using SO115App.Models.Servizi.Infrastruttura.Notification.GestioneChiamateInCorso;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Competenze;
using SO115App.SignalR.Utility;
using System.Threading.Tasks;
namespace SO115App.SignalR.Sender.GestioneChiamateInCorso
{
public class NotificationAddChiamataInCorso : INotificationAddChiamataInCorso
{
private readonly IHubContext<NotificationHub> _notificationHubContext;
private readonly GetGerarchiaToSend _getGerarchiaToSend;
private readonly IGetCompetenzeByCoordinateIntervento _getCompetenze;
public NotificationAddChiamataInCorso(IHubContext<NotificationHub> NotificationHubContext,
GetGerarchiaToSend getGerarchiaToSend,
IGetCompetenzeByCoordinateIntervento getCompetenze)
{
_getGerarchiaToSend = getGerarchiaToSend;
_getCompetenze = getCompetenze;
_notificationHubContext = NotificationHubContext;
}
public async Task SendNotification(ChiamataInCorsoMarkerCommand chiamata)
{
var Competenze = _getCompetenze.GetCompetenzeByCoordinateIntervento(chiamata.AddChiamataInCorso.Localita.Coordinate);
var SediDaNotificare = _getGerarchiaToSend.Get(Competenze[0]);
foreach (var sede in SediDaNotificare)
await _notificationHubContext.Clients.Group(sede).SendAsync("NotifyChiamataInCorsoMarkerAdd", chiamata);
}
}
}
| //-----------------------------------------------------------------------
// <copyright file="NotificationAddChiamataInCorso.cs" company="CNVVF">
// Copyright (C) 2017 - CNVVF
//
// This file is part of SOVVF.
// SOVVF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// SOVVF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
//-----------------------------------------------------------------------
using DomainModel.CQRS.Commands.ChiamataInCorsoMarker;
using Microsoft.AspNetCore.SignalR;
using SO115App.Models.Servizi.Infrastruttura.Notification.GestioneChiamateInCorso;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Competenze;
using SO115App.SignalR.Utility;
using System.Threading.Tasks;
namespace SO115App.SignalR.Sender.GestioneChiamateInCorso
{
public class NotificationAddChiamataInCorso : INotificationAddChiamataInCorso
{
private readonly IHubContext<NotificationHub> _notificationHubContext;
private readonly GetGerarchiaToSend _getGerarchiaToSend;
private readonly IGetCompetenzeByCoordinateIntervento _getCompetenze;
public NotificationAddChiamataInCorso(IHubContext<NotificationHub> NotificationHubContext,
GetGerarchiaToSend getGerarchiaToSend,
IGetCompetenzeByCoordinateIntervento getCompetenze)
{
_getGerarchiaToSend = getGerarchiaToSend;
_getCompetenze = getCompetenze;
_notificationHubContext = NotificationHubContext;
}
public async Task SendNotification(ChiamataInCorsoMarkerCommand chiamata)
{
var Competenze = _getCompetenze.GetCompetenzeByCoordinateIntervento(chiamata.AddChiamataInCorso.Localita.Coordinate);
var SediDaNotificare = _getGerarchiaToSend.Get(Competenze[0]);
SediDaNotificare.Add(chiamata.AddChiamataInCorso.CodiceSedeOperatore);
foreach (var sede in SediDaNotificare)
await _notificationHubContext.Clients.Group(sede).SendAsync("NotifyChiamataInCorsoMarkerAdd", chiamata);
}
}
}
| agpl-3.0 | C# |
2b20dc540407bc458944d52ab2b9cfb7aa3b98da | Disable xunit parallel test runner | michael-wolfenden/Cake.IIS,SharpeRAD/Cake.IIS | src/Tests/Properties/AssemblyInfo.cs | src/Tests/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Xunit;
// 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("Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tests")]
[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("12f5e778-f521-40d5-98b9-b90c2d1ebb09")]
// 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")]
// Disable parallel test running
// http://xunit.github.io/docs/running-tests-in-parallel.html
[assembly: CollectionBehavior(MaxParallelThreads = 1, DisableTestParallelization = true)] | 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("Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tests")]
[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("12f5e778-f521-40d5-98b9-b90c2d1ebb09")]
// 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# |
05e51d730ce23d4ffa3018c2856924bab90e60b5 | update tracing code | tbitowner/IdentityServer3,paulofoliveira/IdentityServer3,bestwpw/IdentityServer3,wondertrap/IdentityServer3,wondertrap/IdentityServer3,kouweizhong/IdentityServer3,chicoribas/IdentityServer3,olohmann/IdentityServer3,openbizgit/IdentityServer3,angelapper/IdentityServer3,mvalipour/IdentityServer3,tuyndv/IdentityServer3,bodell/IdentityServer3,jonathankarsh/IdentityServer3,tuyndv/IdentityServer3,buddhike/IdentityServer3,tbitowner/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,IdentityServer/IdentityServer3,bodell/IdentityServer3,Agrando/IdentityServer3,remunda/IdentityServer3,ryanvgates/IdentityServer3,Agrando/IdentityServer3,openbizgit/IdentityServer3,tonyeung/IdentityServer3,wondertrap/IdentityServer3,tuyndv/IdentityServer3,uoko-J-Go/IdentityServer,Agrando/IdentityServer3,uoko-J-Go/IdentityServer,paulofoliveira/IdentityServer3,yanjustino/IdentityServer3,faithword/IdentityServer3,EternalXw/IdentityServer3,tonyeung/IdentityServer3,jackswei/IdentityServer3,charoco/IdentityServer3,charoco/IdentityServer3,codeice/IdentityServer3,kouweizhong/IdentityServer3,olohmann/IdentityServer3,ryanvgates/IdentityServer3,delloncba/IdentityServer3,roflkins/IdentityServer3,bestwpw/IdentityServer3,roflkins/IdentityServer3,uoko-J-Go/IdentityServer,olohmann/IdentityServer3,jackswei/IdentityServer3,delRyan/IdentityServer3,EternalXw/IdentityServer3,kouweizhong/IdentityServer3,delRyan/IdentityServer3,faithword/IdentityServer3,angelapper/IdentityServer3,chicoribas/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,feanz/Thinktecture.IdentityServer.v3,roflkins/IdentityServer3,faithword/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,feanz/Thinktecture.IdentityServer.v3,SonOfSam/IdentityServer3,tonyeung/IdentityServer3,yanjustino/IdentityServer3,tbitowner/IdentityServer3,jonathankarsh/IdentityServer3,mvalipour/IdentityServer3,SonOfSam/IdentityServer3,chicoribas/IdentityServer3,codeice/IdentityServer3,remunda/IdentityServer3,buddhike/IdentityServer3,EternalXw/IdentityServer3,IdentityServer/IdentityServer3,angelapper/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,delloncba/IdentityServer3,paulofoliveira/IdentityServer3,delloncba/IdentityServer3,buddhike/IdentityServer3,18098924759/IdentityServer3,remunda/IdentityServer3,iamkoch/IdentityServer3,ryanvgates/IdentityServer3,codeice/IdentityServer3,SonOfSam/IdentityServer3,iamkoch/IdentityServer3,18098924759/IdentityServer3,bodell/IdentityServer3,mvalipour/IdentityServer3,yanjustino/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,IdentityServer/IdentityServer3,jonathankarsh/IdentityServer3,18098924759/IdentityServer3,bestwpw/IdentityServer3,openbizgit/IdentityServer3,delRyan/IdentityServer3,jackswei/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,charoco/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,iamkoch/IdentityServer3 | source/Core/Configuration/Hosting/WebApiConfig.cs | source/Core/Configuration/Hosting/WebApiConfig.cs | /*
* Copyright 2014 Dominick Baier, Brock Allen
*
* 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.Diagnostics;
using System.Web.Http;
using System.Web.Http.ExceptionHandling;
using Thinktecture.IdentityServer.Core.Logging;
namespace Thinktecture.IdentityServer.Core.Configuration.Hosting
{
internal static class WebApiConfig
{
public static HttpConfiguration Configure(IdentityServerOptions options)
{
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
config.SuppressDefaultHostAuthentication();
config.MessageHandlers.Insert(0, new KatanaDependencyResolver());
config.Services.Add(typeof(IExceptionLogger), new LogProviderExceptionLogger());
config.Formatters.Remove(config.Formatters.XmlFormatter);
if (options.DiagnosticsOptions.EnableWebApiDiagnostics)
{
var liblog = new TraceSource("LibLog");
liblog.Switch.Level = SourceLevels.All;
liblog.Listeners.Add(new LibLogTraceListener());
var diag = config.EnableSystemDiagnosticsTracing();
diag.IsVerbose = options.DiagnosticsOptions.WebApiDiagnosticsIsVerbose;
diag.TraceSource = liblog;
}
return config;
}
}
} | /*
* Copyright 2014 Dominick Baier, Brock Allen
*
* 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.Diagnostics;
using System.Web.Http;
using System.Web.Http.ExceptionHandling;
using Thinktecture.IdentityServer.Core.Logging;
namespace Thinktecture.IdentityServer.Core.Configuration.Hosting
{
internal static class WebApiConfig
{
public static HttpConfiguration Configure(IdentityServerOptions options)
{
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
config.SuppressDefaultHostAuthentication();
config.MessageHandlers.Insert(0, new KatanaDependencyResolver());
config.Services.Add(typeof(IExceptionLogger), new LogProviderExceptionLogger());
config.Formatters.Remove(config.Formatters.XmlFormatter);
if (options.DiagnosticsOptions.EnableWebApiDiagnostics)
{
var diag = config.EnableSystemDiagnosticsTracing();
var liblog = new TraceSource("LibLog");
liblog.Switch.Level = SourceLevels.All;
liblog.Listeners.Add(new LibLogTraceListener());
diag.TraceSource = liblog;
diag.IsVerbose = options.DiagnosticsOptions.WebApiDiagnosticsIsVerbose;
}
return config;
}
}
} | apache-2.0 | C# |
198d518d487e12a361b6a076128889d369937263 | Set the Key when NameConstant gets created | mvbalaw/MvbaCore | src/MvbaCore/NamedConstant.cs | src/MvbaCore/NamedConstant.cs | using System;
using System.Collections.Generic;
using System.Reflection;
using MvbaCore.Extensions;
namespace MvbaCore
{
[Serializable]
#pragma warning disable 661,660
public class NamedConstant<T> : INamedConstant
#pragma warning restore 661,660
where T : NamedConstant<T>
{
private static readonly Dictionary<string, T> NamedConstants = new Dictionary<string, T>();
protected void Add(string key, T item)
{
Key = key;
NamedConstants.Add(key.ToLower(), item);
}
protected static IEnumerable<T> Values()
{
return NamedConstants.Values;
}
protected static T Get(string key)
{
if (key == null)
{
return null;
}
T t;
NamedConstants.TryGetValue(key.ToLower(), out t);
return t;
}
public static bool operator ==(NamedConstant<T> a, NamedConstant<T> b)
{
if (ReferenceEquals(a, b))
{
return true;
}
if (((object)a == null) || ((object)b == null))
{
return false;
}
return a.Equals(b);
}
public static bool operator !=(NamedConstant<T> a, NamedConstant<T> b)
{
return !(a == b);
}
public string Key { get; protected set; }
public static T GetFor(string key)
{
if (NamedConstants.Count == 0)
{
try
{
var fieldInfos = typeof(T).GetFields(BindingFlags.Static | BindingFlags.Public);
// ensure its static members get created by triggering the type initializer
fieldInfos[0].GetValue(null);
}
catch
{
}
}
return Get(key).OrDefault();
}
}
} | using System;
using System.Collections.Generic;
using System.Reflection;
using MvbaCore.Extensions;
namespace MvbaCore
{
[Serializable]
#pragma warning disable 661,660
public class NamedConstant<T> : INamedConstant
#pragma warning restore 661,660
where T : NamedConstant<T>
{
private static readonly Dictionary<string, T> NamedConstants = new Dictionary<string, T>();
protected void Add(string key, T item)
{
NamedConstants.Add(key.ToLower(), item);
}
protected static IEnumerable<T> Values()
{
return NamedConstants.Values;
}
protected static T Get(string key)
{
if (key == null)
{
return null;
}
T t;
NamedConstants.TryGetValue(key.ToLower(), out t);
return t;
}
public static bool operator ==(NamedConstant<T> a, NamedConstant<T> b)
{
if (ReferenceEquals(a, b))
{
return true;
}
if (((object)a == null) || ((object)b == null))
{
return false;
}
return a.Equals(b);
}
public static bool operator !=(NamedConstant<T> a, NamedConstant<T> b)
{
return !(a == b);
}
public string Key { get; protected set; }
public static T GetFor(string key)
{
if (NamedConstants.Count == 0)
{
try
{
var fieldInfos = typeof(T).GetFields(BindingFlags.Static | BindingFlags.Public);
// ensure its static members get created by triggering the type initializer
fieldInfos[0].GetValue(null);
}
catch
{
}
}
return Get(key).OrDefault();
}
}
} | mit | C# |
e9a25849337865a9194edc6dec7a77720079efdc | Update to next version | twenzel/Cake.MarkdownToPdf,twenzel/Cake.MarkdownToPdf,twenzel/Cake.MarkdownToPdf | src/Cake.MarkdownToPdf/Properties/AssemblyInfo.cs | src/Cake.MarkdownToPdf/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("Cake.MarkdownToPdf")]
[assembly: AssemblyDescription("Cake addin to convert markdown files to pdf")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cake.MarkdownToPdf")]
[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("8731fa2b-39fa-4d77-bde6-897b2d45ce4c")]
// 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("0.2.0.0")]
[assembly: AssemblyVersion("0.4.6.0")]
[assembly: AssemblyFileVersion("0.4.6.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("Cake.MarkdownToPdf")]
[assembly: AssemblyDescription("Cake addin to convert markdown files to pdf")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cake.MarkdownToPdf")]
[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("8731fa2b-39fa-4d77-bde6-897b2d45ce4c")]
// 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("0.2.0.0")]
[assembly: AssemblyVersion("0.4.5.0")]
[assembly: AssemblyFileVersion("0.4.5.0")]
| mit | C# |
0a295135f6f8446ecf8feec03e06718576a75df1 | Update StephanosConstantinou.cs | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/StephanosConstantinou.cs | src/Firehose.Web/Authors/StephanosConstantinou.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class StephanosConstantinou : IAmACommunityMember
{
public string FirstName => "Stephanos";
public string LastName => "Constantinou";
public string ShortBioOrTagLine => "Senior System Administrator. I am using PowerShell a lot to perform day to day tasks and automate procedures.";
public string StateOrRegion => "Limassol,Cyprus";
public string EmailAddress => "stephanos@sconstantinou.com";
public string TwitterHandle => "SCPowerShell";
public string GravatarHash => "04de5e0523cf48e9493c11905fd5999f";
public string GitHubHandle => "SConstantinou";
public GeoPosition Position => new GeoPosition(34.706249, 33.022578);
public Uri WebSite => new Uri("https://www.sconstantinou.com");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.sconstantinou.com/feed/"); } }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class StephanosConstantinou : IAmACommunityMember
{
public string FirstName => "Stephanos";
public string LastName => "Constantinou";
public string ShortBioOrTagLine => "Senior System Administrator. I am using PowerShell a lot to perform day to day tasks and automate procedures.";
public string StateOrRegion => "Limassol";
public string EmailAddress => "stephanos@sconstantinou.com";
public string TwitterHandle => "SCPowerShell";
public string GravatarHash => "04de5e0523cf48e9493c11905fd5999f";
public string GitHubHandle => "SConstantinou";
public GeoPosition Position => new GeoPosition(34.706249, 33.022578);
public Uri WebSite => new Uri("https://www.sconstantinou.com");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.sconstantinou.com/feed/"); } }
}
}
| mit | C# |
5d536b4b187da8654117b9ef48b0c0b35136449d | Bump version to 0.14.1 | quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot | CactbotOverlay/Properties/AssemblyInfo.cs | CactbotOverlay/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.14.1.0")]
[assembly: AssemblyFileVersion("0.14.1.0")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.14.0.0")]
[assembly: AssemblyFileVersion("0.14.0.0")] | apache-2.0 | C# |
e5b8c6080d31a74ef48bdde6e3dafc60118c4047 | Fix controller in winner menu | Nigh7Sh4de/shatterfall,Nigh7Sh4de/shatterfall | shatterfall/Assets/Scripts/selector2.cs | shatterfall/Assets/Scripts/selector2.cs | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
public class selector2 : MonoBehaviour {
public static int option;
public List<GameObject> uiChoices;
public Text PlayerWin;
public static int winner;
public AudioClip selectSound;
private AudioSource source;
// Use this for initialization
void Start () {
source = GetComponent<AudioSource>();
option = 0;
transform.localScale = uiChoices [0].transform.localScale * 9f;
}
float ready;
float READY_DELAY = 0.2f;
float TOGGLE_THRESHOLD = 0.6f;
// Update is called once per frame
void Update () {
PlayerWin.text = "P L A Y E R " + winner + " W I N S !";
if (ready > 0)
ready -= Time.deltaTime;
if ((Input.GetKey(KeyCode.UpArrow) || (Input.GetAxis("MoveVertical") > TOGGLE_THRESHOLD)) && ready <= 0)
{
source.PlayOneShot(selectSound, 1F);
ready = READY_DELAY;
if (option == 0)
{
option = uiChoices.Count - 1;
}
else {
option--;
}
}
if ((Input.GetKey(KeyCode.DownArrow) || (Input.GetAxis("MoveVertical") < -TOGGLE_THRESHOLD)) && ready <= 0)
{
source.PlayOneShot(selectSound, 1F);
ready = READY_DELAY;
if (option == uiChoices.Count - 1)
{
option = 0;
}
else {
option++;
}
}
transform.position = uiChoices[option].transform.position + new Vector3(-uiChoices[option].transform.localScale.x * 0.55f, uiChoices[option].transform.localScale.x * 0.2f, 0);
if (Input.GetKeyDown (KeyCode.Space) || Input.GetAxis("Jump1") > 0) {
if(option == 0){
source.PlayOneShot (selectSound, 1F);
Application.LoadLevel ("main");
}
else {
source.PlayOneShot (selectSound, 1F);
Application.LoadLevel ("MainMenu");
}
}
}
} | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
public class selector2 : MonoBehaviour {
public static int option;
public List<GameObject> uiChoices;
public Text PlayerWin;
public static int winner;
public AudioClip selectSound;
private AudioSource source;
// Use this for initialization
void Start () {
source = GetComponent<AudioSource>();
option = 0;
transform.localScale = uiChoices [0].transform.localScale * 9f;
}
bool ready;
// Update is called once per frame
void Update () {
PlayerWin.text = "P L A Y E R " + winner + " W I N S !";
if (Input.GetAxis("MoveVertical1") == 0)
ready = true;
if (Input.GetKeyDown (KeyCode.UpArrow) || Input.GetAxis("MoveVertical1") > 0 && ready) {
source.PlayOneShot (selectSound, 1F);
ready = false;
if (option == 0) {
option = uiChoices.Count - 1;
} else {
option--;
}
}
if (Input.GetKeyDown (KeyCode.DownArrow) || Input.GetAxis("MoveVertical1") < 0 && ready) {
source.PlayOneShot (selectSound, 1F);
ready = false;
if (option == uiChoices.Count - 1) {
option = 0;
} else {
option++;
}
}
transform.position = uiChoices[option].transform.position + new Vector3(-uiChoices[option].transform.localScale.x * 0.55f, uiChoices[option].transform.localScale.x * 0.2f, 0);
if (Input.GetKeyDown (KeyCode.Space) || Input.GetAxis("Jump1") > 0) {
if(option == 0){
source.PlayOneShot (selectSound, 1F);
Application.LoadLevel ("main");
}
else {
source.PlayOneShot (selectSound, 1F);
Application.LoadLevel ("MainMenu");
}
}
}
} | mit | C# |
0c98263edfb96f62df0270354153719e6083ab61 | Use quest IDs when looking up translations | KCV-Localisation/KanColleViewer,Yuubari/LegacyKCV | Grabacr07.KanColleWrapper/Models/Quest.cs | Grabacr07.KanColleWrapper/Models/Quest.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Grabacr07.KanColleWrapper.Models.Raw;
namespace Grabacr07.KanColleWrapper.Models
{
public class Quest : RawDataWrapper<kcsapi_quest>, IIdentifiable
{
public int Id
{
get { return this.RawData.api_no; }
}
/// <summary>
/// 任務のカテゴリ (編成、出撃、演習 など) を取得します。
/// </summary>
public QuestCategory Category
{
get { return (QuestCategory)this.RawData.api_category; }
}
/// <summary>
/// 任務の種類 (1 回のみ、デイリー、ウィークリー) を取得します。
/// </summary>
public QuestType Type
{
get { return (QuestType)this.RawData.api_type; }
}
/// <summary>
/// 任務の状態を取得します。
/// </summary>
public QuestState State
{
get { return (QuestState)this.RawData.api_state; }
}
/// <summary>
/// 任務の進捗状況を取得します。
/// </summary>
public QuestProgress Progress
{
get { return (QuestProgress)this.RawData.api_progress_flag; }
}
/// <summary>
/// 任務名を取得します。
/// </summary>
public string Title
{
get
{
return KanColleClient.Current.Translations.GetTranslation(RawData.api_title, TranslationType.QuestTitle, this.RawData, this.RawData.api_no);
}
}
/// <summary>
/// 任務の詳細を取得します。
/// </summary>
public string Detail
{
get
{
return KanColleClient.Current.Translations.GetTranslation(RawData.api_detail, TranslationType.QuestDetail, this.RawData, this.RawData.api_no);
}
}
public Quest(kcsapi_quest rawData) : base(rawData) { }
public override string ToString()
{
return string.Format("ID = {0}, Category = {1}, Title = \"{2}\", Type = {3}, State = {4}", this.Id, this.Category, this.Title, this.Type, this.State);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Grabacr07.KanColleWrapper.Models.Raw;
namespace Grabacr07.KanColleWrapper.Models
{
public class Quest : RawDataWrapper<kcsapi_quest>, IIdentifiable
{
public int Id
{
get { return this.RawData.api_no; }
}
/// <summary>
/// 任務のカテゴリ (編成、出撃、演習 など) を取得します。
/// </summary>
public QuestCategory Category
{
get { return (QuestCategory)this.RawData.api_category; }
}
/// <summary>
/// 任務の種類 (1 回のみ、デイリー、ウィークリー) を取得します。
/// </summary>
public QuestType Type
{
get { return (QuestType)this.RawData.api_type; }
}
/// <summary>
/// 任務の状態を取得します。
/// </summary>
public QuestState State
{
get { return (QuestState)this.RawData.api_state; }
}
/// <summary>
/// 任務の進捗状況を取得します。
/// </summary>
public QuestProgress Progress
{
get { return (QuestProgress)this.RawData.api_progress_flag; }
}
/// <summary>
/// 任務名を取得します。
/// </summary>
public string Title
{
get
{
return KanColleClient.Current.Translations.GetTranslation(RawData.api_title, TranslationType.QuestTitle, this.RawData);
}
}
/// <summary>
/// 任務の詳細を取得します。
/// </summary>
public string Detail
{
get
{
return KanColleClient.Current.Translations.GetTranslation(RawData.api_detail, TranslationType.QuestDetail, this.RawData);
}
}
public Quest(kcsapi_quest rawData) : base(rawData) { }
public override string ToString()
{
return string.Format("ID = {0}, Category = {1}, Title = \"{2}\", Type = {3}, State = {4}", this.Id, this.Category, this.Title, this.Type, this.State);
}
}
}
| mit | C# |
030e2d99d9a3dd06072005c401f7b65459574f2c | update version number to 0.2.1.0 | ChrisDeadman/KSPPartRemover | KSPPartRemover/Properties/AssemblyInfo.cs | KSPPartRemover/Properties/AssemblyInfo.cs | using System.Reflection;
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("KSPPartRemover")]
[assembly: AssemblyDescription("Removes parts from KSP save files")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Deadman")]
[assembly: AssemblyProduct("KSPPartRemover")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7e074eb8-495e-4401-afc9-9608b11403c3")]
// 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.1.0")]
[assembly: AssemblyFileVersion("0.2.1.0")]
| using System.Reflection;
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("KSPPartRemover")]
[assembly: AssemblyDescription("Removes parts from KSP save files")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Deadman")]
[assembly: AssemblyProduct("KSPPartRemover")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7e074eb8-495e-4401-afc9-9608b11403c3")]
// 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")]
| mit | C# |
181bb7b6d651a8b8a113eed49b91614d7ab0033b | Add DefaultMetadataTableName | lecaillon/Evolve | test/Evolve.Test/TestContext.cs | test/Evolve.Test/TestContext.cs | using System.IO;
using System.Reflection;
namespace Evolve.Test
{
public static class TestContext
{
static TestContext()
{
ResourcesDirectory = Path.Combine(Path.GetDirectoryName(typeof(TestContext).GetTypeInfo().Assembly.Location), "Resources");
ValidMigrationScriptPath = Path.Combine(ResourcesDirectory, "V1_3_1__Migration_description.sql");
ChinookScriptPath = Path.Combine(ResourcesDirectory, "Chinook_Sqlite.sql");
}
public static string ResourcesDirectory { get; private set; }
public static string ValidMigrationScriptPath { get; private set; }
public static string ChinookScriptPath { get; private set; }
public static string SqlMigrationPrefix => "V";
public static string SqlMigrationSeparator => "__";
public static string SqlMigrationSuffix => ".sql";
public static string SQLiteInMemoryConnectionString => "Data Source=:memory:";
public static string SQLiteDefaultSchemaName => "main";
public static string DefaultMetadataTableName => "changelog";
}
}
| using System.IO;
using System.Reflection;
namespace Evolve.Test
{
public static class TestContext
{
static TestContext()
{
ResourcesDirectory = Path.Combine(Path.GetDirectoryName(typeof(TestContext).GetTypeInfo().Assembly.Location), "Resources");
ValidMigrationScriptPath = Path.Combine(ResourcesDirectory, "V1_3_1__Migration_description.sql");
ChinookScriptPath = Path.Combine(ResourcesDirectory, "Chinook_Sqlite.sql");
}
public static string ResourcesDirectory { get; private set; }
public static string ValidMigrationScriptPath { get; private set; }
public static string ChinookScriptPath { get; private set; }
public static string SqlMigrationPrefix => "V";
public static string SqlMigrationSeparator => "__";
public static string SqlMigrationSuffix => ".sql";
public static string SQLiteInMemoryConnectionString => "Data Source=:memory:";
public static string SQLiteDefaultSchemaName => "main";
}
}
| mit | C# |
d83ad4381843e527a602e6a6d72e29075fd2f9ea | Update PowerShellEventTelemeter.cs | tiksn/TIKSN-Framework | TIKSN.Framework.Core/Analytics/Telemetry/PowerShellEventTelemeter.cs | TIKSN.Framework.Core/Analytics/Telemetry/PowerShellEventTelemeter.cs | using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Threading.Tasks;
namespace TIKSN.Analytics.Telemetry
{
public class PowerShellEventTelemeter : IEventTelemeter
{
private readonly Cmdlet cmdlet;
public PowerShellEventTelemeter(Cmdlet cmdlet) => this.cmdlet = cmdlet;
public Task TrackEvent(string name)
{
this.cmdlet.WriteVerbose($"EVENT: {name}");
return Task.FromResult<object>(null);
}
public Task TrackEvent(string name, IDictionary<string, string> properties)
{
this.cmdlet.WriteVerbose(
$"EVENT: {name} with {string.Join(", ", properties.Select(item => string.Format("{0} is {1}", item.Key, item.Value)))}");
return Task.FromResult<object>(null);
}
}
}
| using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Threading.Tasks;
namespace TIKSN.Analytics.Telemetry
{
public class PowerShellEventTelemeter : IEventTelemeter
{
private readonly Cmdlet cmdlet;
public PowerShellEventTelemeter(Cmdlet cmdlet)
{
this.cmdlet = cmdlet;
}
public Task TrackEvent(string name)
{
cmdlet.WriteVerbose($"EVENT: {name}");
return Task.FromResult<object>(null);
}
public Task TrackEvent(string name, IDictionary<string, string> properties)
{
cmdlet.WriteVerbose($"EVENT: {name} with {string.Join(", ", properties.Select(item => string.Format("{0} is {1}", item.Key, item.Value)))}");
return Task.FromResult<object>(null);
}
}
} | mit | C# |
9d4f53c97cf77c40bad613144fcc75809f1ab05a | Fix Typo in comment | Eclo/azure-iot-sdks,kevinledinh/azure-iot-sdks,kevinledinh/azure-iot-sdks,dominicbetts/azure-iot-sdks,damonbarry/azure-iot-sdks-1,kevinledinh/azure-iot-sdks,oriolpinol/azure-iot-sdks,Eclo/azure-iot-sdks,Eclo/azure-iot-sdks,dominicbetts/azure-iot-sdks,kevinledinh/azure-iot-sdks,damonbarry/azure-iot-sdks-1,oriolpinol/azure-iot-sdks,damonbarry/azure-iot-sdks-1,dominicbetts/azure-iot-sdks,oriolpinol/azure-iot-sdks,dominicbetts/azure-iot-sdks,Eclo/azure-iot-sdks,damonbarry/azure-iot-sdks-1,Eclo/azure-iot-sdks,kevinledinh/azure-iot-sdks,damonbarry/azure-iot-sdks-1,damonbarry/azure-iot-sdks-1,oriolpinol/azure-iot-sdks,damonbarry/azure-iot-sdks-1,kevinledinh/azure-iot-sdks,oriolpinol/azure-iot-sdks,kevinledinh/azure-iot-sdks,dominicbetts/azure-iot-sdks,kevinledinh/azure-iot-sdks,Eclo/azure-iot-sdks,kevinledinh/azure-iot-sdks,Eclo/azure-iot-sdks,Eclo/azure-iot-sdks,oriolpinol/azure-iot-sdks,Eclo/azure-iot-sdks,oriolpinol/azure-iot-sdks,damonbarry/azure-iot-sdks-1,dominicbetts/azure-iot-sdks,oriolpinol/azure-iot-sdks,dominicbetts/azure-iot-sdks,dominicbetts/azure-iot-sdks | csharp/device/Microsoft.Azure.Devices.Client/AuthenticationScheme.cs | csharp/device/Microsoft.Azure.Devices.Client/AuthenticationScheme.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.Devices.Client
{
/// <summary>
/// Specifies the Authentication Scheme used by Device Client
/// </summary>
public enum AuthenticationScheme
{
// Shared Access Signature
SAS = 0,
// X509 Certificate
X509 = 1
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.Devices.Client
{
/// <summary>
/// Specifies the Authentication Scheme used by Device Clienty
/// </summary>
public enum AuthenticationScheme
{
// Shared Access Signature
SAS = 0,
// X509 Certificate
X509 = 1
}
}
| mit | C# |
38f3c277d84eae73a69c92d7b3b7831fcc06561b | Remove unused usings | onatm/Ecowa-Api | src/Ecowa.Api/App_Start/WebApiConfig.cs | src/Ecowa.Api/App_Start/WebApiConfig.cs | using Autofac;
using Autofuzz.Dependency;
using Ecowa.Business;
using Microsoft.WindowsAzure.Mobile.Service;
using System.Web.Http;
namespace Ecowa.Api
{
public static class WebApiConfig
{
public static void Register()
{
ConfigOptions options = new ConfigOptions();
HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options, (configuration, builder) =>
{
BusinessControlStartUp.Run();
IContainer container = ServiceControl.Container;
IEcowaBusiness business = container.Resolve<IEcowaBusiness>();
builder.RegisterInstance(business).As<IEcowaBusiness>();
}));
config.Formatters.Remove(config.Formatters.XmlFormatter);
config.SetIsHosted(true);
}
}
}
| using Autofuzz.Dependency;
using Ecowa.Business;
using Microsoft.WindowsAzure.Mobile.Service;
using Microsoft.WindowsAzure.Mobile.Service.Config;
using System.Reflection;
using System.Web.Http;
using Autofac;
namespace Ecowa.Api
{
public static class WebApiConfig
{
public static void Register()
{
ConfigOptions options = new ConfigOptions();
HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options, (configuration, builder) =>
{
BusinessControlStartUp.Run();
IContainer container = ServiceControl.Container;
IEcowaBusiness business = container.Resolve<IEcowaBusiness>();
builder.RegisterInstance(business).As<IEcowaBusiness>();
}));
config.Formatters.Remove(config.Formatters.XmlFormatter);
config.SetIsHosted(true);
}
}
}
| mit | C# |
9d2d03a306e70a05bee8c134eef93501680ef962 | handle exceptions of RunTimed | sepehr-laal/swag-sync | swag-sync/swag-sync/TaskUtils.cs | swag-sync/swag-sync/TaskUtils.cs | namespace swag
{
using System;
using System.Threading;
using System.Threading.Tasks;
public class TaskUtils
{
public static async Task<bool> RunTimed(Action action, TimeSpan timeout)
{
bool timedout = true;
try
{
if (action == null)
return timedout;
using (var token_source = new CancellationTokenSource())
using (var timeout_task = Task.Delay(timeout, token_source.Token))
using (var action_task = Task.Run(action, token_source.Token))
using (var completed_task = await Task.WhenAny(timeout_task, action_task))
{
if (completed_task == action_task)
timedout = true;
token_source.Cancel();
CleanupTasks(timeout_task, action_task, completed_task);
}
}
catch(Exception ex)
{
Log.Error("Running timed task failed: {0}", ex.Message);
timedout = true;
}
return timedout;
}
public static void CleanupTasks(params Task[] tasks)
{
if (tasks == null || tasks.Length == 0)
return;
foreach (Task task in tasks)
{
try { if (task != null && !task.IsCompleted) task.Wait(50); }
catch { Log.Error("Unable to put Task out of its misery."); }
}
}
}
}
| namespace swag
{
using System;
using System.Threading;
using System.Threading.Tasks;
public class TaskUtils
{
public static async Task<bool> RunTimed(Action action, TimeSpan timeout)
{
bool timedout = false;
if (action == null)
return timedout;
using (var token_source = new CancellationTokenSource())
using (var timeout_task = Task.Delay(timeout, token_source.Token))
using (var action_task = Task.Run(action, token_source.Token))
using (var completed_task = await Task.WhenAny(timeout_task, action_task))
{
if (completed_task == action_task)
timedout = true;
token_source.Cancel();
CleanupTasks(timeout_task, action_task, completed_task);
}
return timedout;
}
public static void CleanupTasks(params Task[] tasks)
{
if (tasks == null || tasks.Length == 0)
return;
foreach (Task task in tasks)
{
try { if (task != null && !task.IsCompleted) task.Wait(50); }
catch { Log.Error("Unable to put Task out of its misery."); }
}
}
}
}
| mit | C# |
e33b9019f410a475f63bb2a1e2e5d8a9b9f7744a | Update DebugInfo.cs | gotmachine/MandatoryRCS | MandatoryRCS-Source/DebugInfo.cs | MandatoryRCS-Source/DebugInfo.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace MandatoryRCS
{
class DebugInfo : PartModule
{
VesselModuleRotation vm;
ModuleTorqueController tc;
ModuleReactionWheel rw;
[KSPField(guiActive = true, guiName = "Ang. Velocity", guiFormat = "00.00")]
public float angularVelocity;
[KSPField(guiActive = true, guiName = "rollTorque", guiFormat = "00.00")]
public float rollTorque;
[KSPField(guiActive = true, guiName = "pitchTorque", guiFormat = "00.00")]
public float pitchTorque;
[KSPField(guiActive = true, guiName = "yawTorque", guiFormat = "00.00")]
public float yawTorque;
[KSPField(guiActive = true, guiName = "inputVectorDelta")]
public string inputVectorDelta;
public void FixedUpdate()
{
if (!(HighLogic.LoadedSceneIsFlight && FlightGlobals.ready))
{
return;
}
vm = vessel.vesselModules.OfType<VesselModuleRotation>().First();
tc = part.Modules.GetModule<ModuleTorqueController>();
rw = part.Modules.GetModule<ModuleReactionWheel>();
angularVelocity = vessel.angularVelocity.magnitude;
rollTorque = rw.RollTorque;
pitchTorque = rw.PitchTorque;
yawTorque = rw.YawTorque;
inputVectorDelta = (rw.inputVector * TimeWarp.fixedDeltaTime).ToString("0.0000");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace MandatoryRCS
{
class DebugInfo : PartModule
{
VesselModuleRotation vm;
ModuleTorqueController tc;
ModuleReactionWheel rw;
[KSPField(guiActive = true, guiName = "Ang. Velocity", guiFormat = "00.00")]
public float angularVelocity;
[KSPField(guiActive = true, guiName = "rollTorque", guiFormat = "00.00")]
public float rollTorque;
[KSPField(guiActive = true, guiName = "pitchTorque", guiFormat = "00.00")]
public float pitchTorque;
[KSPField(guiActive = true, guiName = "yawTorque", guiFormat = "00.00")]
public float yawTorque;
[KSPField(guiActive = true, guiName = "inputVectorDelta")]
public string inputVectorDelta;
public void FixedUpdate()
{
if (!(HighLogic.LoadedSceneIsFlight && FlightGlobals.ready))
{
return;
}
vm = vessel.vesselModules.OfType<VesselModuleRotation>().First();
tc = part.Modules.GetModule<ModuleTorqueController>();
rw = part.Modules.GetModule<ModuleReactionWheel>();
angularVelocity = vessel.angularVelocity.magnitude;
rollTorque = rw.RollTorque;
pitchTorque = rw.PitchTorque;
yawTorque = rw.YawTorque;
inputVectorDelta = (rw.inputVector * TimeWarp.fixedDeltaTime).ToString("0.0000");
}
}
}
| unlicense | C# |
57932a991805af46266ac9148f09681bee71097c | Remove logging statement | depp/ggj15-hacker | Hacker/Assets/Hacker/Platform.cs | Hacker/Assets/Hacker/Platform.cs | using UnityEngine;
using System.Collections;
public class Platform : MonoBehaviour {
void Awake () {
SpriteRenderer sprite = GetComponent<SpriteRenderer>();
Vector2 ssize = sprite.bounds.size;
Vector2 sscale = transform.localScale;
ssize.x /= sscale.x;
ssize.y /= sscale.y;
GameObject prefab = new GameObject();
SpriteRenderer csprite = prefab.AddComponent<SpriteRenderer>();
csprite.sprite = sprite.sprite;
GameObject child;
int w = (int)Mathf.Round (sscale.x), h = (int)Mathf.Round (sscale.y);
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
child = (GameObject) Instantiate (prefab);
child.transform.position = transform.position +
new Vector3(x * ssize.x,
y * ssize.y,
0);
}
}
sprite.enabled = false;
Destroy (prefab);
}
}
| using UnityEngine;
using System.Collections;
public class Platform : MonoBehaviour {
void Awake () {
SpriteRenderer sprite = GetComponent<SpriteRenderer>();
Vector2 ssize = sprite.bounds.size;
Vector2 sscale = transform.localScale;
ssize.x /= sscale.x;
ssize.y /= sscale.y;
GameObject prefab = new GameObject();
SpriteRenderer csprite = prefab.AddComponent<SpriteRenderer>();
csprite.sprite = sprite.sprite;
Debug.Log (sscale);
GameObject child;
int w = (int)Mathf.Round (sscale.x), h = (int)Mathf.Round (sscale.y);
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
child = (GameObject) Instantiate (prefab);
child.transform.position = transform.position +
new Vector3(x * ssize.x,
y * ssize.y,
0);
}
}
sprite.enabled = false;
Destroy (prefab);
}
}
| bsd-2-clause | C# |
740d7eb7ef1ab7f2ac049579bba2fb52414f9e72 | Make broken pipe classifier cover more scenarios. (#1090) | tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools | tools/pipeline-witness/Azure.Sdk.Tools.PipelineWitness/Services/FailureAnalysis/MavenBrokenPipeFailureClassifier.cs | tools/pipeline-witness/Azure.Sdk.Tools.PipelineWitness/Services/FailureAnalysis/MavenBrokenPipeFailureClassifier.cs | using Azure.Sdk.Tools.PipelineWitness.Entities.AzurePipelines;
using Microsoft.TeamFoundation.Build.WebApi;
using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Azure.Sdk.Tools.PipelineWitness.Services.FailureAnalysis
{
public class MavenBrokenPipeFailureClassifier : IFailureClassifier
{
public MavenBrokenPipeFailureClassifier(VssConnection vssConnection)
{
this.vssConnection = vssConnection;
buildClient = vssConnection.GetClient<BuildHttpClient>();
}
private VssConnection vssConnection;
private BuildHttpClient buildClient;
public async Task ClassifyAsync(FailureAnalyzerContext context)
{
var failedTasks = from r in context.Timeline.Records
where r.Result == TaskResult.Failed
where r.RecordType == "Task"
where r.Task != null
where r.Task.Name == "Maven"
where r.Log != null
select r;
foreach (var failedTask in failedTasks)
{
var lines = await buildClient.GetBuildLogLinesAsync(
context.Build.Project.Id,
context.Build.Id,
failedTask.Log.Id
);
if (lines.Any(line => line.Contains("Connection reset") || line.Contains("Connection timed out") || line.Contains("504 Gateway Timeout")))
{
context.AddFailure(failedTask, "Maven Broken Pipe");
}
}
}
}
}
| using Azure.Sdk.Tools.PipelineWitness.Entities.AzurePipelines;
using Microsoft.TeamFoundation.Build.WebApi;
using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Azure.Sdk.Tools.PipelineWitness.Services.FailureAnalysis
{
public class MavenBrokenPipeFailureClassifier : IFailureClassifier
{
public MavenBrokenPipeFailureClassifier(VssConnection vssConnection)
{
this.vssConnection = vssConnection;
buildClient = vssConnection.GetClient<BuildHttpClient>();
}
private VssConnection vssConnection;
private BuildHttpClient buildClient;
public async Task ClassifyAsync(FailureAnalyzerContext context)
{
var failedTasks = from r in context.Timeline.Records
where r.Result == TaskResult.Failed
where r.RecordType == "Task"
where r.Task != null
where r.Task.Name == "Maven"
where r.Log != null
select r;
foreach (var failedTask in failedTasks)
{
var lines = await buildClient.GetBuildLogLinesAsync(
context.Build.Project.Id,
context.Build.Id,
failedTask.Log.Id
);
if (lines.Any(line => line.Contains("Connection reset")))
{
context.AddFailure(failedTask, "Maven Broken Pipe");
}
}
}
}
}
| mit | C# |
ca008e2d514dd02df4ab0c7a6f769b60e957f50c | add typed ShouldEqual to assert extentions | AMSadek/libgit2sharp,vorou/libgit2sharp,Zoxive/libgit2sharp,xoofx/libgit2sharp,Zoxive/libgit2sharp,GeertvanHorrik/libgit2sharp,jamill/libgit2sharp,OidaTiftla/libgit2sharp,jorgeamado/libgit2sharp,shana/libgit2sharp,psawey/libgit2sharp,sushihangover/libgit2sharp,dlsteuer/libgit2sharp,AArnott/libgit2sharp,carlosmn/libgit2sharp,vivekpradhanC/libgit2sharp,OidaTiftla/libgit2sharp,yishaigalatzer/LibGit2SharpCheckOutTests,mono/libgit2sharp,whoisj/libgit2sharp,nulltoken/libgit2sharp,rcorre/libgit2sharp,carlosmn/libgit2sharp,shana/libgit2sharp,vorou/libgit2sharp,jamill/libgit2sharp,dlsteuer/libgit2sharp,AArnott/libgit2sharp,github/libgit2sharp,GeertvanHorrik/libgit2sharp,jeffhostetler/public_libgit2sharp,ethomson/libgit2sharp,oliver-feng/libgit2sharp,nulltoken/libgit2sharp,paulcbetts/libgit2sharp,Skybladev2/libgit2sharp,xoofx/libgit2sharp,paulcbetts/libgit2sharp,AMSadek/libgit2sharp,vivekpradhanC/libgit2sharp,yishaigalatzer/LibGit2SharpCheckOutTests,whoisj/libgit2sharp,sushihangover/libgit2sharp,red-gate/libgit2sharp,github/libgit2sharp,Skybladev2/libgit2sharp,psawey/libgit2sharp,jeffhostetler/public_libgit2sharp,red-gate/libgit2sharp,rcorre/libgit2sharp,ethomson/libgit2sharp,jorgeamado/libgit2sharp,PKRoma/libgit2sharp,mono/libgit2sharp,libgit2/libgit2sharp,oliver-feng/libgit2sharp | LibGit2Sharp.Tests/TestHelpers/AssertExtensions.cs | LibGit2Sharp.Tests/TestHelpers/AssertExtensions.cs | #region Copyright (c) 2011 LibGit2Sharp committers
// The MIT License
//
// Copyright (c) 2011 LibGit2Sharp committers
//
// 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.
#endregion
using System;
using NUnit.Framework;
namespace LibGit2Sharp.Tests
{
public static class AssertExtensions
{
#region public
public static void ShouldBeAboutEqualTo(this DateTimeOffset expected, DateTimeOffset current)
{
Assert.AreEqual(expected.Date, current.Date);
Assert.AreEqual(expected.Offset, current.Offset);
Assert.AreEqual(expected.Hour, current.Hour);
Assert.AreEqual(expected.Minute, current.Minute);
Assert.AreEqual(expected.Second, current.Second);
}
public static void ShouldBeFalse(this bool currentObject)
{
Assert.IsFalse(currentObject);
}
public static void ShouldBeNull(this object currentObject)
{
Assert.IsNull(currentObject);
}
public static void ShouldBeTrue(this bool currentObject)
{
Assert.IsTrue(currentObject);
}
public static void ShouldEqual(this object compareFrom, object compareTo)
{
Assert.AreEqual(compareTo, compareFrom);
}
public static void ShouldEqual<T>(this T compareFrom, T compareTo)
{
Assert.AreEqual(compareTo, compareFrom);
}
public static void ShouldNotBeNull(this object currentObject)
{
Assert.IsNotNull(currentObject);
}
public static void ShouldNotEqual(this object compareFrom, object compareTo)
{
Assert.AreNotEqual(compareTo, compareFrom);
}
#endregion
}
} | #region Copyright (c) 2011 LibGit2Sharp committers
// The MIT License
//
// Copyright (c) 2011 LibGit2Sharp committers
//
// 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.
#endregion
using System;
using NUnit.Framework;
namespace LibGit2Sharp.Tests
{
public static class AssertExtensions
{
#region public
public static void ShouldBeAboutEqualTo(this DateTimeOffset expected, DateTimeOffset current)
{
Assert.AreEqual(expected.Date, current.Date);
Assert.AreEqual(expected.Offset, current.Offset);
Assert.AreEqual(expected.Hour, current.Hour);
Assert.AreEqual(expected.Minute, current.Minute);
Assert.AreEqual(expected.Second, current.Second);
}
public static void ShouldBeFalse(this bool currentObject)
{
Assert.IsFalse(currentObject);
}
public static void ShouldBeNull(this object currentObject)
{
Assert.IsNull(currentObject);
}
public static void ShouldBeTrue(this bool currentObject)
{
Assert.IsTrue(currentObject);
}
public static void ShouldEqual(this object compareFrom, object compareTo)
{
Assert.AreEqual(compareTo, compareFrom);
}
public static void ShouldNotBeNull(this object currentObject)
{
Assert.IsNotNull(currentObject);
}
public static void ShouldNotEqual(this object compareFrom, object compareTo)
{
Assert.AreNotEqual(compareTo, compareFrom);
}
#endregion
}
} | mit | C# |
2975ea9210a7e329a2ae35dfb7f0ef57a283fd74 | Adjust repeat/tail fade in to match stable closer | UselessToucan/osu,peppy/osu-new,ppy/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu | osu.Game.Rulesets.Osu/Objects/SliderEndCircle.cs | osu.Game.Rulesets.Osu/Objects/SliderEndCircle.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.Scoring;
namespace osu.Game.Rulesets.Osu.Objects
{
/// <summary>
/// A hitcircle which is at the end of a slider path (either repeat or final tail).
/// </summary>
public abstract class SliderEndCircle : HitCircle
{
public int RepeatIndex { get; set; }
public double SpanDuration { get; set; }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
if (RepeatIndex > 0)
{
// Repeat points after the first span should appear behind the still-visible one.
TimeFadeIn = 0;
// The next end circle should appear exactly after the previous circle (on the same end) is hit.
TimePreempt = SpanDuration * 2;
}
}
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Objects
{
/// <summary>
/// A hitcircle which is at the end of a slider path (either repeat or final tail).
/// </summary>
public abstract class SliderEndCircle : HitCircle
{
public int RepeatIndex { get; set; }
public double SpanDuration { get; set; }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
// Out preempt should be one span early to give the user ample warning.
TimePreempt += SpanDuration;
// We want to show the first RepeatPoint as the TimePreempt dictates but on short (and possibly fast) sliders
// we may need to cut down this time on following RepeatPoints to only show up to two RepeatPoints at any given time.
if (RepeatIndex > 0)
TimePreempt = Math.Min(SpanDuration * 2, TimePreempt);
}
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
}
}
| mit | C# |
0fc0aac7195b9678c3c274d32b34cc0bf62b0433 | Add update method to TodoRepository | OkraFramework/Okra-Todo | Okra-Todo/Data/TodoRepository.cs | Okra-Todo/Data/TodoRepository.cs | using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Okra.TodoSample.Data
{
[Export(typeof(ITodoRepository))]
public class TodoRepository : ITodoRepository
{
private IList<TodoItem> todoItems;
private int nextId = 4;
public TodoRepository()
{
this.todoItems = new List<TodoItem>
{
new TodoItem() { Id = "1", Title = "First item"},
new TodoItem() { Id = "2", Title = "Second item"},
new TodoItem() { Id = "3", Title = "Third item"}
};
}
public TodoItem GetTodoItemById(string id)
{
return todoItems.FirstOrDefault(item => item.Id == id);
}
public IList<TodoItem> GetTodoItems()
{
return todoItems;
}
public void AddTodoItem(TodoItem todoItem)
{
todoItem.Id = (nextId++).ToString();
this.todoItems.Add(todoItem);
}
public void RemoveTodoItem(TodoItem todoItem)
{
this.todoItems.Remove(todoItem);
}
public void UpdateTodoItem(TodoItem todoItem)
{
TodoItem internalItem = todoItems.First(item => item.Id == todoItem.Id);
internalItem.Title = todoItem.Title;
internalItem.Completed = todoItem.Completed;
}
}
}
| using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Okra.TodoSample.Data
{
[Export(typeof(ITodoRepository))]
public class TodoRepository : ITodoRepository
{
private IList<TodoItem> todoItems;
private int nextId = 4;
public TodoRepository()
{
this.todoItems = new List<TodoItem>
{
new TodoItem() { Id = "1", Title = "First item"},
new TodoItem() { Id = "2", Title = "Second item"},
new TodoItem() { Id = "3", Title = "Third item"}
};
}
public TodoItem GetTodoItemById(string id)
{
return todoItems.Where(item => item.Id == id).FirstOrDefault();
}
public IList<TodoItem> GetTodoItems()
{
return todoItems;
}
public void AddTodoItem(TodoItem todoItem)
{
todoItem.Id = (nextId++).ToString();
this.todoItems.Add(todoItem);
}
public void RemoveTodoItem(TodoItem todoItem)
{
this.todoItems.Remove(todoItem);
}
}
}
| apache-2.0 | C# |
2d5e26cc6e42e2687dbe9161e7c72028d19d1033 | Update Program.cs | fredatgithub/Crypto | SearchAllCombinaisons/Program.cs | SearchAllCombinaisons/Program.cs | using System;
namespace SearchAllCombinaisons
{
public class Program
{
private static readonly char[] PossibleCharacters = {'0','1','2','3','4','5','6','7','8','9',
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', '{', '}',
';', ':', ',', '.', '<', '>', '/', '?' };
private static string _findPassword;
private static int _combinaisons;
public static void Main()
{
int count;
Console.WriteLine("Enter your Password");
_findPassword = Console.ReadLine();
DateTime today = DateTime.Now;
Console.WriteLine("START:\t{0}", today.ToString("yyyy-MM-dd_HH:mm:ss"));
for (count = 0; count <= 15; count++)
{
Recurse(count, 0, "");
}
}
private static void Recurse(int length, int position, string baseString)
{
for (int count = 0; count < PossibleCharacters.Length; count++)
{
_combinaisons++;
if (position < length - 1)
{
Recurse(length, position + 1, baseString + PossibleCharacters[count]);
}
if (baseString + PossibleCharacters[count] == _findPassword)
{
DateTime today = DateTime.Now;
Console.WriteLine("END:\t{0}\nNumber of combinaisons:\t{1}", today.ToString("yyyy-MM-dd_HH:mm:ss"), _combinaisons);
Console.WriteLine("Press a key to exit:");
Console.ReadKey();
Environment.Exit(0);
}
Console.WriteLine(_combinaisons);
}
}
}
}
| /*
The MIT License(MIT)
Copyright(c) 2015 Freddy Juhel
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;
namespace SearchAllCombinaisons
{
public class Program
{
private static readonly char[] PossibleCharacters = {'0','1','2','3','4','5','6','7','8','9',
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', '{', '}',
';', ':', ',', '.', '<', '>', '/', '?' };
private static string _findPassword;
private static int _combinaisons;
public static void Main()
{
int count;
Console.WriteLine("Enter your Password");
_findPassword = Console.ReadLine();
DateTime today = DateTime.Now;
Console.WriteLine("START:\t{0}", today.ToString("yyyy-MM-dd_HH:mm:ss"));
for (count = 0; count <= 15; count++)
{
Recurse(count, 0, "");
}
}
private static void Recurse(int length, int position, string baseString)
{
for (int count = 0; count < PossibleCharacters.Length; count++)
{
_combinaisons++;
if (position < length - 1)
{
Recurse(length, position + 1, baseString + PossibleCharacters[count]);
}
if (baseString + PossibleCharacters[count] == _findPassword)
{
DateTime today = DateTime.Now;
Console.WriteLine("END:\t{0}\nNumber of combinaisons:\t{1}", today.ToString("yyyy-MM-dd_HH:mm:ss"), _combinaisons);
Console.WriteLine("Press a key to exit:");
Console.ReadKey();
Environment.Exit(0);
}
Console.WriteLine(_combinaisons);
}
}
}
} | mit | C# |
ee505ac0f1d337007e2c55d7b4c7c004a2ebf1d9 | Mark assembly as CLSCompliant | felipebz/ndapi | Ndapi/Properties/AssemblyInfo.cs | Ndapi/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
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("Ndapi")]
[assembly: AssemblyDescription("A .NET wrapper for Oracle Forms 6i Open API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Felipe Zorzo")]
[assembly: AssemblyProduct("Ndapi")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]
// 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("9debde14-7c3c-4ebb-a3e9-5c8fbb7e0c04")]
// 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")]
| 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("Ndapi")]
[assembly: AssemblyDescription("A .NET wrapper for Oracle Forms 6i Open API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Felipe Zorzo")]
[assembly: AssemblyProduct("Ndapi")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9debde14-7c3c-4ebb-a3e9-5c8fbb7e0c04")]
// 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# |
84918ac50c6e43dd8f6c3ee303d2fe4c966f3a3e | Update to version 1.3.4 (#94) | Microsoft/Microsoft.IO.RecyclableMemoryStream,maxwellb/Microsoft.IO.RecyclableMemoryStream | src/Properties/AssemblyInfo.cs | src/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.IO.RecyclableMemoryStream")]
[assembly: AssemblyDescription("Pooled memory allocator.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft.IO.RecyclableMemoryStream")]
[assembly: AssemblyCopyright("Copyright © Microsoft 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("9ca0730b-3653-4fc4-b722-9e59fa70ea0b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.4.0")]
[assembly: AssemblyFileVersion("1.3.4.0")]
[assembly: CLSCompliant(true)]
#if !NOFRIENDASSEMBLY
[assembly: InternalsVisibleTo("Microsoft.IO.RecyclableMemoryStream.UnitTests")]
#endif
| using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.IO.RecyclableMemoryStream")]
[assembly: AssemblyDescription("Pooled memory allocator.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft.IO.RecyclableMemoryStream")]
[assembly: AssemblyCopyright("Copyright © Microsoft 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("9ca0730b-3653-4fc4-b722-9e59fa70ea0b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.3.0")]
[assembly: AssemblyFileVersion("1.3.3.0")]
[assembly: CLSCompliant(true)]
#if !NOFRIENDASSEMBLY
[assembly: InternalsVisibleTo("Microsoft.IO.RecyclableMemoryStream.UnitTests")]
#endif
| mit | C# |
e8b2a2fde48ac2dbb22c175dd7d0875aa38fb913 | Check price for 0 | xobed/RohlikAPI,notdev/RohlikAPI,xobed/RohlikAPI,xobed/RohlikAPI,xobed/RohlikAPI | RohlikAPI/Helpers/PriceParser.cs | RohlikAPI/Helpers/PriceParser.cs | using System;
using System.Globalization;
using System.Text.RegularExpressions;
namespace RohlikAPI.Helpers
{
public class PriceParser
{
public double ParsePrice(string priceString)
{
var priceStringWithoutSpaces = priceString.Replace(" ", "");
var cleanPriceString = Regex.Match(priceStringWithoutSpaces, @"(\d*?,\d*)|(\d+)").Value;
try
{
var price = double.Parse(cleanPriceString, new CultureInfo("cs-CZ"));
if (price <= 0)
{
throw new Exception($"Failed to get product price from string '{priceString}'. Resulting price was {price}");
}
return price;
}
catch (Exception ex)
{
throw new Exception($"Failed to parse product price from string '{priceString}'. Exception: {ex}");
}
}
}
} | using System;
using System.Globalization;
using System.Text.RegularExpressions;
namespace RohlikAPI.Helpers
{
public class PriceParser
{
public double ParsePrice(string priceString)
{
var priceStringWithoutSpaces = priceString.Replace(" ", "");
var cleanPriceString = Regex.Match(priceStringWithoutSpaces, @"(\d*?,\d*)|(\d+)").Value;
try
{
var price = double.Parse(cleanPriceString, new CultureInfo("cs-CZ"));
return price;
}
catch (Exception ex)
{
throw new Exception($"Failed to parse product price from string '{priceString}'. Exception: {ex}");
}
}
}
} | mit | C# |
3e848221458a1f864ae86c90086ab11602709d03 | Remove overlapped delegate allocation | dotnet-bot/corefx,rahku/corefx,axelheer/corefx,cydhaselton/corefx,DnlHarvey/corefx,krk/corefx,Jiayili1/corefx,zhenlan/corefx,mmitche/corefx,nbarbettini/corefx,gkhanna79/corefx,rjxby/corefx,gkhanna79/corefx,nchikanov/corefx,weltkante/corefx,Ermiar/corefx,parjong/corefx,krytarowski/corefx,stone-li/corefx,the-dwyer/corefx,Petermarcu/corefx,jlin177/corefx,nchikanov/corefx,mmitche/corefx,fgreinacher/corefx,rubo/corefx,rubo/corefx,seanshpark/corefx,dotnet-bot/corefx,krk/corefx,parjong/corefx,weltkante/corefx,fgreinacher/corefx,DnlHarvey/corefx,zhenlan/corefx,mazong1123/corefx,stephenmichaelf/corefx,elijah6/corefx,billwert/corefx,rahku/corefx,dhoehna/corefx,DnlHarvey/corefx,dotnet-bot/corefx,yizhang82/corefx,ptoonen/corefx,twsouthwick/corefx,weltkante/corefx,MaggieTsang/corefx,elijah6/corefx,wtgodbe/corefx,twsouthwick/corefx,axelheer/corefx,mmitche/corefx,marksmeltzer/corefx,alexperovich/corefx,rahku/corefx,ViktorHofer/corefx,jlin177/corefx,mazong1123/corefx,gkhanna79/corefx,billwert/corefx,seanshpark/corefx,alexperovich/corefx,alexperovich/corefx,ericstj/corefx,stone-li/corefx,lggomez/corefx,YoupHulsebos/corefx,shimingsg/corefx,lggomez/corefx,richlander/corefx,dhoehna/corefx,axelheer/corefx,jlin177/corefx,ravimeda/corefx,DnlHarvey/corefx,MaggieTsang/corefx,elijah6/corefx,ViktorHofer/corefx,shimingsg/corefx,Ermiar/corefx,tijoytom/corefx,weltkante/corefx,cydhaselton/corefx,JosephTremoulet/corefx,mazong1123/corefx,wtgodbe/corefx,ravimeda/corefx,seanshpark/corefx,JosephTremoulet/corefx,ericstj/corefx,billwert/corefx,nbarbettini/corefx,fgreinacher/corefx,rjxby/corefx,MaggieTsang/corefx,Jiayili1/corefx,seanshpark/corefx,dotnet-bot/corefx,nchikanov/corefx,marksmeltzer/corefx,elijah6/corefx,seanshpark/corefx,mmitche/corefx,tijoytom/corefx,stone-li/corefx,mmitche/corefx,Jiayili1/corefx,richlander/corefx,nbarbettini/corefx,krk/corefx,DnlHarvey/corefx,DnlHarvey/corefx,MaggieTsang/corefx,nbarbettini/corefx,marksmeltzer/corefx,stone-li/corefx,mazong1123/corefx,cydhaselton/corefx,axelheer/corefx,the-dwyer/corefx,jlin177/corefx,twsouthwick/corefx,dotnet-bot/corefx,cydhaselton/corefx,parjong/corefx,lggomez/corefx,the-dwyer/corefx,marksmeltzer/corefx,ravimeda/corefx,krk/corefx,marksmeltzer/corefx,parjong/corefx,Jiayili1/corefx,alexperovich/corefx,ericstj/corefx,weltkante/corefx,elijah6/corefx,yizhang82/corefx,mmitche/corefx,krytarowski/corefx,BrennanConroy/corefx,zhenlan/corefx,dhoehna/corefx,nbarbettini/corefx,Ermiar/corefx,rahku/corefx,krytarowski/corefx,YoupHulsebos/corefx,shimingsg/corefx,stephenmichaelf/corefx,Ermiar/corefx,Petermarcu/corefx,rubo/corefx,elijah6/corefx,tijoytom/corefx,dhoehna/corefx,dhoehna/corefx,JosephTremoulet/corefx,ericstj/corefx,mazong1123/corefx,stephenmichaelf/corefx,JosephTremoulet/corefx,billwert/corefx,JosephTremoulet/corefx,Jiayili1/corefx,Petermarcu/corefx,nbarbettini/corefx,Ermiar/corefx,Jiayili1/corefx,dhoehna/corefx,mmitche/corefx,billwert/corefx,dhoehna/corefx,axelheer/corefx,wtgodbe/corefx,ravimeda/corefx,nbarbettini/corefx,parjong/corefx,Ermiar/corefx,stephenmichaelf/corefx,krytarowski/corefx,cydhaselton/corefx,ericstj/corefx,weltkante/corefx,ptoonen/corefx,nchikanov/corefx,rahku/corefx,zhenlan/corefx,billwert/corefx,shimingsg/corefx,tijoytom/corefx,ViktorHofer/corefx,the-dwyer/corefx,JosephTremoulet/corefx,krk/corefx,seanshpark/corefx,rahku/corefx,stone-li/corefx,ravimeda/corefx,shimingsg/corefx,Ermiar/corefx,ravimeda/corefx,yizhang82/corefx,nchikanov/corefx,krytarowski/corefx,gkhanna79/corefx,richlander/corefx,YoupHulsebos/corefx,gkhanna79/corefx,richlander/corefx,richlander/corefx,mazong1123/corefx,twsouthwick/corefx,wtgodbe/corefx,billwert/corefx,krytarowski/corefx,gkhanna79/corefx,rahku/corefx,YoupHulsebos/corefx,twsouthwick/corefx,nchikanov/corefx,rjxby/corefx,BrennanConroy/corefx,YoupHulsebos/corefx,Petermarcu/corefx,wtgodbe/corefx,stone-li/corefx,ptoonen/corefx,dotnet-bot/corefx,krk/corefx,marksmeltzer/corefx,ericstj/corefx,lggomez/corefx,MaggieTsang/corefx,richlander/corefx,twsouthwick/corefx,cydhaselton/corefx,ptoonen/corefx,fgreinacher/corefx,ericstj/corefx,zhenlan/corefx,tijoytom/corefx,DnlHarvey/corefx,MaggieTsang/corefx,ravimeda/corefx,krk/corefx,zhenlan/corefx,jlin177/corefx,seanshpark/corefx,twsouthwick/corefx,Petermarcu/corefx,rjxby/corefx,marksmeltzer/corefx,the-dwyer/corefx,alexperovich/corefx,stone-li/corefx,BrennanConroy/corefx,rjxby/corefx,jlin177/corefx,YoupHulsebos/corefx,wtgodbe/corefx,ViktorHofer/corefx,ViktorHofer/corefx,richlander/corefx,Jiayili1/corefx,ptoonen/corefx,alexperovich/corefx,yizhang82/corefx,shimingsg/corefx,ViktorHofer/corefx,the-dwyer/corefx,mazong1123/corefx,alexperovich/corefx,stephenmichaelf/corefx,YoupHulsebos/corefx,elijah6/corefx,yizhang82/corefx,rubo/corefx,parjong/corefx,yizhang82/corefx,tijoytom/corefx,parjong/corefx,cydhaselton/corefx,ptoonen/corefx,dotnet-bot/corefx,JosephTremoulet/corefx,MaggieTsang/corefx,lggomez/corefx,the-dwyer/corefx,rjxby/corefx,tijoytom/corefx,ViktorHofer/corefx,lggomez/corefx,weltkante/corefx,jlin177/corefx,zhenlan/corefx,ptoonen/corefx,stephenmichaelf/corefx,rubo/corefx,Petermarcu/corefx,gkhanna79/corefx,lggomez/corefx,krytarowski/corefx,stephenmichaelf/corefx,axelheer/corefx,shimingsg/corefx,yizhang82/corefx,rjxby/corefx,wtgodbe/corefx,Petermarcu/corefx,nchikanov/corefx | src/System.Threading.Overlapped/src/System/Threading/ClrThreadPoolBoundHandleOverlapped.cs | src/System.Threading.Overlapped/src/System/Threading/ClrThreadPoolBoundHandleOverlapped.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.
namespace System.Threading
{
/// <summary>
/// Overlapped subclass adding data needed by ThreadPoolBoundHandle.
/// </summary>
internal sealed class ThreadPoolBoundHandleOverlapped : Overlapped
{
private static readonly unsafe IOCompletionCallback s_completionCallback = CompletionCallback;
private readonly IOCompletionCallback _userCallback;
internal readonly object _userState;
internal PreAllocatedOverlapped _preAllocated;
internal unsafe NativeOverlapped* _nativeOverlapped;
internal ThreadPoolBoundHandle _boundHandle;
internal bool _completed;
public unsafe ThreadPoolBoundHandleOverlapped(IOCompletionCallback callback, object state, object pinData, PreAllocatedOverlapped preAllocated)
{
_userCallback = callback;
_userState = state;
_preAllocated = preAllocated;
_nativeOverlapped = Pack(s_completionCallback, pinData);
_nativeOverlapped->OffsetLow = 0; // CLR reuses NativeOverlapped instances and does not reset these
_nativeOverlapped->OffsetHigh = 0;
}
private unsafe static void CompletionCallback(uint errorCode, uint numBytes, NativeOverlapped* nativeOverlapped)
{
ThreadPoolBoundHandleOverlapped overlapped = (ThreadPoolBoundHandleOverlapped)Overlapped.Unpack(nativeOverlapped);
//
// The Win32 thread pool implementation of ThreadPoolBoundHandle does not permit reuse of NativeOverlapped
// pointers without freeing them and allocating new a new one. We need to ensure that code using the CLR
// ThreadPool implementation follows those rules.
//
if (overlapped._completed)
throw new InvalidOperationException(SR.InvalidOperation_NativeOverlappedReused);
overlapped._completed = true;
if (overlapped._boundHandle == null)
throw new InvalidOperationException(SR.Argument_NativeOverlappedAlreadyFree);
overlapped._userCallback(errorCode, numBytes, nativeOverlapped);
}
}
}
| // 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.
namespace System.Threading
{
/// <summary>
/// Overlapped subclass adding data needed by ThreadPoolBoundHandle.
/// </summary>
internal sealed class ThreadPoolBoundHandleOverlapped : Overlapped
{
private readonly IOCompletionCallback _userCallback;
internal readonly object _userState;
internal PreAllocatedOverlapped _preAllocated;
internal unsafe NativeOverlapped* _nativeOverlapped;
internal ThreadPoolBoundHandle _boundHandle;
internal bool _completed;
public unsafe ThreadPoolBoundHandleOverlapped(IOCompletionCallback callback, object state, object pinData, PreAllocatedOverlapped preAllocated)
{
_userCallback = callback;
_userState = state;
_preAllocated = preAllocated;
_nativeOverlapped = Pack(CompletionCallback, pinData);
_nativeOverlapped->OffsetLow = 0; // CLR reuses NativeOverlapped instances and does not reset these
_nativeOverlapped->OffsetHigh = 0;
}
private unsafe static void CompletionCallback(uint errorCode, uint numBytes, NativeOverlapped* nativeOverlapped)
{
ThreadPoolBoundHandleOverlapped overlapped = (ThreadPoolBoundHandleOverlapped)Overlapped.Unpack(nativeOverlapped);
//
// The Win32 thread pool implementation of ThreadPoolBoundHandle does not permit reuse of NativeOverlapped
// pointers without freeing them and allocating new a new one. We need to ensure that code using the CLR
// ThreadPool implementation follows those rules.
//
if (overlapped._completed)
throw new InvalidOperationException(SR.InvalidOperation_NativeOverlappedReused);
overlapped._completed = true;
if (overlapped._boundHandle == null)
throw new InvalidOperationException(SR.Argument_NativeOverlappedAlreadyFree);
overlapped._userCallback(errorCode, numBytes, nativeOverlapped);
}
}
}
| mit | C# |
8f4ba49613769a9d0fda109598333c30633615b7 | Fix a test due to new public type | joelverhagen/TorSharp | test/TorSharp.Tests/PublicTypesTests.cs | test/TorSharp.Tests/PublicTypesTests.cs | using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace UnsharedNamespace
{
public class PublicTypesTests
{
[Fact]
public void TheSetOfPublicTypesIsExpected()
{
var expectedTypes = new List<Type>()
{
typeof(Knapcode.TorSharp.ITorSharpProxy),
typeof(Knapcode.TorSharp.ITorSharpToolFetcher),
typeof(Knapcode.TorSharp.ToolDownloadStrategy),
typeof(Knapcode.TorSharp.ToolRunnerType),
typeof(Knapcode.TorSharp.Tools.DownloadableFile),
typeof(Knapcode.TorSharp.Tools.Tor.TorControlClient),
typeof(Knapcode.TorSharp.Tools.Tor.TorControlException),
typeof(Knapcode.TorSharp.Tools.ZippedToolFormat),
typeof(Knapcode.TorSharp.ToolUpdate),
typeof(Knapcode.TorSharp.ToolUpdates),
typeof(Knapcode.TorSharp.ToolUpdateStatus),
typeof(Knapcode.TorSharp.TorSharpArchitecture),
typeof(Knapcode.TorSharp.TorSharpException),
typeof(Knapcode.TorSharp.TorSharpOSPlatform),
typeof(Knapcode.TorSharp.TorSharpPrivoxySettings),
typeof(Knapcode.TorSharp.TorSharpProxy),
typeof(Knapcode.TorSharp.TorSharpProxyExtensions),
typeof(Knapcode.TorSharp.TorSharpSettings),
typeof(Knapcode.TorSharp.TorSharpToolFetcher),
typeof(Knapcode.TorSharp.TorSharpTorSettings),
};
var publicTypes = typeof(Knapcode.TorSharp.TorSharpProxy)
.Assembly
.GetTypes()
.Where(x => x.IsPublic)
.ToList();
Assert.Empty(publicTypes.Except(expectedTypes));
Assert.Empty(expectedTypes.Except(publicTypes));
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace UnsharedNamespace
{
public class PublicTypesTests
{
[Fact]
public void TheSetOfPublicTypesIsExpected()
{
var expectedTypes = new List<Type>()
{
typeof(Knapcode.TorSharp.ITorSharpProxy),
typeof(Knapcode.TorSharp.ITorSharpToolFetcher),
typeof(Knapcode.TorSharp.ToolDownloadStrategy),
typeof(Knapcode.TorSharp.ToolRunnerType),
typeof(Knapcode.TorSharp.Tools.DownloadableFile),
typeof(Knapcode.TorSharp.Tools.Tor.TorControlClient),
typeof(Knapcode.TorSharp.Tools.Tor.TorControlException),
typeof(Knapcode.TorSharp.Tools.ZippedToolFormat),
typeof(Knapcode.TorSharp.ToolUpdate),
typeof(Knapcode.TorSharp.ToolUpdates),
typeof(Knapcode.TorSharp.ToolUpdateStatus),
typeof(Knapcode.TorSharp.TorSharpArchitecture),
typeof(Knapcode.TorSharp.TorSharpException),
typeof(Knapcode.TorSharp.TorSharpOSPlatform),
typeof(Knapcode.TorSharp.TorSharpPrivoxySettings),
typeof(Knapcode.TorSharp.TorSharpProxy),
typeof(Knapcode.TorSharp.TorSharpSettings),
typeof(Knapcode.TorSharp.TorSharpToolFetcher),
typeof(Knapcode.TorSharp.TorSharpTorSettings),
};
var publicTypes = typeof(Knapcode.TorSharp.TorSharpProxy)
.Assembly
.GetTypes()
.Where(x => x.IsPublic)
.ToList();
Assert.Empty(publicTypes.Except(expectedTypes));
Assert.Empty(expectedTypes.Except(publicTypes));
}
}
}
| mit | C# |
f4870c4678112638b693e59872ae936dc2989ae7 | Update QuoteRepository.cs | halitalf/NadekoMods,PravEF/EFNadekoBot,WoodenGlaze/NadekoBot,Midnight-Myth/Mitternacht-NEW,Taknok/NadekoBot,ShadowNoire/NadekoBot,Nielk1/NadekoBot,Blacnova/NadekoBot,gfrewqpoiu/NadekoBot,Midnight-Myth/Mitternacht-NEW,ScarletKuro/NadekoBot,Midnight-Myth/Mitternacht-NEW,miraai/NadekoBot,shikhir-arora/NadekoBot,Midnight-Myth/Mitternacht-NEW,Youngsie1997/NadekoBot,powered-by-moe/MikuBot | src/NadekoBot/Services/Database/Repositories/Impl/QuoteRepository.cs | src/NadekoBot/Services/Database/Repositories/Impl/QuoteRepository.cs | using NadekoBot.Services.Database.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace NadekoBot.Services.Database.Repositories.Impl
{
public class QuoteRepository : Repository<Quote>, IQuoteRepository
{
public QuoteRepository(DbContext context) : base(context)
{
}
public IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword) =>
_set.Where(q => q.GuildId == guildId && q.Keyword == keyword);
public IEnumerable<Quote> GetGroup(ulong guildId, int skip, int take) =>
_set.Where(q=>q.GuildId == guildId).OrderBy(q => q.Keyword).Skip(skip).Take(take).ToList();
public Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword)
{
var rng = new NadekoRandom();
return _set.Where(q => q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rng.Next()).FirstOrDefaultAsync();
}
public Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text)
{
var rngk = new NadekoRandom();
return _set.Where(q => q.Text.IndexOf(text, StringComparison.OrdinalIgnoreCase) >=0 && q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rngk.Next()).FirstOrDefaultAsync();
}
}
}
| using NadekoBot.Services.Database.Models;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace NadekoBot.Services.Database.Repositories.Impl
{
public class QuoteRepository : Repository<Quote>, IQuoteRepository
{
public QuoteRepository(DbContext context) : base(context)
{
}
public IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword) =>
_set.Where(q => q.GuildId == guildId && q.Keyword == keyword);
public IEnumerable<Quote> GetGroup(ulong guildId, int skip, int take) =>
_set.Where(q=>q.GuildId == guildId).OrderBy(q => q.Keyword).Skip(skip).Take(take).ToList();
public Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword)
{
var rng = new NadekoRandom();
return _set.Where(q => q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rng.Next()).FirstOrDefaultAsync();
}
public Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text)
{
var rngk = new NadekoRandom();
string lowertext = text.ToLowerInvariant();
string uppertext = text.ToUpperInvariant();
return _set.Where(q => (q.Text.Contains(text) | q.Text.Contains(lowertext) | q.Text.Contains(uppertext)) & (q.GuildId == guildId && q.Keyword == keyword)).OrderBy(q => rngk.Next()).FirstOrDefaultAsync();
}
}
}
| mit | C# |
62be3861971382632dea63eddb5adefc17a7974d | Fix issue with precision in assertions | SkillsFundingAgency/das-paymentsacceptancetesting | src/SFA.DAS.Payments.AcceptanceTests/Assertions/TransactionTypeRules/TransactionTypeRuleBase.cs | src/SFA.DAS.Payments.AcceptanceTests/Assertions/TransactionTypeRules/TransactionTypeRuleBase.cs | using System;
using System.Collections.Generic;
using System.Linq;
using SFA.DAS.Payments.AcceptanceTests.Contexts;
using SFA.DAS.Payments.AcceptanceTests.ReferenceDataModels;
using SFA.DAS.Payments.AcceptanceTests.ResultsDataModels;
namespace SFA.DAS.Payments.AcceptanceTests.Assertions.TransactionTypeRules
{
public abstract class TransactionTypeRuleBase
{
public virtual void AssertPeriodValues(IEnumerable<PeriodValue> periodValues, LearnerResults[] submissionResults, EmployerAccountContext employerAccountContext)
{
foreach (var period in periodValues)
{
var payments = FilterPayments(period, submissionResults, employerAccountContext);
var paidInPeriod = payments.Sum(p => p.Amount);
if(Math.Round(paidInPeriod, 2) != Math.Round(period.Value, 2))
{
throw new Exception(FormatAssertionFailureMessage(period, paidInPeriod));
}
}
}
protected abstract IEnumerable<PaymentResult> FilterPayments(PeriodValue period, IEnumerable<LearnerResults> submissionResults, EmployerAccountContext employerAccountContext);
protected abstract string FormatAssertionFailureMessage(PeriodValue period, decimal actualPaymentInPeriod);
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using SFA.DAS.Payments.AcceptanceTests.Contexts;
using SFA.DAS.Payments.AcceptanceTests.ReferenceDataModels;
using SFA.DAS.Payments.AcceptanceTests.ResultsDataModels;
namespace SFA.DAS.Payments.AcceptanceTests.Assertions.TransactionTypeRules
{
public abstract class TransactionTypeRuleBase
{
public virtual void AssertPeriodValues(IEnumerable<PeriodValue> periodValues, LearnerResults[] submissionResults, EmployerAccountContext employerAccountContext)
{
foreach (var period in periodValues)
{
var payments = FilterPayments(period, submissionResults, employerAccountContext);
var paidInPeriod = payments.Sum(p => p.Amount);
if (period.Value != paidInPeriod)
{
throw new Exception(FormatAssertionFailureMessage(period, paidInPeriod));
}
}
}
protected abstract IEnumerable<PaymentResult> FilterPayments(PeriodValue period, IEnumerable<LearnerResults> submissionResults, EmployerAccountContext employerAccountContext);
protected abstract string FormatAssertionFailureMessage(PeriodValue period, decimal actualPaymentInPeriod);
}
}
| mit | C# |
43fd62ddefd28f60a41021c9f0b87e833f51fd88 | add IfTest | sdcb/sdmap | sdmap/test/sdmap.test/DictionaryTest.cs | sdmap/test/sdmap.test/DictionaryTest.cs | using sdmap.Compiler;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace sdmap.test
{
public class DictionaryTest
{
[Fact]
public void MacroTest()
{
var rt = new SdmapCompiler();
rt.AddSourceCode("sql v1{#prop<A>}");
var result = rt.TryEmit("v1", new Dictionary<string, object>
{
["A"] = "A"
});
Assert.True(result.IsSuccess);
Assert.Equal("A", result.Value);
}
[Fact]
public void IfTest()
{
var rt = new SdmapCompiler();
rt.AddSourceCode("sql v1{#if(A){A}}");
var result = rt.TryEmit("v1", new Dictionary<string, object>
{
["A"] = true
});
Assert.True(result.IsSuccess);
Debugger.Launch();
Assert.Equal("A", result.Value);
}
}
}
| using sdmap.Compiler;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace sdmap.test
{
public class DictionaryTest
{
[Fact]
public void Dictionary()
{
var rt = new SdmapCompiler();
rt.AddSourceCode("sql v1{#prop<A>}");
var result = rt.TryEmit("v1", new Dictionary<string, object>
{
["A"] = "A"
});
Assert.True(result.IsSuccess);
Assert.Equal("A", result.Value);
}
}
}
| mit | C# |
d83ce8ea0518379b4433662ee6fc8b83af1e68ab | write exceptions on migration error | mehrandvd/Tralus,mehrandvd/Tralus | Framework/Source/Tralus.Framework.PowerShell/Migration/Cmdlets/UpdateTralusDatabaseCmdlet.cs | Framework/Source/Tralus.Framework.PowerShell/Migration/Cmdlets/UpdateTralusDatabaseCmdlet.cs | using System;
using System.Linq;
using System.Management.Automation;
namespace Tralus.Framework.PowerShell.Migration
{
[Cmdlet(VerbsData.Update, "TralusDatabase", SupportsShouldProcess = true)]
public class UpdateTralusDatabaseCmdlet : TralusMigrationCmdletBase
{
protected override void ProcessRecord()
{
base.ProcessRecord();
var migrator = GetMigrator();
var migrationBundles = migrator.GetMigrationPlan();
if (!migrationBundles.Any())
{
WriteWarning("No pending migration.");
return;
}
var bundleNumber = 1;
foreach (var migrationBundle in migrationBundles)
{
WriteObject($"\n{bundleNumber++}. Migrating ({migrationBundle}):");
foreach (var applyingMigration in migrationBundle.MigrationNames)
{
WriteObject($"\t-[{applyingMigration}]");
}
if (ShouldProcess("Database", $"Applying migration up to: [{migrationBundle.TargetMigrationName}]"))
{
try
{
var dbMigrator = migrationBundle.GetNewMigrator();
dbMigrator.Update(migrationBundle.TargetMigrationName);
}
catch (Exception exception)
{
WriteObject(exception.ToString());
throw;
}
WriteObject("\tDone.\n");
}
}
}
}
} | using System.Linq;
using System.Management.Automation;
namespace Tralus.Framework.PowerShell.Migration
{
[Cmdlet(VerbsData.Update, "TralusDatabase", SupportsShouldProcess = true)]
public class UpdateTralusDatabaseCmdlet : TralusMigrationCmdletBase
{
protected override void ProcessRecord()
{
base.ProcessRecord();
var migrator = GetMigrator();
var migrationBundles = migrator.GetMigrationPlan();
if (!migrationBundles.Any())
{
WriteWarning("No pending migration.");
return;
}
var bundleNumber = 1;
foreach (var migrationBundle in migrationBundles)
{
WriteObject($"\n{bundleNumber++}. Migrating ({migrationBundle}):");
foreach (var applyingMigration in migrationBundle.MigrationNames)
{
WriteObject($"\t-[{applyingMigration}]");
}
if (ShouldProcess("Database", $"Applying migration up to: [{migrationBundle.TargetMigrationName}]"))
{
var dbMigrator = migrationBundle.GetNewMigrator();
dbMigrator.Update(migrationBundle.TargetMigrationName);
WriteObject("\tDone.\n");
}
}
}
}
} | apache-2.0 | C# |
5696d2a944bbea61e124ec2097bb3d92ee263c91 | Use int instead of uint in BCRYPT_RSAKEY_BLOB | AArnott/pinvoke,jmelosegui/pinvoke,vbfox/pinvoke | src/BCrypt/BCrypt+BCRYPT_RSAKEY_BLOB.cs | src/BCrypt/BCrypt+BCRYPT_RSAKEY_BLOB.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="BCRYPT_RSAKEY_BLOB"/> nested type.
/// </content>
public partial class BCrypt
{
/// <summary>
/// A key blob format for transporting RSA keys.
/// </summary>
public struct BCRYPT_RSAKEY_BLOB
{
/// <summary>
/// Specifies the type of RSA key this BLOB represents.
/// </summary>
public MagicNumber Magic;
/// <summary>
/// The size, in bits, of the key.
/// </summary>
public int BitLength;
/// <summary>
/// The size, in bytes, of the exponent of the key.
/// </summary>
public int cbPublicExp;
/// <summary>
/// The size, in bytes, of the modulus of the key.
/// </summary>
public int cbModulus;
/// <summary>
/// The size, in bytes, of the first prime number of the key. This is only used for private key BLOBs.
/// </summary>
public int cbPrime1;
/// <summary>
/// The size, in bytes, of the second prime number of the key. This is only used for private key BLOBs.
/// </summary>
public int cbPrime2;
/// <summary>
/// Enumerates the values that may be expected in the <see cref="Magic"/> field.
/// </summary>
public enum MagicNumber : uint
{
BCRYPT_RSAPUBLIC_MAGIC = 0x31415352, // RSA1
BCRYPT_RSAPRIVATE_MAGIC = 0x32415352, // RSA2
BCRYPT_RSAFULLPRIVATE_MAGIC = 0x33415352, // RSA3
}
}
}
}
| // 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="BCRYPT_RSAKEY_BLOB"/> nested type.
/// </content>
public partial class BCrypt
{
/// <summary>
/// A key blob format for transporting RSA keys.
/// </summary>
public struct BCRYPT_RSAKEY_BLOB
{
/// <summary>
/// Specifies the type of RSA key this BLOB represents.
/// </summary>
public MagicNumber Magic;
/// <summary>
/// The size, in bits, of the key.
/// </summary>
public uint BitLength;
/// <summary>
/// The size, in bytes, of the exponent of the key.
/// </summary>
public uint cbPublicExp;
/// <summary>
/// The size, in bytes, of the modulus of the key.
/// </summary>
public uint cbModulus;
/// <summary>
/// The size, in bytes, of the first prime number of the key. This is only used for private key BLOBs.
/// </summary>
public uint cbPrime1;
/// <summary>
/// The size, in bytes, of the second prime number of the key. This is only used for private key BLOBs.
/// </summary>
public uint cbPrime2;
/// <summary>
/// Enumerates the values that may be expected in the <see cref="Magic"/> field.
/// </summary>
public enum MagicNumber : uint
{
BCRYPT_RSAPUBLIC_MAGIC = 0x31415352, // RSA1
BCRYPT_RSAPRIVATE_MAGIC = 0x32415352, // RSA2
BCRYPT_RSAFULLPRIVATE_MAGIC = 0x33415352, // RSA3
}
}
}
}
| mit | C# |
84bfaac5c4ba427105ef7040357d8cf41c2ba9ee | Fix sender UpdateChiamataInCorso | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.SignalR/Sender/GestioneChiamateInCorso/NotificationUpDateChiamataInCorso.cs | src/backend/SO115App.SignalR/Sender/GestioneChiamateInCorso/NotificationUpDateChiamataInCorso.cs | //-----------------------------------------------------------------------
// <copyright file="NotificationUpDateChiamataInCorso.cs" company="CNVVF">
// Copyright (C) 2017 - CNVVF
//
// This file is part of SOVVF.
// SOVVF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// SOVVF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
//-----------------------------------------------------------------------
using DomainModel.CQRS.Commands.ChiamataInCorsoMarker;
using Microsoft.AspNetCore.SignalR;
using SO115App.Models.Servizi.Infrastruttura.Notification.GestioneChiamateInCorso;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Competenze;
using SO115App.SignalR.Utility;
using System.Threading.Tasks;
namespace SO115App.SignalR.Sender.GestioneChiamateInCorso
{
public class NotificationUpDateChiamataInCorso : INotificationUpDateChiamataInCorso
{
private readonly IHubContext<NotificationHub> _notificationHubContext;
private readonly GetGerarchiaToSend _getGerarchiaToSend;
private readonly IGetCompetenzeByCoordinateIntervento _getCompetenze;
public NotificationUpDateChiamataInCorso(IHubContext<NotificationHub> NotificationHubContext,
GetGerarchiaToSend getGerarchiaToSend,
IGetCompetenzeByCoordinateIntervento getCompetenze)
{
_notificationHubContext = NotificationHubContext;
_getGerarchiaToSend = getGerarchiaToSend;
_getCompetenze = getCompetenze;
}
public async Task SendNotification(UpDateChiamataInCorsoMarkerCommand chiamata)
{
var Competenze = _getCompetenze.GetCompetenzeByCoordinateIntervento(chiamata.ChiamataInCorso.Localita.Coordinate);
var SediDaNotificare = _getGerarchiaToSend.Get(Competenze[0]);
//SediDaNotificare.Add(chiamata.ChiamataInCorso.CodiceSedeOperatore);
foreach (var sede in SediDaNotificare)
await _notificationHubContext.Clients.Group(sede).SendAsync("NotifyChiamataInCorsoMarkerUpdate", chiamata);
}
}
}
| //-----------------------------------------------------------------------
// <copyright file="NotificationUpDateChiamataInCorso.cs" company="CNVVF">
// Copyright (C) 2017 - CNVVF
//
// This file is part of SOVVF.
// SOVVF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// SOVVF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
// </copyright>
//-----------------------------------------------------------------------
using DomainModel.CQRS.Commands.ChiamataInCorsoMarker;
using Microsoft.AspNetCore.SignalR;
using SO115App.Models.Servizi.Infrastruttura.Notification.GestioneChiamateInCorso;
using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.Competenze;
using SO115App.SignalR.Utility;
using System.Threading.Tasks;
namespace SO115App.SignalR.Sender.GestioneChiamateInCorso
{
public class NotificationUpDateChiamataInCorso : INotificationUpDateChiamataInCorso
{
private readonly IHubContext<NotificationHub> _notificationHubContext;
private readonly GetGerarchiaToSend _getGerarchiaToSend;
private readonly IGetCompetenzeByCoordinateIntervento _getCompetenze;
public NotificationUpDateChiamataInCorso(IHubContext<NotificationHub> NotificationHubContext,
GetGerarchiaToSend getGerarchiaToSend,
IGetCompetenzeByCoordinateIntervento getCompetenze)
{
_notificationHubContext = NotificationHubContext;
_getGerarchiaToSend = getGerarchiaToSend;
_getCompetenze = getCompetenze;
}
public async Task SendNotification(UpDateChiamataInCorsoMarkerCommand chiamata)
{
var Competenze = _getCompetenze.GetCompetenzeByCoordinateIntervento(chiamata.ChiamataInCorso.Localita.Coordinate);
var SediDaNotificare = _getGerarchiaToSend.Get(Competenze[0]);
SediDaNotificare.Add(chiamata.ChiamataInCorso.CodiceSedeOperatore);
foreach (var sede in SediDaNotificare)
await _notificationHubContext.Clients.Group(sede).SendAsync("NotifyChiamataInCorsoMarkerUpdate", chiamata);
}
}
}
| agpl-3.0 | C# |
170be79da78f8427ee1b932314d208b6584f3313 | Fix `SynchronizationContext` to match correctly implementation structure | smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ppy/osu-framework | osu.Framework/Threading/SchedulerSynchronizationContext.cs | osu.Framework/Threading/SchedulerSynchronizationContext.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Diagnostics;
using System.Threading;
#nullable enable
namespace osu.Framework.Threading
{
/// <summary>
/// A synchronisation context which posts all continuatiuons to a scheduler instance.
/// </summary>
internal class SchedulerSynchronizationContext : SynchronizationContext
{
private readonly Scheduler scheduler;
public SchedulerSynchronizationContext(Scheduler scheduler)
{
this.scheduler = scheduler;
}
public override void Send(SendOrPostCallback d, object? state)
{
var del = scheduler.Add(() => d(state));
Debug.Assert(del != null);
while (del.State == ScheduledDelegate.RunState.Waiting)
scheduler.Update();
}
public override void Post(SendOrPostCallback d, object? state) => scheduler.Add(() => d(state));
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
#nullable enable
namespace osu.Framework.Threading
{
/// <summary>
/// A synchronisation context which posts all continuatiuons to a scheduler instance.
/// </summary>
internal class SchedulerSynchronizationContext : SynchronizationContext
{
private readonly Scheduler scheduler;
public SchedulerSynchronizationContext(Scheduler scheduler)
{
this.scheduler = scheduler;
}
public override void Send(SendOrPostCallback d, object? state) => scheduler.Add(() => d(state), false);
public override void Post(SendOrPostCallback d, object? state) => scheduler.Add(() => d(state), true);
}
}
| mit | C# |
f42f9cffe34a57b516c298feb9e5a52ee548f96d | Make HitCirclePlacementMask directly modify hitcircle position | NeoAdonis/osu,peppy/osu,NeoAdonis/osu,ppy/osu,johnneijzen/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,DrabWeb/osu,ppy/osu,ZLima12/osu,UselessToucan/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu,EVAST9919/osu,peppy/osu,smoogipoo/osu,2yangk23/osu,2yangk23/osu,UselessToucan/osu,johnneijzen/osu,naoey/osu,UselessToucan/osu,smoogipoo/osu,DrabWeb/osu,EVAST9919/osu,naoey/osu,ZLima12/osu,DrabWeb/osu,naoey/osu | osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs | osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.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 osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Masks
{
public class HitCirclePlacementMask : PlacementMask
{
public new HitCircle HitObject => (HitCircle)base.HitObject;
public HitCirclePlacementMask()
: base(new HitCircle())
{
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
InternalChild = new HitCircleMask(HitObject);
HitObject.PositionChanged += _ => Position = HitObject.StackedPosition;
}
protected override void LoadComplete()
{
base.LoadComplete();
// Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame
HitObject.Position = GetContainingInputManager().CurrentState.Mouse.Position;
}
protected override bool OnClick(ClickEvent e)
{
HitObject.StartTime = EditorClock.CurrentTime;
EndPlacement();
return true;
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
HitObject.Position = e.MousePosition;
return true;
}
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Masks
{
public class HitCirclePlacementMask : PlacementMask
{
public new HitCircle HitObject => (HitCircle)base.HitObject;
public HitCirclePlacementMask()
: base(new HitCircle())
{
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
InternalChild = new HitCircleMask(HitObject);
}
protected override void LoadComplete()
{
base.LoadComplete();
// Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame
Position = GetContainingInputManager().CurrentState.Mouse.Position;
}
protected override bool OnClick(ClickEvent e)
{
HitObject.StartTime = EditorClock.CurrentTime;
HitObject.Position = e.MousePosition;
EndPlacement();
return true;
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
Position = e.MousePosition;
return true;
}
}
}
| mit | C# |
72dbeaec1632ce6a94c71bc82141d447a1f19d4f | Fix the comment | johnneijzen/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,EVAST9919/osu,smoogipooo/osu,peppy/osu,johnneijzen/osu,UselessToucan/osu,2yangk23/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,ZLima12/osu,ppy/osu,peppy/osu,ZLima12/osu,NeoAdonis/osu,2yangk23/osu,EVAST9919/osu,smoogipoo/osu | osu.Game/Online/API/Requests/Responses/APIKudosuHistory.cs | osu.Game/Online/API/Requests/Responses/APIKudosuHistory.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 Humanizer;
using Newtonsoft.Json;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIKudosuHistory
{
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt;
[JsonProperty("amount")]
public int Amount;
[JsonProperty("post")]
public ModdingPost Post;
public class ModdingPost
{
[JsonProperty("url")]
public string Url;
[JsonProperty("title")]
public string Title;
}
[JsonProperty("giver")]
public KudosuGiver Giver;
public class KudosuGiver
{
[JsonProperty("url")]
public string Url;
[JsonProperty("username")]
public string Username;
}
[JsonProperty("action")]
private string action
{
set
{
//We will receive something like "event.action" or just "action"
string parsed = value.Contains(".") ? value.Split('.')[0].Pascalize() + value.Split('.')[1].Pascalize() : value.Pascalize();
Action = (KudosuAction)Enum.Parse(typeof(KudosuAction), parsed);
}
}
public KudosuAction Action;
}
}
| // 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 Humanizer;
using Newtonsoft.Json;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIKudosuHistory
{
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt;
[JsonProperty("amount")]
public int Amount;
[JsonProperty("post")]
public ModdingPost Post;
public class ModdingPost
{
[JsonProperty("url")]
public string Url;
[JsonProperty("title")]
public string Title;
}
[JsonProperty("giver")]
public KudosuGiver Giver;
public class KudosuGiver
{
[JsonProperty("url")]
public string Url;
[JsonProperty("username")]
public string Username;
}
[JsonProperty("action")]
private string action
{
set
{
//We will receive something like "foo.bar" or just "foo"
string parsed = value.Contains(".") ? value.Split('.')[0].Pascalize() + value.Split('.')[1].Pascalize() : value.Pascalize();
Action = (KudosuAction)Enum.Parse(typeof(KudosuAction), parsed);
}
}
public KudosuAction Action;
}
}
| mit | C# |
9854b9f7d07790e45bee23d3885f1119d7a34131 | add two hubs dd | mequanta/MsoServices,mequanta/MsoServices,mequanta/MsoServices | Mso.SignalR/SmartQuantHub.cs | Mso.SignalR/SmartQuantHub.cs | using System;
using Microsoft.AspNet.SignalR;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR.Hubs;
namespace Mso.SignalR.Hubs
{
public class SmartQuantHub : Hub<ISmartQuantService>
{
public async Task<string> GetProviderListAsync()
{
throw new NotImplementedException();
}
public async Task<string> GetProviderAsync(string providerName)
{
throw new NotImplementedException();
}
public async Task<string> SetProviderPropertiesAsync(string providerName, string jsonProperties)
{
throw new NotImplementedException();
}
public async Task<string> GetProviderPropertiesAsync(string providerName, string[] names)
{
throw new NotImplementedException();
}
public async void ConnectProvider(string providerName)
{
throw new NotImplementedException();
}
public async void DisconnectProvider(string providerName)
{
throw new NotImplementedException();
}
public async void GetInstrumentListAsync()
{
throw new NotImplementedException();
}
public async void AddInstrumentsAsync(string jsonText)
{
throw new NotImplementedException();
}
public async void DeleteInstrumentsAsync(string[] names)
{
throw new NotImplementedException();
}
public async void UpdateInstrumentAsync(string names, string jsonProperties)
{
throw new NotImplementedException();
}
public async Task<string> GetDataSeriesListAsync()
{
throw new NotImplementedException();
}
public async Task<string> GetStrategyListAsync()
{
throw new NotImplementedException();
}
public async Task<string> StartStrategy(string strategyId)
{
throw new NotImplementedException();
}
public async Task<string> StopStrategy(string strategyId)
{
throw new NotImplementedException();
}
public async Task<string> PauseStrategy(string strategyId, string evet)
{
throw new NotImplementedException();
}
}
}
| using System;
using Microsoft.AspNet.SignalR;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR.Hubs;
namespace Mso.SignalR.Hubs
{
public class SmartQuantHub : Hub<ISmartQuantService>
{
}
}
| apache-2.0 | C# |
2964d6b5b9ce9d76b818880be7b47c1dea848c0b | Add optional dotnet new arguments | RehanSaeed/ASP.NET-MVC-Boilerplate,RehanSaeed/ASP.NET-MVC-Boilerplate,ASP-NET-Core-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates,ASP-NET-Core-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates,RehanSaeed/ASP.NET-MVC-Boilerplate,ASP-NET-Core-Boilerplate/Templates | Tests/Boilerplate.Templates.Test/Framework/TempDirectoryExtensions.cs | Tests/Boilerplate.Templates.Test/Framework/TempDirectoryExtensions.cs | namespace Boilerplate.Templates.Test
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
public static class TempDirectoryExtensions
{
public static async Task<Project> DotnetNew(
this TempDirectory tempDirectory,
string templateName,
string name,
IDictionary<string, string> arguments = null,
TimeSpan? timeout = null)
{
var stringBuilder = new StringBuilder($"new {templateName} --name \"{name}\"");
if (arguments != null)
{
foreach (var argument in arguments)
{
stringBuilder.Append($" --{argument.Key} \"{argument.Value}\"");
}
}
await ProcessAssert.AssertStart(
tempDirectory.DirectoryPath,
"dotnet",
stringBuilder.ToString(),
timeout ?? TimeSpan.FromSeconds(20));
var projectDirectoryPath = Path.Combine(tempDirectory.DirectoryPath, name);
var projectFilePath = Path.Combine(projectDirectoryPath, name + ".csproj");
var publishDirectoryPath = Path.Combine(projectDirectoryPath, "Publish");
return new Project(name, projectFilePath, projectDirectoryPath, publishDirectoryPath);
}
}
}
| namespace Boilerplate.Templates.Test
{
using System;
using System.IO;
using System.Threading.Tasks;
public static class TempDirectoryExtensions
{
public static async Task<Project> DotnetNew(
this TempDirectory tempDirectory,
string templateName,
string name = null,
TimeSpan? timeout = null)
{
await ProcessAssert.AssertStart(tempDirectory.DirectoryPath, "dotnet", $"new {templateName} --name \"{name}\"", timeout ?? TimeSpan.FromSeconds(20));
var projectDirectoryPath = Path.Combine(tempDirectory.DirectoryPath, name);
var projectFilePath = Path.Combine(projectDirectoryPath, name + ".csproj");
var publishDirectoryPath = Path.Combine(projectDirectoryPath, "Publish");
return new Project(name, projectFilePath, projectDirectoryPath, publishDirectoryPath);
}
}
}
| mit | C# |
74ca780c7996b7acd910f390fee631fade5f2355 | Fix NRE when GridAction does not target a CCNodeGrid. Also, continue issuing error to log for just a little while longer. | haithemaraissia/CocosSharp,zmaruo/CocosSharp,MSylvia/CocosSharp,mono/CocosSharp,TukekeSoft/CocosSharp,zmaruo/CocosSharp,MSylvia/CocosSharp,mono/CocosSharp,TukekeSoft/CocosSharp,haithemaraissia/CocosSharp | src/actions/action_grid/CCGridAction.cs | src/actions/action_grid/CCGridAction.cs | using System;
using System.Diagnostics;
namespace CocosSharp
{
public class CCGridAction : CCAmplitudeAction
{
protected internal CCGridSize GridSize { get; private set; }
#region Constructors
public CCGridAction (float duration) : base (duration)
{
}
public CCGridAction (float duration, CCGridSize gridSize) : this (duration, gridSize, 0)
{
}
protected CCGridAction (float duration, CCGridSize gridSize, float amplitude) : base (duration, amplitude)
{
GridSize = gridSize;
}
#endregion Constructors
protected CCNodeGrid GridNode(CCNode target)
{
var gridNodeTarget = target as CCNodeGrid;
if (gridNodeTarget == null)
{
CCLog.Log("Grid Actions can only target CCNodeGrids.");
return null;
}
return gridNodeTarget;
}
protected internal override CCActionState StartAction(CCNode target)
{
return new CCGridActionState (this, GridNode(target));
}
public override CCFiniteTimeAction Reverse ()
{
return new CCReverseTime (this);
}
}
#region Action state
public class CCGridActionState : CCAmplitudeActionState
{
protected CCGridSize GridSize { get; private set; }
public virtual CCGridBase Grid {
get { return null; }
protected set { }
}
public CCGridActionState (CCGridAction action, CCNodeGrid target) : base (action, target)
{
GridSize = action.GridSize;
// If target is not a CCNodeGrid we will want to emmit a message and
// return or there can be possible NRE's later on.
var gridNodeTarget = Target as CCNodeGrid;
if (gridNodeTarget == null)
{
CCLog.Log("Grid Actions only target CCNodeGrids.");
return;
}
CCGridBase targetGrid = target.Grid;
if (targetGrid != null && targetGrid.ReuseGrid > 0)
{
Grid = targetGrid;
if (targetGrid.Active && targetGrid.GridSize.X == GridSize.X && targetGrid.GridSize.Y == GridSize.Y)
{
targetGrid.Reuse ();
}
else
{
Debug.Assert (false);
}
}
else
{
if (targetGrid != null && targetGrid.Active)
{
targetGrid.Active = false;
}
CCGridBase newgrid = Grid;
if (target != null)
{
target.Grid = newgrid;
target.Grid.Active = true;
}
}
}
}
#endregion Action state
} | using System;
using System.Diagnostics;
namespace CocosSharp
{
public class CCGridAction : CCAmplitudeAction
{
protected internal CCGridSize GridSize { get; private set; }
#region Constructors
public CCGridAction (float duration) : base (duration)
{
}
public CCGridAction (float duration, CCGridSize gridSize) : this (duration, gridSize, 0)
{
}
protected CCGridAction (float duration, CCGridSize gridSize, float amplitude) : base (duration, amplitude)
{
GridSize = gridSize;
}
#endregion Constructors
protected CCNodeGrid GridNode(CCNode target)
{
var gridNodeTarget = target as CCNodeGrid;
if (gridNodeTarget == null)
{
CCLog.Log("Grid Actions can only target CCNodeGrids.");
return null;
}
return gridNodeTarget;
}
protected internal override CCActionState StartAction(CCNode target)
{
return new CCGridActionState (this, GridNode(target));
}
public override CCFiniteTimeAction Reverse ()
{
return new CCReverseTime (this);
}
}
#region Action state
public class CCGridActionState : CCAmplitudeActionState
{
protected CCGridSize GridSize { get; private set; }
public virtual CCGridBase Grid {
get { return null; }
protected set { }
}
public CCGridActionState (CCGridAction action, CCNodeGrid target) : base (action, target)
{
GridSize = action.GridSize;
CCGridBase targetGrid = target.Grid;
if (targetGrid != null && targetGrid.ReuseGrid > 0)
{
Grid = targetGrid;
if (targetGrid.Active && targetGrid.GridSize.X == GridSize.X && targetGrid.GridSize.Y == GridSize.Y)
{
targetGrid.Reuse ();
}
else
{
Debug.Assert (false);
}
}
else
{
if (targetGrid != null && targetGrid.Active)
{
targetGrid.Active = false;
}
CCGridBase newgrid = Grid;
if (target != null)
{
target.Grid = newgrid;
target.Grid.Active = true;
}
}
}
}
#endregion Action state
} | mit | C# |
b9b8d3d655dafb6417172838970c6e41ed0eb1e5 | Add tutorials to blog categories. | LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform | src/CompetitionPlatform/Data/BlogCategory/BlogCategoriesRepository.cs | src/CompetitionPlatform/Data/BlogCategory/BlogCategoriesRepository.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CompetitionPlatform.Data.BlogCategory
{
public class BlogCategoriesRepository : IBlogCategoriesRepository
{
public List<string> GetCategories()
{
return new List<string>
{
"News",
"Results",
"Winners",
"Success stories",
"Videos",
"About",
"Tutorials"
};
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CompetitionPlatform.Data.BlogCategory
{
public class BlogCategoriesRepository : IBlogCategoriesRepository
{
public List<string> GetCategories()
{
return new List<string>
{
"News",
"Results",
"Winners",
"Success stories",
"Videos",
"About"
};
}
}
}
| mit | C# |
6e45d0f0296e31aedf7d8ca7386e0cd41fa7cb14 | Change object to dynamic | watson-developer-cloud/dotnet-standard-sdk,watson-developer-cloud/dotnet-standard-sdk | src/IBM.WatsonDeveloperCloud.Conversation/v1/Model/MessageResponse.cs | src/IBM.WatsonDeveloperCloud.Conversation/v1/Model/MessageResponse.cs | /**
* Copyright 2017 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using Newtonsoft.Json;
using System.Collections.Generic;
namespace IBM.WatsonDeveloperCloud.Conversation.v1.Model
{
/// <summary>
/// Returns the last user input, the recognized intents and entities, and the updated context and system output.
/// The response can include properties that are added by dialog node output or by the client app.
/// </summary>
public class MessageResponse
{
/// <summary>
/// The user input from the request.
/// </summary>
[JsonProperty("input")]
public dynamic Input { get; set; }
/// <summary>
/// Whether to return more than one intent. Included in the response only.
/// </summary>
[JsonProperty("alternate_intents")]
public bool AlternateIntents { get; set; }
/// <summary>
/// A context object that includes state information for the conversation.
/// </summary>
[JsonProperty("context")]
public dynamic Context { get; set; }
/// <summary>
/// An entities object that includes terms from the request that are identified as entities. Returns an empty array
/// if no entities are returned.
/// </summary>
[JsonProperty("entities")]
public List<EntityResponse> Entities { get; set; }
/// <summary>
/// An array of intent name-confidence pairs for the user input. The list is sorted in descending order of confidence.
/// If there are 10 or fewer intents, the sum of the confidence values is 100%. Returns an empty array if no intents are returned.
/// </summary>
[JsonProperty("intents")]
public List<Intent> Intents { get; set; }
/// <summary>
/// An output object that includes the response to the user, the nodes that were hit, and messages from the log.
/// </summary>
[JsonProperty("output")]
public dynamic Output { get; set; }
}
}
| /**
* Copyright 2017 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using Newtonsoft.Json;
using System.Collections.Generic;
namespace IBM.WatsonDeveloperCloud.Conversation.v1.Model
{
/// <summary>
/// Returns the last user input, the recognized intents and entities, and the updated context and system output.
/// The response can include properties that are added by dialog node output or by the client app.
/// </summary>
public class MessageResponse
{
/// <summary>
/// The user input from the request.
/// </summary>
[JsonProperty("input")]
public InputData Input { get; set; }
/// <summary>
/// Whether to return more than one intent. Included in the response only.
/// </summary>
[JsonProperty("alternate_intents")]
public bool AlternateIntents { get; set; }
/// <summary>
/// A context object that includes state information for the conversation.
/// </summary>
[JsonProperty("context")]
public Context Context { get; set; }
/// <summary>
/// An entities object that includes terms from the request that are identified as entities. Returns an empty array
/// if no entities are returned.
/// </summary>
[JsonProperty("entities")]
public List<EntityResponse> Entities { get; set; }
/// <summary>
/// An array of intent name-confidence pairs for the user input. The list is sorted in descending order of confidence.
/// If there are 10 or fewer intents, the sum of the confidence values is 100%. Returns an empty array if no intents are returned.
/// </summary>
[JsonProperty("intents")]
public List<Intent> Intents { get; set; }
/// <summary>
/// An output object that includes the response to the user, the nodes that were hit, and messages from the log.
/// </summary>
[JsonProperty("output")]
public OutputData Output { get; set; }
}
}
| apache-2.0 | C# |
291fd839896adfd3761e4887cc4e5775c777c6eb | add default constructor | psyun/HDO2O-RestfulAPI | HDO2O.DTO/BarbershopDTO.cs | HDO2O.DTO/BarbershopDTO.cs | using HDO2O.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HDO2O.DTO
{
public class BarbershopDTO : BaseDTO<Barbershop>
{
public string BusinessLicense { get; set; }
public int Id { get; set; }
public double Lat { get; set; }
public double Lng { get; set; }
public string LocationTitle { get; set; }
public string Name { get; set; }
public string OwnerHairDresserId { get; set; }
public BarbershopDTO()
{
}
public BarbershopDTO(Barbershop entity)
: base(entity)
{
this.BusinessLicense = entity.BusinessLicense;
this.Id = entity.Id;
this.Lat = entity.Lat;
this.Lng = entity.Lng;
this.LocationTitle = entity.LocationTitle;
this.Name = entity.Name;
}
public override Barbershop ToEntity()
{
return new Barbershop
{
Id = this.Id,
BusinessLicense = this.BusinessLicense,
Lat = this.Lat,
Lng = this.Lng,
LocationTitle = this.LocationTitle,
Name = this.Name
};
}
}
}
| using HDO2O.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HDO2O.DTO
{
public class BarbershopDTO : BaseDTO<Barbershop>
{
public string BusinessLicense { get; set; }
public Guid Id { get; set; }
public double Lat { get; set; }
public double Lng { get; set; }
public string LocationTitle { get; set; }
public string Name { get; set; }
public BarbershopDTO(Barbershop entity)
: base(entity)
{
this.BusinessLicense = entity.BusinessLicense;
this.Id = entity.Id;
this.Lat = entity.Lat;
this.Lng = entity.Lng;
this.LocationTitle = entity.LocationTitle;
this.Name = entity.Name;
}
public override Barbershop ToEntity()
{
return new Barbershop
{
Id = this.Id,
BusinessLicense = this.BusinessLicense,
Lat = this.Lat,
Lng = this.Lng,
LocationTitle = this.LocationTitle,
Name = this.Name
};
}
}
}
| apache-2.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.