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 |
|---|---|---|---|---|---|---|---|---|
9b1c2bee10c4726060929868939725b6e913d516 | Update changelog | zumicts/Audiotica | Apps/Audiotica.WindowsPhone/View/HomePage.xaml.cs | Apps/Audiotica.WindowsPhone/View/HomePage.xaml.cs | #region
using Windows.Storage;
using Windows.UI.Core;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;
using Microsoft.Xbox.Music.Platform.Contract.DataModel;
#endregion
namespace Audiotica.View
{
public sealed partial class HomePage
{
public HomePage()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
var justUpdated = true;
var firstRun = !ApplicationData.Current.LocalSettings.Values.ContainsKey("CurrentBuild");
if (!firstRun)
justUpdated = (string) ApplicationData.Current.LocalSettings.Values["CurrentBuild"]
!= "1409-beta2-patch0";
else
{
ApplicationData.Current.LocalSettings.Values.Add("CurrentBuild", "1409-beta2-patch0");
new MessageDialog("This beta is meant for testing the player and saving songs. Downloading is not available until patch #2 but you can stream.",
"v1409 (BETA2)").ShowAsync();
}
if (!justUpdated || firstRun) return;
new MessageDialog("-bg player \n-streaming \n-artist link in album page \n-fix loading data issues", "Beta2").ShowAsync();
ApplicationData.Current.LocalSettings.Values["CurrentBuild"] = "1409-beta2-patch0";
}
//TODO [Harry,20140908] move this to view model with RelayCommand
private void ListView_ItemClick(object sender, ItemClickEventArgs e)
{
var album = e.ClickedItem as XboxAlbum;
if (album != null) Frame.Navigate(typeof (AlbumPage), album.Id);
}
private void Grid_Tapped(object sender, TappedRoutedEventArgs e)
{
var artist = ((Grid) sender).DataContext as XboxArtist;
if (artist != null) Frame.Navigate(typeof (ArtistPage), artist.Id);
}
}
} | #region
using Windows.Storage;
using Windows.UI.Core;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;
using Microsoft.Xbox.Music.Platform.Contract.DataModel;
#endregion
namespace Audiotica.View
{
public sealed partial class HomePage
{
public HomePage()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
var justUpdated = true;
var firstRun = !ApplicationData.Current.LocalSettings.Values.ContainsKey("CurrentBuild");
if (!firstRun)
justUpdated = (string) ApplicationData.Current.LocalSettings.Values["CurrentBuild"]
!= "1409-beta1-patch3";
else
{
ApplicationData.Current.LocalSettings.Values.Add("CurrentBuild", "1409-beta1-patch3");
new MessageDialog("This beta is meant for UI feedback and international testing of the charts api.",
"v1409 (BETA1) - Patch #3").ShowAsync();
}
if (!justUpdated || firstRun) return;
new MessageDialog("changelog here", "Patch #").ShowAsync();
ApplicationData.Current.LocalSettings.Values["CurrentBuild"] = "1409-beta1-patch3";
}
//TODO [Harry,20140908] move this to view model with RelayCommand
private void ListView_ItemClick(object sender, ItemClickEventArgs e)
{
var album = e.ClickedItem as XboxAlbum;
if (album != null) Frame.Navigate(typeof (AlbumPage), album.Id);
}
private void Grid_Tapped(object sender, TappedRoutedEventArgs e)
{
var artist = ((Grid) sender).DataContext as XboxArtist;
if (artist != null) Frame.Navigate(typeof (ArtistPage), artist.Id);
}
}
} | apache-2.0 | C# |
0d9ed9201fe0fac3b630473b4335d0d78587e1c0 | 解决一个由协程引起的Editor崩溃的Bug。 | winddyhe/knight | Assets/Plugins/Core/Coroutine/CoroutineHandler.cs | Assets/Plugins/Core/Coroutine/CoroutineHandler.cs | //======================================================================
// Copyright (C) 2015-2020 Winddy He. All rights reserved
// Email: hgplan@126.com
//======================================================================
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Core
{
public class CoroutineHandler : MonoBehaviour
{
public Coroutine Coroutine;
public bool IsCompleted;
public bool IsRunning;
public Coroutine StartHandler(IEnumerator rIEnum)
{
this.IsCompleted = false;
this.IsRunning = true;
this.Coroutine = this.StartCoroutine(this.StartHandler_Async(rIEnum));
return this.Coroutine;
}
private IEnumerator StartHandler_Async(IEnumerator rIEnum)
{
yield return rIEnum;
this.IsRunning = false;
this.IsCompleted = true;
// 要等一帧才能把自己删掉,要不然会崩溃
yield return 0;
// 自己把自己删掉,并将对应的数据都清空
CoroutineManager.Instance.Stop(this);
}
}
}
| //======================================================================
// Copyright (C) 2015-2020 Winddy He. All rights reserved
// Email: hgplan@126.com
//======================================================================
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Core
{
public class CoroutineHandler : MonoBehaviour
{
public Coroutine Coroutine;
public bool IsCompleted;
public bool IsRunning;
public Coroutine StartHandler(IEnumerator rIEnum)
{
this.IsCompleted = false;
this.IsRunning = true;
this.Coroutine = this.StartCoroutine(this.StartHandler_Async(rIEnum));
return this.Coroutine;
}
private IEnumerator StartHandler_Async(IEnumerator rIEnum)
{
yield return rIEnum;
this.IsRunning = false;
this.IsCompleted = true;
// 自己把自己删掉,并将对应的数据都清空
CoroutineManager.Instance.Stop(this);
}
}
}
| mit | C# |
18196ad1b837c77bb9f3c4d4afaa79da6d2ed1f8 | Comment on ShipManager.cs (This should have been in the last commit) | Voxelgon/Voxelgon,Voxelgon/Voxelgon | Assets/Plugins/Voxelgon/Spacecraft/ShipManager.cs | Assets/Plugins/Voxelgon/Spacecraft/ShipManager.cs | using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using Voxelgon;
[RequireComponent (typeof (Rigidbody))]
public class ShipManager : MonoBehaviour {
public float portTransCutoff = 5;
//Setup Variables for gathering Ports
public enum Direction{
YawLeft,
YawRight,
TransLeft,
TransRight,
TransForw,
TransBack
}
//dictionary of ports
public Dictionary<Direction, List<GameObject> > portGroups = new Dictionary<Direction, List<GameObject> > ();
public void SetupPorts(){
portGroups.Add( Direction.YawLeft, new List<GameObject>() );
portGroups.Add( Direction.YawRight, new List<GameObject>() );
portGroups.Add( Direction.TransLeft, new List<GameObject>() );
portGroups.Add( Direction.TransRight, new List<GameObject>() );
portGroups.Add( Direction.TransForw, new List<GameObject>() );
portGroups.Add( Direction.TransBack, new List<GameObject>() );
Vector3 origin = transform.rigidbody.centerOfMass;
Debug.Log(origin);
Component[] PortScripts = gameObject.GetComponentsInChildren(typeof(RCSport));
foreach(Component i in PortScripts) {
float angle = Voxelgon.Math.RelativeAngle(origin, i.transform);
Debug.Log(angle);
if(angle > portTransCutoff){
portGroups[Direction.YawLeft].Add(i.gameObject);
Debug.Log("This port is for turning Left!");
} else if(angle < (-1 * portTransCutoff)){
portGroups[Direction.YawRight].Add(i.gameObject);
Debug.Log("This port is for turning right!");
}
}
}
//Startup Script
public void Start() {
SetupPorts();
}
}
| using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using Voxelgon;
[RequireComponent (typeof (Rigidbody))]
public class ShipManager : MonoBehaviour {
public float portTransCutoff = 5;
//Setup Variables for gathering Ports
public enum Direction{
YawLeft,
YawRight,
TransLeft,
TransRight,
TransForw,
TransBack
}
//dictionary of ports
public Dictionary<Direction, List<GameObject> > portGroups = new Dictionary<Direction, List<GameObject> > ();
public void SetupPorts(){
portGroups.Add( Direction.YawLeft, new List<GameObject>() );
portGroups.Add( Direction.YawRight, new List<GameObject>() );
portGroups.Add( Direction.TransLeft, new List<GameObject>() );
portGroups.Add( Direction.TransRight, new List<GameObject>() );
portGroups.Add( Direction.TransForw, new List<GameObject>() );
portGroups.Add( Direction.TransBack, new List<GameObject>() );
Vector3 origin = transform.rigidbody.centerOfMass;
Debug.Log(origin);
Component[] PortScripts = gameObject.GetComponentsInChildren(typeof(RCSport));
foreach(Component i in PortScripts) {
float angle = Voxelgon.Math.RelativeAngle(origin, i.transform);
Debug.Log(angle);
if(angle > portTransCutoff){
portGroups[Direction.YawLeft].Add(i.gameObject);
Debug.Log("This port is for turning Left!");
} else if(angle < (-1 * portTransCutoff)){
portGroups[Direction.YawRight].Add(i.gameObject);
Debug.Log("This port is for turning right!");
}
}
}
public void Start() {
SetupPorts();
}
}
| apache-2.0 | C# |
6ee10fe98bca84115288e283d41eedb3425f12be | add grs | btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver | BTCPayServer/BTCPayNetworkProvider.Groestlcoin.cs | BTCPayServer/BTCPayNetworkProvider.Groestlcoin.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NBitcoin;
namespace BTCPayServer
{
public partial class BTCPayNetworkProvider
{
public void InitGroestlcoin()
{
var nbxplorerNetwork = NBXplorerNetworkProvider.GetFromCryptoCode("GRS");
Add(new BTCPayNetwork()
{
CryptoCode = nbxplorerNetwork.CryptoCode,
DisplayName = "Groestlcoin",
BlockExplorerLink = NetworkType == NetworkType.Mainnet
? "https://chainz.cryptoid.info/grs/tx.dws?{0}.htm"
: "https://chainz.cryptoid.info/grs-test/tx.dws?{0}.htm",
NBitcoinNetwork = nbxplorerNetwork.NBitcoinNetwork,
NBXplorerNetwork = nbxplorerNetwork,
UriScheme = "groestlcoin",
DefaultRateRules = new[]
{
"GRS_X = GRS_BTC * BTC_X",
"GRS_BTC = bittrex(GRS_BTC)"
},
CryptoImagePath = "imlegacy/groestlcoin.png",
LightningImagePath = "imlegacy/groestlcoin-lightning.svg",
DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType),
CoinType = NetworkType == NetworkType.Mainnet ? new KeyPath("17'") : new KeyPath("1'"),
//https://github.com/Groestlcoin/electrum-grs/blob/6799baba60305164126a92b52e5e95284ed44543/electrum_grs/constants.py
ElectrumMapping = NetworkType == NetworkType.Mainnet
? new Dictionary<uint, string[]>()
{
{0x0488b21eU, new[] {"legacy"}},
{0x049d7cb2U, new[] {"p2sh"}},
{0x04b24746U, Array.Empty<string>()},
}
: new Dictionary<uint, string[]>()
{
{0x043587cfU, new[] {"legacy"}},
{0x044a5262U, new[] {"p2sh"}},
{0x045f1cf6U, Array.Empty<string>()}
}
});
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NBitcoin;
namespace BTCPayServer
{
public partial class BTCPayNetworkProvider
{
public void InitGroestlcoin()
{
var nbxplorerNetwork = NBXplorerNetworkProvider.GetFromCryptoCode("GRS");
Add(new BTCPayNetwork()
{
CryptoCode = nbxplorerNetwork.CryptoCode,
DisplayName = "Groestlcoin",
BlockExplorerLink = NetworkType == NetworkType.Mainnet ? "https://chainz.cryptoid.info/grs/tx.dws?{0}.htm" : "https://chainz.cryptoid.info/grs-test/tx.dws?{0}.htm",
NBitcoinNetwork = nbxplorerNetwork.NBitcoinNetwork,
NBXplorerNetwork = nbxplorerNetwork,
UriScheme = "groestlcoin",
DefaultRateRules = new[]
{
"GRS_X = GRS_BTC * BTC_X",
"GRS_BTC = bittrex(GRS_BTC)"
},
CryptoImagePath = "imlegacy/groestlcoin.png",
LightningImagePath = "imlegacy/groestlcoin-lightning.svg",
DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType),
CoinType = NetworkType == NetworkType.Mainnet ? new KeyPath("17'") : new KeyPath("1'")
});
}
}
}
| mit | C# |
592a1cb2b66853b80b56e3289bdb00446ac48da0 | Disable broken test | github/VisualStudio,github/VisualStudio,github/VisualStudio | src/UnitTests/GitHub.VisualStudio/TeamExplorer/Home/GraphsNavigationItemTests.cs | src/UnitTests/GitHub.VisualStudio/TeamExplorer/Home/GraphsNavigationItemTests.cs | using System;
using GitHub.Api;
using GitHub.Services;
using GitHub.VisualStudio.TeamExplorer.Home;
using NSubstitute;
using Xunit;
public class GraphsNavigationItemTests
{
public class TheExecuteMethod : TestBaseClass
{
[Theory(Skip = "Needs fixing with new TeamFoundation split assemblies")]
[InlineData("https://github.com/foo/bar.git", "https://github.com/foo/bar/graphs")]
[InlineData("https://haacked@github.com/foo/bar.git", "https://github.com/foo/bar/graphs")]
[InlineData("https://github.com/foo/bar", "https://github.com/foo/bar/graphs")]
[InlineData("https://github.com/foo/bar/", "https://github.com/foo/bar/graphs")]
public void BrowsesToTheCorrectURL(string origin, string expectedUrl)
{
var apiFactory = Substitute.For<ISimpleApiClientFactory>();
var browser = Substitute.For<IVisualStudioBrowser>();
var lazyBrowser = new Lazy<IVisualStudioBrowser>(() => browser);
var holder = Substitute.For<ITeamExplorerServiceHolder>();
var graphsNavigationItem = new GraphsNavigationItem(apiFactory, lazyBrowser, holder)
{
ActiveRepoUri = origin
};
graphsNavigationItem.Execute();
browser.Received().OpenUrl(new Uri(expectedUrl));
}
}
}
| using System;
using GitHub.Api;
using GitHub.Services;
using GitHub.VisualStudio.TeamExplorer.Home;
using NSubstitute;
using Xunit;
public class GraphsNavigationItemTests
{
public class TheExecuteMethod : TestBaseClass
{
[Theory]
[InlineData("https://github.com/foo/bar.git", "https://github.com/foo/bar/graphs")]
[InlineData("https://haacked@github.com/foo/bar.git", "https://github.com/foo/bar/graphs")]
[InlineData("https://github.com/foo/bar", "https://github.com/foo/bar/graphs")]
[InlineData("https://github.com/foo/bar/", "https://github.com/foo/bar/graphs")]
public void BrowsesToTheCorrectURL(string origin, string expectedUrl)
{
var apiFactory = Substitute.For<ISimpleApiClientFactory>();
var browser = Substitute.For<IVisualStudioBrowser>();
var lazyBrowser = new Lazy<IVisualStudioBrowser>(() => browser);
var holder = Substitute.For<ITeamExplorerServiceHolder>();
var graphsNavigationItem = new GraphsNavigationItem(apiFactory, lazyBrowser, holder)
{
ActiveRepoUri = origin
};
graphsNavigationItem.Execute();
browser.Received().OpenUrl(new Uri(expectedUrl));
}
}
}
| mit | C# |
94324211275fb4efafb7c230f13355a0b2ca555e | return when you fail | drcrook1/BioInformatics,drcrook1/BioInformatics,drcrook1/BioInformatics | Web/BioInfo.Web.Services/Implementations/SqlDeviceRegistration.cs | Web/BioInfo.Web.Services/Implementations/SqlDeviceRegistration.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BioInfo.Web.Core.Interfaces;
using BioInfo.Web.Core.EntityFramework;
namespace BioInfo.Web.Services.Implementations
{
public class SqlDeviceRegistration : IDeviceRegistration
{
private BioInfoDBContext deviceRegistry;
public SqlDeviceRegistration(string connectionString)
{
this.deviceRegistry = new BioInfoDBContext(connectionString);
}
public async Task<FunctionResult<bool>> RegisterDeviceAsync(IDevice device)
{
try
{
bool userExists = deviceRegistry.DomainUsers.Any(x => x.Id == device.OwnerId);
if (!userExists)
{
return FunctionResult.Fail("There is no register user. Please register user before registering device.");
}
bool bandExists = deviceRegistry.Bands.Any(x => x.IoTHubId == device.Name);
if (bandExists)
{
return FunctionResult.Fail("Device has already been registered");
}
var band = new Band(device.Name, device.OwnerId);
deviceRegistry.Bands.Add(band);
await deviceRegistry.SaveChangesAsync();
}
catch (Exception ex)
{
return FunctionResult.Fail(ex.Message);
}
return FunctionResult.Success();
}
public async Task<FunctionResult<bool>> UnregisterDeviceAsync(IDevice device)
{
try
{
var band = new Band(device.Name, device.OwnerId);
deviceRegistry.Bands.Remove(band);
await deviceRegistry.SaveChangesAsync();
}
catch (Exception ex)
{
return FunctionResult.Fail(ex.Message);
}
return FunctionResult.Success();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BioInfo.Web.Core.Interfaces;
using BioInfo.Web.Core.EntityFramework;
namespace BioInfo.Web.Services.Implementations
{
public class SqlDeviceRegistration : IDeviceRegistration
{
private BioInfoDBContext deviceRegistry;
public SqlDeviceRegistration()
{
this.deviceRegistry = new BioInfoDBContext();
}
public SqlDeviceRegistration(string connectionString)
{
this.deviceRegistry = new BioInfoDBContext(connectionString);
}
public async Task<FunctionResult<bool>> RegisterDeviceAsync(IDevice device)
{
try
{
bool userExists = deviceRegistry.DomainUsers.Any(x => x.Id == device.OwnerId);
if (!userExists)
{
FunctionResult.Fail("There is no register user. Please register user before registering device.");
}
bool bandExists = deviceRegistry.Bands.Any(x => x.IoTHubId == device.Name);
if (!bandExists)
{
FunctionResult.Fail("Device has already been registered");
}
var band = new Band(device.Name, device.OwnerId);
deviceRegistry.Bands.Add(band);
await deviceRegistry.SaveChangesAsync();
}
catch (Exception ex)
{
FunctionResult.Fail(ex.Message);
}
return FunctionResult.Success();
}
public async Task<FunctionResult<bool>> UnregisterDeviceAsync(IDevice device)
{
try
{
var band = new Band(device.Name, device.OwnerId);
deviceRegistry.Bands.Remove(band);
await deviceRegistry.SaveChangesAsync();
}
catch (Exception ex)
{
FunctionResult.Fail(ex.Message);
}
return FunctionResult.Success();
}
}
}
| mit | C# |
3f942591e61e57d206c80797455c18739f1af76d | change default title | samaritanevent/Samaritans,samaritanevent/Samaritans | Samaritans/Samaritans/Views/Shared/_Layout.cshtml | Samaritans/Samaritans/Views/Shared/_Layout.cshtml | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Do Gooders</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Do Gooders", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Do Gooders", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
| mit | C# |
15bc56642f475dbbb83f047b9208fc55f49f93d6 | Update ILiteDbDatabaseProvider.cs | tiksn/TIKSN-Framework | TIKSN.Core/Data/LiteDB/ILiteDbDatabaseProvider.cs | TIKSN.Core/Data/LiteDB/ILiteDbDatabaseProvider.cs | using LiteDB;
namespace TIKSN.Data.LiteDB
{
/// <summary>
/// Create LiteDB database
/// </summary>
public interface ILiteDbDatabaseProvider
{
/// <summary>
/// Creates LiteDB database
/// </summary>
/// <returns></returns>
LiteDatabase GetDatabase();
/// <summary>
/// Creates LiteDB database with mapper
/// </summary>
/// <param name="mapper">Mapper</param>
/// <returns></returns>
LiteDatabase GetDatabase(BsonMapper mapper);
}
}
| using LiteDB;
namespace TIKSN.Data.LiteDB
{
/// <summary>
/// Create LiteDB database
/// </summary>
public interface ILiteDbDatabaseProvider
{
/// <summary>
/// Creates LiteDB database
/// </summary>
/// <returns></returns>
LiteDatabase GetDatabase();
/// <summary>
/// Creates LiteDB database with mapper
/// </summary>
/// <param name="mapper">Mapper</param>
/// <returns></returns>
LiteDatabase GetDatabase(BsonMapper mapper);
}
} | mit | C# |
2e4a005da1aff3bea13829a61b2af00a6ec87112 | Remove unneeded setter | arnovb-github/CmcLibNet | CmcLibNet.Attributes/CursorCreatableAttribute.cs | CmcLibNet.Attributes/CursorCreatableAttribute.cs | using System;
namespace Vovin.CmcLibNet.Attributes
{
/// <summary>
/// Indicates if a Commence cursor can be created on the Commence View type.
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public class CursorCreatableAttribute : Attribute
{
#region Properties
/// <summary>
/// Property.
/// </summary>
public bool CursorCreatable { get; }
#endregion
#region Constructor
/// <summary>
/// Constructor.
/// </summary>
/// <param name="value">Boolean.</param>
public CursorCreatableAttribute(bool value)
{
this.CursorCreatable = value;
}
#endregion
}
}
| using System;
namespace Vovin.CmcLibNet.Attributes
{
/// <summary>
/// Indicates if a Commence cursor can be created on the Commence View type.
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public class CursorCreatableAttribute : Attribute
{
#region Properties
/// <summary>
/// Property.
/// </summary>
public bool CursorCreatable { get; protected set; }
#endregion
#region Constructor
/// <summary>
/// Constructor.
/// </summary>
/// <param name="value">Boolean.</param>
public CursorCreatableAttribute(bool value)
{
this.CursorCreatable = value;
}
#endregion
}
}
| mit | C# |
e2b308f380150c262e42feea16b384582d86614d | Update Demo | sunkaixuan/SqlSugar | Src/Asp.Net/SqlServerTest/Demo/Demo1_Queryable.cs | Src/Asp.Net/SqlServerTest/Demo/Demo1_Queryable.cs | using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OrmTest
{
public class Demo1_Queryable
{
public static void Init()
{
ConditionScreening();
Async();
}
private static void ConditionScreening()
{
Console.WriteLine("");
Console.WriteLine("#### Condition Screening Start ####");
SqlSugarClient db = GetInstance();
//id=@id
var list = db.Queryable<Order>().Where(it => it.Id == 1).ToList();
//id=@id or name like '%'+@name+'%'
var list2 = db.Queryable<Order>().Where(it => it.Id == 1 || it.Name.Contains("jack")).ToList();
//Create expression
var exp = Expressionable.Create<Order>()
.And(it => it.Id == 1)
.Or(it => it.Name.Contains("jack")).ToExpression();
var list3 = db.Queryable<Order>().Where(exp).ToList();
Console.WriteLine("#### Condition Screening End ####");
}
private static void Async()
{
Console.WriteLine("");
Console.WriteLine("#### Async Start ####");
SqlSugarClient db = GetInstance();
var task1 = db.Queryable<Order>().FirstAsync();
var task2 = db.Queryable<Order>().Where(it => it.Id == 1).ToListAsync();
task1.Wait();
task2.Wait();
Console.WriteLine("#### Async End ####");
}
private static SqlSugarClient GetInstance()
{
return new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.SqlServer,
ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
AopEvents = new AopEvents
{
OnLogExecuting = (sql, p) =>
{
Console.WriteLine(sql);
Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value)));
}
}
});
}
}
}
| using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OrmTest
{
public class Demo1_Queryable
{
public static void Init()
{
Async();
}
private static void Async()
{
Console.WriteLine("");
Console.WriteLine("#### Async Start ####");
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.SqlServer,
ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
AopEvents = new AopEvents
{
OnLogExecuting = (sql, p) =>
{
Console.WriteLine(sql);
}
}
});
var task1 = db.Queryable<Order>().FirstAsync();
var task2 = db.Queryable<Order>().Where(it => it.Id == 1).ToListAsync();
task1.Wait();
task2.Wait();
Console.WriteLine("#### Async End ####");
}
}
}
| apache-2.0 | C# |
b45ac59a2153f65cd39cc4c1a96d7e03cbe9d9cb | Update SteamNetworkingTest.cs | Facepunch/Facepunch.Steamworks,Facepunch/Facepunch.Steamworks,Facepunch/Facepunch.Steamworks | Facepunch.Steamworks.Test/SteamNetworkingTest.cs | Facepunch.Steamworks.Test/SteamNetworkingTest.cs | using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class SteamNetworkingTest
{
[TestMethod]
public async Task SendP2PPacket()
{
var sent = SteamNetworking.SendP2PPacket( SteamClient.SteamId, new byte[] { 1, 2, 3 } );
Assert.IsTrue( sent );
while ( !SteamNetworking.IsP2PPacketAvailable() )
{
await Task.Delay( 10 );
}
var packet = SteamNetworking.ReadP2PPacket();
Assert.IsTrue( packet.HasValue );
Assert.AreEqual( packet.Value.SteamId, SteamClient.SteamId );
Assert.AreEqual( packet.Value.Data[1], 2 );
Assert.AreEqual( packet.Value.Data.Length, 3 );
}
}
}
| using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class SteamNetworkingTest
{
[TestMethod]
public async Task SendP2PPacket()
{
var sent = SteamNetworking.SendP2PPacket( SteamClient.SteamId, new byte[] { 1, 2, 3 } );
Assert.IsTrue( sent );
while ( SteamNetworking.IsP2PPacketAvailable() )
{
var packet = SteamNetworking.ReadP2PPacket();
if ( packet.HasValue )
{
HandleMessageFrom( packet.Value.SteamId, packet.Value.Data );
}
}
Assert.IsTrue( packet.HasValue );
Assert.AreEqual( packet.Value.SteamId, SteamClient.SteamId );
Assert.AreEqual( packet.Value.Data[1], 2 );
Assert.AreEqual( packet.Value.Data.Length, 3 );
}
}
}
| mit | C# |
925615320e4d8ae455738b5dc3fa1de8a170f71f | Update lazer default combo colours to match stable | smoogipoo/osu,smoogipooo/osu,smoogipoo/osu,johnneijzen/osu,ppy/osu,ZLima12/osu,NeoAdonis/osu,peppy/osu,2yangk23/osu,johnneijzen/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu,UselessToucan/osu,ZLima12/osu,UselessToucan/osu,peppy/osu,peppy/osu,EVAST9919/osu,UselessToucan/osu,EVAST9919/osu,ppy/osu,peppy/osu-new,NeoAdonis/osu | osu.Game/Skinning/DefaultSkinConfiguration.cs | osu.Game/Skinning/DefaultSkinConfiguration.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 osuTK.Graphics;
namespace osu.Game.Skinning
{
/// <summary>
/// A skin configuration pre-populated with sane defaults.
/// </summary>
public class DefaultSkinConfiguration : SkinConfiguration
{
public DefaultSkinConfiguration()
{
ComboColours.AddRange(new[]
{
new Color4(255, 192, 0, 255),
new Color4(0, 202, 0, 255),
new Color4(18, 124, 255, 255),
new Color4(242, 24, 57, 255),
});
}
}
}
| // 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 osuTK.Graphics;
namespace osu.Game.Skinning
{
/// <summary>
/// A skin configuration pre-populated with sane defaults.
/// </summary>
public class DefaultSkinConfiguration : SkinConfiguration
{
public DefaultSkinConfiguration()
{
ComboColours.AddRange(new[]
{
new Color4(17, 136, 170, 255),
new Color4(102, 136, 0, 255),
new Color4(204, 102, 0, 255),
new Color4(121, 9, 13, 255)
});
}
}
}
| mit | C# |
8214f5de8d4b905f845981b4c7d48f76a47da282 | Remove HasTime constraint from RetryExample - not needed | louthy/language-ext,StanJav/language-ext | Samples/EffectsExamples/Examples/RetryExample.cs | Samples/EffectsExamples/Examples/RetryExample.cs | using LanguageExt;
using LanguageExt.Common;
using LanguageExt.Sys;
using LanguageExt.Sys.Traits;
using LanguageExt.Effects.Traits;
using static LanguageExt.Prelude;
namespace EffectsExamples
{
public class RetryExample<RT>
where RT : struct,
HasCancel<RT>,
HasConsole<RT>
{
readonly static Error Failed = ("I asked you to say hello, and you can't even do that?!");
public static Eff<RT, Unit> main =>
retry(Schedule.Recurs(5),
from _ in Console<RT>.writeLine("Say hello")
from t in Console<RT>.readLine
from e in guard(t == "hello", Failed)
from m in Console<RT>.writeLine("Hi")
select unit);
}
}
| using LanguageExt;
using LanguageExt.Common;
using LanguageExt.Sys;
using LanguageExt.Sys.Traits;
using LanguageExt.Effects.Traits;
using static LanguageExt.Prelude;
namespace EffectsExamples
{
public class RetryExample<RT>
where RT : struct,
HasTime<RT>,
HasCancel<RT>,
HasConsole<RT>
{
readonly static Error Failed = ("I asked you to say hello, and you can't even do that?!");
public static Eff<RT, Unit> main =>
retry(Schedule.Recurs(5),
from _ in Console<RT>.writeLine("Say hello")
from t in Console<RT>.readLine
from e in guard(t == "hello", Failed)
from m in Console<RT>.writeLine("Hi")
select unit);
}
}
| mit | C# |
3be2e33521dde6b5297ee12802b2feac954db563 | Add both hands below hips extension | mrvux/kgp | src/KGP.Core/KinectMiniPoseExtensions.cs | src/KGP.Core/KinectMiniPoseExtensions.cs | using Microsoft.Kinect;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KGP
{
/// <summary>
/// Small list of extension methods for very basic pose detection
/// </summary>
public static class KinectMiniPoseExtensions
{
/// <summary>
/// Compares height between two joints
/// </summary>
/// <param name="kb">Kinect body</param>
/// <param name="first">First kinect joint</param>
/// <param name="second">Second Kinect joint</param>
/// <returns>true if both joints are at least inferred and first joint Y > second joint Y, false otherwise (also returns false if one of those joints is not tracked)</returns>
public static bool CompareHeight(this KinectBody kb, JointType first, JointType second)
{
Joint j1 = kb.Joints[first];
Joint j2 = kb.Joints[second];
return j1.IsAtLeastInferred() && j2.IsAtLeastInferred() && j1.Position.Y > j2.Position.Y;
}
/// <summary>
/// Checks if left hand is raised (we consider raised as "above head")
/// </summary>
/// <param name="kb">Kinect body to check</param>
/// <returns>true if raised, false otherwise</returns>
public static bool LeftHandRaised(this KinectBody kb)
{
return kb.CompareHeight(JointType.HandLeft, JointType.Head);
}
/// <summary>
/// Checks if rights hand is raised (we consider raised as "above head")
/// </summary>
/// <param name="kb">Kinect body to check</param>
/// <returns>true if raised, false otherwise</returns>
public static bool RightHandRaised(this KinectBody kb)
{
return kb.CompareHeight(JointType.HandRight, JointType.Head);
}
/// <summary>
/// Checks if both left and right hand are raised (we consider raised as "above head")
/// </summary>
/// <param name="kb">Kinect body to check</param>
/// <returns>true if raised, false otherwise</returns>
public static bool BothHandsRaised(this KinectBody kb)
{
return kb.LeftHandRaised() && kb.RightHandRaised();
}
/// <summary>
/// Checks if both hands are below hips
/// </summary>
/// <param name="kb">kinect body</param>
/// <returns>True if both hands are below hips, false otherwise</returns>
public static bool BothHandsBelowHip(this KinectBody kb)
{
return kb.CompareHeight(JointType.HipRight, JointType.HandRight) && kb.CompareHeight(JointType.HipLeft, JointType.HandLeft);
}
}
}
| using Microsoft.Kinect;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KGP
{
/// <summary>
/// Small list of extension methods for very basic pose detection
/// </summary>
public static class KinectMiniPoseExtensions
{
/// <summary>
/// Compares height between two joints
/// </summary>
/// <param name="kb">Kinect body</param>
/// <param name="first">First kinect joint</param>
/// <param name="second">Second Kinect joint</param>
/// <returns>true if both joints are at least inferred and first joint Y > second joint Y, false otherwise (also returns false if one of those joints is not tracked)</returns>
public static bool CompareHeight(this KinectBody kb, JointType first, JointType second)
{
Joint j1 = kb.Joints[first];
Joint j2 = kb.Joints[second];
return j1.IsAtLeastInferred() && j2.IsAtLeastInferred() && j1.Position.Y > j2.Position.Y;
}
/// <summary>
/// Checks if left hand is raised (we consider raised as "above head")
/// </summary>
/// <param name="kb">Kinect body to check</param>
/// <returns>true if raised, false otherwise</returns>
public static bool LeftHandRaised(this KinectBody kb)
{
return kb.CompareHeight(JointType.HandLeft, JointType.Head);
}
/// <summary>
/// Checks if rights hand is raised (we consider raised as "above head")
/// </summary>
/// <param name="kb">Kinect body to check</param>
/// <returns>true if raised, false otherwise</returns>
public static bool RightHandRaised(this KinectBody kb)
{
return kb.CompareHeight(JointType.HandRight, JointType.Head);
}
/// <summary>
/// Checks if both left and right hand are raised (we consider raised as "above head")
/// </summary>
/// <param name="kb">Kinect body to check</param>
/// <returns>true if raised, false otherwise</returns>
public static bool BothHandsRaised(this KinectBody kb)
{
return kb.LeftHandRaised() && kb.RightHandRaised();
}
}
}
| mit | C# |
735b592dac9e77853ab684101b462ae42fc2a870 | Add acceleration to projectile | puzzud/Flipper | Assets/Scripts/ProjectileMovement.cs | Assets/Scripts/ProjectileMovement.cs | using UnityEngine;
using System.Collections;
public class ProjectileMovement : MonoBehaviour {
public Vector3 movementDirection;
public Vector3 startLocation;
public float speed;
public float accelerationConstant;
public int maxDistance;
public float distance;
public Weapon weapon;
// Use this for initialization
void Start () {
maxDistance = 30;
speed = 30;
accelerationConstant = 1.0f;
}
// Update is called once per frame
void Update () {
transform.position = Vector3.MoveTowards(transform.position, movementDirection + transform.position, speed * Time.deltaTime);
speed += accelerationConstant;
distance = Vector3.Distance(startLocation, transform.position);
if ( distance > maxDistance)
{
weapon.projectileCount--;
Destroy(this.gameObject);
}
}
void OnTriggerEnter(Collider other)
{
if (other.name == "Box Monster(Clone)")
{
Debug.Log("Box HIT!!!");
GameEntity monsterEntity = other.GetComponent<GameEntity>();
if (monsterEntity)
{
// TODO: Base this damage based on weapon.
monsterEntity.takeDamage(1.0f);
}
else
{
// Destroy monster in case it doesnt have an entity.
Destroy(other.gameObject);
}
weapon.projectileCount--;
Destroy(this.gameObject);
}
}
}
| using UnityEngine;
using System.Collections;
public class ProjectileMovement : MonoBehaviour {
public Vector3 movementDirection;
public Vector3 startLocation;
public int speed;
public int maxDistance;
public float distance;
public Weapon weapon;
// Use this for initialization
void Start () {
maxDistance = 30;
}
// Update is called once per frame
void Update () {
transform.position = Vector3.MoveTowards(transform.position, movementDirection + transform.position, speed * Time.deltaTime);
distance = Vector3.Distance(startLocation, transform.position);
if ( distance > maxDistance)
{
weapon.projectileCount--;
Destroy(this.gameObject);
}
}
void OnTriggerEnter(Collider other)
{
if (other.name == "Box Monster(Clone)")
{
Debug.Log("Box HIT!!!");
GameEntity monsterEntity = other.GetComponent<GameEntity>();
if (monsterEntity)
{
// TODO: Base this damage based on weapon.
monsterEntity.takeDamage(1.0f);
}
else
{
// Destroy monster in case it doesnt have an entity.
Destroy(other.gameObject);
}
weapon.projectileCount--;
Destroy(this.gameObject);
}
}
}
| mit | C# |
0ff2c186f4e2ccb76f7cbe9a77424e1d0658ecc3 | Fix parameter not bering passed | smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework | osu.Framework/Testing/TestRunHeadlessGameHost.cs | osu.Framework/Testing/TestRunHeadlessGameHost.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.IO;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Logging;
using osu.Framework.Platform;
namespace osu.Framework.Testing
{
/// <summary>
/// A GameHost which writes to the system temporary directory, attempting to clean up after the test run completes.
/// </summary>
public class TestRunHeadlessGameHost : HeadlessGameHost
{
private readonly bool bypassCleanup;
public override IEnumerable<string> UserStoragePaths { get; }
public static string TemporaryTestDirectory = Path.Combine(Path.GetTempPath(), "of-test-headless");
[Obsolete("Use TestRunHeadlessGameHost(HostConfig, bool) instead.")]
public TestRunHeadlessGameHost(string name = null, bool bindIPC = false, bool realtime = false, bool portableInstallation = false, bool bypassCleanup = false)
: this(new HostOptions
{
Name = name,
BindIPC = bindIPC,
Realtime = realtime,
PortableInstallation = portableInstallation,
}, bypassCleanup)
{
}
public TestRunHeadlessGameHost(HostOptions hostOptions, bool bypassCleanup = false)
: base(hostOptions)
{
this.bypassCleanup = bypassCleanup;
UserStoragePaths = TemporaryTestDirectory.Yield();
}
protected override void Dispose(bool isDisposing)
{
// ensure no more log entries are written during cleanup.
// there is a flush call in base.Dispose which seals the deal.
Logger.Enabled = false;
base.Dispose(isDisposing);
if (!bypassCleanup)
{
try
{
Storage.DeleteDirectory(string.Empty);
}
catch
{
}
}
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.IO;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Logging;
using osu.Framework.Platform;
namespace osu.Framework.Testing
{
/// <summary>
/// A GameHost which writes to the system temporary directory, attempting to clean up after the test run completes.
/// </summary>
public class TestRunHeadlessGameHost : HeadlessGameHost
{
private readonly bool bypassCleanup;
public override IEnumerable<string> UserStoragePaths { get; }
public static string TemporaryTestDirectory = Path.Combine(Path.GetTempPath(), "of-test-headless");
[Obsolete("Use TestRunHeadlessGameHost(HostConfig, bool) instead.")]
public TestRunHeadlessGameHost(string name = null, bool bindIPC = false, bool realtime = false, bool portableInstallation = false, bool bypassCleanup = false)
: this(new HostOptions
{
Name = name,
BindIPC = bindIPC,
Realtime = realtime,
PortableInstallation = portableInstallation,
})
{
}
public TestRunHeadlessGameHost(HostOptions hostOptions, bool bypassCleanup = false)
: base(hostOptions)
{
this.bypassCleanup = bypassCleanup;
UserStoragePaths = TemporaryTestDirectory.Yield();
}
protected override void Dispose(bool isDisposing)
{
// ensure no more log entries are written during cleanup.
// there is a flush call in base.Dispose which seals the deal.
Logger.Enabled = false;
base.Dispose(isDisposing);
if (!bypassCleanup)
{
try
{
Storage.DeleteDirectory(string.Empty);
}
catch
{
}
}
}
}
}
| mit | C# |
c7677d896a0432a11c3810c09e18761f2b98b843 | Remove SliderTickJudgement | NeoAdonis/osu,DrabWeb/osu,peppy/osu,naoey/osu,peppy/osu-new,NeoAdonis/osu,naoey/osu,smoogipoo/osu,DrabWeb/osu,smoogipoo/osu,DrabWeb/osu,ppy/osu,smoogipoo/osu,ppy/osu,smoogipooo/osu,Drezi126/osu,johnneijzen/osu,Nabile-Rahmani/osu,2yangk23/osu,UselessToucan/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu,EVAST9919/osu,naoey/osu,peppy/osu,NeoAdonis/osu,ppy/osu,2yangk23/osu,ZLima12/osu,Frontear/osuKyzer,EVAST9919/osu,UselessToucan/osu,ZLima12/osu | osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs | osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Judgements
{
public class OsuJudgement : Judgement
{
/// <summary>
/// The positional hit offset.
/// </summary>
public Vector2 PositionOffset;
protected override int NumericResultFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Meh:
return 50;
case HitResult.Good:
return 100;
case HitResult.Great:
return 300;
}
}
public ComboResult Combo;
}
} | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Judgements
{
public class SliderTickJudgement : OsuJudgement
{
}
public class OsuJudgement : Judgement
{
/// <summary>
/// The positional hit offset.
/// </summary>
public Vector2 PositionOffset;
protected override int NumericResultFor(HitResult result)
{
switch (result)
{
default:
return 0;
case HitResult.Meh:
return 50;
case HitResult.Good:
return 100;
case HitResult.Great:
return 300;
}
}
public ComboResult Combo;
}
} | mit | C# |
793bc0ad081d4f61d0a3aca4facd5516f94cb40e | revert last commit | dfensgmbh/biz.dfch.CS.Appclusive.Scheduler | src/biz.dfch.CS.Appclusive.Scheduler.Extensions/ContractClassForIScriptInvoker.cs | src/biz.dfch.CS.Appclusive.Scheduler.Extensions/ContractClassForIScriptInvoker.cs | /**
* Copyright 2015 d-fens GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Management.Automation;
namespace biz.dfch.CS.Appclusive.Scheduler.Extensions
{
[ContractClassFor(typeof(IScriptInvoker))]
public abstract class ContractClassForIScriptInvoker : IScriptInvoker
{
PowerShell IScriptInvoker.Powershell
{
get
{
Contract.Ensures(null != Contract.Result<PowerShell>());
return default(PowerShell);
}
}
// disable warning for missing call to dispose as this is only a ContractClass
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
public void Dispose()
{
return;
}
public List<string> RunPowershell(string pathToScriptFile, Dictionary<string, object> parameters)
{
Contract.Requires(!string.IsNullOrWhiteSpace(pathToScriptFile));
Contract.Requires(null != parameters);
return default(List<string>);
}
public bool RunPowershell(string pathToScriptFile, Dictionary<string, object> parameters, ref List<object> scriptResult)
{
Contract.Requires(File.Exists(pathToScriptFile));
Contract.Requires(null != parameters);
Contract.Requires(null != scriptResult);
Contract.Ensures(null != scriptResult);
return default(bool);
}
public bool RunPowershell(string pathToScriptFile, Dictionary<string, object> parameters, ref List<string> scriptResult)
{
return default(bool);
}
}
}
| /**
* Copyright 2015 d-fens GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Management.Automation;
namespace biz.dfch.CS.Appclusive.Scheduler.Extensions
{
[ContractClassFor(typeof(IScriptInvoker))]
public abstract class ContractClassForIScriptInvoker : IScriptInvoker
{
PowerShell IScriptInvoker.Powershell
{
get
{
Contract.Ensures(null != Contract.Result<PowerShell>());
return default(PowerShell);
}
}
public void Dispose()
{
return;
}
public List<string> RunPowershell(string pathToScriptFile, Dictionary<string, object> parameters)
{
Contract.Requires(!string.IsNullOrWhiteSpace(pathToScriptFile));
Contract.Requires(null != parameters);
return default(List<string>);
}
public bool RunPowershell(string pathToScriptFile, Dictionary<string, object> parameters, ref List<object> scriptResult)
{
Contract.Requires(File.Exists(pathToScriptFile));
Contract.Requires(null != parameters);
Contract.Requires(null != scriptResult);
Contract.Ensures(null != scriptResult);
return default(bool);
}
public bool RunPowershell(string pathToScriptFile, Dictionary<string, object> parameters, ref List<string> scriptResult)
{
return default(bool);
}
}
}
| apache-2.0 | C# |
3e7d8ad60542c2234dd1d001ef8ea4a37e5a69e7 | Remove HTML content type check from response filter because the check is performed in CassetteApplication instead. | BluewireTechnologies/cassette,andrewdavey/cassette,damiensawyer/cassette,andrewdavey/cassette,damiensawyer/cassette,honestegg/cassette,honestegg/cassette,BluewireTechnologies/cassette,andrewdavey/cassette,honestegg/cassette,damiensawyer/cassette | src/Cassette.Web/PlaceholderReplacingResponseFilter.cs | src/Cassette.Web/PlaceholderReplacingResponseFilter.cs | using System;
using System.IO;
using System.Web;
using Cassette.UI;
namespace Cassette.Web
{
public class PlaceholderReplacingResponseFilter : MemoryStream
{
public PlaceholderReplacingResponseFilter(HttpResponseBase response, IPlaceholderTracker placeholderTracker)
{
this.response = response;
this.placeholderTracker = placeholderTracker;
outputStream = response.Filter;
}
readonly Stream outputStream;
readonly HttpResponseBase response;
readonly IPlaceholderTracker placeholderTracker;
public override void Write(byte[] buffer, int offset, int count)
{
if (response.Headers["Content-Encoding"] != null)
{
throw new InvalidOperationException("Cannot rewrite page output when it has been compressed. Either set ICassetteApplication.HtmlRewritingEnabled to false in the Cassette configuration, or set <urlCompression dynamicCompressionBeforeCache=\"false\" /> in Web.config.");
}
buffer = ReplacePlaceholders(buffer, offset, count);
outputStream.Write(buffer, 0, buffer.Length);
}
byte[] ReplacePlaceholders(byte[] buffer, int offset, int count)
{
var encoding = response.Output.Encoding;
var html = encoding.GetString(buffer, offset, count);
html = placeholderTracker.ReplacePlaceholders(html);
return encoding.GetBytes(html);
}
}
} | using System;
using System.IO;
using System.Web;
using Cassette.UI;
namespace Cassette.Web
{
public class PlaceholderReplacingResponseFilter : MemoryStream
{
public PlaceholderReplacingResponseFilter(HttpResponseBase response, IPlaceholderTracker placeholderTracker)
{
this.response = response;
this.placeholderTracker = placeholderTracker;
outputStream = response.Filter;
}
readonly Stream outputStream;
readonly HttpResponseBase response;
readonly IPlaceholderTracker placeholderTracker;
public override void Write(byte[] buffer, int offset, int count)
{
if (response.Headers["Content-Encoding"] != null)
{
throw new InvalidOperationException("Cannot rewrite page output when it has been compressed. Either set ICassetteApplication.HtmlRewritingEnabled to false in the Cassette configuration, or set <urlCompression dynamicCompressionBeforeCache=\"false\" /> in Web.config.");
}
if (IsHtmlResponse)
{
buffer = ReplacePlaceholders(buffer, offset, count);
outputStream.Write(buffer, 0, buffer.Length);
}
else
{
outputStream.Write(buffer, offset, count);
}
}
byte[] ReplacePlaceholders(byte[] buffer, int offset, int count)
{
var encoding = response.Output.Encoding;
var html = encoding.GetString(buffer, offset, count);
html = placeholderTracker.ReplacePlaceholders(html);
return encoding.GetBytes(html);
}
bool IsHtmlResponse
{
get
{
return response.ContentType == "text/html" ||
response.ContentType == "application/xhtml+xml";
}
}
}
}
| mit | C# |
69111c6b91c8f98636b89911e388b102f0901fa7 | Change data item "thread" to a discrete string value | eleven41/Eleven41.Logging.Loggly | Eleven41.Logging.Loggly/LogglyLog.cs | Eleven41.Logging.Loggly/LogglyLog.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Eleven41.Logging
{
public class LogglyLog : LogglyBase, ILog
{
public LogglyLog()
{
}
public LogglyLog(Dictionary<string, object> data)
: base(data)
{
}
public void Log(LogLevels level, string sFormat, params object[] args)
{
// Call the data version
Log(this.DateTimeProvider.GetCurrentDateTime(), level, null, sFormat, args);
}
public void Log(DateTime date, LogLevels level, string sFormat, params object[] args)
{
Log(date, level, null, sFormat, args);
}
public void Log(LogLevels level, Dictionary<string, object> messageData, string sFormat, params object[] args)
{
Log(this.DateTimeProvider.GetCurrentDateTime(), level, null, sFormat, args);
}
public void Log(DateTime date, LogLevels level, Dictionary<string, object> messageData, string sFormat, params object[] args)
{
if (_client == null)
return;
// Start with the standard properties
Dictionary<string, object> data = new Dictionary<string, object>(this.Data);
// These fields are allowed to be overwritten by the caller
data["thread"] = System.Threading.Thread.CurrentThread.GetHashCode().ToString();
// Add the message data
if (messageData != null)
{
foreach (var kvp in messageData)
{
data[kvp.Key] = kvp.Value;
}
}
// Add the new stuff for this message
data["message"] = String.Format(sFormat, args);
data["level"] = level.ToString();
data["date"] = date;
// Serialize and dispatch
var logglyEvent = new Loggly.LogglyEvent();
foreach (var key in data.Keys)
{
logglyEvent.Data.Add(key, data[key]);
}
if (this.IsSync)
{
var response = _client.Log(logglyEvent).Result;
}
else
{
_client.Log(logglyEvent).ConfigureAwait(false);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Eleven41.Logging
{
public class LogglyLog : LogglyBase, ILog
{
public LogglyLog()
{
}
public LogglyLog(Dictionary<string, object> data)
: base(data)
{
}
public void Log(LogLevels level, string sFormat, params object[] args)
{
// Call the data version
Log(this.DateTimeProvider.GetCurrentDateTime(), level, null, sFormat, args);
}
public void Log(DateTime date, LogLevels level, string sFormat, params object[] args)
{
Log(date, level, null, sFormat, args);
}
public void Log(LogLevels level, Dictionary<string, object> messageData, string sFormat, params object[] args)
{
Log(this.DateTimeProvider.GetCurrentDateTime(), level, null, sFormat, args);
}
public void Log(DateTime date, LogLevels level, Dictionary<string, object> messageData, string sFormat, params object[] args)
{
if (_client == null)
return;
// Start with the standard properties
Dictionary<string, object> data = new Dictionary<string, object>(this.Data);
// These fields are allowed to be overwritten by the caller
data["thread"] = System.Threading.Thread.CurrentThread.GetHashCode();
// Add the message data
if (messageData != null)
{
foreach (var kvp in messageData)
{
data[kvp.Key] = kvp.Value;
}
}
// Add the new stuff for this message
data["message"] = String.Format(sFormat, args);
data["level"] = level.ToString();
data["date"] = date;
// Serialize and dispatch
var logglyEvent = new Loggly.LogglyEvent();
foreach (var key in data.Keys)
{
logglyEvent.Data.Add(key, data[key]);
}
if (this.IsSync)
{
var response = _client.Log(logglyEvent).Result;
}
else
{
_client.Log(logglyEvent).ConfigureAwait(false);
}
}
}
}
| mit | C# |
5b2ea3a8eb647fe52e77d268d5c378f835718c32 | Enable the cross-targeting test | nkolev92/sdk,nkolev92/sdk | test/Microsoft.NETCore.Build.Tests/GivenThatWeWantToBuildACrossTargetedLibrary.cs | test/Microsoft.NETCore.Build.Tests/GivenThatWeWantToBuildACrossTargetedLibrary.cs | // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.IO;
using Microsoft.NETCore.TestFramework;
using Microsoft.NETCore.TestFramework.Assertions;
using Microsoft.NETCore.TestFramework.Commands;
using Xunit;
using static Microsoft.NETCore.TestFramework.Commands.MSBuildTest;
namespace Microsoft.NETCore.Build.Tests
{
public class GivenThatWeWantToBuildACrossTargetedLibrary
{
private TestAssetsManager _testAssetsManager = TestAssetsManager.TestProjectsAssetsManager;
public void It_builds_the_library_successfully()
{
var testAsset = _testAssetsManager
.CopyTestAsset("CrossTargeting")
.WithSource();
var libraryProjectDirectory = Path.Combine(testAsset.TestRoot, "TestLibrary");
testAsset.Restore(libraryProjectDirectory, $"/p:RestoreFallbackFolders={RepoInfo.PackagesPath}");
var buildCommand = new BuildCommand(Stage0MSBuild, libraryProjectDirectory);
buildCommand
.Execute()
.Should()
.Pass();
var outputDirectory = buildCommand.GetOutputDirectory();
outputDirectory.Should().OnlyHaveFiles(new[] {
"netstandard1.4/TestLibrary.dll",
"netstandard1.4/TestLibrary.pdb",
"netstandard1.4/TestLibrary.deps.json",
"netstandard1.5/TestLibrary.dll",
"netstandard1.5/TestLibrary.pdb",
"netstandard1.5/TestLibrary.deps.json"
}, SearchOption.AllDirectories);
}
}
}
| // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.IO;
using Microsoft.NETCore.TestFramework;
using Microsoft.NETCore.TestFramework.Assertions;
using Microsoft.NETCore.TestFramework.Commands;
using Xunit;
using static Microsoft.NETCore.TestFramework.Commands.MSBuildTest;
namespace Microsoft.NETCore.Build.Tests
{
public class GivenThatWeWantToBuildACrossTargetedLibrary
{
private TestAssetsManager _testAssetsManager = TestAssetsManager.TestProjectsAssetsManager;
// This test needs to be run with restore3. Skipping this test until we can enable restore3 in the tests.
// Skip the test until "https://github.com/dotnet/sdk/issues/75" is fixed.
// [Fact]
public void It_builds_the_library_successfully()
{
var testAsset = _testAssetsManager
.CopyTestAsset("CrossTargeting")
.WithSource();
var libraryProjectDirectory = Path.Combine(testAsset.TestRoot, "TestLibrary");
testAsset.Restore(libraryProjectDirectory, $"/p:RestoreFallbackFolders={RepoInfo.PackagesPath}");
var buildCommand = new BuildCommand(Stage0MSBuild, libraryProjectDirectory);
buildCommand
.Execute()
.Should()
.Pass();
var outputDirectory = buildCommand.GetOutputDirectory();
outputDirectory.Should().OnlyHaveFiles(new[] {
"netstandard1.4/TestLibrary.dll",
"netstandard1.4/TestLibrary.pdb",
"netstandard1.4/TestLibrary.deps.json",
"netstandard1.5/TestLibrary.dll",
"netstandard1.5/TestLibrary.pdb",
"netstandard1.5/TestLibrary.deps.json"
}, SearchOption.AllDirectories);
}
}
}
| mit | C# |
6a4dc13e848936e7c697f2dc1d98caa9a316e1b7 | Insert unity directive | bartlomiejwolk/AnimationPathAnimator | APEventsComponent/NodeEvent.cs | APEventsComponent/NodeEvent.cs | using UnityEngine;
namespace ATP.AnimationPathAnimator.APEventsComponent {
[System.Serializable]
// TODO Rename to NodeEventSlot.
public sealed class NodeEvent {
/// <summary>
/// Selected source game object.
/// </summary>
[SerializeField]
private GameObject sourceGO;
/// <summary>
/// Selected source component.
/// </summary>
[SerializeField]
private Component sourceCo;
//[SerializeField]
//private Component[] sourceComponents;
/// <summary>
/// Names of components existing on source game object.
/// </summary>
//[SerializeField]
//private string[] sourceCoNames;
[SerializeField]
private string sourceMethodName;
#if UNITY_EDITOR
[SerializeField]
private int sourceMethodIndex;
[SerializeField]
private int sourceComponentIndex;
/// <summary>
/// How many rows should be displayed in the inspector.
/// </summary>
[SerializeField]
private int rows = 1;
#endif
/// <summary>
/// Index of the source component in the source component names list.
/// </summary>
//[SerializeField]
//private int sourceCoIndex;
[SerializeField]
private string methodArg;
public string MethodArg {
get { return methodArg; }
set { methodArg = value; }
}
/// <summary>
/// Selected source component.
/// </summary>
public Component SourceCo {
get { return sourceCo; }
}
/// <summary>
/// Names of components existing on source game object.
/// </summary>
//[SerializeField]
//private string[] sourceCoNames;
public string SourceMethodName {
get { return sourceMethodName; }
}
/// <summary>
/// Selected source game object.
/// </summary>
public GameObject SourceGO {
get { return sourceGO; }
}
}
} | using UnityEngine;
namespace ATP.AnimationPathAnimator.APEventsComponent {
[System.Serializable]
// TODO Rename to NodeEventSlot.
public sealed class NodeEvent {
/// <summary>
/// Selected source game object.
/// </summary>
[SerializeField]
private GameObject sourceGO;
/// <summary>
/// Selected source component.
/// </summary>
[SerializeField]
private Component sourceCo;
//[SerializeField]
//private Component[] sourceComponents;
/// <summary>
/// Names of components existing on source game object.
/// </summary>
//[SerializeField]
//private string[] sourceCoNames;
[SerializeField]
private string sourceMethodName;
[SerializeField]
private int sourceMethodIndex;
[SerializeField]
private int sourceComponentIndex;
/// <summary>
/// How many rows should be displayed in the inspector.
/// </summary>
[SerializeField]
private int rows = 1;
/// <summary>
/// Index of the source component in the source component names list.
/// </summary>
//[SerializeField]
//private int sourceCoIndex;
[SerializeField]
private string methodArg;
public string MethodArg {
get { return methodArg; }
set { methodArg = value; }
}
/// <summary>
/// Selected source component.
/// </summary>
public Component SourceCo {
get { return sourceCo; }
}
/// <summary>
/// Names of components existing on source game object.
/// </summary>
//[SerializeField]
//private string[] sourceCoNames;
public string SourceMethodName {
get { return sourceMethodName; }
}
/// <summary>
/// Selected source game object.
/// </summary>
public GameObject SourceGO {
get { return sourceGO; }
}
}
} | mit | C# |
2d0124f8d854731a46e93d52bd7ced782ea25a32 | Add `stale` check conclusion (#2080) | octokit/octokit.net,shiftkey/octokit.net,shiftkey/octokit.net,octokit/octokit.net,adamralph/octokit.net | Octokit/Models/Common/CheckStatus.cs | Octokit/Models/Common/CheckStatus.cs | using System;
using Octokit.Internal;
namespace Octokit
{
public enum CheckStatus
{
[Parameter(Value = "queued")]
Queued,
[Parameter(Value = "in_progress")]
InProgress,
[Parameter(Value = "completed")]
Completed,
}
public enum CheckConclusion
{
[Parameter(Value = "success")]
Success,
[Parameter(Value = "failure")]
Failure,
[Parameter(Value = "neutral")]
Neutral,
[Parameter(Value = "cancelled")]
Cancelled,
[Parameter(Value = "timed_out")]
TimedOut,
[Parameter(Value = "action_required")]
ActionRequired,
[Parameter(Value = "skipped")]
Skipped,
[Parameter(Value = "stale")]
Stale,
}
public enum CheckAnnotationLevel
{
[Parameter(Value = "notice")]
Notice,
[Parameter(Value = "warning")]
Warning,
[Parameter(Value = "failure")]
Failure,
}
[Obsolete("This enum is replaced with CheckAnnotationLevel but may still be required on GitHub Enterprise 2.14")]
public enum CheckWarningLevel
{
[Parameter(Value = "notice")]
Notice,
[Parameter(Value = "warning")]
Warning,
[Parameter(Value = "failure")]
Failure,
}
}
| using System;
using Octokit.Internal;
namespace Octokit
{
public enum CheckStatus
{
[Parameter(Value = "queued")]
Queued,
[Parameter(Value = "in_progress")]
InProgress,
[Parameter(Value = "completed")]
Completed,
}
public enum CheckConclusion
{
[Parameter(Value = "success")]
Success,
[Parameter(Value = "failure")]
Failure,
[Parameter(Value = "neutral")]
Neutral,
[Parameter(Value = "cancelled")]
Cancelled,
[Parameter(Value = "timed_out")]
TimedOut,
[Parameter(Value = "action_required")]
ActionRequired,
[Parameter(Value = "skipped")]
Skipped,
}
public enum CheckAnnotationLevel
{
[Parameter(Value = "notice")]
Notice,
[Parameter(Value = "warning")]
Warning,
[Parameter(Value = "failure")]
Failure,
}
[Obsolete("This enum is replaced with CheckAnnotationLevel but may still be required on GitHub Enterprise 2.14")]
public enum CheckWarningLevel
{
[Parameter(Value = "notice")]
Notice,
[Parameter(Value = "warning")]
Warning,
[Parameter(Value = "failure")]
Failure,
}
}
| mit | C# |
ae83d15601c66f84f32a5e8dab6e51202dac67d0 | tweak log settings | ArsenShnurkov/BitSharp | BitSharp.Node/LoggingModule.cs | BitSharp.Node/LoggingModule.cs | using Ninject;
using Ninject.Modules;
using NLog;
using NLog.Config;
using NLog.Targets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitSharp.Node
{
public class LoggingModule : NinjectModule
{
private readonly LogLevel logLevel;
public LoggingModule(LogLevel logLevel)
{
this.logLevel = logLevel;
}
public override void Load()
{
// initialize logging configuration
var config = new LoggingConfiguration();
// create console target
var consoleTarget = new ColoredConsoleTarget();
config.AddTarget("console", consoleTarget);
// console settings
consoleTarget.Layout = "${message}";
// console rules
config.LoggingRules.Add(new LoggingRule("*", logLevel, consoleTarget));
// create file target
var fileTarget = new FileTarget();
config.AddTarget("file", fileTarget);
// file settings
fileTarget.FileName = "${basedir}/BitSharp.log";
fileTarget.Layout = "${message}";
fileTarget.DeleteOldFileOnStartup = true;
// file rules
config.LoggingRules.Add(new LoggingRule("*", logLevel, fileTarget));
// activate configuration and bind
LogManager.Configuration = config;
this.Kernel.Bind<Logger>().ToMethod(context => LogManager.GetLogger("BitSharp"));
}
}
}
| using Ninject;
using Ninject.Modules;
using NLog;
using NLog.Config;
using NLog.Targets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitSharp.Node
{
public class LoggingModule : NinjectModule
{
private readonly LogLevel logLevel;
public LoggingModule(LogLevel logLevel)
{
this.logLevel = logLevel;
}
public override void Load()
{
// Step 1. Create configuration object
var config = new LoggingConfiguration();
// Step 2. Create targets and add them to the configuration
var consoleTarget = new ColoredConsoleTarget();
config.AddTarget("console", consoleTarget);
var fileTarget = new FileTarget();
config.AddTarget("file", fileTarget);
// Step 3. Set target properties
consoleTarget.Layout = @"${date:format=HH\\:MM\\:ss} ${logger} ${message}";
fileTarget.FileName = "${basedir}/BitSharp.log";
fileTarget.Layout = "${message}";
fileTarget.DeleteOldFileOnStartup = true;
// Step 4. Define rules
var rule1 = new LoggingRule("*", logLevel, consoleTarget);
config.LoggingRules.Add(rule1);
var rule2 = new LoggingRule("*", logLevel, fileTarget);
config.LoggingRules.Add(rule2);
// Step 5. Activate the configuration
LogManager.Configuration = config;
this.Kernel.Bind<Logger>().ToMethod(context => LogManager.GetLogger("BitSharp"));
}
}
}
| unlicense | C# |
38482e3638508520748122b4f7a811724b6e4e9e | Remove interface that is no longer user. | dotnet/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,dotnet/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,diryboy/roslyn,AmadeusW/roslyn,weltkante/roslyn,dotnet/roslyn,physhi/roslyn,weltkante/roslyn,bartdesmet/roslyn,sharwell/roslyn,physhi/roslyn,eriawan/roslyn,KevinRansom/roslyn,mavasani/roslyn,diryboy/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,physhi/roslyn,weltkante/roslyn,eriawan/roslyn,sharwell/roslyn,mavasani/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,KevinRansom/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn | src/Features/Core/Portable/NavigateTo/INavigateToSearchService.cs | src/Features/Core/Portable/NavigateTo/INavigateToSearchService.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.CodeAnalysis.NavigateTo
{
internal interface INavigateToSearchService : ILanguageService
{
IImmutableSet<string> KindsProvided { get; }
bool CanFilter { get; }
Task<ImmutableArray<INavigateToSearchResult>> SearchProjectAsync(Project project, ImmutableArray<Document> priorityDocuments, string searchPattern, IImmutableSet<string> kinds, CancellationToken cancellationToken);
Task<ImmutableArray<INavigateToSearchResult>> SearchDocumentAsync(Document document, string searchPattern, IImmutableSet<string> kinds, CancellationToken cancellationToken);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.CodeAnalysis.NavigateTo
{
internal interface INavigateToSearchService : ILanguageService
{
IImmutableSet<string> KindsProvided { get; }
bool CanFilter { get; }
Task<ImmutableArray<INavigateToSearchResult>> SearchProjectAsync(Project project, ImmutableArray<Document> priorityDocuments, string searchPattern, IImmutableSet<string> kinds, CancellationToken cancellationToken);
Task<ImmutableArray<INavigateToSearchResult>> SearchDocumentAsync(Document document, string searchPattern, IImmutableSet<string> kinds, CancellationToken cancellationToken);
}
[Obsolete("Use " + nameof(INavigateToSearchResult) + " instead", error: false)]
internal interface INavigateToSeINavigateToSearchService_RemoveInterfaceAboveAndRenameThisAfterInternalsVisibleToUsersUpdatearchService : ILanguageService
{
IImmutableSet<string> KindsProvided { get; }
bool CanFilter { get; }
Task<ImmutableArray<INavigateToSearchResult>> SearchProjectAsync(Project project, ImmutableArray<Document> priorityDocuments, string searchPattern, IImmutableSet<string> kinds, CancellationToken cancellationToken);
Task<ImmutableArray<INavigateToSearchResult>> SearchDocumentAsync(Document document, string searchPattern, IImmutableSet<string> kinds, CancellationToken cancellationToken);
}
}
| mit | C# |
847f17ea1a01072cae0240f91e033023e596013e | fix test case | hmah/boo,rmartinho/boo,wbardzinski/boo,rmartinho/boo,bamboo/boo,wbardzinski/boo,KidFashion/boo,rmartinho/boo,wbardzinski/boo,Unity-Technologies/boo,rmartinho/boo,bamboo/boo,bamboo/boo,BitPuffin/boo,BITechnologies/boo,BitPuffin/boo,boo-lang/boo,Unity-Technologies/boo,drslump/boo,KingJiangNet/boo,KingJiangNet/boo,drslump/boo,BillHally/boo,bamboo/boo,boo-lang/boo,hmah/boo,drslump/boo,BillHally/boo,KidFashion/boo,KingJiangNet/boo,KingJiangNet/boo,wbardzinski/boo,hmah/boo,BITechnologies/boo,drslump/boo,rmboggs/boo,boo-lang/boo,hmah/boo,KidFashion/boo,Unity-Technologies/boo,BillHally/boo,bamboo/boo,BitPuffin/boo,boo-lang/boo,BITechnologies/boo,wbardzinski/boo,boo-lang/boo,Unity-Technologies/boo,BillHally/boo,rmboggs/boo,KingJiangNet/boo,hmah/boo,boo-lang/boo,BillHally/boo,KidFashion/boo,bamboo/boo,rmboggs/boo,Unity-Technologies/boo,BITechnologies/boo,KingJiangNet/boo,BitPuffin/boo,BITechnologies/boo,KingJiangNet/boo,wbardzinski/boo,rmboggs/boo,KingJiangNet/boo,hmah/boo,wbardzinski/boo,rmboggs/boo,KidFashion/boo,BitPuffin/boo,KidFashion/boo,BitPuffin/boo,rmartinho/boo,Unity-Technologies/boo,rmboggs/boo,rmartinho/boo,bamboo/boo,BITechnologies/boo,BitPuffin/boo,KidFashion/boo,boo-lang/boo,Unity-Technologies/boo,BillHally/boo,drslump/boo,boo-lang/boo,rmboggs/boo,wbardzinski/boo,rmartinho/boo,Unity-Technologies/boo,BillHally/boo,BitPuffin/boo,rmartinho/boo,BITechnologies/boo,hmah/boo,drslump/boo,BITechnologies/boo,hmah/boo,rmboggs/boo,hmah/boo,drslump/boo | tests/BooCompiler.Tests/CompilerContextTest.cs | tests/BooCompiler.Tests/CompilerContextTest.cs | using Boo.Lang.Compiler;
using Boo.Lang.Compiler.Ast;
using Boo.Lang.Environments;
using NUnit.Framework;
namespace BooCompiler.Tests
{
[TestFixture]
public class CompilerContextTest
{
[Test]
public void CompileUnitIsProvidedToTheEnvironment()
{
var compileUnit = new CompileUnit();
ActiveEnvironment.With(
new CompilerContext(compileUnit).Environment,
() => Assert.AreSame(compileUnit, My<CompileUnit>.Instance));
}
}
}
| using Boo.Lang.Compiler;
using Boo.Lang.Compiler.Ast;
using Boo.Lang.Environments;
using NUnit.Framework;
namespace BooCompiler.Tests
{
[TestFixture]
public class CompilerContextTest
{
[Test]
public void CompileUnitIsProvidedToTheEnvironment()
{
var compileUnit = new CompileUnit();
ActiveEnvironment.With(new CompilerContext().Environment, () => {
Assert.AreSame(compileUnit, My<CompileUnit>.Instance);
});
}
}
}
| bsd-3-clause | C# |
4fc581e3893af197dca3f38be8d505ddfe7ed771 | Use Unity-defined uri launcher | killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity | Assets/MRTK/Examples/Demos/HandTracking/Scripts/LaunchUri.cs | Assets/MRTK/Examples/Demos/HandTracking/Scripts/LaunchUri.cs | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
[AddComponentMenu("Scripts/MRTK/Examples/LaunchUri")]
public class LaunchUri : MonoBehaviour
{
/// <summary>
/// Launch a UWP slate app. In most cases, your experience can continue running while the
/// launched app renders on top.
/// </summary>
/// <param name="uri">Url of the web page or app to launch. See https://docs.microsoft.com/windows/uwp/launch-resume/launch-default-app
/// for more information about the protocols that can be used when launching apps.</param>
public void Launch(string uri)
{
Debug.Log($"LaunchUri: Launching {uri}");
#if UNITY_WSA
UnityEngine.WSA.Launcher.LaunchUri(uri, false);
#else
Application.OpenURL(uri);
#endif
}
}
}
| // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
[AddComponentMenu("Scripts/MRTK/Examples/LaunchUri")]
public class LaunchUri : MonoBehaviour
{
/// <summary>
/// Launch a UWP slate app. In most cases, your experience can continue running while the
/// launched app renders on top.
/// </summary>
/// <param name="uri">Url of the web page or app to launch. See https://docs.microsoft.com/windows/uwp/launch-resume/launch-default-app
/// for more information about the protocols that can be used when launching apps.</param>
public void Launch(string uri)
{
Debug.Log($"LaunchUri: Launching {uri}");
#if WINDOWS_UWP
UnityEngine.WSA.Application.InvokeOnUIThread(async () =>
{
bool result = await global::Windows.System.Launcher.LaunchUriAsync(new System.Uri(uri));
if (!result)
{
Debug.LogError("Launching URI failed to launch.");
}
}, false);
#else
Application.OpenURL(uri);
#endif
}
}
}
| mit | C# |
69c2d7bd557682a013136c8fd2091bdcac608e02 | Update Settings.cs | LocalJoost/TemperatureReaderDemo | TemperatureReader.Shared/Settings.cs | TemperatureReader.Shared/Settings.cs | namespace TemperatureReader.Shared
{
public static class Settings
{
public static readonly string TemperatureBusConnectionString =
"Endpoint=sb://yournamespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXXXXXXXXXXXXXXXXYOURKEYHEREXXXXXXXXXXXXXXXX";";
public static readonly string TemperatureQueue = "temperaturedatabus";
public static readonly int TemperatureQueueTtl = 10;
public static readonly string FanSwitchQueue = "fanswitchcommandbus";
public static readonly int FanSwitchQueueTtl = 10;
public const int ErrorPinId = 12;
public const int DataPinId = 16;
public const int LongFlashTime = 250;
public const int ShortFlashTime = 125;
public const int AdcCsPinId = 5;
public const int AdcClkPinId = 6;
public const int AdcDigitalIoPinId = 13;
public const int DefaultTemperaturePostingDelay = 5000;
public const int MaxReadRetry = 10;
public const int SwitchPinId = 18;
}
}
| namespace TemperatureReader.Shared
{
public static class Settings
{
public static readonly string TemperatureBusConnectionString =
"Endpoint=sb://localjoosttemperaturebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=IWrd0nOx6GMvdr4hpWZpGxMstrQgegdnv9ngBzr63vk=";
public static readonly string TemperatureQueue = "temperaturedatabus";
public static readonly int TemperatureQueueTtl = 10;
public static readonly string FanSwitchQueue = "fanswitchcommandbus";
public static readonly int FanSwitchQueueTtl = 10;
public const int ErrorPinId = 12;
public const int DataPinId = 16;
public const int LongFlashTime = 250;
public const int ShortFlashTime = 125;
public const int AdcCsPinId = 5;
public const int AdcClkPinId = 6;
public const int AdcDigitalIoPinId = 13;
public const int DefaultTemperaturePostingDelay = 5000;
public const int MaxReadRetry = 10;
public const int SwitchPinId = 18;
}
}
| mit | C# |
0069a634906912a1241363fb9afd54cc7461d561 | Clear ResponsiveExceptionFilter. | SaladLab/Akka.Interfaced,SaladbowlCreative/Akka.Interfaced,SaladLab/Akka.Interfaced,SaladbowlCreative/Akka.Interfaced | core/Akka.Interfaced/ResponsiveExceptionFilter.cs | core/Akka.Interfaced/ResponsiveExceptionFilter.cs | using System;
using System.Linq;
namespace Akka.Interfaced
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public class ResponsiveExceptionAttribute : Attribute, IFilterPerClassFactory
{
private Func<Exception, bool> _filter;
public ResponsiveExceptionAttribute(Func<Exception, bool> filter)
{
_filter = filter;
}
public ResponsiveExceptionAttribute(params Type[] exceptionTypes)
{
_filter = e => exceptionTypes.Any(t => e.GetType() == t);
}
void IFilterPerClassFactory.Setup(Type actorType)
{
}
IFilter IFilterPerClassFactory.CreateInstance()
{
return new ResponsiveExceptionFilter(_filter);
}
}
public class ResponsiveExceptionFilter : IPostRequestFilter
{
private Func<Exception, bool> _filter;
int IFilter.Order => 0;
public ResponsiveExceptionFilter(Func<Exception, bool> filter)
{
_filter = filter;
}
void IPostRequestFilter.OnPostRequest(PostRequestFilterContext context)
{
if (context.Exception != null && _filter(context.Exception))
{
context.Response = new ResponseMessage
{
RequestId = context.Request.RequestId,
Exception = context.Exception
};
context.Exception = null;
}
}
}
}
| using System;
using System.Linq;
namespace Akka.Interfaced
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public class ResponsiveException
: Attribute, IFilterPerClassFactory, IPostRequestFilter
{
private Func<Exception, bool> _filter;
int IFilter.Order => 0;
public ResponsiveException(Func<Exception, bool> filter)
{
_filter = filter;
}
public ResponsiveException(params Type[] exceptionTypes)
{
_filter = e => exceptionTypes.Any(t => e.GetType() == t);
}
void IFilterPerClassFactory.Setup(Type actorType)
{
}
IFilter IFilterPerClassFactory.CreateInstance()
{
return this;
}
void IPostRequestFilter.OnPostRequest(PostRequestFilterContext context)
{
if (context.Exception != null && _filter(context.Exception))
{
context.Response = new ResponseMessage
{
RequestId = context.Request.RequestId,
Exception = context.Exception
};
context.Exception = null;
}
}
}
}
| mit | C# |
4588febcfc3214cc0a8a83b9401e2f0679c94421 | Add Validation Messages to the Clone Section Screen | tommcclean/PortalCMS,tommcclean/PortalCMS,tommcclean/PortalCMS | Portal.CMS.Web/Areas/PageBuilder/Views/Section/_Clone.cshtml | Portal.CMS.Web/Areas/PageBuilder/Views/Section/_Clone.cshtml | @model Portal.CMS.Web.Areas.PageBuilder.ViewModels.Section.CloneViewModel
@{
Layout = "";
var pageList = Model.PageList.Select(x => new SelectListItem { Value = x.PageId.ToString(), Text = x.PageName });
}
<div class="panel-inner">
@using (Html.BeginForm("Clone", "Section", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(x => x.PageAssociationId)
if (pageList.Any())
{
<div class="alert alert-warning" role="alert">Clone a Section onto another Page to keep your content synced across all relevant pages</div>
}
else
{
<div class="alert alert-danger" role="alert">You can't Clone this Section because you don't have any other pages yet...</div>
}
@Html.ValidationMessageFor(x => x.PageId)
<div class="control-group">
@Html.LabelFor(x => x.PageId)
@Html.DropDownListFor(m => m.PageId, pageList)
</div>
<div class="footer">
<button class="btn primary"><span class="fa fa-check"></span><span class="hidden-xs">Clone Section</span></button>
<button class="btn" data-dismiss="modal"><span class="fa fa-times"></span><span class="hidden-xs">Cancel</span></button>
</div>
}
</div> | @model Portal.CMS.Web.Areas.PageBuilder.ViewModels.Section.CloneViewModel
@{
Layout = "";
var pageList = Model.PageList.Select(x => new SelectListItem { Value = x.PageId.ToString(), Text = x.PageName });
}
<div class="panel-inner">
@using (Html.BeginForm("Clone", "Section", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(x => x.PageAssociationId)
<div class="alert alert-warning" role="alert">Clone a Section onto another Page to keep your content synced across all relevant pages</div>
@Html.ValidationMessage("PageId")
<div class="control-group">
@Html.LabelFor(x => x.PageId)
@Html.DropDownListFor(m => m.PageId, pageList)
</div>
<div class="footer">
<button class="btn primary"><span class="fa fa-check"></span><span class="hidden-xs">Clone Section</span></button>
<button class="btn" data-dismiss="modal"><span class="fa fa-times"></span><span class="hidden-xs">Cancel</span></button>
</div>
}
</div> | mit | C# |
28722a34e4a4a5781cb33525e40497f1e2a8b218 | Simplify logic in user profile validation | shanecharles/allReady,enderdickerson/allReady,anobleperson/allReady,auroraocciduusadmin/allReady,JowenMei/allReady,HamidMosalla/allReady,dpaquette/allReady,joelhulen/allReady,gftrader/allReady,binaryjanitor/allReady,forestcheng/allReady,pranap/allReady,JowenMei/allReady,BillWagner/allReady,jonatwabash/allReady,chinwobble/allReady,gftrader/allReady,BillWagner/allReady,binaryjanitor/allReady,GProulx/allReady,GProulx/allReady,BarryBurke/allReady,jonatwabash/allReady,gitChuckD/allReady,timstarbuck/allReady,timstarbuck/allReady,MisterJames/allReady,forestcheng/allReady,pranap/allReady,jonatwabash/allReady,GProulx/allReady,MisterJames/allReady,BarryBurke/allReady,VishalMadhvani/allReady,chinwobble/allReady,shanecharles/allReady,gitChuckD/allReady,BillWagner/allReady,mheggeseth/allReady,stevejgordon/allReady,enderdickerson/allReady,mgmccarthy/allReady,BarryBurke/allReady,HamidMosalla/allReady,forestcheng/allReady,HTBox/allReady,timstarbuck/allReady,shawnwildermuth/allReady,mgmccarthy/allReady,auroraocciduusadmin/allReady,arst/allReady,stevejgordon/allReady,binaryjanitor/allReady,kmlewis/allReady,BillWagner/allReady,joelhulen/allReady,mheggeseth/allReady,mipre100/allReady,mipre100/allReady,JowenMei/allReady,dangle1/allReady,colhountech/allReady,HamidMosalla/allReady,dangle1/allReady,HTBox/allReady,chinwobble/allReady,kmlewis/allReady,mgmccarthy/allReady,forestcheng/allReady,JowenMei/allReady,stevejgordon/allReady,shawnwildermuth/allReady,anobleperson/allReady,c0g1t8/allReady,MisterJames/allReady,MisterJames/allReady,VishalMadhvani/allReady,dpaquette/allReady,enderdickerson/allReady,arst/allReady,colhountech/allReady,anobleperson/allReady,shanecharles/allReady,chinwobble/allReady,HamidMosalla/allReady,mipre100/allReady,stevejgordon/allReady,c0g1t8/allReady,mgmccarthy/allReady,pranap/allReady,timstarbuck/allReady,colhountech/allReady,joelhulen/allReady,gftrader/allReady,c0g1t8/allReady,gitChuckD/allReady,HTBox/allReady,VishalMadhvani/allReady,bcbeatty/allReady,shawnwildermuth/allReady,shawnwildermuth/allReady,mheggeseth/allReady,dangle1/allReady,shanecharles/allReady,arst/allReady,dangle1/allReady,dpaquette/allReady,pranap/allReady,VishalMadhvani/allReady,GProulx/allReady,BarryBurke/allReady,binaryjanitor/allReady,bcbeatty/allReady,gftrader/allReady,joelhulen/allReady,jonatwabash/allReady,kmlewis/allReady,bcbeatty/allReady,bcbeatty/allReady,auroraocciduusadmin/allReady,gitChuckD/allReady,HTBox/allReady,auroraocciduusadmin/allReady,dpaquette/allReady,colhountech/allReady,mipre100/allReady,kmlewis/allReady,arst/allReady,enderdickerson/allReady,c0g1t8/allReady,anobleperson/allReady,mheggeseth/allReady | AllReadyApp/Web-App/AllReady/Models/ApplicationUser.cs | AllReadyApp/Web-App/AllReady/Models/ApplicationUser.cs | using Microsoft.AspNet.Identity.EntityFramework;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace AllReady.Models
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
{
[Display(Name = "Associated skills")]
public List<UserSkill> AssociatedSkills { get; set; } = new List<UserSkill>();
public string Name { get; set; }
[Display(Name = "Time Zone")]
[Required]
public string TimeZoneId { get; set; }
public string PendingNewEmail { get; set; }
public IEnumerable<ValidationResult> ValidateProfileCompleteness()
{
List<ValidationResult> validationResults = new List<ValidationResult>();
if (!EmailConfirmed)
{
validationResults.Add(new ValidationResult("Verify your email address", new string[] { nameof(Email) }));
}
if (string.IsNullOrWhiteSpace(Name))
{
validationResults.Add(new ValidationResult("Enter your name", new string[] { nameof(Name) }));
}
if (string.IsNullOrWhiteSpace(PhoneNumber))
{
validationResults.Add(new ValidationResult("Add a phone number", new string[] { nameof(PhoneNumber) }));
}
else if (!PhoneNumberConfirmed)
{
validationResults.Add(new ValidationResult("Confirm your phone number", new string[] { nameof(PhoneNumberConfirmed) }));
}
return validationResults;
}
public bool IsProfileComplete()
{
return !ValidateProfileCompleteness().Any();
}
}
} | using Microsoft.AspNet.Identity.EntityFramework;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace AllReady.Models
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
{
[Display(Name = "Associated skills")]
public List<UserSkill> AssociatedSkills { get; set; } = new List<UserSkill>();
public string Name { get; set; }
[Display(Name = "Time Zone")]
[Required]
public string TimeZoneId { get; set; }
public string PendingNewEmail { get; set; }
public IEnumerable<ValidationResult> ValidateProfileCompleteness()
{
List<ValidationResult> validationResults = new List<ValidationResult>();
if (!EmailConfirmed)
{
validationResults.Add(new ValidationResult("Verify your email address", new string[] { nameof(Email) }));
}
if (string.IsNullOrWhiteSpace(Name))
{
validationResults.Add(new ValidationResult("Enter your name", new string[] { nameof(Name) }));
}
if (string.IsNullOrWhiteSpace(PhoneNumber))
{
validationResults.Add(new ValidationResult("Add a phone number", new string[] { nameof(PhoneNumber) }));
}
if (!string.IsNullOrWhiteSpace(PhoneNumber) && !PhoneNumberConfirmed)
{
validationResults.Add(new ValidationResult("Confirm your phone number", new string[] { nameof(PhoneNumberConfirmed) }));
}
return validationResults;
}
public bool IsProfileComplete()
{
return !ValidateProfileCompleteness().Any();
}
}
} | mit | C# |
735663e59c9ae44141239898ee2bc21d2be8edf6 | Add group role to relationship | mattgwagner/alert-roster | AlertRoster.Web/Models/MemberGroup.cs | AlertRoster.Web/Models/MemberGroup.cs | namespace AlertRoster.Web.Models
{
public class MemberGroup
{
public int MemberId { get; private set; }
public virtual Member Member { get; private set; }
public int GroupId { get; private set; }
public virtual Group Group { get; private set; }
public GroupRole Role { get; set; } = GroupRole.Member;
private MemberGroup()
{
// Parameter-less ctor for EF
}
public MemberGroup(int memberId, int groupId)
{
this.MemberId = memberId;
this.GroupId = groupId;
}
public enum GroupRole : byte
{
Member = 0,
Administrator = 1
}
}
} | namespace AlertRoster.Web.Models
{
public class MemberGroup
{
public int MemberId { get; private set; }
public virtual Member Member { get; private set; }
public int GroupId { get; private set; }
public virtual Group Group { get; private set; }
private MemberGroup()
{
// Parameter-less ctor for EF
}
public MemberGroup(int memberId, int groupId)
{
this.MemberId = memberId;
this.GroupId = groupId;
}
}
} | mit | C# |
679175ddea4c1e39bc99d3c3c09630910cef23a3 | Remove unnecessary constructor | Krusen/Additio.Sitecore.DependencyConfigReader | src/Additio.Configuration/DependencyConfigReader.cs | src/Additio.Configuration/DependencyConfigReader.cs | using System;
using System.IO;
using System.Linq;
using System.Text;
using Sitecore.Configuration;
using Sitecore.Diagnostics;
namespace Additio.Configuration
{
public class DependencyConfigReader : ConfigReader
{
protected IDependencyResolver DependencyResolver { get; set; }
public DependencyConfigReader()
{
DependencyResolver = new DependencyResolver();
}
protected override void LoadAutoIncludeFiles(ConfigPatcher patcher, string folder)
{
Assert.ArgumentNotNull(patcher, nameof(patcher));
Assert.ArgumentNotNull(folder, nameof(folder));
try
{
if (!Directory.Exists(folder))
return;
var configFiles = Directory.GetFiles(folder, "*.config", SearchOption.AllDirectories).ToList();
var sortedFiles = DependencyResolver.GetSortedFiles(configFiles, folder);
foreach (var node in sortedFiles)
{
try
{
using (var reader = new StreamReader(node.FilePath, Encoding.UTF8))
{
// Add patch source with relative path, not just file name
patcher.ApplyPatch(reader, node.RelativePath);
}
}
catch (Exception ex)
{
Log.Error("Could not load configuration file: " + node.FilePath + ": " + ex, typeof(DependencyConfigReader));
}
}
}
catch (Exception ex)
{
Log.Error("Could not scan configuration folder " + folder + " for files: " + ex, typeof(DependencyConfigReader));
}
}
}
}
| using System;
using System.IO;
using System.Linq;
using System.Text;
using Sitecore.Configuration;
using Sitecore.Diagnostics;
namespace Additio.Configuration
{
public class DependencyConfigReader : ConfigReader
{
protected IDependencyResolver DependencyResolver { get; set; }
public DependencyConfigReader() : this(new DependencyResolver())
{
}
public DependencyConfigReader(IDependencyResolver dependencyResolver)
{
DependencyResolver = dependencyResolver;
}
protected override void LoadAutoIncludeFiles(ConfigPatcher patcher, string folder)
{
Assert.ArgumentNotNull(patcher, nameof(patcher));
Assert.ArgumentNotNull(folder, nameof(folder));
try
{
if (!Directory.Exists(folder))
return;
var configFiles = Directory.GetFiles(folder, "*.config", SearchOption.AllDirectories).ToList();
var sortedFiles = DependencyResolver.GetSortedFiles(configFiles, folder);
foreach (var node in sortedFiles)
{
try
{
using (var reader = new StreamReader(node.FilePath, Encoding.UTF8))
{
// Add patch source with relative path, not just file name
patcher.ApplyPatch(reader, node.RelativePath);
}
}
catch (Exception ex)
{
Log.Error("Could not load configuration file: " + node.FilePath + ": " + ex, typeof(DependencyConfigReader));
}
}
}
catch (Exception ex)
{
Log.Error("Could not scan configuration folder " + folder + " for files: " + ex, typeof(DependencyConfigReader));
}
}
}
}
| unlicense | C# |
39e103127e3aceae7d4b35523a0611c619986505 | test green for #6 | awesome-inc/NuPlug | NuPlug/NuPlugPackageManager.cs | NuPlug/NuPlugPackageManager.cs | using System.Runtime.Versioning;
using NuGet;
namespace NuPlug
{
public class NuPlugPackageManager : PackageManager
{
public NuPlugPackageManager(IPackageRepository sourceRepository, string path)
: base(sourceRepository, path)
{}
public NuPlugPackageManager(IPackageRepository sourceRepository, IPackagePathResolver pathResolver, IFileSystem fileSystem)
: base(sourceRepository, pathResolver, fileSystem)
{}
public NuPlugPackageManager(IPackageRepository sourceRepository, IPackagePathResolver pathResolver, IFileSystem fileSystem, IPackageRepository localRepository)
: base(sourceRepository, pathResolver, fileSystem, localRepository)
{}
public FrameworkName TargetFramework { get; set; } = VersionHelper.GetTargetFramework();
public override void InstallPackage(IPackage package, bool ignoreDependencies, bool allowPrereleaseVersions)
{
InstallPackage(package, TargetFramework, ignoreDependencies, allowPrereleaseVersions);
}
}
} | using System.Runtime.Versioning;
using NuGet;
namespace NuPlug
{
public class NuPlugPackageManager : PackageManager
{
public NuPlugPackageManager(IPackageRepository sourceRepository, string path)
: base(sourceRepository, path)
{}
public NuPlugPackageManager(IPackageRepository sourceRepository, IPackagePathResolver pathResolver, IFileSystem fileSystem)
: base(sourceRepository, pathResolver, fileSystem)
{}
public NuPlugPackageManager(IPackageRepository sourceRepository, IPackagePathResolver pathResolver, IFileSystem fileSystem, IPackageRepository localRepository)
: base(sourceRepository, pathResolver, fileSystem, localRepository)
{}
public FrameworkName TargetFramework { get; set; } = VersionHelper.GetTargetFramework();
//public override void InstallPackage(IPackage package, bool ignoreDependencies, bool allowPrereleaseVersions)
//{
// InstallPackage(package, TargetFramework, ignoreDependencies, allowPrereleaseVersions);
//}
}
} | apache-2.0 | C# |
2d71595848317398812eb365ca7a654a7b496145 | Update documentation | autofac/Autofac | src/Autofac/Core/ComponentRegisteredEventArgs.cs | src/Autofac/Core/ComponentRegisteredEventArgs.cs | // This software is part of the Autofac IoC container
// Copyright � 2011 Autofac Contributors
// https://autofac.org
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
using System;
using Autofac.Core.Registration;
namespace Autofac.Core
{
/// <summary>
/// Information about the ocurrence of a component being registered
/// with a container.
/// </summary>
public class ComponentRegisteredEventArgs : EventArgs
{
/// <summary>
/// Gets the <see cref="IComponentRegistryBuilder" /> into which the registration was made.
/// </summary>
public IComponentRegistryBuilder ComponentRegistryBuilder { get; }
/// <summary>
/// Gets the component registration.
/// </summary>
public IComponentRegistration ComponentRegistration { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ComponentRegisteredEventArgs"/> class.
/// </summary>
/// <param name="registryBuilder">The <see cref="IComponentRegistryBuilder" /> into which the registration was made.</param>
/// <param name="componentRegistration">The component registration.</param>
public ComponentRegisteredEventArgs(IComponentRegistryBuilder registryBuilder, IComponentRegistration componentRegistration)
{
if (registryBuilder == null) throw new ArgumentNullException(nameof(registryBuilder));
if (componentRegistration == null) throw new ArgumentNullException(nameof(componentRegistration));
ComponentRegistryBuilder = registryBuilder;
ComponentRegistration = componentRegistration;
}
}
}
| // This software is part of the Autofac IoC container
// Copyright � 2011 Autofac Contributors
// https://autofac.org
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
using System;
using Autofac.Core.Registration;
namespace Autofac.Core
{
/// <summary>
/// Information about the ocurrence of a component being registered
/// with a container.
/// </summary>
public class ComponentRegisteredEventArgs : EventArgs
{
/// <summary>
/// Gets the <see cref="IComponentRegistryBuilder" /> into which the registration was made.
/// </summary>
public IComponentRegistryBuilder ComponentRegistryBuilder { get; }
/// <summary>
/// Gets the component registration.
/// </summary>
public IComponentRegistration ComponentRegistration { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ComponentRegisteredEventArgs"/> class.
/// </summary>
/// <param name="registryBuilder">The container into which the registration
/// was made.</param>
/// <param name="componentRegistration">The component registration.</param>
public ComponentRegisteredEventArgs(IComponentRegistryBuilder registryBuilder, IComponentRegistration componentRegistration)
{
if (registryBuilder == null) throw new ArgumentNullException(nameof(registryBuilder));
if (componentRegistration == null) throw new ArgumentNullException(nameof(componentRegistration));
ComponentRegistryBuilder = registryBuilder;
ComponentRegistration = componentRegistration;
}
}
}
| mit | C# |
2bede2f471b71503a01f6aa9167c8b03e9077b9b | Fix errors | Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D | src/Dock.Model/ViewBase.cs | src/Dock.Model/ViewBase.cs | // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
namespace Dock.Model
{
/// <summary>
/// View base class.
/// </summary>
public abstract class ViewBase : ObservableObject, IView
{
private ImmutableArray<IViewsWindow> _windows;
/// <inheritdoc/>
public ImmutableArray<IViewsWindow> Windows
{
get => _windows;
set => Update(ref _windows, value);
}
/// <inheritdoc/>
public abstract string Title { get; }
/// <inheritdoc/>
public abstract object Context { get; }
/// <inheritdoc/>
public virtual void ShowWindows()
{
foreach (var window in _windows)
{
window.Present();
}
}
/// <inheritdoc/>
public virtual void CloseWindows()
{
foreach (var window in _windows)
{
window.Destroy();
}
}
/// <summary>
/// Check whether the <see cref="Title"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public virtual bool ShouldSerializeTitle() => true;
/// <summary>
/// Check whether the <see cref="Context"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public virtual bool ShouldSerializeContext() => false;
/// <summary>
/// Check whether the <see cref="Windows"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public virtual bool ShouldSerializeWindows() => _windows.IsEmpty == false;
}
}
| // Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
namespace Dock.Model
{
/// <summary>
/// View base class.
/// </summary>
public abstract class ViewBase : ObservableObject, IView
{
private ImmutableArray<IViewsWindow> _windows;
/// <inheritdoc/>
public ImmutableArray<IViewsWindow> Windows
{
get => _panels;
set => Update(ref _windows, value);
}
/// <inheritdoc/>
public abstract string Title { get; }
/// <inheritdoc/>
public abstract object Context { get; }
/// <inheritdoc/>
public virtual void ShowWindows()
{
foreach (var window in _windows)
{
window.Create();
window.Present();
}
}
/// <inheritdoc/>
public virtual void CloseWindows()
{
foreach (var window in _windows)
{
window.Destroy();
}
}
/// <summary>
/// Check whether the <see cref="Title"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public virtual bool ShouldSerializeTitle() => true;
/// <summary>
/// Check whether the <see cref="Context"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public virtual bool ShouldSerializeContext() => false;
/// <summary>
/// Check whether the <see cref="Windows"/> property has changed from its default value.
/// </summary>
/// <returns>Returns true if the property has changed; otherwise, returns false.</returns>
public virtual bool ShouldSerializeWindows() => _windows.IsEmpty == false;
}
}
| mit | C# |
ee42c70193cc61c747970c620c6efdb16bd09497 | Update NotificationManager.cs | piccoloaiutante/ScriptCs.MPNSTester | src/NotificationManager.cs | src/NotificationManager.cs | using ScriptCs.Contracts;
using ScriptCs.MpnsTester.Notifiers;
namespace ScriptCs.MpnsTester
{
public class NotificationManager : IScriptPackContext
{
public void RawDataSend(string message, string url)
{
var rawDataNotifier = new RawDataNotifier(url);
rawDataNotifier.Notify(message);
}
public void TileNotificationSend(string backgroundImage, string count, string title,
string backBackgroundImage, string backTitle, string backContent, string url)
{
var tileNotifier = new TileNotifier(url);
tileNotifier.Notify(backgroundImage, count, title, backBackgroundImage, backTitle, backContent);
}
public void ToastNotificationSend(string title, string content, string pageUrl, string url)
{
var toastNotifier = new ToastNotifier(url);
toastNotifier.Notify(title, content, pageUrl);
}
}
}
| using ScriptCs.Contracts;
using ScriptCs.MpnsTester.Notifiers;
namespace ScriptCs.MpnsTester
{
public class NotificationManager : IScriptPackContext
{
public void RawDataSend(string message, string url)
{
var rawDataNotifier = new RawDataNotifier(url);
rawDataNotifier.Notify(message);
}
public void TileNotificationSend(string backgroundImage, string count, string title,
string backBackgroundImage, string backTitle, string backContent, string url)
{
var tileNotifier = new TileNotifier(url);
tileNotifier.Notify(backgroundImage, count, title, backBackgroundImage, backTitle, backContent);
}
public void ToastNotificationSend(string title, string content, string url)
{
var toastNotifier = new ToastNotifier(url);
toastNotifier.Notify(title, content);
}
}
}
| mit | C# |
2f3f4f3e4b8b660b05d6652a9b1261f09901bcea | Add new checks to verifier | peppy/osu,NeoAdonis/osu,peppy/osu-new,UselessToucan/osu,peppy/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu | osu.Game.Rulesets.Osu/Edit/OsuBeatmapVerifier.cs | osu.Game.Rulesets.Osu/Edit/OsuBeatmapVerifier.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks.Components;
using osu.Game.Rulesets.Osu.Edit.Checks;
namespace osu.Game.Rulesets.Osu.Edit
{
public class OsuBeatmapVerifier : IBeatmapVerifier
{
private readonly List<ICheck> checks = new List<ICheck>
{
// Compose
new CheckOffscreenObjects(),
// Spread
new CheckTimeDistanceEquality(),
new CheckLowDiffOverlaps()
};
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
{
return checks.SelectMany(check => check.Run(context));
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks.Components;
using osu.Game.Rulesets.Osu.Edit.Checks;
namespace osu.Game.Rulesets.Osu.Edit
{
public class OsuBeatmapVerifier : IBeatmapVerifier
{
private readonly List<ICheck> checks = new List<ICheck>
{
new CheckOffscreenObjects()
};
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
{
return checks.SelectMany(check => check.Run(context));
}
}
}
| mit | C# |
757bb6911e6e7db4e4cbadaec7bb58858afc9780 | Fix license header from wrong project | EVAST9919/osu,ZLima12/osu,smoogipoo/osu,DrabWeb/osu,peppy/osu,ppy/osu,Nabile-Rahmani/osu,ppy/osu,UselessToucan/osu,2yangk23/osu,Frontear/osuKyzer,UselessToucan/osu,ZLima12/osu,ppy/osu,NeoAdonis/osu,EVAST9919/osu,smoogipoo/osu,johnneijzen/osu,johnneijzen/osu,naoey/osu,DrabWeb/osu,2yangk23/osu,naoey/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,peppy/osu,naoey/osu,DrabWeb/osu,peppy/osu,peppy/osu-new | osu.Game.Tests/Visual/TestCasePlaybackControl.cs | osu.Game.Tests/Visual/TestCasePlaybackControl.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit.Components;
using osu.Game.Tests.Beatmaps;
using OpenTK;
namespace osu.Game.Tests.Visual
{
public class TestCasePlaybackControl : OsuTestCase
{
public TestCasePlaybackControl()
{
var playback = new PlaybackControl
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(200,100)
};
playback.Beatmap.Value = new TestWorkingBeatmap(new Beatmap());
Add(playback);
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit.Components;
using osu.Game.Tests.Beatmaps;
using OpenTK;
namespace osu.Game.Tests.Visual
{
public class TestCasePlaybackControl : OsuTestCase
{
public TestCasePlaybackControl()
{
var playback = new PlaybackControl
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(200,100)
};
playback.Beatmap.Value = new TestWorkingBeatmap(new Beatmap());
Add(playback);
}
}
}
| mit | C# |
0067657d0571e01a73275efc845a8b328719f768 | Modify method to abstract which will force a compile error if the implementation is not supplied in a derived class rather than throw a NotImplementedException() | csnate/cctray-jenkins-transport,csnate/cctray-jenkins-transport | JenkinsTransport/BuildParameters/BaseBuildParameter.cs | JenkinsTransport/BuildParameters/BaseBuildParameter.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using ThoughtWorks.CruiseControl.Remote.Parameters;
namespace JenkinsTransport.BuildParameters
{
public abstract class BaseBuildParameter
{
public string Name { get; private set; }
public string Description { get; private set; }
public BuildParameterType ParameterType { get; protected set; }
public string DefaultValue { get; private set; }
public abstract ParameterBase ToParameterBase();
protected BaseBuildParameter(XContainer document)
{
Name = (string)document.Element("name");
Description = (string)document.Element("description");
DefaultValue = (string)document.Descendants("defaultParameterValue").First().Element("value");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using ThoughtWorks.CruiseControl.Remote.Parameters;
namespace JenkinsTransport.BuildParameters
{
public abstract class BaseBuildParameter
{
public string Name { get; private set; }
public string Description { get; private set; }
public BuildParameterType ParameterType { get; protected set; }
public string DefaultValue { get; private set; }
public virtual ParameterBase ToParameterBase()
{
throw new NotImplementedException("Must be overridden in derived class");
}
protected BaseBuildParameter(XContainer document)
{
Name = (string)document.Element("name");
Description = (string)document.Element("description");
DefaultValue = (string)document.Descendants("defaultParameterValue").First().Element("value");
}
}
}
| mit | C# |
328b52d0561656962691c96eb7c3917e97d50e14 | Remove redundant method | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Servers/Kestrel/shared/test/TestResources.cs | src/Servers/Kestrel/shared/test/TestResources.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using Xunit;
namespace Microsoft.AspNetCore.Testing
{
public static class TestResources
{
private static readonly string _baseDir = Path.Combine(Directory.GetCurrentDirectory(), "shared", "TestCertificates");
public static string TestCertificatePath { get; } = Path.Combine(_baseDir, "testCert.pfx");
public static string GetCertPath(string name) => Path.Combine(_baseDir, name);
private const int MutexTimeout = 120 * 1000;
private static readonly Mutex importPfxMutex = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
new Mutex(initiallyOwned: false, "Global\\KestrelTests.Certificates.LoadPfxCertificate") :
null;
public static X509Certificate2 GetTestCertificate(string certName = "testCert.pfx")
{
// On Windows, applications should not import PFX files in parallel to avoid a known system-level
// race condition bug in native code which can cause crashes/corruption of the certificate state.
if (importPfxMutex != null)
{
Assert.True(importPfxMutex.WaitOne(MutexTimeout), "Cannot acquire the global certificate mutex.");
}
try
{
return new X509Certificate2(GetCertPath(certName), "testPassword");
}
finally
{
importPfxMutex?.ReleaseMutex();
}
}
public static X509Certificate2 GetTestCertificate(string certName, string password)
{
return new X509Certificate2(GetCertPath(certName), password);
}
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using Xunit;
namespace Microsoft.AspNetCore.Testing
{
public static class TestResources
{
private static readonly string _baseDir = Path.Combine(Directory.GetCurrentDirectory(), "shared", "TestCertificates");
public static string TestCertificatePath { get; } = Path.Combine(_baseDir, "testCert.pfx");
public static string GetCertPath(string name) => Path.Combine(_baseDir, name);
private const int MutexTimeout = 120 * 1000;
private static readonly Mutex importPfxMutex = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
new Mutex(initiallyOwned: false, "Global\\KestrelTests.Certificates.LoadPfxCertificate") :
null;
public static X509Certificate2 GetTestCertificate(string certName = "testCert.pfx")
{
// On Windows, applications should not import PFX files in parallel to avoid a known system-level
// race condition bug in native code which can cause crashes/corruption of the certificate state.
if (importPfxMutex != null)
{
Assert.True(importPfxMutex.WaitOne(MutexTimeout), "Cannot acquire the global certificate mutex.");
}
try
{
return new X509Certificate2(GetCertPath(certName), "testPassword");
}
finally
{
importPfxMutex?.ReleaseMutex();
}
}
public static X509Certificate2 GetTestCertificate(string certName, string password)
{
return new X509Certificate2(GetCertPath(certName), password);
}
public static X509Certificate2 GetTestCertificate(string certName, string password)
{
return new X509Certificate2(GetCertPath(certName), password);
}
}
}
| apache-2.0 | C# |
f98a200e43e8cf87549acac4cf3f3538f9e57343 | Fix settings save | SnpM/Lockstep-Framework,yanyiyun/LockstepFramework,erebuswolf/LockstepFramework | Settings/LSFSettingsManager.cs | Settings/LSFSettingsManager.cs | using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Lockstep {
public static class LSFSettingsManager {
public const string SETTINGS_NAME = "LockstepFrameworkSettings.asset";
static LSFSettings MainSettings;
static LSFSettingsManager () {
LSFSettings settings = Resources.Load<LSFSettings> (SETTINGS_NAME);
#if UNITY_EDITOR
if (Application.isPlaying == false) {
if (settings == null)
{
settings = ScriptableObject.CreateInstance <LSFSettings> ();
if (!System.IO.Directory.Exists(Application.dataPath + "/Resources"))
AssetDatabase.CreateFolder ("Assets","Resources");
AssetDatabase.CreateAsset (settings,"Assets/Resources/" + SETTINGS_NAME);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh ();
}
}
#endif
MainSettings = settings;
if (MainSettings == null) {
throw new System.NullReferenceException ("No LockstepFrameworkSettings detected. Make sure there is one in the root directory of a Resources folder");
}
}
public static LSFSettings GetSettings () {
return MainSettings;
}
}
} | using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Lockstep {
public static class LSFSettingsManager {
public const string SETTINGS_NAME = "LockstepFrameworkSettings";
static LSFSettings MainSettings;
static LSFSettingsManager () {
LSFSettings settings = Resources.Load<LSFSettings> (SETTINGS_NAME);
#if UNITY_EDITOR
if (Application.isPlaying == false) {
if (settings == null)
{
settings = ScriptableObject.CreateInstance <LSFSettings> ();
if (!System.IO.Directory.Exists(Application.dataPath + "/Resources"))
AssetDatabase.CreateFolder ("Assets","Resources");
AssetDatabase.CreateAsset (settings,"Assets/Resources/" + SETTINGS_NAME);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh ();
}
}
#endif
MainSettings = settings;
if (MainSettings == null) {
throw new System.NullReferenceException ("No LockstepFrameworkSettings detected. Make sure there is one in the root directory of a Resources folder");
}
}
public static LSFSettings GetSettings () {
return MainSettings;
}
}
} | mit | C# |
42351ba927369ae5d16146d2c42607a845671e21 | Fix dead link | blrchen/AzureSpeed,blrchen/AzureSpeed,blrchen/AzureSpeed,blrchen/AzureSpeed | AzureSpeed.Web.App/Views/Azure/Reference.cshtml | AzureSpeed.Web.App/Views/Azure/Reference.cshtml | @{
ViewBag.Title = "Reference";
}
<div class="container-fluid">
<div class="page-header">
<h3>@ViewBag.Title</h3>
</div>
<div class="row">
<div class="col-md-12">
<ul class="list-unstyled">
<li>
<a href="https://azure.microsoft.com/en-us/regions/" target="_blank">Azure Datacenter Regions</a>
</li>
<li>
<a href="https://docs.microsoft.com/en-us/azure/cdn/cdn-pop-locations" target="_blank">Azure Content Delivery Network (CDN) Node Locations</a>
</li>
<li>
<a href="http://msdn.microsoft.com/library/azure/dn249410.aspx" target="_blank">Azure Storage Scalability and Performance Targets</a>
</li>
<li>
<a href="http://azure.microsoft.com/en-us/documentation/articles/azure-subscription-service-limits" target="_blank">Azure Subscription and Service Limits, Quotas, and Constraints</a>
</li>
<li>
<a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html" target="_blank">AWS Regions and Availability Zones</a>
</li>
</ul>
</div>
</div>
</div> | @{
ViewBag.Title = "Reference";
}
<div class="container-fluid">
<div class="page-header">
<h3>@ViewBag.Title</h3>
</div>
<div class="row">
<div class="col-md-12">
<ul class="list-unstyled">
<li>
<a href="https://azure.microsoft.com/en-us/regions/" target="_blank">Azure Datacenter Regions</a>
</li>
<li>
<a href="https://docs.microsoft.com/en-us/azure/cdn/cdn-pop-locations" target="_blank">Azure Content Delivery Network (CDN) Node Locations</a>
</li>
<li>
<a href="http://msdn.microsoft.com/library/azure/dn249410.aspx" target="_blank">Azure Storage Scalability and Performance Targets</a>
</li>
<li>
<a href="http://azure.microsoft.com/en-us/documentation/articles/azure-subscription-service-limits/" target="_blank">Azure Subscription and Service Limits, Quotas, and Constraints</a>
</li>
<li>
<a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html" target="_blank">AWS Regions and Availability Zones</a>
</li>
</ul>
</div>
</div>
</div> | mit | C# |
7202958d3ffe5e5eeb189155c3485e020231a3c5 | Cover CMAC -> Key property setter with null check test | sergezhigunov/OpenGost | tests/OpenGost.Security.Cryptography.Tests/CmacTest.cs | tests/OpenGost.Security.Cryptography.Tests/CmacTest.cs | using System;
using Xunit;
namespace OpenGost.Security.Cryptography
{
public abstract class CmacTest<T> : CryptoConfigRequiredTest
where T : CMAC, new()
{
protected void VerifyCmac(string dataHex, string keyHex, string digestHex)
{
var digestBytes = digestHex.HexToByteArray();
byte[] computedDigest;
using (var cmac = new T())
{
Assert.True(cmac.HashSize > 0);
var key = keyHex.HexToByteArray();
cmac.Key = key;
// make sure the getter returns different objects each time
Assert.NotSame(key, cmac.Key);
Assert.NotSame(cmac.Key, cmac.Key);
// make sure the setter didn't cache the exact object we passed in
key[0] = (byte)(key[0] + 1);
Assert.NotEqual<byte>(key, cmac.Key);
computedDigest = cmac.ComputeHash(dataHex.HexToByteArray());
}
Assert.Equal(digestBytes, computedDigest);
}
[Fact]
public void Key_Throws_IfValueIsNull()
{
byte[] value = null!;
using var cmac = new T();
Assert.Throws<ArgumentNullException>(nameof(value), () => cmac.Key = value);
}
}
}
| using Xunit;
namespace OpenGost.Security.Cryptography
{
public abstract class CmacTest<T> : CryptoConfigRequiredTest
where T : CMAC, new()
{
protected void VerifyCmac(string dataHex, string keyHex, string digestHex)
{
var digestBytes = digestHex.HexToByteArray();
byte[] computedDigest;
using (var cmac = new T())
{
Assert.True(cmac.HashSize > 0);
var key = keyHex.HexToByteArray();
cmac.Key = key;
// make sure the getter returns different objects each time
Assert.NotSame(key, cmac.Key);
Assert.NotSame(cmac.Key, cmac.Key);
// make sure the setter didn't cache the exact object we passed in
key[0] = (byte)(key[0] + 1);
Assert.NotEqual<byte>(key, cmac.Key);
computedDigest = cmac.ComputeHash(dataHex.HexToByteArray());
}
Assert.Equal(digestBytes, computedDigest);
}
}
}
| mit | C# |
9d8c94ad97f7c7cb4f6175a2dce08742b9bf78bd | add clock and rearrange | vishgnu/dashing.net,vishgnu/dashing.net,vishgnu/dashing.net | src/dashing.net/Views/Dashboard/Sample.cshtml | src/dashing.net/Views/Dashboard/Sample.cshtml | @{
ViewBag.Title = "My Dash";
}
<div class="gridster">
<ul>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="welcome" data-view="Text" data-title="Hello" data-text="Commander!" data-moreinfo="Protip: You can drag the widgets around!"></div>
</li>
<li data-row="2" data-col="1" data-sizex="1" data-sizey="1">
<div data-view="Clock"></div>
<i class="icon-time icon-background"></i>
</li>
<li data-row="1" data-col="2" data-sizex="2" data-sizey="2">
<div data-id="trafficmap" data-view="Trafficmap" data-title="MY Traffic" data-lat="51.3051" data-long="6.995" data-zoom="10"></div>
</li>
@*<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="synergy" data-view="Meter" data-title="Synergy" data-min="0" data-max="100"></div>
</li>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="2">
<div data-id="buzzwords" data-view="List" data-unordered="true" data-title="Buzzwords" data-moreinfo="# of times said around the office"></div>
</li>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="valuation" data-view="Number" data-title="Current Valuation" data-moreinfo="In billions" data-prefix="$"></div>
</li>
<li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
<div data-id="convergence" data-view="Graph" data-title="Convergence" style="background-color:#ff9618"></div>
</li>*@
</ul>
<center><div style="font-size: 12px">Try this: curl -d "{ 'auth_token': 'YOUR_AUTH_TOKEN', 'text': 'Hey, Look what I can do!' }" @Request.Url.Scheme://@Request.Url.Host:@Request.Url.Port/widgets/welcome</div></center>
</div>
| @{
ViewBag.Title = "My Dash";
}
<div class="gridster">
<ul>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="welcome" data-view="Text" data-title="Hello" data-text="Commander!" data-moreinfo="Protip: You can drag the widgets around!"></div>
</li>
<li data-row="1" data-col="1" data-sizex="3" data-sizey="3">
<div data-id="trafficmap" data-view="Trafficmap" data-title="MY Traffic" data-lat="51.3051" data-long="6.995" data-zoom="10"></div>
</li>
@*<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="synergy" data-view="Meter" data-title="Synergy" data-min="0" data-max="100"></div>
</li>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="2">
<div data-id="buzzwords" data-view="List" data-unordered="true" data-title="Buzzwords" data-moreinfo="# of times said around the office"></div>
</li>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="valuation" data-view="Number" data-title="Current Valuation" data-moreinfo="In billions" data-prefix="$"></div>
</li>
<li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
<div data-id="convergence" data-view="Graph" data-title="Convergence" style="background-color:#ff9618"></div>
</li>*@
</ul>
<center><div style="font-size: 12px">Try this: curl -d "{ 'auth_token': 'YOUR_AUTH_TOKEN', 'text': 'Hey, Look what I can do!' }" @Request.Url.Scheme://@Request.Url.Host:@Request.Url.Port/widgets/welcome</div></center>
</div>
| mit | C# |
508f9849a3e0b667a076fcc1a762eb6ccbfe2d47 | fix for CyberTester to correctly find test cases in all subfolders | mcraveiro/Qart,avao/Qart,tudway/Qart | Src/Qart.Testing/TestSystem.cs | Src/Qart.Testing/TestSystem.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Qart.Testing
{
public class TestSystem
{
public IDataStore DataStorage { get; private set; }
public TestSystem(IDataStore dataStorage)
{
DataStorage = dataStorage;
}
public TestCase GetTestCase(string id)
{
return new TestCase(id, this);
}
public IEnumerable<TestCase> GetTestCases()
{
return GetTestCases("");
}
private IEnumerable<TestCase> GetTestCases(string groupId)
{
var testCases = new List<TestCase>();
var groups = DataStorage.GetItemGroups(groupId);
foreach (var group in groups)
{
var id = Path.Combine(groupId, group);
testCases.AddRange(GetTestCases(id));
if(IsTestCase(id))
{
testCases.Add(new TestCase(id, this));
}
}
return testCases;
}
private bool IsTestCase(string group)
{
return DataStorage.Contains(Path.Combine(group, ".test"));
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Qart.Testing
{
public class TestSystem
{
public IDataStore DataStorage { get; private set; }
public TestSystem(IDataStore dataStorage)
{
DataStorage = dataStorage;
}
public TestCase GetTestCase(string id)
{
return new TestCase(id, this);
}
public IEnumerable<TestCase> GetTestCases()
{
return GetTestCases("");
}
private IEnumerable<TestCase> GetTestCases(string groupId)
{
var testCases = new List<TestCase>();
var groups = DataStorage.GetItemGroups(groupId);
foreach (var group in groups)
{
testCases.AddRange(GetTestCases(group));
if(IsTestCase(group))
{
testCases.Add(new TestCase(group, this));
}
}
return testCases;
}
private bool IsTestCase(string group)
{
return DataStorage.Contains(Path.Combine(group, ".test"));
}
}
}
| apache-2.0 | C# |
f7fd4dea3d522261def4f73a2690505b72b82894 | Test support - verify log entries | DejanMilicic/DotCommerce | source/DotCommerce.Persistence.SqlServer.Test/Infrastructure/Support/TestSupport.cs | source/DotCommerce.Persistence.SqlServer.Test/Infrastructure/Support/TestSupport.cs |
namespace DotCommerce.Persistence.SqlServer.Test.Infrastructure.Support
{
using System.Collections.Generic;
using System.Configuration;
using global::DotCommerce.Domain;
using global::DotCommerce.Interfaces;
using global::DotCommerce.Persistence.SqlServer.Test.Infrastructure.DTO;
using Respawn;
using Shouldly;
public static class TestSupport
{
public static void AddProductToOrder(this IDotCommerceApi dc, IOrder order, Product product)
{
dc.AddItemToOrder(
order: order,
itemid: product.Id,
quantity: product.Quantity,
price: product.Price,
name: product.Name,
discount: product.Discount,
weight: product.Weight,
url: product.Url,
imageUrl: product.ImageUrl);
}
public static void SetShippingAddress(this IDotCommerceApi dc, IOrder order, Address address)
{
dc.SetShippingAddress(
order: order,
title: address.Title, firstName: address.FirstName, lastName: address.LastName, company: address.Company,
street: address.Street, streetNumber: address.StreetNumber, city: address.City, zip: address.Zip,
country: address.Country, state: address.State, province: address.Province, email: address.Email,
phone: address.Phone, singleAddress: address.SingleAddress);
}
public static void SetBillingAddress(this IDotCommerceApi dc, IOrder order, Address address)
{
dc.SetBillingAddress(
order: order,
title: address.Title, firstName: address.FirstName, lastName: address.LastName, company: address.Company,
street: address.Street, streetNumber: address.StreetNumber, city: address.City, zip: address.Zip,
country: address.Country, state: address.State, province: address.Province, email: address.Email,
phone: address.Phone, singleAddress: address.SingleAddress);
}
public static void ResetDatabase()
{
Checkpoint checkpoint = new Checkpoint
{
TablesToIgnore = new[]
{
"__MigrationHistory"
},
};
try
{
checkpoint.Reset(ConfigurationManager.ConnectionStrings["DotCommerce"].ConnectionString);
}
catch
{
// we will get exception in he case when database is not existing
}
}
public static void VerifyLogEntries(this IDotCommerceApi dc, IOrder order, List<LogAction> actions)
{
var log = dc.GetLogEntries(order.Id);
log.Count.ShouldBe(actions.Count);
for (int i = 0; i < actions.Count; i++)
{
log[i].Action.ShouldBe(actions[i]);
}
}
}
}
|
namespace DotCommerce.Persistence.SqlServer.Test.Infrastructure.Support
{
using System.Configuration;
using global::DotCommerce.Interfaces;
using global::DotCommerce.Persistence.SqlServer.Test.Infrastructure.DTO;
using Respawn;
public static class TestSupport
{
public static void AddProductToOrder(this IDotCommerceApi dc, IOrder order, Product product)
{
dc.AddItemToOrder(
order: order,
itemid: product.Id,
quantity: product.Quantity,
price: product.Price,
name: product.Name,
discount: product.Discount,
weight: product.Weight,
url: product.Url,
imageUrl: product.ImageUrl);
}
public static void SetShippingAddress(this IDotCommerceApi dc, IOrder order, Address address)
{
dc.SetShippingAddress(
order: order,
title: address.Title, firstName: address.FirstName, lastName: address.LastName, company: address.Company,
street: address.Street, streetNumber: address.StreetNumber, city: address.City, zip: address.Zip,
country: address.Country, state: address.State, province: address.Province, email: address.Email,
phone: address.Phone, singleAddress: address.SingleAddress);
}
public static void SetBillingAddress(this IDotCommerceApi dc, IOrder order, Address address)
{
dc.SetBillingAddress(
order: order,
title: address.Title, firstName: address.FirstName, lastName: address.LastName, company: address.Company,
street: address.Street, streetNumber: address.StreetNumber, city: address.City, zip: address.Zip,
country: address.Country, state: address.State, province: address.Province, email: address.Email,
phone: address.Phone, singleAddress: address.SingleAddress);
}
public static void ResetDatabase()
{
Checkpoint checkpoint = new Checkpoint
{
TablesToIgnore = new[]
{
"__MigrationHistory"
},
};
try
{
checkpoint.Reset(ConfigurationManager.ConnectionStrings["DotCommerce"].ConnectionString);
}
catch
{
// we will get exception in he case when database is not existing
}
}
}
}
| unlicense | C# |
f8efb0bf618e0c832a5cda0e8dfcf2ec4b541924 | Improve UsernameHistoryRepository. | Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW | src/MitternachtBot/Services/Database/Repositories/Impl/UsernameHistoryRepository.cs | src/MitternachtBot/Services/Database/Repositories/Impl/UsernameHistoryRepository.cs | using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Mitternacht.Services.Database.Models;
namespace Mitternacht.Services.Database.Repositories.Impl {
public class UsernameHistoryRepository : Repository<UsernameHistoryModel>, IUsernameHistoryRepository {
public UsernameHistoryRepository(DbContext context) : base(context) { }
public bool AddUsername(ulong userId, string username, ushort discriminator) {
if(!string.IsNullOrWhiteSpace(username)) {
username = username.Trim();
var current = GetUsernamesDescending(userId).FirstOrDefault();
var now = DateTime.UtcNow;
if(current != null) {
if(string.Equals(current.Name, username, StringComparison.Ordinal) && current.DiscordDiscriminator == discriminator) {
if(current.DateReplaced.HasValue) {
current.DateReplaced = null;
}
return false;
}
if(!current.DateReplaced.HasValue) {
current.DateReplaced = now;
}
}
_set.Add(new UsernameHistoryModel {
UserId = userId,
Name = username,
DiscordDiscriminator = discriminator,
DateSet = now
});
return true;
} else {
return false;
}
}
public IOrderedQueryable<UsernameHistoryModel> GetUsernamesDescending(ulong userId)
=> _set.AsQueryable().Where(u => u.UserId == userId && !(u is NicknameHistoryModel)).OrderByDescending(u => u.DateSet);
public string GetLastUsername(ulong userId)
=> GetUsernamesDescending(userId).FirstOrDefault()?.Name;
}
} | using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Mitternacht.Services.Database.Models;
using System.Linq.Expressions;
namespace Mitternacht.Services.Database.Repositories.Impl {
public class UsernameHistoryRepository : Repository<UsernameHistoryModel>, IUsernameHistoryRepository
{
public UsernameHistoryRepository(DbContext context) : base(context) { }
public bool AddUsername(ulong userId, string username, ushort discriminator) {
if (string.IsNullOrWhiteSpace(username)) return false;
username = username.Trim();
var current = GetUsernamesDescending(userId).FirstOrDefault();
var now = DateTime.UtcNow;
if (current != null)
{
if (string.Equals(current.Name, username, StringComparison.Ordinal) && current.DiscordDiscriminator == discriminator)
{
if (!current.DateReplaced.HasValue) return false;
current.DateReplaced = null;
_set.Update(current);
return false;
}
if (!current.DateReplaced.HasValue)
{
current.DateReplaced = now;
_set.Update(current);
}
}
_set.Add(new UsernameHistoryModel {
UserId = userId,
Name = username,
DiscordDiscriminator = discriminator,
DateSet = now
});
return true;
}
public IOrderedQueryable<UsernameHistoryModel> GetUsernamesDescending(ulong userId)
=> _set.Where((Expression<Func<UsernameHistoryModel, bool>>)(u => u.UserId == userId && !(u is NicknameHistoryModel))).OrderByDescending(u => u.DateSet);
public string GetLastUsername(ulong userId)
=> GetUsernamesDescending(userId).FirstOrDefault()?.Name;
}
} | mit | C# |
17a14072329e122d3aaf6428a37922a0f7acdfc4 | update logics of spam checker | qihangnet/MZBlog,qihangnet/MZBlog,qihangnet/MZBlog | MZBlog.Core/Commands/Posts/NewCommentCommand.cs | MZBlog.Core/Commands/Posts/NewCommentCommand.cs | using iBoxDB.LocalServer;
using MZBlog.Core.Documents;
using System;
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
namespace MZBlog.Core.Commands.Posts
{
public class NewCommentCommand
{
public NewCommentCommand()
{
Id = ObjectId.NewObjectId();
}
public string Id { get; set; }
public SpamShield SpamShield { get; set; }
public string PostId { get; set; }
[Required]
public string NickName { get; set; }
[Required]
[EmailAddress]
public string Email { get; set; }
public string SiteUrl { get; set; }
[Required]
[MinLength(3)]
public string Content { get; set; }
public string IPAddress { get; set; }
}
public class NewCommentCommandInvoker : ICommandInvoker<NewCommentCommand, CommandResult>
{
private readonly DB.AutoBox _db;
private readonly ISpamShieldService _spamShield;
public NewCommentCommandInvoker(DB.AutoBox db, ISpamShieldService spamShield)
{
_db = db;
_spamShield = spamShield;
}
public CommandResult Execute(NewCommentCommand command)
{
if (Regex.IsMatch(command.Email, @"smithg\d*@gmail.com") || _spamShield.IsSpam(command.SpamShield))
{
return new CommandResult("You are a spam!");
}
var comment = new BlogComment
{
Id = command.Id,
Email = command.Email,
NickName = command.NickName,
Content = command.Content,
IPAddress = command.IPAddress,
PostId = command.PostId,
SiteUrl = command.SiteUrl,
CreatedTime = DateTime.UtcNow
};
var result = _db.Insert(DBTableNames.BlogComments, comment);
return CommandResult.SuccessResult;
}
}
} | using iBoxDB.LocalServer;
using MZBlog.Core.Documents;
using System;
using System.ComponentModel.DataAnnotations;
namespace MZBlog.Core.Commands.Posts
{
public class NewCommentCommand
{
public NewCommentCommand()
{
Id = ObjectId.NewObjectId();
}
public string Id { get; set; }
public SpamShield SpamShield { get; set; }
public string PostId { get; set; }
[Required]
public string NickName { get; set; }
[Required]
[EmailAddress]
public string Email { get; set; }
public string SiteUrl { get; set; }
[Required]
[MinLength(3)]
public string Content { get; set; }
public string IPAddress { get; set; }
}
public class NewCommentCommandInvoker : ICommandInvoker<NewCommentCommand, CommandResult>
{
private readonly DB.AutoBox _db;
private readonly ISpamShieldService _spamShield;
public NewCommentCommandInvoker(DB.AutoBox db, ISpamShieldService spamShield)
{
_db = db;
_spamShield = spamShield;
}
public CommandResult Execute(NewCommentCommand command)
{
if (_spamShield.IsSpam(command.SpamShield))
{
return new CommandResult("You are a spam!");
}
var comment = new BlogComment
{
Id = command.Id,
Email = command.Email,
NickName = command.NickName,
Content = command.Content,
IPAddress = command.IPAddress,
PostId = command.PostId,
SiteUrl = command.SiteUrl,
CreatedTime = DateTime.UtcNow
};
var result = _db.Insert(DBTableNames.BlogComments, comment);
return CommandResult.SuccessResult;
}
}
} | mit | C# |
0fe3e79498552589651f8d1e110a74883b10de19 | add missing properties on user model | Odonno/gitter-api-pcl | GitterSharp/GitterSharp.Model/User.cs | GitterSharp/GitterSharp.Model/User.cs | using Newtonsoft.Json;
using System.Collections.Generic;
namespace GitterSharp.Model
{
public class User
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("username")]
public string Username { get; set; }
[JsonProperty("displayName")]
public string DisplayName { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("avatarUrlSmall")]
public string SmallAvatarUrl { get; set; }
[JsonProperty("avatarUrlMedium")]
public string MediumAvatarUrl { get; set; }
[JsonProperty("providers")]
public IEnumerable<string> Providers { get; set; }
[JsonProperty("v")]
public int Version { get; set; }
[JsonProperty("gv")]
public string GravatarVersion { get; set; }
[JsonIgnore]
public string GitHubUrl { get { return $"https://github.com{Url}"; } }
}
}
| using Newtonsoft.Json;
namespace GitterSharp.Model
{
public class User
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("username")]
public string Username { get; set; }
[JsonProperty("displayName")]
public string DisplayName { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("avatarUrlSmall")]
public string SmallAvatarUrl { get; set; }
[JsonProperty("avatarUrlMedium")]
public string MediumAvatarUrl { get; set; }
[JsonIgnore]
public string GitHubUrl { get { return $"https://github.com{Url}"; } }
}
}
| apache-2.0 | C# |
e08b65fbd6014a7b6b970bd2558a4cd073bda151 | Fix FindStream function | protyposis/Aurio,protyposis/Aurio | AudioAlign/AudioAlign.Audio/Streams/StreamExtensions.cs | AudioAlign/AudioAlign.Audio/Streams/StreamExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace AudioAlign.Audio.Streams {
public static class StreamExtensions {
/// <summary>
/// Searches for a stream of a given type in a hierarchy of nested streams.
/// </summary>
/// <typeparam name="T">the type of the stream to search for</typeparam>
/// <param name="stream">a stream that may envelop a hierarchy of streams</param>
/// <returns>the stream of the given type if found, else null</returns>
public static T FindStream<T>(this IAudioStream stream) {
FieldInfo fieldInfo = typeof(AbstractAudioStreamWrapper)
.GetField("sourceStream", BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
while (true) {
if (stream is T) {
return (T)stream;
}
else if (stream is AbstractAudioStreamWrapper) {
stream = (IAudioStream)fieldInfo.GetValue(stream);
}
else {
return default(T);
}
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace AudioAlign.Audio.Streams {
public static class StreamExtensions {
/// <summary>
/// Searches for a stream of a given type in a hierarchy of nested streams.
/// </summary>
/// <typeparam name="T">the type of the stream to search for</typeparam>
/// <param name="stream">a stream that may envelop a hierarchy of streams</param>
/// <returns>the stream of the given type if found, else null</returns>
public static T FindStream<T>(this IAudioStream stream) {
FieldInfo fieldInfo = typeof(AbstractAudioStreamWrapper)
.GetField("sourceStream", System.Reflection.BindingFlags.NonPublic);
while (true) {
if (stream is T) {
return (T)stream;
}
else if (stream is AbstractAudioStreamWrapper) {
stream = (IAudioStream)fieldInfo.GetValue(stream);
}
else {
return default(T);
}
}
}
}
}
| agpl-3.0 | C# |
dbf8020f1343d5b77a96b2d408a4c9abfd50852d | remove use of USE_GENERICS in PArray.cs | ingted/volante,ingted/volante,kjk/volante-obsolete,kjk/volante-obsolete,kjk/volante-obsolete,ingted/volante,kjk/volante-obsolete,ingted/volante | csharp/src/PArray.cs | csharp/src/PArray.cs | namespace NachoDB
{
using System;
/// <summary>
/// Common interface for all PArrays
/// </summary>
public interface GenericPArray
{
/// <summary> Get number of the array elements
/// </summary>
/// <returns>the number of related objects
///
/// </returns>
int Size();
/// <summary> Get OID of array element.
/// </summary>
/// <param name="i">index of the object in the relation
/// </param>
/// <returns>OID of the object (0 if array contains <code>null</code> reference)
/// </returns>
int GetOid(int i);
/// <summary>
/// Set owner objeet for this PArray. Owner is persistent object contaning this PArray.
/// This method is mostly used by storage itself, but can also used explicityl by programmer if
/// Parray component of one persistent object is assigned to component of another persistent object
/// </summary>
/// <param name="owner">link owner</param>
void SetOwner(IPersistent owner);
}
/// <summary>Dynamically extended array of reference to persistent objects.
/// It is inteded to be used in classes using virtual properties to
/// access components of persistent objects. You can not use standard
/// C# array here, instead you should use PArray class.
/// PArray is created by Storage.createArray method
/// </summary>
public interface PArray<T> : GenericPArray, Link<T> where T:class,IPersistent
{
}
} | namespace NachoDB
{
using System;
/// <summary>
/// Common interface for all PArrays
/// </summary>
public interface GenericPArray
{
/// <summary> Get number of the array elements
/// </summary>
/// <returns>the number of related objects
///
/// </returns>
int Size();
/// <summary> Get OID of array element.
/// </summary>
/// <param name="i">index of the object in the relation
/// </param>
/// <returns>OID of the object (0 if array contains <code>null</code> reference)
/// </returns>
int GetOid(int i);
/// <summary>
/// Set owner objeet for this PArray. Owner is persistent object contaning this PArray.
/// This method is mostly used by storage itself, but can also used explicityl by programmer if
/// Parray component of one persistent object is assigned to component of another persistent object
/// </summary>
/// <param name="owner">link owner</param>
void SetOwner(IPersistent owner);
}
/// <summary>Dynamically extended array of reference to persistent objects.
/// It is inteded to be used in classes using virtual properties to
/// access components of persistent objects. You can not use standard
/// C# array here, instead you should use PArray class.
/// PArray is created by Storage.createArray method
/// </summary>
#if USE_GENERICS
public interface PArray<T> : GenericPArray, Link<T> where T:class,IPersistent
#else
public interface PArray : GenericPArray, Link
#endif
{
}
} | mit | C# |
fe383230c73ba0b74ea6ad7ac7c89792d008f204 | Update MessageFailedHandler.cs | yuxuac/docs.particular.net,eclaus/docs.particular.net,pedroreys/docs.particular.net,pashute/docs.particular.net,WojcikMike/docs.particular.net | Snippets/Snippets_5/Monitoring/MessageFailedHandler.cs | Snippets/Snippets_5/Monitoring/MessageFailedHandler.cs | namespace MonitoringNotifications.ServiceControl.Notifications
{
using System;
using global::ServiceControl.Contracts;
using NServiceBus;
#region MessageFailedHandler
internal class MessageFailedHandler : IHandleMessages<MessageFailed>
{
public void Handle(MessageFailed message)
{
var failedMessageId = message.FailedMessageId;
var exceptionMessage = message.FailureDetails.Exception.Message;
using (var client = new HipchatClient())
{
var chatMessage = string.Format("Message with id: {0} failed with reason: '{1}' Open in ServiceInsight: {2}",
failedMessageId,
exceptionMessage,
GetServiceInsightUri(failedMessageId));
client.PostChatMessage(chatMessage);
}
}
#endregion
private string GetServiceInsightUri(string failedMessageId)
{
//si://localhost:33333/api?Search=26f7b1dc-4ff1-4341-ada4-a3ae01057403
return string.Format("si://localhost:33333/api?Search={0}", failedMessageId);
}
}
class HipchatClient : IDisposable
{
public void Dispose()
{
throw new NotImplementedException();
}
public void PostChatMessage(string chatMessage)
{
throw new NotImplementedException();
}
}
}
| namespace MonitoringNotifications.ServiceControl.Notifications
{
using System;
using global::ServiceControl.Contracts;
using NServiceBus;
#region MessageFailedHandler 5.0
internal class MessageFailedHandler : IHandleMessages<MessageFailed>
{
public void Handle(MessageFailed message)
{
var failedMessageId = message.FailedMessageId;
var exceptionMessage = message.FailureDetails.Exception.Message;
using (var client = new HipchatClient())
{
var chatMessage = string.Format("Message with id: {0} failed with reason: '{1}' Open in ServiceInsight: {2}",
failedMessageId,
exceptionMessage,
GetServiceInsightUri(failedMessageId));
client.PostChatMessage(chatMessage);
}
}
#endregion
private string GetServiceInsightUri(string failedMessageId)
{
//si://localhost:33333/api?Search=26f7b1dc-4ff1-4341-ada4-a3ae01057403
return string.Format("si://localhost:33333/api?Search={0}", failedMessageId);
}
}
class HipchatClient : IDisposable
{
public void Dispose()
{
throw new NotImplementedException();
}
public void PostChatMessage(string chatMessage)
{
throw new NotImplementedException();
}
}
} | apache-2.0 | C# |
cda6a58f7d6c45ebef8eb970952983f02c21902c | Update src/Avalonia.Controls/Notifications/Notification.cs | wieslawsoltes/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,akrisiun/Perspex,grokys/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia | src/Avalonia.Controls/Notifications/Notification.cs | src/Avalonia.Controls/Notifications/Notification.cs | // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
namespace Avalonia.Controls.Notifications
{
/// <summary>
/// Implements the INotification interfaces.
/// Can be displayed by both <see cref="INotificationManager"/> and <see cref="IManagedNotificationManager"/>
/// </summary>
/// <remarks>
/// This class represents a notification that can be displayed either in a window using
/// <see cref="WindowNotificationManager"/> or by the host operating system (to be implemented).
/// </remarks>
public class Notification : INotification
{
/// <summary>
/// Initializes a new instance of the <see cref="Notification"/> class.
/// </summary>
/// <param name="title">The title of the notification.</param>
/// <param name="message">The message to be displayed in the notification.</param>
/// <param name="type">The <see cref="NotificationType"/> of the notification.</param>
/// <param name="expiration">The expiry time at which the notification will close.
/// Use <see cref="TimeSpan.Zero"/> for notifications that will remain open.</param>
/// <param name="onClick">The Action to call when the notification is clicked.</param>
/// <param name="onClose">The Action to call when the notification is closed.</param>
public Notification(string title,
string message,
NotificationType type = NotificationType.Information,
TimeSpan? expiration = null,
Action onClick = null,
Action onClose = null)
{
Title = title;
Message = message;
Type = type;
Expiration = expiration.HasValue ? expiration.Value : TimeSpan.FromSeconds(5);
OnClick = onClick;
OnClose = onClose;
}
/// <inheritdoc/>
public string Title { get; private set; }
/// <inheritdoc/>
public string Message { get; private set; }
/// <inheritdoc/>
public NotificationType Type { get; private set; }
/// <inheritdoc/>
public TimeSpan Expiration { get; private set; }
/// <inheritdoc/>
public Action OnClick { get; private set; }
/// <inheritdoc/>
public Action OnClose { get; private set; }
}
}
| // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
namespace Avalonia.Controls.Notifications
{
/// <summary>
/// Implements the INotification interfaces.
/// Can be displayed by both <see cref="INotificationManager"/> and <see cref="IManagedNotificationManager"/>
/// </summary>
/// <remarks>
/// This notification content type is compatible with native notifications.
/// </remarks>
public class Notification : INotification
{
/// <summary>
/// Initializes a new instance of the <see cref="Notification"/> class.
/// </summary>
/// <param name="title">The title of the notification.</param>
/// <param name="message">The message to be displayed in the notification.</param>
/// <param name="type">The <see cref="NotificationType"/> of the notification.</param>
/// <param name="expiration">The expiry time at which the notification will close.
/// Use <see cref="TimeSpan.Zero"/> for notifications that will remain open.</param>
/// <param name="onClick">The Action to call when the notification is clicked.</param>
/// <param name="onClose">The Action to call when the notification is closed.</param>
public Notification(string title,
string message,
NotificationType type = NotificationType.Information,
TimeSpan? expiration = null,
Action onClick = null,
Action onClose = null)
{
Title = title;
Message = message;
Type = type;
Expiration = expiration.HasValue ? expiration.Value : TimeSpan.FromSeconds(5);
OnClick = onClick;
OnClose = onClose;
}
/// <inheritdoc/>
public string Title { get; private set; }
/// <inheritdoc/>
public string Message { get; private set; }
/// <inheritdoc/>
public NotificationType Type { get; private set; }
/// <inheritdoc/>
public TimeSpan Expiration { get; private set; }
/// <inheritdoc/>
public Action OnClick { get; private set; }
/// <inheritdoc/>
public Action OnClose { get; private set; }
}
}
| mit | C# |
a7d8925f2fddc374afc64046690fe04f43a08a85 | Store common parameters in an object for NumericField | jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode | Drums/VDrumExplorer.Model/Schema/Fields/NumericField.cs | Drums/VDrumExplorer.Model/Schema/Fields/NumericField.cs | // Copyright 2019 Jon Skeet. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using VDrumExplorer.Model.Schema.Physical;
namespace VDrumExplorer.Model.Schema.Fields
{
/// <summary>
/// A field that is normally displayed as a number, with some optional scaling, offseting etc.
/// </summary>
public sealed class NumericField : NumericFieldBase
{
private readonly NumericFieldParameters numericFieldParameters;
/// <summary>
/// Some fields have a single "special" value (e.g. "Off", or "-INF").
/// If this property is non-null, it provides the raw value and appropriate text.
/// </summary>
public (int value, string text)? CustomValueFormatting => numericFieldParameters.CustomValueFormatting;
public string? OffLabel => numericFieldParameters.OffLabel;
public int? Divisor => numericFieldParameters.Divisor;
public int? Multiplier => numericFieldParameters.Multiplier;
public int? ValueOffset => numericFieldParameters.ValueOffset;
public string? Suffix => numericFieldParameters.Suffix;
private NumericField(FieldContainer? parent, FieldParameters common, int min, int max, int @default, NumericFieldParameters numericFieldParameters)
: base(parent, common, min, max, @default) =>
this.numericFieldParameters = numericFieldParameters;
internal NumericField(FieldContainer? parent, FieldParameters common, int min, int max, int @default,
int? divisor, int? multiplier, int? valueOffset, string? suffix, (int value, string text)? customValueFormatting)
: this(parent, common, min, max, @default, new NumericFieldParameters(divisor, multiplier, valueOffset, suffix, customValueFormatting))
{
}
internal override FieldBase WithParent(FieldContainer parent) =>
new NumericField(parent, Parameters, Min, Max, Default, numericFieldParameters);
private class NumericFieldParameters
{
public (int value, string text)? CustomValueFormatting { get; }
public string? OffLabel { get; }
public int? Divisor { get; }
public int? Multiplier { get; }
public int? ValueOffset { get; }
public string? Suffix { get; }
internal NumericFieldParameters (int? divisor, int? multiplier, int? valueOffset, string? suffix, (int value, string text)? customValueFormatting) =>
(Divisor, Multiplier, ValueOffset, Suffix, CustomValueFormatting) =
(divisor, multiplier, valueOffset, suffix, customValueFormatting);
}
}
}
| // Copyright 2019 Jon Skeet. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using VDrumExplorer.Model.Schema.Physical;
namespace VDrumExplorer.Model.Schema.Fields
{
/// <summary>
/// A field that is normally displayed as a number, with some optional scaling, offseting etc.
/// </summary>
public sealed class NumericField : NumericFieldBase
{
/// <summary>
/// Some fields have a single "special" value (e.g. "Off", or "-INF").
/// If this property is non-null, it provides the raw value and appropriate text.
/// </summary>
public (int value, string text)? CustomValueFormatting { get; }
public string? OffLabel { get; }
public int? Divisor { get; }
public int? Multiplier { get; }
public int? ValueOffset { get; }
public string? Suffix { get; }
internal NumericField(FieldContainer? parent, FieldParameters common, int min, int max, int @default,
int? divisor, int? multiplier, int? valueOffset, string? suffix, (int value, string text)? customValueFormatting)
: base(parent, common, min, max, @default) =>
(Divisor, Multiplier, ValueOffset, Suffix, CustomValueFormatting) =
(divisor, multiplier, valueOffset, suffix, customValueFormatting);
internal override FieldBase WithParent(FieldContainer parent) =>
new NumericField(parent, Parameters, Min, Max, Default, Divisor, Multiplier, ValueOffset, Suffix, CustomValueFormatting);
}
}
| apache-2.0 | C# |
a64be42f39274195d02168befc1174445f4f6031 | Update AssemblyInfo.cs | qianlifeng/Wox,Wox-launcher/Wox,qianlifeng/Wox,lances101/Wox,lances101/Wox,Wox-launcher/Wox,qianlifeng/Wox | Wox/Properties/AssemblyInfo.cs | Wox/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Wox")]
[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Wox")]
[assembly: AssemblyCopyright("The MIT License (MIT)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
)]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Wox")]
[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Wox")]
[assembly: AssemblyCopyright("The MIT License (MIT)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
//若要开始生成可本地化的应用程序,请在
//<PropertyGroup> 中的 .csproj 文件中
//设置 <UICulture>CultureYouAreCodingWith</UICulture>。例如,如果您在源文件中
//使用的是美国英语,请将 <UICulture> 设置为 en-US。然后取消
//对以下 NeutralResourceLanguage 特性的注释。更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(在页面或应用程序资源词典中
// 未找到某个资源的情况下使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(在页面、应用程序或任何主题特定资源词典中
// 未找到某个资源的情况下使用)
)]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] | mit | C# |
4d33ba1ab41415eff5d1bc82142f3fc8924c662d | Update FormatRanges2.cs | maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET | Examples/CSharp/Data/AddOn/NamedRanges/FormatRanges2.cs | Examples/CSharp/Data/AddOn/NamedRanges/FormatRanges2.cs | using System.IO;
using Aspose.Cells;
using System.Drawing;
namespace Aspose.Cells.Examples.Data.AddOn.NamedRanges
{
public class FormatRanges2
{
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();
//Clears the worksheets
workbook.Worksheets.Clear();
//Adding a new worksheet to the Workbook object
workbook.Worksheets.Add();
//Obtaining the reference of the newly added 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("Hello World From Aspose");
//Creating a range of cells starting from "A1" cell to 3rd column in a row
Range range = worksheet.Cells.CreateRange(0, 0, 1, 3);
//Adding a thick top border with blue line
range.SetOutlineBorder(BorderType.TopBorder, CellBorderType.Thick, Color.Blue);
//Adding a thick bottom border with blue line
range.SetOutlineBorder(BorderType.BottomBorder, CellBorderType.Thick, Color.Blue);
//Adding a thick left border with blue line
range.SetOutlineBorder(BorderType.LeftBorder, CellBorderType.Thick, Color.Blue);
//Adding a thick right border with blue line
range.SetOutlineBorder(BorderType.RightBorder, CellBorderType.Thick, 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.Data.AddOn.NamedRanges
{
public class FormatRanges2
{
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();
//Clears the worksheets
workbook.Worksheets.Clear();
//Adding a new worksheet to the Workbook object
workbook.Worksheets.Add();
//Obtaining the reference of the newly added 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("Hello World From Aspose");
//Creating a range of cells starting from "A1" cell to 3rd column in a row
Range range = worksheet.Cells.CreateRange(0, 0, 1, 3);
//Adding a thick top border with blue line
range.SetOutlineBorder(BorderType.TopBorder, CellBorderType.Thick, Color.Blue);
//Adding a thick bottom border with blue line
range.SetOutlineBorder(BorderType.BottomBorder, CellBorderType.Thick, Color.Blue);
//Adding a thick left border with blue line
range.SetOutlineBorder(BorderType.LeftBorder, CellBorderType.Thick, Color.Blue);
//Adding a thick right border with blue line
range.SetOutlineBorder(BorderType.RightBorder, CellBorderType.Thick, Color.Blue);
//Saving the Excel file
workbook.Save(dataDir + "book1.out.xls");
}
}
} | mit | C# |
007357c9020be71f07180391006170b7e97eeb7c | Include example of changing sql string. | majorsilence/My-FyiReporting,daniellor/My-FyiReporting,majorsilence/My-FyiReporting,maratoss/My-FyiReporting,chripf/My-FyiReporting,maratoss/My-FyiReporting,daniellor/My-FyiReporting,chripf/My-FyiReporting,chripf/My-FyiReporting,maratoss/My-FyiReporting,maratoss/My-FyiReporting,daniellor/My-FyiReporting,daniellor/My-FyiReporting,maratoss/My-FyiReporting,chripf/My-FyiReporting,majorsilence/My-FyiReporting,majorsilence/My-FyiReporting,majorsilence/My-FyiReporting,majorsilence/My-FyiReporting,chripf/My-FyiReporting,majorsilence/My-FyiReporting,chripf/My-FyiReporting,daniellor/My-FyiReporting,chripf/My-FyiReporting,daniellor/My-FyiReporting,maratoss/My-FyiReporting,maratoss/My-FyiReporting,daniellor/My-FyiReporting | Examples/SampleApp2-SetData/SampleApp2-SetData/Form1.cs | Examples/SampleApp2-SetData/SampleApp2-SetData/Form1.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SQLite;
namespace SampleApp2_SetData
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
// TODO: You must change this connection string to match where your database is
string connectionString = @"Data Source=C:\Users\Peter\Projects\My-FyiReporting\Examples\northwindEF.db;Version=3;Pooling=True;Max Pool Size=100;";
SQLiteConnection cn = new SQLiteConnection(connectionString);
SQLiteCommand cmd = new SQLiteCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT CategoryID, CategoryName, Description FROM Categories;";
cmd.Connection = cn;
DataTable dt = GetTable(cmd);
string filepath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory() , "SampleApp2-TestReport.rdl");
rdlViewer1.SourceFile = new Uri(filepath);
rdlViewer1.Report.DataSets["Data"].SetData(dt);
//rdlViewer1.Report.DataSets["Data"].SetSource("SELECT CategoryID, CategoryName, Description FROM Categories where CategoryName = 'SeaFood'");
rdlViewer1.Rebuild();
}
public DataTable GetTable(SQLiteCommand cmd)
{
System.Data.ConnectionState original = cmd.Connection.State;
if (cmd.Connection.State == ConnectionState.Closed)
{
cmd.Connection.Open();
}
DataTable dt = new DataTable();
SQLiteDataReader dr;
dr = cmd.ExecuteReader();
dt.Load(dr);
dr.Close();
dr.Dispose();
if (original == ConnectionState.Closed)
{
cmd.Connection.Clone();
}
return dt;
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SQLite;
namespace SampleApp2_SetData
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
// TODO: You must change this connection string to match where your database is
string connectionString = @"Data Source=C:\Users\Peter\Projects\My-FyiReporting\Examples\northwindEF.db;Version=3;Pooling=True;Max Pool Size=100;";
SQLiteConnection cn = new SQLiteConnection(connectionString);
SQLiteCommand cmd = new SQLiteCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT CategoryID, CategoryName, Description FROM Categories;";
cmd.Connection = cn;
DataTable dt = GetTable(cmd);
string filepath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory() , "SampleApp2-TestReport.rdl");
rdlViewer1.SourceFile = new Uri(filepath);
rdlViewer1.Report.DataSets["Data"].SetData(dt);
rdlViewer1.Rebuild();
}
public DataTable GetTable(SQLiteCommand cmd)
{
System.Data.ConnectionState original = cmd.Connection.State;
if (cmd.Connection.State == ConnectionState.Closed)
{
cmd.Connection.Open();
}
DataTable dt = new DataTable();
SQLiteDataReader dr;
dr = cmd.ExecuteReader();
dt.Load(dr);
dr.Close();
dr.Dispose();
if (original == ConnectionState.Closed)
{
cmd.Connection.Clone();
}
return dt;
}
}
}
| apache-2.0 | C# |
2d96be7108f7cdc94b2d724eb442418f63b3dc33 | Fix build warning | gafter/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,davkean/roslyn,ErikSchierboom/roslyn,tannergooding/roslyn,bartdesmet/roslyn,dotnet/roslyn,panopticoncentral/roslyn,wvdd007/roslyn,brettfo/roslyn,physhi/roslyn,tmat/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,jmarolf/roslyn,mgoertz-msft/roslyn,reaction1989/roslyn,KirillOsenkov/roslyn,physhi/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,AlekseyTs/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,genlu/roslyn,stephentoub/roslyn,eriawan/roslyn,brettfo/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,eriawan/roslyn,reaction1989/roslyn,diryboy/roslyn,sharwell/roslyn,genlu/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,reaction1989/roslyn,aelij/roslyn,KevinRansom/roslyn,jmarolf/roslyn,AmadeusW/roslyn,diryboy/roslyn,dotnet/roslyn,stephentoub/roslyn,mgoertz-msft/roslyn,aelij/roslyn,tmat/roslyn,KevinRansom/roslyn,tmat/roslyn,gafter/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,eriawan/roslyn,jmarolf/roslyn,heejaechang/roslyn,physhi/roslyn,gafter/roslyn,AmadeusW/roslyn,tannergooding/roslyn,brettfo/roslyn,wvdd007/roslyn,ErikSchierboom/roslyn,AmadeusW/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,tannergooding/roslyn,davkean/roslyn,diryboy/roslyn,heejaechang/roslyn,bartdesmet/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,panopticoncentral/roslyn,AlekseyTs/roslyn,KirillOsenkov/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,mavasani/roslyn,davkean/roslyn,genlu/roslyn,aelij/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,mgoertz-msft/roslyn,sharwell/roslyn,dotnet/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn | src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/SyntaxGeneratorInternalExtensions/SyntaxGeneratorInternal.cs | src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/SyntaxGeneratorInternalExtensions/SyntaxGeneratorInternal.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 Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.LanguageServices;
namespace Microsoft.CodeAnalysis.Editing
{
/// <summary>
/// Internal extensions to <see cref="SyntaxGenerator"/>.
///
/// This interface is available in the shared CodeStyle and Workspaces layer to allow
/// sharing internal generator methods between them. Once the methods are ready to be
/// made public APIs, they can be moved to <see cref="SyntaxGenerator"/>.
/// </summary>
internal abstract class SyntaxGeneratorInternal : ILanguageService
{
internal abstract ISyntaxFacts SyntaxFacts { get; }
/// <summary>
/// Creates a statement that declares a single local variable with an optional initializer.
/// </summary>
internal abstract SyntaxNode LocalDeclarationStatement(
SyntaxNode type, SyntaxToken identifier, SyntaxNode initializer = null, bool isConst = false);
/// <summary>
/// Creates a statement that declares a single local variable.
/// </summary>
internal SyntaxNode LocalDeclarationStatement(SyntaxToken name, SyntaxNode initializer)
=> LocalDeclarationStatement(null, name, initializer);
internal abstract SyntaxNode WithInitializer(SyntaxNode variableDeclarator, SyntaxNode initializer);
internal abstract SyntaxNode EqualsValueClause(SyntaxToken operatorToken, SyntaxNode value);
internal abstract SyntaxToken Identifier(string identifier);
internal abstract SyntaxNode ConditionalAccessExpression(SyntaxNode expression, SyntaxNode whenNotNull);
internal abstract SyntaxNode MemberBindingExpression(SyntaxNode name);
internal abstract SyntaxNode RefExpression(SyntaxNode expression);
/// <summary>
/// Wraps with parens.
/// </summary>
internal abstract SyntaxNode AddParentheses(SyntaxNode expression, bool includeElasticTrivia = true, bool addSimplifierAnnotation = true);
/// <summary>
/// Creates a statement that can be used to yield a value from an iterator method.
/// </summary>
/// <param name="expression">An expression that can be yielded.</param>
internal abstract SyntaxNode YieldReturnStatement(SyntaxNode expression);
/// <summary>
/// <see langword="true"/> if the language requires a "TypeExpression"
/// (including <see langword="var"/>) to be stated when making a
/// <see cref="LocalDeclarationStatement(SyntaxNode, SyntaxToken, SyntaxNode, bool)"/>.
/// <see langword="false"/> if the language allows the type node to be entirely elided.
/// </summary>
internal abstract bool RequiresLocalDeclarationType();
}
}
| // 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 Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.LanguageServices;
namespace Microsoft.CodeAnalysis.Editing
{
/// <summary>
/// Internal extensions to <see cref="SyntaxGenerator"/>.
///
/// This interface is available in the shared CodeStyle and Workspaces layer to allow
/// sharing internal generator methods between them. Once the methods are ready to be
/// made public APIs, they can be moved to <see cref="SyntaxGenerator"/>.
/// </summary>
internal abstract class SyntaxGeneratorInternal : ILanguageService
{
internal abstract ISyntaxFacts SyntaxFacts { get; }
/// <summary>
/// Creates a statement that declares a single local variable with an optional initializer.
/// </summary>
internal abstract SyntaxNode LocalDeclarationStatement(
SyntaxNode type, SyntaxToken identifier, SyntaxNode initializer = null, bool isConst = false);
/// <summary>
/// Creates a statement that declares a single local variable.
/// </summary>
internal SyntaxNode LocalDeclarationStatement(SyntaxToken name, SyntaxNode initializer)
=> LocalDeclarationStatement(null, name, initializer);
internal abstract SyntaxNode WithInitializer(SyntaxNode variableDeclarator, SyntaxNode initializer);
internal abstract SyntaxNode EqualsValueClause(SyntaxToken operatorToken, SyntaxNode value);
internal abstract SyntaxToken Identifier(string identifier);
internal abstract SyntaxNode ConditionalAccessExpression(SyntaxNode expression, SyntaxNode whenNotNull);
internal abstract SyntaxNode MemberBindingExpression(SyntaxNode name);
internal abstract SyntaxNode RefExpression(SyntaxNode expression);
/// <summary>
/// Wraps with parens.
/// </summary>
internal abstract SyntaxNode AddParentheses(SyntaxNode expression, bool includeElasticTrivia = true, bool addSimplifierAnnotation = true);
/// <summary>
/// Creates a statement that can be used to yield a value from an iterator method.
/// </summary>
/// <param name="expression">An expression that can be yielded.</param>
internal abstract SyntaxNode YieldReturnStatement(SyntaxNode expression);
/// <summary>
/// <see langword="true"/> if the language requires a <see cref="TypeExpression(ITypeSymbol)"/>
/// (including <see langword="var"/>) to be stated when making a
/// <see cref="LocalDeclarationStatement(ITypeSymbol, string, SyntaxNode, bool)"/>.
/// <see langword="false"/> if the language allows the type node to be entirely elided.
/// </summary>
internal abstract bool RequiresLocalDeclarationType();
}
}
| mit | C# |
45b873e2fdc3685a48e8ffe10e662e44e3cde949 | Make HttpClientExtentions.SendAsync<T> obsolete | sahb1239/SAHB.GraphQLClient | src/SAHB.GraphQLClient/Http/HttpClientExtentions.cs | src/SAHB.GraphQLClient/Http/HttpClientExtentions.cs | using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace SAHB.GraphQLClient.Http
{
public static class HttpClientExtentions
{
[Obsolete]
public static Task<HttpResponseMessage> SendAsync<T>(this IHttpClient client, HttpMethod method, string url, string authorizationToken = null, string authorizationMethod = "Bearer")
{
return client.SendAsync(() =>
{
var requestMessage = new HttpRequestMessage(method, url);
if (authorizationToken != null)
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(authorizationMethod, authorizationToken);
}
return requestMessage;
});
}
public static Task<HttpResponseMessage> SendItemAsync(this IHttpClient client, HttpMethod method, string url, string item,
string authorizationToken = null, string authorizationMethod = "Bearer")
{
return client.SendAsync(() =>
{
var requestMessage = new HttpRequestMessage(method, url)
{
Content = new StringContent(item, System.Text.Encoding.UTF8, "application/json")
};
if (authorizationToken != null)
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(authorizationMethod, authorizationToken);
}
return requestMessage;
});
}
}
} | using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace SAHB.GraphQLClient.Http
{
public static class HttpClientExtentions
{
public static Task<HttpResponseMessage> SendAsync<T>(this IHttpClient client, HttpMethod method, string url, string authorizationToken = null, string authorizationMethod = "Bearer")
{
return client.SendAsync(() =>
{
var requestMessage = new HttpRequestMessage(method, url);
if (authorizationToken != null)
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(authorizationMethod, authorizationToken);
}
return requestMessage;
});
}
public static Task<HttpResponseMessage> SendItemAsync(this IHttpClient client, HttpMethod method, string url, string item,
string authorizationToken = null, string authorizationMethod = "Bearer")
{
return client.SendAsync(() =>
{
var requestMessage = new HttpRequestMessage(method, url)
{
Content = new StringContent(item, System.Text.Encoding.UTF8, "application/json")
};
if (authorizationToken != null)
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(authorizationMethod, authorizationToken);
}
return requestMessage;
});
}
}
} | mit | C# |
82996ee40ae31d7049110fcdb59d6f9da3aef4cd | Update GetDataConnection.cs | 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,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET | Examples/CSharp/Articles/GetDataConnection.cs | Examples/CSharp/Articles/GetDataConnection.cs | using System;
using Aspose.Cells;
using Aspose.Cells.ExternalConnections;
namespace Aspose.Cells.Examples.Articles
{
class GetDataConnection
{
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);
Workbook workbook = new Workbook(dataDir + "WebQuerySample.xlsx");
ExternalConnection connection = workbook.DataConnections[0];
if (connection is WebQueryConnection)
{
WebQueryConnection webQuery = (WebQueryConnection)connection;
Console.WriteLine("Web Query URL: " + webQuery.Url);
}
}
//ExEnd:1
}
}
| using System;
using Aspose.Cells;
using Aspose.Cells.ExternalConnections;
namespace Aspose.Cells.Examples.Articles
{
class GetDataConnection
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
Workbook workbook = new Workbook(dataDir + "WebQuerySample.xlsx");
ExternalConnection connection = workbook.DataConnections[0];
if (connection is WebQueryConnection)
{
WebQueryConnection webQuery = (WebQueryConnection)connection;
Console.WriteLine("Web Query URL: " + webQuery.Url);
}
}
}
}
| mit | C# |
a4d66005779554a214f474282fc62ef3387a023b | Implement Trace | chkn/Tempest | iOS/Tempest/TraceSwitch.cs | iOS/Tempest/TraceSwitch.cs | //
// TraceSwitch.cs
//
// Author:
// Eric Maupin <me@ermau.com>
//
// Copyright (c) 2013 Eric Maupin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Diagnostics;
namespace Tempest
{
class TraceSwitch
{
public TraceSwitch (string foo, string bar)
{
}
public bool TraceVerbose
{
get { return false; }
}
public bool TraceWarning
{
get { return false; }
}
public bool TraceError
{
get { return false; }
}
}
class Trace
{
[Conditional ("TRACE")]
public static void WriteLineIf (bool condition, string message)
{
if (!condition)
return;
WriteLine (message);
}
[Conditional ("TRACE")]
public static void WriteLineIf (bool condition, string message, string category)
{
if (!condition)
return;
WriteLine (category, message);
}
[Conditional ("TRACE")]
public static void WriteLine (string message)
{
Console.WriteLine (message);
}
[Conditional ("TRACE")]
public static void WriteLine (string message, string category)
{
Console.WriteLine ("[{0}] {1}", category, message);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tempest
{
class TraceSwitch
{
public TraceSwitch (string foo, string bar)
{
}
public bool TraceVerbose
{
get { return false; }
}
public bool TraceWarning
{
get { return false; }
}
public bool TraceError
{
get { return false; }
}
}
class Trace
{
public static void WriteLineIf (bool condition, string message)
{
}
public static void WriteLineIf (bool condition, string message, string category)
{
}
}
}
| mit | C# |
ea385e20aa051d080aec21a69c797e9ecac55964 | Use a mutex to guard cert creation on windows (#11546) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Servers/Kestrel/shared/test/TestResources.cs | src/Servers/Kestrel/shared/test/TestResources.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using Xunit;
namespace Microsoft.AspNetCore.Testing
{
public static class TestResources
{
private static readonly string _baseDir = Path.Combine(Directory.GetCurrentDirectory(), "shared", "TestCertificates");
public static string TestCertificatePath { get; } = Path.Combine(_baseDir, "testCert.pfx");
public static string GetCertPath(string name) => Path.Combine(_baseDir, name);
private const int MutexTimeout = 120 * 1000;
private static readonly Mutex importPfxMutex = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
new Mutex(initiallyOwned: false, "Global\\KestrelTests.Certificates.LoadPfxCertificate") :
null;
public static X509Certificate2 GetTestCertificate(string certName = "testCert.pfx")
{
// On Windows, applications should not import PFX files in parallel to avoid a known system-level
// race condition bug in native code which can cause crashes/corruption of the certificate state.
if (importPfxMutex != null)
{
Assert.True(importPfxMutex.WaitOne(MutexTimeout), "Cannot acquire the global certificate mutex.");
}
try
{
return new X509Certificate2(GetCertPath(certName), "testPassword");
}
finally
{
importPfxMutex?.ReleaseMutex();
}
}
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using System.Security.Cryptography.X509Certificates;
namespace Microsoft.AspNetCore.Testing
{
public static class TestResources
{
private static readonly string _baseDir = Path.Combine(Directory.GetCurrentDirectory(), "shared", "TestCertificates");
public static string TestCertificatePath { get; } = Path.Combine(_baseDir, "testCert.pfx");
public static string GetCertPath(string name) => Path.Combine(_baseDir, name);
public static X509Certificate2 GetTestCertificate()
{
return new X509Certificate2(TestCertificatePath, "testPassword");
}
public static X509Certificate2 GetTestCertificate(string certName)
{
return new X509Certificate2(GetCertPath(certName), "testPassword");
}
}
}
| apache-2.0 | C# |
192421577c412c6933b00c671f8eb807741c3f9e | change pw | bergthor13/Skermstafir,bergthor13/Skermstafir,bergthor13/Skermstafir | Skermstafir/Views/Account/_ChangePasswordPartial.cshtml | Skermstafir/Views/Account/_ChangePasswordPartial.cshtml | @using Microsoft.AspNet.Identity
@model Skermstafir.Models.ManageUserViewModel
@using (Html.BeginForm("Manage", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<h4>Breyta lykilorði</h4>
<hr />
@Html.ValidationSummary()
<div class="form-group">
@Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.OldPassword, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Change password" class="btn btn-default" />
</div>
</div>
}
| @using Microsoft.AspNet.Identity
@model Skermstafir.Models.ManageUserViewModel
<p>You're logged in as <strong>@User.Identity.GetUserName()</strong>.</p>
@using (Html.BeginForm("Manage", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<h4>Change Password Form</h4>
<hr />
@Html.ValidationSummary()
<div class="form-group">
@Html.LabelFor(m => m.OldPassword, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.OldPassword, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Change password" class="btn btn-default" />
</div>
</div>
}
| mit | C# |
ab091759c5c15c90025c5d30d821b4c09c992876 | Format code | ulrichb/ReSharperExtensionsShared | Src/ReSharperExtensionsShared/Debugging/DebugUtility.cs | Src/ReSharperExtensionsShared/Debugging/DebugUtility.cs | using System;
using System.Diagnostics;
using JetBrains.Annotations;
using JetBrains.ReSharper.Psi;
namespace ReSharperExtensionsShared.Debugging
{
public static class DebugUtility
{
public static string FormatIncludingContext([CanBeNull] IDeclaredElement element)
{
if (element == null)
return "NULL";
var result = element.GetType().Name + " '" + element.ShortName + "'";
var clrDeclaredElement = element as IClrDeclaredElement;
if (clrDeclaredElement != null)
{
var containingType = clrDeclaredElement.GetContainingType();
var containingTypeName = containingType == null ? "NULL" : containingType.GetClrName().FullName;
result += " in " + containingTypeName;
if (clrDeclaredElement is IParameter) // executing GetContainingTypeMember() on e.g. TypeParameters throws in R# 8.2
{
var containingTypeMember = clrDeclaredElement.GetContainingTypeMember();
if (containingTypeMember != null)
result += "." + containingTypeMember.ShortName + "()";
}
}
return result;
}
public static string FormatWithElapsed([NotNull] string message, [NotNull] Stopwatch stopwatch)
{
return message + " took " + Math.Round(stopwatch.Elapsed.TotalMilliseconds * 1000) + " usec";
}
}
} | using System;
using System.Diagnostics;
using JetBrains.Annotations;
using JetBrains.ReSharper.Psi;
namespace ReSharperExtensionsShared.Debugging
{
public static class DebugUtility
{
public static string FormatIncludingContext([CanBeNull] IDeclaredElement element)
{
if (element == null)
return "NULL";
var result = element.GetType().Name + " '" + element.ShortName + "'";
var clrDeclaredElement = element as IClrDeclaredElement;
if (clrDeclaredElement != null)
{
var containingType = clrDeclaredElement.GetContainingType();
var containingTypeName = containingType == null ? "NULL" : containingType.GetClrName().FullName;
result += " in " + containingTypeName;
if (clrDeclaredElement is IParameter) // executing GetContainingTypeMember() on e.g. TypeParameters throws in R# 8.2
{
var containingTypeMember = clrDeclaredElement.GetContainingTypeMember();
if (containingTypeMember != null)
result += "." + containingTypeMember.ShortName + "()";
}
}
return result;
}
public static string FormatWithElapsed([NotNull] string message, [NotNull] Stopwatch stopwatch)
{
return message + " took " + Math.Round(stopwatch.Elapsed.TotalMilliseconds*1000) + " usec";
}
}
} | mit | C# |
bf5730f9626659621669d704f316ed608a3ce565 | Fix typo | SergeyTeplyakov/ErrorProne.NET | src/ErrorProne.NET/ErrorProne.NET/Annotations/ReadOnlyAttribute.cs | src/ErrorProne.NET/ErrorProne.NET/Annotations/ReadOnlyAttribute.cs | using System;
namespace ErrorProne.NET.Annotations
{
/// <summary>
/// Attribute that mimics readonly modifier on fields.
/// </summary>
/// <remarks>
/// The reason of this attribute is to get readonly behavior without paying the cost of
/// copying readonly fields of value types.
///
/// ErrorProne.NET will emit an error if this attribute would be applied on the field of non-custom structs.
/// </remarks>
[AttributeUsage(AttributeTargets.Field)]
public class ReadOnlyAttribute : Attribute
{}
}
| using System;
namespace ErrorProne.NET.Annotations
{
/// <summary>
/// Attribute that mimics readonly modifier on fields.
/// </summary>
/// <remarks>
/// The reason of this attirubte is to get readonly behavior without paying the cost of
/// copying readonly fields of value types.
///
/// ErrorProne.NET will emit an error if this attribute would be applied on the field of non-custom structs.
/// </remarks>
[AttributeUsage(AttributeTargets.Field)]
public class ReadOnlyAttribute : Attribute
{}
} | mit | C# |
c9495bb601daa79f4deabc872fa34cc6e045f670 | add consul to services not needing health check | lvermeulen/Nanophone | src/Nanophone.RegistryHost.ConsulRegistry/HealthCheckExtensions.cs | src/Nanophone.RegistryHost.ConsulRegistry/HealthCheckExtensions.cs | using Consul;
using System;
using Nanophone.RegistryHost.ConsulRegistry.Logging;
namespace Nanophone.RegistryHost.ConsulRegistry
{
public static class HealthCheckExtensions
{
private static readonly ILog s_log = LogProvider.For<ConsulRegistryHost>();
public static bool NeedsStatusCheck(this HealthCheck healthCheck)
{
if (healthCheck == null)
{
return false;
}
string serviceName = string.IsNullOrWhiteSpace(healthCheck.ServiceName) ? "" : $" {healthCheck.ServiceName}";
// don't check consul
if (healthCheck.ServiceName == "consul")
{
s_log.Debug($"Not checking service${serviceName}");
return false;
}
// don't check services without service ID
if (healthCheck.ServiceID == "")
{
s_log.Debug($"Not checking service${serviceName}: service is missing service ID");
return false;
}
// don't check serfHealth
if (healthCheck.CheckID.Equals("serfHealth", StringComparison.OrdinalIgnoreCase))
{
s_log.Debug($"Not checking service${serviceName}: service is system health check");
return false;
}
// don't check nodes in maintenance
if (healthCheck.CheckID.Equals("_node_maintenance", StringComparison.OrdinalIgnoreCase))
{
s_log.Debug($"Not checking service${serviceName}: service node is in maintenance");
return false;
}
// don't check services in maintenance
if (healthCheck.CheckID.StartsWith("_service_maintenance:", StringComparison.OrdinalIgnoreCase))
{
s_log.Debug($"Not checking service${serviceName}: service is in maintenance");
return false;
}
return true;
}
}
}
| using Consul;
using System;
using Nanophone.RegistryHost.ConsulRegistry.Logging;
namespace Nanophone.RegistryHost.ConsulRegistry
{
public static class HealthCheckExtensions
{
private static readonly ILog s_log = LogProvider.For<ConsulRegistryHost>();
public static bool NeedsStatusCheck(this HealthCheck healthCheck)
{
if (healthCheck == null)
{
return false;
}
string serviceName = string.IsNullOrWhiteSpace(healthCheck.ServiceName) ? "" : $" {healthCheck.ServiceName}";
// don't check services without service ID
if (healthCheck.ServiceID == "")
{
s_log.Debug($"Not checking service${serviceName}: service is missing service ID");
return false;
}
if (healthCheck.CheckID.Equals("serfHealth", StringComparison.OrdinalIgnoreCase))
{
s_log.Debug($"Not checking service${serviceName}: service is system health check");
return false;
}
if (healthCheck.CheckID.Equals("_node_maintenance", StringComparison.OrdinalIgnoreCase))
{
s_log.Debug($"Not checking service${serviceName}: service node is in maintenance");
return false;
}
if (healthCheck.CheckID.StartsWith("_service_maintenance:", StringComparison.OrdinalIgnoreCase))
{
s_log.Debug($"Not checking service${serviceName}: service is in maintenance");
return false;
}
return true;
}
}
}
| mit | C# |
67675a5ae5d899a9a89914d93770fef72481a3e6 | correct spacing around paramref test | OmniSharp/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn | tests/OmniSharp.Roslyn.CSharp.Tests/DocumentationConverterFacts.cs | tests/OmniSharp.Roslyn.CSharp.Tests/DocumentationConverterFacts.cs | using System.Threading.Tasks;
using OmniSharp.Roslyn.CSharp.Services.Documentation;
using Xunit;
namespace OmniSharp.Roslyn.CSharp.Tests
{
public class DocumentationConverterFacts
{
[Fact]
public void Converts_xml_documentation_to_plain_text()
{
var documentation = @"
<member name=""M:TestNamespace.TestClass.GetZero"">
<summary>
The GetZero method.
</summary>
<example>
This sample shows how to call the <see cref=""M:TestNamespace.TestClass.GetZero""/> method.
<code>
class TestClass
{
static int Main()
{
return GetZero();
}
}
</code>
</example>
</member>";
var plainText = DocumentationConverter.ConvertDocumentation(documentation, "\n");
var expected =
@"The GetZero method.
Example:
This sample shows how to call the TestNamespace.TestClass.GetZero method.
class TestClass
{
static int Main()
{
return GetZero();
}
}
";
Assert.Equal(expected, plainText, ignoreLineEndingDifferences: true);
}
[Fact]
public void Has_correct_spacing_around_paramref()
{
var documentation = @"
<summary>DoWork is a method in the TestClass class.
The <paramref name=""arg""/> parameter takes a number and <paramref name=""arg2""/> takes a string.
</summary>";
var plainText = DocumentationConverter.ConvertDocumentation(documentation, "\n");
var expected =
@"DoWork is a method in the TestClass class.
The arg parameter takes a number and arg2 takes a string.";
Assert.Equal(expected, plainText, ignoreLineEndingDifferences: true);
}
}
}
| using System.Threading.Tasks;
using OmniSharp.Roslyn.CSharp.Services.Documentation;
using Xunit;
namespace OmniSharp.Roslyn.CSharp.Tests
{
public class DocumentationConverterFacts
{
[Fact]
public void Converts_xml_documentation_to_plain_text()
{
var documentation = @"
<member name=""M:TestNamespace.TestClass.GetZero"">
<summary>
The GetZero method.
</summary>
<example>
This sample shows how to call the <see cref=""M:TestNamespace.TestClass.GetZero""/> method.
<code>
class TestClass
{
static int Main()
{
return GetZero();
}
}
</code>
</example>
</member>";
var plainText = DocumentationConverter.ConvertDocumentation(documentation, "\n");
var expected =
@"The GetZero method.
Example:
This sample shows how to call the TestNamespace.TestClass.GetZero method.
class TestClass
{
static int Main()
{
return GetZero();
}
}
";
Assert.Equal(expected, plainText, ignoreLineEndingDifferences: true);
}
}
}
| mit | C# |
29c85b849a4caa56494069d62cfd4851adf8c431 | add BitBox02 support | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Hwi/Models/HardwareWalletModels.cs | WalletWasabi/Hwi/Models/HardwareWalletModels.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace WalletWasabi.Hwi.Models
{
/// <summary>
/// Source: https://github.com/bitcoin-core/HWI/pull/228
/// </summary>
public enum HardwareWalletModels
{
Unknown,
Coldcard,
Coldcard_Simulator,
DigitalBitBox_01,
DigitalBitBox_01_Simulator,
KeepKey,
KeepKey_Simulator,
Ledger_Nano_S,
Trezor_1,
Trezor_1_Simulator,
Trezor_T,
Trezor_T_Simulator,
BitBox02_BTCOnly,
BitBox02_Multi,
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace WalletWasabi.Hwi.Models
{
/// <summary>
/// Source: https://github.com/bitcoin-core/HWI/pull/228
/// </summary>
public enum HardwareWalletModels
{
Unknown,
Coldcard,
Coldcard_Simulator,
DigitalBitBox_01,
DigitalBitBox_01_Simulator,
KeepKey,
KeepKey_Simulator,
Ledger_Nano_S,
Trezor_1,
Trezor_1_Simulator,
Trezor_T,
Trezor_T_Simulator
}
}
| mit | C# |
e0ca5b126f3574fe935e7c30336b3929dea61d7a | Add SessionHash property and mark SessionHeight as obsolete. | clement911/ShopifySharp,addsb/ShopifySharp,nozzlegear/ShopifySharp | ShopifySharp/Entities/ShopifyClientDetails.cs | ShopifySharp/Entities/ShopifyClientDetails.cs | using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShopifySharp
{
public class ShopifyClientDetails
{
/// <summary>
/// Shopify does not offer documentation for this field.
/// </summary>
[JsonProperty("accept_language")]
public string AcceptLanguage { get; set; }
/// <summary>
/// The browser screen height in pixels, if available.
/// </summary>
[JsonProperty("browser_height")]
public string BrowserHeight { get; set; }
/// <summary>
/// The browser IP address.
/// </summary>
[JsonProperty("browser_ip")]
public string BrowserIp { get; set; }
/// <summary>
/// The browser screen width in pixels, if available.
/// </summary>
[JsonProperty("browser_width")]
public string BrowserWidth { get; set; }
/// <summary>
/// Obsolete: This property is incorrect and will be removed in a future release.
/// </summary>
[JsonProperty("session_height"), Obsolete("This property is incorrect and will be removed in a future release.")]
public string SessionHeight { get; set; }
/// <summary>
/// A hash of the session.
/// </summary>
[JsonProperty("session_hash")]
public string SessionHash { get; set; }
/// <summary>
/// The browser's user agent string.
/// </summary>
[JsonProperty("user_agent")]
public string UserAgent { get; set; }
}
}
| using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShopifySharp
{
public class ShopifyClientDetails
{
/// <summary>
/// Shopify does not offer documentation for this field.
/// </summary>
[JsonProperty("accept_language")]
public string AcceptLanguage { get; set; }
/// <summary>
/// The browser screen height in pixels, if available.
/// </summary>
[JsonProperty("browser_height")]
public string BrowserHeight { get; set; }
/// <summary>
/// The browser IP address.
/// </summary>
[JsonProperty("browser_ip")]
public string BrowserIp { get; set; }
/// <summary>
/// The browser screen width in pixels, if available.
/// </summary>
[JsonProperty("browser_width")]
public string BrowserWidth { get; set; }
/// <summary>
/// A hash of the session.
/// </summary>
[JsonProperty("session_height")]
public string SessionHeight { get; set; }
/// <summary>
/// The browser's user agent string.
/// </summary>
[JsonProperty("user_agent")]
public string UserAgent { get; set; }
}
}
| mit | C# |
8fd451be90c67ef791d50a210625297b98f50ad8 | Fix typo in LineStyle.cs | AngleSharp/AngleSharp.Css,AngleSharp/AngleSharp.Css,AngleSharp/AngleSharp.Css | src/AngleSharp.Css/Dom/LineStyle.cs | src/AngleSharp.Css/Dom/LineStyle.cs | namespace AngleSharp.Css.Dom
{
/// <summary>
/// An enumeration with all possible line styles.
/// </summary>
public enum LineStyle : byte
{
/// <summary>
/// No outline (outline-width is 0).
/// </summary>
None,
/// <summary>
/// Same as 'none', except in terms of border conflict resolution for table elements.
/// </summary>
Hidden,
/// <summary>
/// The outline is a series of dots.
/// </summary>
Dotted,
/// <summary>
/// The outline is a series of short line segments.
/// </summary>
Dashed,
/// <summary>
/// The outline is a single line.
/// </summary>
Solid,
/// <summary>
/// The outline is two single lines. The outline-width is the sum of the two lines and the space between them.
/// </summary>
Double,
/// <summary>
/// The outline looks as though it were carved into the canvas.
/// </summary>
Groove,
/// <summary>
/// The opposite of groove: the outline looks as though it were coming out of the canvas.
/// </summary>
Ridge,
/// <summary>
/// The outline makes the box look as though it were embedded in the canvas.
/// </summary>
Inset,
/// <summary>
/// The opposite of inset: the outline makes the box look as though it were coming out of the canvas.
/// </summary>
Outset
}
}
| namespace AngleSharp.Css.Dom
{
/// <summary>
/// An enumeration with all possible line styles.
/// </summary>
public enum LineStyle : byte
{
/// <summary>
/// No outline (outline-width is 0).
/// </summary>
None,
/// <summary>
/// Same as 'none', except in terms of border conflict resolution for table elements.
/// </summary>
Hidden,
/// <summary>
/// The outline is a series of dots.
/// </summary>
Dotted,
/// <summary>
/// The outline is a series of short line segments.
/// </summary>
Dashed,
/// <summary>
/// The outline is a single line.
/// </summary>
Solid,
/// <summary>
/// The outline is two single lines. The outline-width is the sum of the two lines and the space between them.
/// </summary>
Double,
/// <summary>
/// The outline looks as though it were carved into the canvas.
/// </summary>
Groove,
/// <summary>
/// The opposite of groove: the outline looks as though it were coming out of the canvas.
/// </summary>
Ridge,
/// <summary>
/// The outline makes the box look as though it were embeded in the canvas.
/// </summary>
Inset,
/// <summary>
/// The opposite of inset: the outline makes the box look as though it were coming out of the canvas.
/// </summary>
Outset
}
}
| mit | C# |
834bcda840dcd253fe8ad7de6c3bb6618cfe0a6f | Make VisitingMind's Mind readable by VV | space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14 | Content.Server/GameObjects/Components/Mobs/VisitingMindComponent.cs | Content.Server/GameObjects/Components/Mobs/VisitingMindComponent.cs | using Content.Server.Mobs;
using Robust.Shared.GameObjects;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Mobs
{
[RegisterComponent]
public sealed class VisitingMindComponent : Component
{
public override string Name => "VisitingMind";
[ViewVariables]
public Mind Mind { get; set; }
public override void OnRemove()
{
base.OnRemove();
Mind?.UnVisit();
}
}
}
| using Content.Server.Mobs;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Mobs
{
[RegisterComponent]
public sealed class VisitingMindComponent : Component
{
public override string Name => "VisitingMind";
public Mind Mind { get; set; }
public override void OnRemove()
{
base.OnRemove();
Mind?.UnVisit();
}
}
}
| mit | C# |
f82d143016338c7592c5baf5e8789373978dc2a5 | Add AssemblyHashAlgorithm.GetName() ext method | jorik041/dnlib,kiootic/dnlib,Arthur2e5/dnlib,modulexcite/dnlib,picrap/dnlib,yck1509/dnlib,ilkerhalil/dnlib,ZixiangBoy/dnlib,0xd4d/dnlib | src/DotNet/AssemblyHashAlgorithm.cs | src/DotNet/AssemblyHashAlgorithm.cs | namespace dot10.DotNet {
/// <summary>
/// Any ALG_CLASS_HASH type in WinCrypt.h can be used by Microsoft's CLI implementation
/// </summary>
public enum AssemblyHashAlgorithm : uint {
/// <summary/>
None = 0,
/// <summary/>
MD2 = 0x8001,
/// <summary/>
MD4 = 0x8002,
/// <summary>This is a reserved value in the CLI</summary>
MD5 = 0x8003,
/// <summary>The only algorithm supported by the CLI</summary>
SHA1 = 0x8004,
/// <summary/>
MAC = 0x8005,
/// <summary/>
SSL3_SHAMD5 = 0x8008,
/// <summary/>
HMAC = 0x8009,
/// <summary/>
TLS1PRF = 0x800A,
/// <summary/>
HASH_REPLACE_OWF = 0x800B,
/// <summary/>
SHA_256 = 0x800C,
/// <summary/>
SHA_384 = 0x800D,
/// <summary/>
SHA_512 = 0x800E,
}
static partial class Extensions {
internal static string GetName(this AssemblyHashAlgorithm hashAlg) {
switch (hashAlg) {
case AssemblyHashAlgorithm.MD2: return null;
case AssemblyHashAlgorithm.MD4: return null;
case AssemblyHashAlgorithm.MD5: return "MD5";
case AssemblyHashAlgorithm.SHA1: return "SHA1";
case AssemblyHashAlgorithm.MAC: return null;
case AssemblyHashAlgorithm.SSL3_SHAMD5: return null;
case AssemblyHashAlgorithm.HMAC: return "HMAC";
case AssemblyHashAlgorithm.TLS1PRF: return null;
case AssemblyHashAlgorithm.HASH_REPLACE_OWF: return null;
case AssemblyHashAlgorithm.SHA_256: return "SHA256";
case AssemblyHashAlgorithm.SHA_384: return "SHA384";
case AssemblyHashAlgorithm.SHA_512: return "SHA512";
default: return null;
}
}
}
}
| namespace dot10.DotNet {
/// <summary>
/// Any ALG_CLASS_HASH type in WinCrypt.h can be used by Microsoft's CLI implementation
/// </summary>
public enum AssemblyHashAlgorithm : uint {
/// <summary/>
None = 0,
/// <summary/>
MD2 = 0x8001,
/// <summary/>
MD4 = 0x8002,
/// <summary>This is a reserved value in the CLI</summary>
MD5 = 0x8003,
/// <summary>The only algorithm supported by the CLI</summary>
SHA1 = 0x8004,
/// <summary/>
MAC = 0x8005,
/// <summary/>
SSL3_SHAMD5 = 0x8008,
/// <summary/>
HMAC = 0x8009,
/// <summary/>
TLS1PRF = 0x800A,
/// <summary/>
HASH_REPLACE_OWF = 0x800B,
/// <summary/>
SHA_256 = 0x800C,
/// <summary/>
SHA_384 = 0x800D,
/// <summary/>
SHA_512 = 0x800E,
}
}
| mit | C# |
bf43bae316ec6216e79beb95b2ba25137d91908d | Remove Marshal.GetHRForLastWin32Error call from Diagnostics.Process | mono/referencesource,evincarofautumn/referencesource | System/services/monitoring/system/diagnosticts/processwaithandle.cs | System/services/monitoring/system/diagnosticts/processwaithandle.cs | using System;
using System.Threading;
using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace System.Diagnostics {
internal class ProcessWaitHandle : WaitHandle {
[ResourceExposure(ResourceScope.None)]
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
internal ProcessWaitHandle( SafeProcessHandle processHandle): base() {
SafeWaitHandle waitHandle = null;
bool succeeded = NativeMethods.DuplicateHandle(
new HandleRef(this, NativeMethods.GetCurrentProcess()),
processHandle,
new HandleRef(this, NativeMethods.GetCurrentProcess()),
out waitHandle,
0,
false,
NativeMethods.DUPLICATE_SAME_ACCESS);
if (!succeeded) {
#if MONO
// In Mono, Marshal.GetHRForLastWin32Error is not implemented;
// and also DuplicateHandle throws its own exception rather
// than returning false on error, so this code is unreachable.
throw new SystemException("Unknown error in DuplicateHandle");
#else
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
#endif
}
this.SafeWaitHandle = waitHandle;
}
}
}
| using System;
using System.Threading;
using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace System.Diagnostics {
internal class ProcessWaitHandle : WaitHandle {
[ResourceExposure(ResourceScope.None)]
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
internal ProcessWaitHandle( SafeProcessHandle processHandle): base() {
SafeWaitHandle waitHandle = null;
bool succeeded = NativeMethods.DuplicateHandle(
new HandleRef(this, NativeMethods.GetCurrentProcess()),
processHandle,
new HandleRef(this, NativeMethods.GetCurrentProcess()),
out waitHandle,
0,
false,
NativeMethods.DUPLICATE_SAME_ACCESS);
if (!succeeded) {
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
}
this.SafeWaitHandle = waitHandle;
}
}
}
| mit | C# |
61892ff03370a9d5d5fb2bb2ad688f91069a5286 | Bump version to 0.1.4 | exira/ges-runner | src/Properties/AssemblyInfo.cs | src/Properties/AssemblyInfo.cs | // <auto-generated/>
using System.Reflection;
[assembly: AssemblyTitleAttribute("ges-runner")]
[assembly: AssemblyProductAttribute("Exira.EventStore.Runner")]
[assembly: AssemblyDescriptionAttribute("Exira.EventStore.Runner is a wrapper that uses Topshelf to run EventStore as a Windows Service")]
[assembly: AssemblyVersionAttribute("0.1.4")]
[assembly: AssemblyFileVersionAttribute("0.1.4")]
[assembly: AssemblyMetadataAttribute("githash","bcf45f3109641cbe04911296b03041834b47b28d")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.1.4";
}
}
| // <auto-generated/>
using System.Reflection;
[assembly: AssemblyTitleAttribute("ges-runner")]
[assembly: AssemblyProductAttribute("Exira.EventStore.Runner")]
[assembly: AssemblyDescriptionAttribute("Exira.EventStore.Runner is a wrapper that uses Topshelf to run EventStore as a Windows Service")]
[assembly: AssemblyVersionAttribute("0.1.3")]
[assembly: AssemblyFileVersionAttribute("0.1.3")]
[assembly: AssemblyMetadataAttribute("githash","47e38dd78e4164b7c6d7feeaa38933b46a4b24be")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.1.3";
}
}
| mit | C# |
d226eba77f64380f3be0c640b7ca4cf2c333a657 | Build and publish nuget package | RockFramework/Rock.EmbeddedNativeLibrary | src/Properties/AssemblyInfo.cs | src/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("Rock.EmbeddedNativeLibrary")]
[assembly: AssemblyDescription("Consume native libraries from .NET by adding as embedded resources.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.EmbeddedNativeLibrary")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 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("bbf12b49-1839-4a25-b841-1af4f2eeb4b0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.*")]
[assembly: AssemblyFileVersion("1.2.0")]
[assembly: AssemblyInformationalVersion("1.2.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("Rock.EmbeddedNativeLibrary")]
[assembly: AssemblyDescription("Consume native libraries from .NET by adding as embedded resources.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.EmbeddedNativeLibrary")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 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("bbf12b49-1839-4a25-b841-1af4f2eeb4b0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.*")]
[assembly: AssemblyFileVersion("1.1.2")]
[assembly: AssemblyInformationalVersion("1.1.2")]
| mit | C# |
af75d22e07fdc0f2ddf19c59707be804bd3c484f | fix typo VisualResult(s) | mastersign/mediacategorizer-ui | processing/AnalyzeResultsAndWriteOutputProcess.cs | processing/AnalyzeResultsAndWriteOutputProcess.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using de.fhb.oll.mediacategorizer.edn;
using de.fhb.oll.mediacategorizer.settings;
using de.fhb.oll.mediacategorizer.tools;
namespace de.fhb.oll.mediacategorizer.processing
{
class AnalyzeResultsAndWriteOutputProcess : ProcessBase
{
public AnalyzeResultsAndWriteOutputProcess(ProcessChain chain, params IProcess[] dependencies)
: base(chain, "Analysieren und Ergebnisse speichern", dependencies)
{
ProgressWeight = 20;
}
private DistilleryTool GetDistilleryTool()
{
return (DistilleryTool)ToolProvider.Create(Chain, typeof(DistilleryTool));
}
private string BuildJobFilePath()
{
return Path.Combine(Project.GetWorkingDirectory(), "job.edn");
}
protected override void Work()
{
var jobFile = BuildJobFilePath();
OnProgress("Projekt kodieren...");
using (var w = new StreamWriter(jobFile))
{
var ednW = new EdnWriter(w);
Project.Configuration.VolatileProperties["parallel-proc"] = Setup.Parallelization != ParallelizationMode.None;
Project.WriteTo(ednW);
}
OnProgress("Analyse starten...");
var distillery = GetDistilleryTool();
distillery.RunDistillery(jobFile, wi => { WorkItem = wi; }, OnProgress, OnProgress, OnError);
if (Project.Configuration.ShowResult)
{
Process.Start(Path.Combine(Project.OutputDir,
Project.Configuration.VisualizeResult
? "index.html"
: Project.ResultFile));
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using de.fhb.oll.mediacategorizer.edn;
using de.fhb.oll.mediacategorizer.settings;
using de.fhb.oll.mediacategorizer.tools;
namespace de.fhb.oll.mediacategorizer.processing
{
class AnalyzeResultsAndWriteOutputProcess : ProcessBase
{
public AnalyzeResultsAndWriteOutputProcess(ProcessChain chain, params IProcess[] dependencies)
: base(chain, "Analysieren und Ergebnisse speichern", dependencies)
{
ProgressWeight = 20;
}
private DistilleryTool GetDistilleryTool()
{
return (DistilleryTool)ToolProvider.Create(Chain, typeof(DistilleryTool));
}
private string BuildJobFilePath()
{
return Path.Combine(Project.GetWorkingDirectory(), "job.edn");
}
protected override void Work()
{
var jobFile = BuildJobFilePath();
OnProgress("Projekt kodieren...");
using (var w = new StreamWriter(jobFile))
{
var ednW = new EdnWriter(w);
Project.Configuration.VolatileProperties["parallel-proc"] = Setup.Parallelization != ParallelizationMode.None;
Project.WriteTo(ednW);
}
OnProgress("Analyse starten...");
var distillery = GetDistilleryTool();
distillery.RunDistillery(jobFile, wi => { WorkItem = wi; }, OnProgress, OnProgress, OnError);
if (Project.Configuration.ShowResult)
{
Process.Start(Path.Combine(Project.OutputDir,
Project.Configuration.VisualizeResults
? "index.html"
: Project.ResultFile));
}
}
}
}
| mit | C# |
1dbfcd5853fef6bda289a05289912d6a20b6e2bf | fix null reference, modify previous | lvermeulen/Equalizer | src/Equalizer.Nanophone/RoundRobinAddressRouter.cs | src/Equalizer.Nanophone/RoundRobinAddressRouter.cs | using System;
using System.Collections.Generic;
using Equalizer.Core;
using Equalizer.Routers;
using Nanophone.Core;
namespace Equalizer.Nanophone
{
public class RoundRobinAddressRouter : BaseDiscriminatingRouter<RegistryInformation>
{
private readonly RoundRobinRouter<RegistryInformation> _router;
public RoundRobinAddressRouter()
{
_router = new RoundRobinRouter<RegistryInformation>();
Discriminator = (x, y) => x?.Address == y?.Address;
}
public override Func<RegistryInformation, RegistryInformation, bool> Discriminator { get; }
public override RegistryInformation Choose(RegistryInformation previous, IList<RegistryInformation> instances)
{
var next = _router.Choose(instances);
Previous = next;
return next;
}
}
}
| using System;
using System.Collections.Generic;
using Equalizer.Core;
using Equalizer.Routers;
using Nanophone.Core;
namespace Equalizer.Nanophone
{
public class RoundRobinAddressRouter : BaseDiscriminatingRouter<RegistryInformation>
{
private readonly RoundRobinRouter<RegistryInformation> _router;
public RoundRobinAddressRouter()
{
_router = new RoundRobinRouter<RegistryInformation>();
Discriminator = (x, y) => x.Address == y.Address;
}
public override Func<RegistryInformation, RegistryInformation, bool> Discriminator { get; }
public override RegistryInformation Choose(RegistryInformation previous, IList<RegistryInformation> instances)
{
return _router.Choose(instances);
}
}
}
| mit | C# |
9b9bf73ece95bc7a02192d31ddb7ddd5d0eae9cd | Use UseServer() instead of UseKestrel() to allow override in tests | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/MusicStore/Program.cs | src/MusicStore/Program.cs | using Microsoft.AspNetCore.Hosting;
namespace MusicStore
{
public static class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
// We set the server by name before default args so that command line arguments can override it.
// This is used to allow deployers to choose the server for testing.
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseDefaultHostingConfiguration(args)
.UseIISIntegration()
.UseStartup("MusicStore")
.Build();
host.Run();
}
}
}
| using Microsoft.AspNetCore.Hosting;
namespace MusicStore
{
public static class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
// We set the server before default args so that command line arguments can override it.
// This is used to allow deployers to choose the server for testing.
.UseKestrel()
.UseDefaultHostingConfiguration(args)
.UseIISIntegration()
.UseStartup("MusicStore")
.Build();
host.Run();
}
}
}
| apache-2.0 | C# |
fd72ab10fa8e38f3576dc250d59dfa217e00ad9f | fix exception demo | tibel/Caliburn.Light | samples/Demo.ExceptionHandling/AppBootstrapper.cs | samples/Demo.ExceptionHandling/AppBootstrapper.cs | using System.Diagnostics;
using System.Windows;
using System.Windows.Threading;
using Caliburn.Light;
namespace Demo.ExceptionHandling
{
public class AppBootstrapper : BootstrapperBase
{
private SimpleContainer _container;
protected override void Configure()
{
_container = new SimpleContainer();
IoC.Initialize(_container);
_container.RegisterSingleton<IWindowManager, WindowManager>();
_container.RegisterSingleton<IEventAggregator, EventAggregator>();
var typeResolver = new ViewModelTypeResolver();
typeResolver.Register<ShellView, ShellViewModel>();
_container.RegisterInstance<IViewModelTypeResolver>(typeResolver);
_container.RegisterPerRequest<IServiceLocator>(null, c => c);
_container.RegisterSingleton<IViewModelLocator, ViewModelLocator>();
_container.RegisterSingleton<IViewModelBinder, ViewModelBinder>();
_container.RegisterPerRequest<ShellViewModel>();
_container.RegisterPerRequest<ShellView>();
}
protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
{
Debug.WriteLine(">>> Dispatcher - {0}", e.Exception);
}
protected override void OnStartup(StartupEventArgs e)
{
DisplayRootViewFor<ShellViewModel>();
}
}
}
| using System.Diagnostics;
using System.Windows;
using System.Windows.Threading;
using Caliburn.Light;
namespace Demo.ExceptionHandling
{
public class AppBootstrapper : BootstrapperBase
{
private SimpleContainer _container;
protected override void Configure()
{
_container = new SimpleContainer();
IoC.Initialize(_container);
_container.RegisterSingleton<IWindowManager, WindowManager>();
_container.RegisterSingleton<IEventAggregator, EventAggregator>();
_container.RegisterPerRequest<ShellView>();
_container.RegisterPerRequest<ShellViewModel>();
}
protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
{
Debug.WriteLine(">>> Dispatcher - {0}", e.Exception);
}
protected override void OnStartup(StartupEventArgs e)
{
DisplayRootViewFor<ShellViewModel>();
}
}
}
| mit | C# |
3bf2ec8c0464b9bab163c9cd5b86b25d7f0c661a | Set some default | jdt/StickEmApp | Source/StickEmApp/StickEmApp/Entities/SalesResult.cs | Source/StickEmApp/StickEmApp/Entities/SalesResult.cs | namespace StickEmApp.Entities
{
public class SalesResult
{
public SalesResult()
{
Status = ResultType.Exact;
Difference = new Money(0);
}
public ResultType Status { get; set; }
public Money Difference { get; set; }
}
} | namespace StickEmApp.Entities
{
public class SalesResult
{
public ResultType Status { get; set; }
public Money Difference { get; set; }
}
} | mit | C# |
be3c6911f8aa6e188e33b2367452bf0e227097fd | Disable parallelization for RhinoMock using alternative way | AutoFixture/AutoFixture,Pvlerick/AutoFixture,sean-gilliam/AutoFixture,zvirja/AutoFixture | Src/AutoRhinoMockUnitTest/Properties/AssemblyInfo.cs | Src/AutoRhinoMockUnitTest/Properties/AssemblyInfo.cs | using System.Reflection;
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: 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("1489ac72-1967-48b8-a302-79b2900acbe3")]
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]
| using System.Reflection;
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: 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("1489ac72-1967-48b8-a302-79b2900acbe3")]
[assembly: CollectionBehavior(DisableTestParallelization = true)]
| mit | C# |
a85d60cfafdfde130c1a9b4eada34e0671776c2e | Add Instagram | jetebusiness/NEO-Default_Theme,jetebusiness/NEO-Default_Theme | Views/Shared/Blocks/Instagram/_InstagramMedia.cshtml | Views/Shared/Blocks/Instagram/_InstagramMedia.cshtml | @model IList<DomainCompany.Entities.InstagramMedia>
@if (Model != null && Model.Count() > 0)
{
var userName = @Model.FirstOrDefault().username;
<div class="ui container">
<div class="ui horizontal divider">
<a href="https://www.instagram.com/@userName/?hl=pt-br" title="@userName" target="_blank">@Html.Raw("@"+userName)</a>
</div>
<div class="ui grid">
<div class="row one column">
<div class="column">
<div class="ui equal width grid margin none images middle aligned center aligned stackable slideshow insta_feed" data-qtd="6">
@foreach (var media in Model.Where(c => c.media_type.ToLower() == "image").Take(10))
{
<div class="column slideshow-item">
<a href="@media.permalink" target="_blank">
<img class="ui image centered fluid " src="@media.media_url" alt="" title="" onerror="imgError(this)">
</a>
</div>
}
</div>
</div>
</div>
</div>
<div class="ui divider hidden"></div>
</div>
} | @model IList<DomainCompany.Entities.InstagramMedia>
@if (Model != null && Model.Count() > 0)
{
var userName = @Model.FirstOrDefault().username;
<div class="ui container">
<div class="ui horizontal divider">
<a href="https://www.instagram.com/@userName/?hl=pt-br" title="@userName" target="_blank">@Html.Raw("@"+userName)</a>
</div>
<div class="ui grid">
<div class="row one column">
<div class="column">
<div class="ui equal width grid margin none images middle aligned center aligned stackable slideshow insta_feed" data-qtd="6">
@foreach (var media in Model.Where(c => c.media_type.ToLower() == "image").Take(10))
{
<div class="column slideshow-item">
<a href="@media.permalink" target="_blank">
<img class="ui image centered fluid " src="@media.media_url" alt="" title="" onerror="imgError(this)">
</a>
</div>
}
</div>
</div>
</div>
</div>
<div class="ui divider hidden"></div>
</div>
} | mpl-2.0 | C# |
3053c467c76ea1f51f34fc9cc1330ddc446ef6c5 | Fix description for Sebastian Jensen (#412) | planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin | src/Firehose.Web/Authors/SebastianJensen.cs | src/Firehose.Web/Authors/SebastianJensen.cs | using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class SebastianJensen : IAmACommunityMember
{
public string FirstName => "Sebastian";
public string LastName => "Jensen";
public string StateOrRegion => "Pforzheim, Germany";
public string EmailAddress => "apps@tsjdev-apps.de";
public string ShortBioOrTagLine => "is Mobile .NET Developer and creates apps for UWP, iOS and Android.";
public Uri WebSite => new Uri("https://www.tsjdev-apps.de");
public string TwitterHandle => "tsjdevapps";
public string GitHubHandle => "tsjdev-apps";
public string GravatarHash => "d990a05a189c263901ca94367d3a50be";
public GeoPosition Position => new GeoPosition(48.892186, 8.694629);
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://www.tsjdev-apps.de/feed"); }
}
}
} | using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class SebastianJensen : IAmACommunityMember
{
public string FirstName => "Sebastian";
public string LastName => "Jensen";
public string StateOrRegion => "Pforzheim, Germany";
public string EmailAddress => "apps@tsjdev-apps.de";
public string ShortBioOrTagLine => "Sebastian Jensen is Mobile .NET Developer and creates apps for UWP, iOS and Android.";
public Uri WebSite => new Uri("https://www.tsjdev-apps.de");
public string TwitterHandle => "tsjdevapps";
public string GitHubHandle => "tsjdev-apps";
public string GravatarHash => "d990a05a189c263901ca94367d3a50be";
public GeoPosition Position => new GeoPosition(48.892186, 8.694629);
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://www.tsjdev-apps.de/feed"); }
}
}
} | mit | C# |
4d04e6f4f61e2978550e4814aa15ec0c5539ac5f | make triples immutable :) | richorama/AzureStorageExtensions | AzureGraphStore/Triple.cs | AzureGraphStore/Triple.cs | using System;
namespace Two10.AzureGraphStore
{
public class Triple
{
public Triple(string subject, string property, string value)
{
if (string.IsNullOrWhiteSpace(subject)) throw new ArgumentNullException("subject");
if (string.IsNullOrWhiteSpace(property)) throw new ArgumentNullException("property");
if (string.IsNullOrWhiteSpace(value)) throw new ArgumentNullException("value");
if (subject.Contains("~") || property.Contains("~") || value.Contains("~")) throw new ArgumentException("Triples may not contains the '~' character");
this.Subject = subject;
this.Property = property;
this.Value = value;
}
public string Subject { get; private set; }
public string Property { get; private set; }
public string Value { get; private set; }
public override string ToString()
{
return string.Format("{0} {1} {2}", this.Subject, this.Property, this.Value);
}
}
}
| using System;
namespace Two10.AzureGraphStore
{
public class Triple
{
public Triple(string subject, string property, string value)
{
if (string.IsNullOrWhiteSpace(subject)) throw new ArgumentNullException("subject");
if (string.IsNullOrWhiteSpace(property)) throw new ArgumentNullException("property");
if (string.IsNullOrWhiteSpace(value)) throw new ArgumentNullException("value");
if (subject.Contains("~") || property.Contains("~") || value.Contains("~")) throw new ArgumentException("Triples may not contains the '~' character");
this.Subject = subject;
this.Property = property;
this.Value = value;
}
public string Subject { get; set; }
public string Property { get; set; }
public string Value { get; set; }
public override string ToString()
{
return string.Format("{0} {1} {2}", this.Subject, this.Property, this.Value);
}
}
}
| mit | C# |
290ae373469bd43d66c6c965edb7e0c016ff797a | Add assertion of only usage game-wide | peppy/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,ppy/osu,peppy/osu-new | osu.Game/Screens/Play/ScreenSuspensionHandler.cs | osu.Game/Screens/Play/ScreenSuspensionHandler.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
namespace osu.Game.Screens.Play
{
/// <summary>
/// Ensures screen is not suspended / dimmed while gameplay is active.
/// </summary>
public class ScreenSuspensionHandler : Component
{
private readonly GameplayClockContainer gameplayClockContainer;
private Bindable<bool> isPaused;
[Resolved]
private GameHost host { get; set; }
public ScreenSuspensionHandler([NotNull] GameplayClockContainer gameplayClockContainer)
{
this.gameplayClockContainer = gameplayClockContainer ?? throw new ArgumentNullException(nameof(gameplayClockContainer));
}
protected override void LoadComplete()
{
base.LoadComplete();
// This is the only usage game-wide of suspension changes.
// Assert to ensure we don't accidentally forget this in the future.
Debug.Assert(host.AllowScreenSuspension.Value);
isPaused = gameplayClockContainer.IsPaused.GetBoundCopy();
isPaused.BindValueChanged(paused => host.AllowScreenSuspension.Value = paused.NewValue, true);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
isPaused?.UnbindAll();
if (host != null)
host.AllowScreenSuspension.Value = true;
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Platform;
namespace osu.Game.Screens.Play
{
/// <summary>
/// Ensures screen is not suspended / dimmed while gameplay is active.
/// </summary>
public class ScreenSuspensionHandler : Component
{
private readonly GameplayClockContainer gameplayClockContainer;
private Bindable<bool> isPaused;
[Resolved]
private GameHost host { get; set; }
public ScreenSuspensionHandler([NotNull] GameplayClockContainer gameplayClockContainer)
{
this.gameplayClockContainer = gameplayClockContainer ?? throw new ArgumentNullException(nameof(gameplayClockContainer));
}
protected override void LoadComplete()
{
base.LoadComplete();
isPaused = gameplayClockContainer.IsPaused.GetBoundCopy();
isPaused.BindValueChanged(paused => host.AllowScreenSuspension.Value = paused.NewValue, true);
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
isPaused?.UnbindAll();
if (host != null)
host.AllowScreenSuspension.Value = true;
}
}
}
| mit | C# |
443b3aa7f96eebfda99ad1eb1144bc20fce12c9d | remove filesystem watcher | kreeben/resin,kreeben/resin | src/Sir.HttpServer/KeyValueConfiguration.cs | src/Sir.HttpServer/KeyValueConfiguration.cs | using System;
using System.Collections.Generic;
using System.IO;
namespace Sir
{
public class KeyValueConfiguration : IConfigurationProvider
{
private IDictionary<string, string> _doc;
private readonly string _fileName;
public KeyValueConfiguration(string readFromFileName = null)
{
_doc = new Dictionary<string, string>();
_fileName = Path.Combine(Directory.GetCurrentDirectory(), readFromFileName);
OnFileChanged();
}
private void OnFileChanged()
{
var dic = new Dictionary<string, string>();
string text;
using (var fs = new FileStream(_fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (var r = new StreamReader(fs))
{
text = r.ReadToEnd();
}
foreach (var line in text.Split('\n', StringSplitOptions.RemoveEmptyEntries))
{
var segs = line.Split('=');
dic.Add(segs[0].Trim(), segs[1].Trim());
}
_doc = dic;
}
public string Get(string key)
{
string val;
if (!_doc.TryGetValue(key, out val))
{
return null;
}
return val;
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
namespace Sir
{
public class KeyValueConfiguration : IConfigurationProvider
{
private IDictionary<string, string> _doc;
private readonly string _fileName;
public KeyValueConfiguration(string readFromFileName = null)
{
_doc = new Dictionary<string, string>();
_fileName = Path.Combine(Directory.GetCurrentDirectory(), readFromFileName);
OnFileChanged(null, null);
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = Directory.GetCurrentDirectory();
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
watcher.Filter = $"*{Path.GetExtension(readFromFileName)}";
watcher.Changed += new FileSystemEventHandler(OnFileChanged);
watcher.EnableRaisingEvents = true;
}
private void OnFileChanged(object sender, FileSystemEventArgs e)
{
if (e != null && e.FullPath != _fileName)
{
return;
}
var dic = new Dictionary<string, string>();
string text;
using (var fs = new FileStream(_fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (var r = new StreamReader(fs))
{
text = r.ReadToEnd();
}
foreach (var line in text.Split('\n', StringSplitOptions.RemoveEmptyEntries))
{
var segs = line.Split('=');
dic.Add(segs[0].Trim(), segs[1].Trim());
}
_doc = dic;
}
public string Get(string key)
{
string val;
if (!_doc.TryGetValue(key, out val))
{
return null;
}
return val;
}
}
}
| mit | C# |
1d8dc96d75c526f3341f590a270e29de61cff2ee | Update TermFindSettingsAttribute | atata-framework/atata,YevgeniyShunevych/Atata,atata-framework/atata,YevgeniyShunevych/Atata | src/Atata/Attributes/TermFindSettingsAttribute.cs | src/Atata/Attributes/TermFindSettingsAttribute.cs | using System;
namespace Atata
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
public class TermFindSettingsAttribute : Attribute
{
public TermFindSettingsAttribute(FindTermBy by, TermFormat format = TermFormat.Inherit, TermMatch match = TermMatch.Inherit)
: this(by.ResolveFindAttributeType(), format, match)
{
}
public TermFindSettingsAttribute(Type finderAttributeType, TermFormat format = TermFormat.Inherit, TermMatch match = TermMatch.Inherit)
{
FinderAttributeType = finderAttributeType;
Format = format;
Match = match;
}
public Type FinderAttributeType { get; private set; }
public TermFormat Format { get; set; }
public new TermMatch Match { get; set; }
}
}
| using System;
namespace Atata
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited = true)]
public class TermFindSettingsAttribute : Attribute
{
public TermFindSettingsAttribute(Type finderAttributeType, TermFormat format = TermFormat.Inherit, TermMatch match = TermMatch.Inherit)
{
FinderAttributeType = finderAttributeType;
Format = format;
Match = match;
}
public Type FinderAttributeType { get; private set; }
public TermFormat Format { get; set; }
public new TermMatch Match { get; set; }
}
}
| apache-2.0 | C# |
d4e60da38f3f02458494b3089003e6b8a2c43c75 | Include build number in version | Netuitive/collectdwin,Netuitive/netuitive-windows-agent | src/CollectdWinService/Properties/AssemblyInfo.cs | src/CollectdWinService/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("CollectdWinService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Bloomberg LP")]
[assembly: AssemblyProduct("CollectdWinService")]
[assembly: AssemblyCopyright("Copyright © Bloomberg LP 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("dc0404f4-acd7-40b3-ab7a-6e63f023ac40")]
// 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.6.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("CollectdWinService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Bloomberg LP")]
[assembly: AssemblyProduct("CollectdWinService")]
[assembly: AssemblyCopyright("Copyright © Bloomberg LP 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("dc0404f4-acd7-40b3-ab7a-6e63f023ac40")]
// 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.5.2.0")]
[assembly: AssemblyFileVersion("0.5.2.0")] | apache-2.0 | C# |
6a6c908b74925e1255357871cc6e07f33cab4897 | add meta tag to disable compatibility mode in IE | IdentityServer/IdentityServer2,kjnilsson/Thinktecture.IdentityServer.v2,IdentityServer/IdentityServer2,rfavillejr/Thinktecture.IdentityServer.v2,rfavillejr/Thinktecture.IdentityServer.v2,rfavillejr/Thinktecture.IdentityServer.v2,kjnilsson/Thinktecture.IdentityServer.v2,kjnilsson/Thinktecture.IdentityServer.v2,IdentityServer/IdentityServer2 | src/OnPremise/WebSite/Views/Shared/_Layout.cshtml | src/OnPremise/WebSite/Views/Shared/_Layout.cshtml | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
@Styles.Render("~/Content/themes/base/css", "~/Content/css")
@RenderSection("styles", false)
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="masterHeader">
<img src="@Url.Content("~/Content/images/logo.jpg")" alt="Logo" />
<h2 class="masterHeaderText">@ViewBag.SiteName</h2>
</div>
<div class="menu">
@if (ViewBag.IsAdministrator)
{
@Html.ActionLink("[administration]", "index", "home", new{area="Admin"}, null)
@:
<a href="http://wiki.thinktecture.com/IdentityServer.MainPage.ashx" target="_blank">[docs]</a>
@:
}
@if (ViewBag.IsSignedIn)
{
@Html.ActionLink("[home]", "index", "home", new{area=""}, null)
@:
@Html.ActionLink("[sign out]", "signout", "account", new{area=""}, null)
@:
@:(signed in as @Context.User.Identity.Name)
}
else
{
@Html.ActionLink("[home]", "index", "home", new{area=""}, null)
@:
@Html.ActionLink("[sign in]", "signin", "account", new{area=""}, null)
}
</div>
<section id="main-section">
@RenderBody()
</section>
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/themes/base/css", "~/Content/css")
@RenderSection("styles", false)
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="masterHeader">
<img src="@Url.Content("~/Content/images/logo.jpg")" alt="Logo" />
<h2 class="masterHeaderText">@ViewBag.SiteName</h2>
</div>
<div class="menu">
@if (ViewBag.IsAdministrator)
{
@Html.ActionLink("[administration]", "index", "home", new{area="Admin"}, null)
@:
<a href="http://wiki.thinktecture.com/IdentityServer.MainPage.ashx" target="_blank">[docs]</a>
@:
}
@if (ViewBag.IsSignedIn)
{
@Html.ActionLink("[home]", "index", "home", new{area=""}, null)
@:
@Html.ActionLink("[sign out]", "signout", "account", new{area=""}, null)
@:
@:(signed in as @Context.User.Identity.Name)
}
else
{
@Html.ActionLink("[home]", "index", "home", new{area=""}, null)
@:
@Html.ActionLink("[sign in]", "signin", "account", new{area=""}, null)
}
</div>
<section id="main-section">
@RenderBody()
</section>
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)
</body>
</html>
| bsd-3-clause | C# |
b642c97a57b86980e0c52950ebabf70d9a6fe86e | Fix phone number column in employees grid | dmytrokuzmin/RepairisCore,dmytrokuzmin/RepairisCore,dmytrokuzmin/RepairisCore | src/Repairis.Web.Mvc/Views/Employees/Index.cshtml | src/Repairis.Web.Mvc/Views/Employees/Index.cshtml | @{
ViewBag.Title = "Employees";
}
<h3>Employees</h3>
<p>
<a asp-action="Create" class="btn btn-success"><i class="fa fa-plus"></i> New employee</a>
</p>
<ej-grid id="Employees" allow-text-wrap="true" allow-selection="false" allow-sorting="true" allow-paging="true" allow-filtering="true" enable-touch="false" allow-resize-to-fit="true" enable-alt-row="false">
<e-datamanager url="/api/Employees" adaptor="UrlAdaptor" offline="false" />
<e-sort-settings>
<e-sorted-columns>
<e-sorted-column field="Surname" direction="Ascending" />
</e-sorted-columns>
</e-sort-settings>
<e-page-settings page-size="10" />
<e-filter-settings filter-type="Excel" />
<e-columns>
<e-column template-id="#gridActionsTemplate" allow-sorting="false" allow-filtering="false" allow-grouping="false" width="50" />
<e-column field="Surname" type="string" header-text="@L("Surname")" text-align="Center" width="100" />
<e-column field="Name" type="string" header-text="@L("Name")" text-align="Center" width="100" />
<e-column field="FatherName" type="string" header-text="@L("FatherName")" text-align="Center" width="100" />
<e-column field="AdditionalInfo" type="string" header-text="@L("AdditionalInfo")" />
<e-column field="PhoneNumber" type="string" header-text="@L("MobilePhoneNumber")" width="100" />
<e-column field="SecondaryPhoneNumber" type="string" header-text="@L("SecondaryPhoneNumber")" width="100" />
<e-column field="EmailAddress" type="string" header-text="@L("Email")" />
<e-column field="Address" type="string" header-text="@L("Address")" />
</e-columns>
</ej-grid>
<script id="gridActionsTemplate" type="text/x-jsrender">
<a href="/Employees/Edit/{{:Id}}"><i class="fa fa-pencil text-success fa" aria-hidden="true"></i></a>
<a href="/Employees/Delete/{{:Id}}"><i class="fa fa-trash-o text-danger fa" aria-hidden="true"></i></a>
</script> | @{
ViewBag.Title = "Employees";
}
<h3>Employees</h3>
<p>
<a asp-action="Create" class="btn btn-success"><i class="fa fa-plus"></i> New employee</a>
</p>
<ej-grid id="Employees" allow-text-wrap="true" allow-selection="false" allow-sorting="true" allow-paging="true" allow-filtering="true" enable-touch="false" allow-resize-to-fit="true" enable-alt-row="false">
<e-datamanager url="/api/Employees" adaptor="UrlAdaptor" offline="false" />
<e-sort-settings>
<e-sorted-columns>
<e-sorted-column field="Surname" direction="Ascending" />
</e-sorted-columns>
</e-sort-settings>
<e-page-settings page-size="10" />
<e-filter-settings filter-type="Excel" />
<e-columns>
<e-column template-id="#gridActionsTemplate" allow-sorting="false" allow-filtering="false" allow-grouping="false" width="50" />
<e-column field="Surname" type="string" header-text="@L("Surname")" text-align="Center" width="100" />
<e-column field="Name" type="string" header-text="@L("Name")" text-align="Center" width="100" />
<e-column field="FatherName" type="string" header-text="@L("FatherName")" text-align="Center" width="100" />
<e-column field="AdditionalInfo" type="string" header-text="@L("AdditionalInfo")" />
<e-column field="CustomerPhoneNumber" type="string" header-text="@L("MobilePhoneNumber")" width="100" />
<e-column field="SecondaryPhoneNumber" type="string" header-text="@L("SecondaryPhoneNumber")" width="100" />
<e-column field="EmailAddress" type="string" header-text="@L("Email")" />
<e-column field="Address" type="string" header-text="@L("Address")" />
</e-columns>
</ej-grid>
<script id="gridActionsTemplate" type="text/x-jsrender">
<a href="/Employees/Edit/{{:Id}}"><i class="fa fa-pencil text-success fa" aria-hidden="true"></i></a>
<a href="/Employees/Delete/{{:Id}}"><i class="fa fa-trash-o text-danger fa" aria-hidden="true"></i></a>
</script> | mit | C# |
13a0d4eadcd77c4e7a804a4335f6c03401e5dcf3 | Fix show-build-chain logic to properly detect cloned build configs. | ComputerWorkware/TeamCityApi | src/TeamCityApi/UseCases/ShowBuildChainUseCase.cs | src/TeamCityApi/UseCases/ShowBuildChainUseCase.cs | using System.Linq;
using System.Threading.Tasks;
using TeamCityApi.Helpers;
using TeamCityApi.Logging;
namespace TeamCityApi.UseCases
{
public class ShowBuildChainUseCase
{
private static readonly ILog Log = LogProvider.GetLogger(typeof(ShowBuildChainUseCase));
private readonly ITeamCityClient _client;
public ShowBuildChainUseCase(ITeamCityClient client)
{
_client = client;
}
public async Task Execute(string buildConfigId)
{
Log.Info("================Show Build Chain: start ================");
var buildConfig = await _client.BuildConfigs.GetByConfigurationId(buildConfigId);
var buildChainId = buildConfig.Parameters[ParameterName.BuildConfigChainId].Value;
var buildConfigChain = new BuildConfigChain(_client.BuildConfigs, buildConfig);
ShowBuildChain(buildConfigChain, buildChainId);
}
private static void ShowBuildChain(BuildConfigChain buildConfigChain, string buildChainId)
{
foreach (var node in buildConfigChain.Nodes.OrderBy(n=>n.Value.Id))
{
Log.InfoFormat(
!string.IsNullOrEmpty(node.Value.Parameters[ParameterName.ClonedFromBuildId]?.Value)
? "BuildConfigId: (CLONED) {0}"
: "BuildConfigId: {0}", node.Value.Id);
}
}
}
} | using System.Linq;
using System.Threading.Tasks;
using TeamCityApi.Helpers;
using TeamCityApi.Logging;
namespace TeamCityApi.UseCases
{
public class ShowBuildChainUseCase
{
private static readonly ILog Log = LogProvider.GetLogger(typeof(ShowBuildChainUseCase));
private readonly ITeamCityClient _client;
public ShowBuildChainUseCase(ITeamCityClient client)
{
_client = client;
}
public async Task Execute(string buildConfigId)
{
Log.Info("================Show Build Chain: start ================");
var buildConfig = await _client.BuildConfigs.GetByConfigurationId(buildConfigId);
var buildChainId = buildConfig.Parameters[ParameterName.BuildConfigChainId].Value;
var buildConfigChain = new BuildConfigChain(_client.BuildConfigs, buildConfig);
ShowBuildChain(buildConfigChain, buildChainId);
}
private static void ShowBuildChain(BuildConfigChain buildConfigChain, string buildChainId)
{
foreach (var node in buildConfigChain.Nodes)
{
if (node.Value.Parameters[ParameterName.BuildConfigChainId].Value == buildChainId)
{
Log.InfoFormat("BuildConfigId: (CLONED) {0}", node.Value.Id);
}
else
{
Log.InfoFormat("BuildConfigId: {0}", node.Value.Id);
}
}
}
}
} | mit | C# |
6297bcb16ac9a6688612aacd39a5d56f643ccfe8 | Update version to 1.3.7 | anonymousthing/ListenMoeClient | Properties/AssemblyInfo.cs | 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("Listen.moe Client")]
[assembly: AssemblyProduct("Listen.moe Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright 2017 Listen.moe. All rights reserved.")]
// 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("88b02799-425e-4622-a849-202adb19601b")]
// 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.7.0")]
[assembly: AssemblyFileVersion("1.3.7.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("Listen.moe Client")]
[assembly: AssemblyProduct("Listen.moe Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright 2017 Listen.moe. All rights reserved.")]
// 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("88b02799-425e-4622-a849-202adb19601b")]
// 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.6.0")]
[assembly: AssemblyFileVersion("1.3.6.0")]
| mit | C# |
05422eb5f04f80def2e9d372d54f3a0caa94f40f | Fix a typo in WasmType | jonathanvdc/cs-wasm,jonathanvdc/cs-wasm | libwasm/WasmType.cs | libwasm/WasmType.cs | namespace Wasm
{
/// <summary>
/// An enumeration of WebAssembly language types.
/// </summary>
public enum WasmType : sbyte
{
/// <summary>
/// A 32-bit integer type.
/// </summary>
Int32 = -0x01,
/// <summary>
/// A 64-bit integer type.
/// </summary>
Int64 = -0x02,
/// <summary>
/// A 32-bit floating-point type.
/// </summary>
Float32 = -0x03,
/// <summary>
/// A 64-bit floating-point type.
/// </summary>
Float64 = -0x04,
/// <summary>
/// A pointer to a function of any type.
/// </summary>
AnyFunc = -0x10,
/// <summary>
/// The type of function declarations.
/// </summary>
Func = -0x20,
/// <summary>
/// A pseudo-type for representing an empty block type.
/// </summary>
Empty = -0x40
}
/// <summary>
/// An enumeration of WebAssembly value types.
/// </summary>
public enum WasmValueType : sbyte
{
/// <summary>
/// A 32-bit integer type.
/// </summary>
Int32 = -0x01,
/// <summary>
/// A 64-bit integer type.
/// </summary>
Int64 = -0x02,
/// <summary>
/// A 32-bit floating-point type.
/// </summary>
Float32 = -0x03,
/// <summary>
/// A 64-bit floating-point type.
/// </summary>
Float64 = -0x04
}
} | namespace Wasm
{
/// <summary>
/// An enumeration of WebAssembly language types.
/// </summary>
public enum WasmType : sbyte
{
/// <summary>
/// A 32-bit integer type.
/// </summary>
Int32 = -0x01,
/// <summary>
/// A 64-bit integer type.
/// </summary>
Int64 = -0x02,
/// <summary>
/// A 32-bit floating-point type.
/// </summary>
Float32 = -0x03,
/// <summary>
/// A 64-bit floating-point type.
/// </summary>
Float64 = -0x04,
/// <summary>
/// A pointer to a function of any type.
/// </summary>
AnyFunc = -0x10,
/// <summary>
/// The type of function declarations.
/// </summary>
Func = -0x20,
/// <summary>
/// A pseudo-type for for representing an empty block type.
/// </summary>
Empty = -0x40
}
/// <summary>
/// An enumeration of WebAssembly value types.
/// </summary>
public enum WasmValueType : sbyte
{
/// <summary>
/// A 32-bit integer type.
/// </summary>
Int32 = -0x01,
/// <summary>
/// A 64-bit integer type.
/// </summary>
Int64 = -0x02,
/// <summary>
/// A 32-bit floating-point type.
/// </summary>
Float32 = -0x03,
/// <summary>
/// A 64-bit floating-point type.
/// </summary>
Float64 = -0x04
}
} | mit | C# |
9ec4009e495f0fcbda967e30a5c29d11a809fb09 | Update ICompositeCurrencyConverter.cs | tiksn/TIKSN-Framework | TIKSN.Core/Finance/ICompositeCurrencyConverter.cs | TIKSN.Core/Finance/ICompositeCurrencyConverter.cs | namespace TIKSN.Finance
{
public interface ICompositeCurrencyConverter : ICurrencyConverter
{
void Add(ICurrencyConverter converter);
}
}
| namespace TIKSN.Finance
{
public interface ICompositeCurrencyConverter : ICurrencyConverter
{
void Add(ICurrencyConverter converter);
}
} | mit | C# |
446145337231bdb63a21d4fb46159e75c897886e | Update bot builder assembly version 1.12.9 | mmatkow/BotBuilder,xiangyan99/BotBuilder,msft-shahins/BotBuilder,xiangyan99/BotBuilder,stevengum97/BotBuilder,dr-em/BotBuilder,msft-shahins/BotBuilder,yakumo/BotBuilder,dr-em/BotBuilder,msft-shahins/BotBuilder,xiangyan99/BotBuilder,Clairety/ConnectMe,mmatkow/BotBuilder,Clairety/ConnectMe,Clairety/ConnectMe,xiangyan99/BotBuilder,stevengum97/BotBuilder,stevengum97/BotBuilder,mmatkow/BotBuilder,yakumo/BotBuilder,Clairety/ConnectMe,yakumo/BotBuilder,stevengum97/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,mmatkow/BotBuilder,dr-em/BotBuilder,dr-em/BotBuilder | CSharp/Library/Properties/AssemblyInfo.cs | CSharp/Library/Properties/AssemblyInfo.cs | using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Bot.Builder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Bot Builder")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.12.9.0")]
[assembly: AssemblyFileVersion("1.12.9.0")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]
[assembly: NeutralResourcesLanguage("en")]
| using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Bot.Builder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Bot Builder")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cdfec7d6-847e-4c13-956b-0a960ae3eb60")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.12.8.0")]
[assembly: AssemblyFileVersion("1.12.8.0")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]
[assembly: NeutralResourcesLanguage("en")]
| mit | C# |
1530828388294f5f6ec1e6634ef6bc07387c955e | Update sql server versions | KankuruSQL/KMO | KVersion.cs | KVersion.cs | namespace KMO
{
public static class KVersion
{
public const int Sp2017 = 1000;
public const int Cu2017 = 3048;
public const int Sp2016 = 5026;
public const int Cu2016 = 5264;
public const int Sp2014 = 6024;
public const int Cu2014 = 6214;
public const int Sp2012 = 7001;
public const int Cu2012 = 7469;
public const int Sp2008R2 = 6000;
public const int Cu2008R2 = 6560;
public const int Sp2008 = 6000;
public const int Cu2008 = 6556;
public const int Sp2005 = 5000;
public const int Cu2005 = 5324;
public const string Sp2017Link = "https://www.microsoft.com/en-us/sql-server/sql-server-downloads";
public const string Cu2017Link = "https://support.microsoft.com/en-us/help/4466404";
public const string Sp2016Link = "https://www.microsoft.com/en-us/download/details.aspx?id=56836";
public const string Cu2016Link = "https://support.microsoft.com/en-us/help/4475776";
public const string Sp2014Link = "https://support.microsoft.com/en-us/help/4022619";
public const string Cu2014Link = "https://support.microsoft.com/en-us/help/4482960";
public const string Sp2012Link = "https://www.microsoft.com/en-us/download/details.aspx?id=56040";
public const string Cu2012Link = "https://support.microsoft.com/en-us/help/4091266";
public const string Sp2008R2Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44271";
public const string Cu2008R2Link = "https://support.microsoft.com/en-us/help/4057113";
public const string Sp2008Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44278";
public const string Cu2008Link = "https://support.microsoft.com/en-us/help/4057114";
public const string Sp2005Link = "http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b953e84f-9307-405e-bceb-47bd345baece";
public const string Cu2005Link = "http://support.microsoft.com/kb/2716427";
}
}
| namespace KMO
{
public static class KVersion
{
public const int Sp2017 = 1000;
public const int Cu2017 = 3008;
public const int Sp2016 = 4001;
public const int Cu2016 = 4457;
public const int Sp2014 = 5000;
public const int Cu2014 = 5557;
public const int Sp2012 = 7001;
public const int Cu2012 = 7001;
public const int Sp2008R2 = 6000;
public const int Cu2008R2 = 6542;
public const int Sp2008 = 6000;
public const int Cu2008 = 6547;
public const int Sp2005 = 5000;
public const int Cu2005 = 5324;
public const string Sp2017Link = "https://www.microsoft.com/en-us/sql-server/sql-server-downloads";
public const string Cu2017Link = "https://support.microsoft.com/en-us/help/4052574";
public const string Sp2016Link = "https://www.microsoft.com/en-us/download/details.aspx?id=54276";
public const string Cu2016Link = "https://support.microsoft.com/en-us/help/4037354";
public const string Sp2014Link = "https://www.microsoft.com/en-us/download/details.aspx?id=53168";
public const string Cu2014Link = "https://support.microsoft.com/en-us/help/4037356";
public const string Sp2012Link = "https://www.microsoft.com/en-us/download/details.aspx?id=56040";
public const string Cu2012Link = "https://www.microsoft.com/en-us/download/details.aspx?id=56040";
public const string Sp2008R2Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44271";
public const string Cu2008R2Link = "https://support.microsoft.com/en-us/kb/3146034";
public const string Sp2008Link = "http://www.microsoft.com/en-us/download/details.aspx?id=44278";
public const string Cu2008Link = "https://support.microsoft.com/en-us/kb/3146034";
public const string Sp2005Link = "http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b953e84f-9307-405e-bceb-47bd345baece";
public const string Cu2005Link = "http://support.microsoft.com/kb/2716427";
}
}
| mit | C# |
ad207dbb5b3e0a21f754af86edc340e3257784fd | Duplicate some methods from TransformExtensions for convenience | mysticfall/Alensia | Assets/Alensia/Core/Common/ComponentExtensions.cs | Assets/Alensia/Core/Common/ComponentExtensions.cs | using System.Collections.Generic;
using UnityEngine;
namespace Alensia.Core.Common
{
public static class ComponentExtensions
{
public static T GetOrAddComponent<T>(this Component component) where T : Component
{
return component.GetComponent<T>() ?? component.gameObject.AddComponent<T>();
}
public static IEnumerable<Transform> GetChildren(this Component parent) => parent.transform.GetChildren();
public static T FindComponent<T>(this Component parent, string path) where T : class =>
parent.transform.Find(path)?.GetComponent<T>();
public static T FindComponentInChildren<T>(this Component parent, string path) where T : class =>
parent.transform.Find(path)?.GetComponentInChildren<T>();
}
} | using UnityEngine;
namespace Alensia.Core.Common
{
public static class ComponentExtensions
{
public static T GetOrAddComponent<T>(this Component component) where T : Component
{
return component.GetComponent<T>() ?? component.gameObject.AddComponent<T>();
}
}
} | apache-2.0 | C# |
9eae551eda09ca03a8d17f5f938a20550fd6eb52 | Correct star image | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/V2/Index.cshtml | src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/V2/Index.cshtml | @model SFA.DAS.EmployerAccounts.Web.OrchestratorResponse<SFA.DAS.EmployerAccounts.Web.ViewModels.AccountDashboardViewModel>
@{
ViewBag.Title = "Home";
ViewBag.PageID = "page-company-homepage";
}
<div class="das-dashboard-header das-section--header">
<div class="govuk-width-container das-dashboard-header__border">
<h1 class="govuk-heading-m das-account__title">Your employer account</h1>
<h2 class="govuk-heading-l das-account__account-name">@Model.Data.Account.Name</h2>
<a href="@Url.FavouritesAction()" class="das-favourites-link govuk-body">
<span class="das-favourites-link__icon"><img src="@Html.CdnLink("images", "favourite-unchecked-black.svg")" alt=""></span>
<span class="das-favourites-link__text">View saved favourites</span>
</a>
</div>
</div>
<main class="govuk-main-wrapper das-section--dashboard" id="main-content" role="main">
<div class="govuk-width-container">
<div class="das-panels">
<div class="das-panels__col das-panels__col--primary">
@Html.Action("Row1Panel1", new { model = Model.Data })
@Html.Action("Row2Panel1", new { model = Model.Data })
</div>
<div class="das-panels__col das-panels__col--secondary">
@Html.Action("Row1Panel2", new { model = Model.Data })
@Html.Action("Row2Panel2", new { model = Model.Data })
</div>
</div>
</div>
</main>
| @model SFA.DAS.EmployerAccounts.Web.OrchestratorResponse<SFA.DAS.EmployerAccounts.Web.ViewModels.AccountDashboardViewModel>
@{
ViewBag.Title = "Home";
ViewBag.PageID = "page-company-homepage";
}
<div class="das-dashboard-header das-section--header">
<div class="govuk-width-container das-dashboard-header__border">
<h1 class="govuk-heading-m das-account__title">Your employer account</h1>
<h2 class="govuk-heading-l das-account__account-name">@Model.Data.Account.Name</h2>
<a href="@Url.FavouritesAction()" class="das-favourites-link govuk-body">
<span class="das-favourites-link__icon"><img src="/images/favourite-unchecked-black.svg" alt=""></span>
<span class="das-favourites-link__text">View saved favourites</span>
</a>
</div>
</div>
<main class="govuk-main-wrapper das-section--dashboard" id="main-content" role="main">
<div class="govuk-width-container">
<div class="das-panels">
<div class="das-panels__col das-panels__col--primary">
@Html.Action("Row1Panel1", new { model = Model.Data })
@Html.Action("Row2Panel1", new { model = Model.Data })
</div>
<div class="das-panels__col das-panels__col--secondary">
@Html.Action("Row1Panel2", new { model = Model.Data })
@Html.Action("Row2Panel2", new { model = Model.Data })
</div>
</div>
</div>
</main>
| mit | C# |
d87dd89a369eee742425a9c7ed87848687f9a54f | Bump version to 0.7.5 | 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.7.5.0")]
[assembly: AssemblyFileVersion("0.7.5.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.7.4.0")]
[assembly: AssemblyFileVersion("0.7.4.0")] | apache-2.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.