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 |
|---|---|---|---|---|---|---|---|---|
eb74f64295dae77c811afade79d751e8c4af8b6d | Update UIComponentAttribute | atata-framework/atata,atata-framework/atata,YevgeniyShunevych/Atata,YevgeniyShunevych/Atata | src/Atata/Attributes/UIComponentAttribute.cs | src/Atata/Attributes/UIComponentAttribute.cs | using System;
using System.Linq;
namespace Atata
{
[AttributeUsage(AttributeTargets.Class)]
public class UIComponentAttribute : Attribute
{
public UIComponentAttribute(string elementXPath)
: this(elementXPath, null)
{
}
public UIComponentAttribute(string elementXPath, string idFinderFormat)
{
ElementXPath = elementXPath;
IdFinderFormat = idFinderFormat;
}
public string ElementXPath { get; private set; }
public string IdFinderFormat { get; private set; }
public string IgnoreNameEndings { get; set; }
public string[] GetIgnoreNameEndingValues()
{
return IgnoreNameEndings != null ? IgnoreNameEndings.Split(',').Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : new string[0];
}
}
}
| using System;
using System.Linq;
namespace Atata
{
[AttributeUsage(AttributeTargets.Class)]
public class UIComponentAttribute : Attribute
{
public UIComponentAttribute(string elementXPath, string idFinderFormat = null)
{
ElementXPath = elementXPath;
IdFinderFormat = idFinderFormat;
}
public string ElementXPath { get; private set; }
public string IdFinderFormat { get; private set; }
public string IgnoreNameEndings { get; set; }
public string[] GetIgnoreNameEndingValues()
{
return IgnoreNameEndings != null ? IgnoreNameEndings.Split(',').Where(x => !string.IsNullOrWhiteSpace(x)).ToArray() : new string[0];
}
}
}
| apache-2.0 | C# |
b4a244041e42b5fd889635eb0602791291606099 | Save created towers in an array | emazzotta/unity-tower-defense | Assets/Scripts/GameController.cs | Assets/Scripts/GameController.cs | using UnityEngine;
using System.Collections;
public class GameController : MonoBehaviour {
public GameObject towerBase;
public GameObject gameField;
private GameObject[,] towerBases;
private int gameFieldWidth = 0;
private int gameFieldHeight = 0;
void Start () {
this.gameFieldWidth = (int)(gameField.transform.localScale.x);
this.gameFieldHeight = (int)(gameField.transform.localScale.z);
this.towerBases = new GameObject[this.gameFieldWidth, this.gameFieldHeight];
this.initGamePlatform ();
}
void initGamePlatform() {
for (int x = 0; x < this.gameFieldWidth; x++) {
for (int z = 0; z < this.gameFieldHeight; z++) {
GameObject newTowerBase = Instantiate (towerBase);
newTowerBase.AddComponent<Rigidbody> ();
newTowerBase.transform.position = new Vector3 (towerBase.transform.position.x+x, 0.1f, towerBase.transform.position.z-z);
this.towerBases [x, z] = newTowerBase;
}
}
}
}
| using UnityEngine;
using System.Collections;
public class GameController : MonoBehaviour {
public GameObject towerBase;
public GameObject gameField;
void Start () {
Debug.Log ("GameController: Game Started");
this.initGamePlatform ();
}
void Update () {
}
void initGamePlatform() {
for (int x = 0; x < gameField.transform.localScale.x; x++) {
for (int z = 0; z < gameField.transform.localScale.z; z++) {
GameObject newTowerBase = Instantiate (towerBase);
newTowerBase.AddComponent<Rigidbody> ();
newTowerBase.transform.position = new Vector3 (towerBase.transform.position.x+x, 0.1f, towerBase.transform.position.z-z);
// TODO:: Set transform to Parent.
// Doesn't work: newTowerBase.transform.SetParent (towerBase.transform);
}
}
}
}
| mit | C# |
7a2b5dc25422bb80d61cf5d48c4e43ca80e7e1cf | Rename properties | mstrother/BmpListener | BmpListener/Bmp/BmpPeerHeader.cs | BmpListener/Bmp/BmpPeerHeader.cs | using System;
using System.Linq;
using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace BmpListener.Bmp
{
public class BmpPeerHeader
{
public BmpPeerHeader(ArraySegment<byte> data)
{
Decode(data);
}
public PeerType Type { get; private set; }
public bool IsPostPolicy { get; private set; }
public ulong PeerDistinguisher { get; private set; }
public IPAddress PeerAddress { get; private set; }
public uint AS { get; private set; }
public IPAddress PeerBGPId { get; private set; }
public DateTime DateTime { get; private set; }
public void Decode(ArraySegment<byte> data)
{
Type = (PeerType) data.First();
var flags = data.ElementAt(1);
if ((flags & (1 << 6)) != 0)
IsPostPolicy = true;
if ((flags & (1 << 7)) != 0)
{
var ipBytes = data.Skip(10).Take(16).ToArray();
PeerAddress = new IPAddress(ipBytes);
}
else
{
var ipBytes = data.Skip(22).Take(4).ToArray();
PeerAddress = new IPAddress(ipBytes);
}
PeerDistinguisher = BitConverter.ToUInt64(data.Skip(2).Take(8).Reverse().ToArray(), 0);
AS = data.ToUInt32(26);
PeerBGPId = new IPAddress(data.Skip(30).Take(4).ToArray());
var seconds = data.ToUInt32(34);
var microSeconds = data.ToUInt32(38);
DateTime =
DateTimeOffset.FromUnixTimeSeconds(seconds).AddTicks(microSeconds * 10).DateTime.ToUniversalTime();
}
}
} | using System;
using System.Linq;
using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace BmpListener.Bmp
{
public class BmpPeerHeader
{
public BmpPeerHeader(ArraySegment<byte> data)
{
Decode(data);
}
public PeerType PeerType { get; private set; }
public bool IsPostPolicy { get; private set; }
public ulong PeerDistinguisher { get; private set; }
public IPAddress PeerAddress { get; private set; }
public uint PeerAS { get; private set; }
public IPAddress PeerBGPId { get; private set; }
public DateTime DateTime { get; private set; }
public void Decode(ArraySegment<byte> data)
{
PeerType = (PeerType) data.First();
var flags = data.ElementAt(1);
if ((flags & (1 << 6)) != 0)
IsPostPolicy = true;
if ((flags & (1 << 7)) != 0)
{
var ipBytes = data.Skip(10).Take(16).ToArray();
PeerAddress = new IPAddress(ipBytes);
}
else
{
var ipBytes = data.Skip(22).Take(4).ToArray();
PeerAddress = new IPAddress(ipBytes);
}
PeerDistinguisher = BitConverter.ToUInt64(data.Skip(2).Take(8).Reverse().ToArray(), 0);
PeerAS = data.ToUInt32(26);
PeerBGPId = new IPAddress(data.Skip(30).Take(4).ToArray());
var seconds = data.ToUInt32(34);
var microSeconds = data.ToUInt32(38);
DateTime =
DateTimeOffset.FromUnixTimeSeconds(seconds).AddTicks(microSeconds * 10).DateTime.ToUniversalTime();
}
}
} | mit | C# |
133dc6728be3872a94a8d63fa3788e1937dbe39c | make url parameter optional to handle api/v2/ root requests | Pondidum/NuCache,Pondidum/NuCache,Pondidum/NuCache | NuCache/Controllers/PackagesController.cs | NuCache/Controllers/PackagesController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Threading.Tasks;
namespace NuCache.Controllers
{
public class PackagesController : ApiController
{
private readonly IPackageSource _packageSource;
private readonly IDictionary<Func<String, bool>, Func<HttpRequestMessage, Task<HttpResponseMessage>>> _dispatchers;
public PackagesController(IPackageSource source)
{
_packageSource = source;
_dispatchers = new Dictionary<Func<string, bool>, Func<HttpRequestMessage, Task<HttpResponseMessage>>>();
var ignore = StringComparison.OrdinalIgnoreCase;
_dispatchers.Add(
u => string.IsNullOrWhiteSpace(u),
r => _packageSource.Get(r));
_dispatchers.Add(
u => string.Equals(u, "$metadata", ignore),
r => _packageSource.Metadata(r));
_dispatchers.Add(
u => u.StartsWith("packages", ignore),
r => _packageSource.List(r));
_dispatchers.Add(
u => u.StartsWith("FindPackagesByID()", ignore),
r => _packageSource.FindPackagesByID(r));
_dispatchers.Add(
u => u.StartsWith( "search()", ignore),
r => _packageSource.Search(r));
_dispatchers.Add(
u => u.StartsWith("package", ignore),
r => _packageSource.GetPackageByID(r));
_dispatchers.Add(
u => string.Equals(u, "package-ids", ignore),
r => _packageSource.GetPackageIDs(r));
}
[HttpGet]
public async Task<HttpResponseMessage> Dispatch(string url = "")
{
var dispatcher = _dispatchers.FirstOrDefault(d => d.Key(url)).Value;
if (dispatcher == null)
{
return null;
}
return await dispatcher(Request);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Threading.Tasks;
namespace NuCache.Controllers
{
public class PackagesController : ApiController
{
private readonly IPackageSource _packageSource;
private readonly IDictionary<Func<String, bool>, Func<HttpRequestMessage, Task<HttpResponseMessage>>> _dispatchers;
public PackagesController(IPackageSource source)
{
_packageSource = source;
_dispatchers = new Dictionary<Func<string, bool>, Func<HttpRequestMessage, Task<HttpResponseMessage>>>();
var ignore = StringComparison.OrdinalIgnoreCase;
_dispatchers.Add(
u => string.IsNullOrWhiteSpace(u),
r => _packageSource.Get(r));
_dispatchers.Add(
u => string.Equals(u, "$metadata", ignore),
r => _packageSource.Metadata(r));
_dispatchers.Add(
u => u.StartsWith("packages", ignore),
r => _packageSource.List(r));
_dispatchers.Add(
u => u.StartsWith("FindPackagesByID()", ignore),
r => _packageSource.FindPackagesByID(r));
_dispatchers.Add(
u => u.StartsWith( "search()", ignore),
r => _packageSource.Search(r));
_dispatchers.Add(
u => u.StartsWith("package", ignore),
r => _packageSource.GetPackageByID(r));
_dispatchers.Add(
u => string.Equals(u, "package-ids", ignore),
r => _packageSource.GetPackageIDs(r));
}
[HttpGet]
public async Task<HttpResponseMessage> Dispatch(string url)
{
var dispatcher = _dispatchers.FirstOrDefault(d => d.Key(url)).Value;
if (dispatcher == null)
{
return null;
}
return await dispatcher(Request);
}
}
}
| lgpl-2.1 | C# |
668012399979acf859a2634efb6856669124de7d | return statuscode result | Pondidum/OctopusStore,Pondidum/OctopusStore | OctopusStore/Consul/KeyValueController.cs | OctopusStore/Consul/KeyValueController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using OctopusStore.Infrastructure;
namespace OctopusStore.Consul
{
public class KeyValueController : ApiController
{
private readonly VariableStore _store;
public KeyValueController(VariableStore store)
{
_store = store;
}
public IEnumerable<ValueModel> GetKv(string keyGreedy)
{
var key = keyGreedy ?? string.Empty;
var pairs = Request.GetQueryNameValuePairs();
var recurse = pairs.Any(pair => pair.Key.EqualsIgnore("recurse"));
var values = recurse
? _store.GetValuesPrefixed(key).ToList()
: _store.GetValue(key).ToList();
return values.Any()
? values
: null;
}
public HttpStatusCode PutKv([FromBody]string content, string keyGreedy)
{
var pairs = Request.GetQueryNameValuePairs();
_store.WriteValue(keyGreedy, model =>
{
model.Value = Convert.ToBase64String(Encoding.UTF8.GetBytes(content));
pairs
.Where(p => p.Key.EqualsIgnore("flags"))
.Select(p => Convert.ToInt32(p.Value))
.DoFirst(value => model.Flags = value);
});
return HttpStatusCode.OK;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using OctopusStore.Infrastructure;
namespace OctopusStore.Consul
{
public class KeyValueController : ApiController
{
private readonly VariableStore _store;
public KeyValueController(VariableStore store)
{
_store = store;
}
public IEnumerable<ValueModel> GetKv(string keyGreedy)
{
var key = keyGreedy ?? string.Empty;
var pairs = Request.GetQueryNameValuePairs();
var recurse = pairs.Any(pair => pair.Key.EqualsIgnore("recurse"));
var values = recurse
? _store.GetValuesPrefixed(key).ToList()
: _store.GetValue(key).ToList();
return values.Any()
? values
: null;
}
public HttpResponseMessage PutKv([FromBody]string content, string keyGreedy)
{
var pairs = Request.GetQueryNameValuePairs();
_store.WriteValue(keyGreedy, model =>
{
model.Value = Convert.ToBase64String(Encoding.UTF8.GetBytes(content));
pairs
.Where(p => p.Key.EqualsIgnore("flags"))
.Select(p => Convert.ToInt32(p.Value))
.DoFirst(value => model.Flags = value);
});
return new HttpResponseMessage(HttpStatusCode.OK);
}
}
}
| lgpl-2.1 | C# |
44a42a4c7d7e9f0f27d4ac8eb6f51c76974ee88e | add of generic GetSearchAlertViaSolr | Appleseed/base,Appleseed/base | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Providers/EmailAlertProvider.cs | Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Providers/EmailAlertProvider.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Appleseed.Base.Alerts.Model;
using System.Data;
using Dapper;
using System.Data.SqlClient;
using System.Configuration;
using System.Net;
using System.IO;
using Newtonsoft.Json;
namespace Appleseed.Base.Alerts.Providers
{
class EmailAlertProvider : IAlert
{
static IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
static string SolrURL = System.Configuration.ConfigurationManager.AppSettings["SolrURL"];
public List<UserAlert> GetUserAlertSchedules(string scheudle)
{
var userAlerts = db.Query<UserAlert>("GetPortalUserAlerts", new { alert_schedule = scheudle },
commandType: CommandType.StoredProcedure).ToList<UserAlert>();
return userAlerts;
}
public RootSolrObject GetSearchAlertViaSolr(string query)
{
// perform split function
string url = SolrURL + WebUtility.HtmlDecode(query);
HttpWebRequest getRequest = (HttpWebRequest)WebRequest.Create(url);
getRequest.Method = "GET";
using (var getResponse = (HttpWebResponse)getRequest.GetResponse())
{
Stream newStream = getResponse.GetResponseStream();
StreamReader sr = new StreamReader(newStream);
var result = sr.ReadToEnd();
var searchResults = JsonConvert.DeserializeObject<RootSolrObject>(result);
return searchResults;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Appleseed.Base.Alerts.Model;
using System.Data;
using Dapper;
using System.Data.SqlClient;
using System.Configuration;
namespace Appleseed.Base.Alerts.Providers
{
class EmailAlertProvider : IAlert
{
static IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
public List<UserAlert> GetUserAlertSchedules(string scheudle)
{
var userAlerts = db.Query<UserAlert>("GetPortalUserAlerts", new { alert_schedule = scheudle },
commandType: CommandType.StoredProcedure).ToList<UserAlert>();
return userAlerts;
}
}
}
| apache-2.0 | C# |
53d52dd90ab1106d51f68e381610db3a51405d0b | fix bug that only retrieves the parent folder instead of its files | StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis,StephenClearyApps/DotNetApis | service/DotNetApis.Storage/ReferenceStorage.cs | service/DotNetApis.Storage/ReferenceStorage.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using DotNetApis.Common;
using Microsoft.WindowsAzure.Storage.Blob;
namespace DotNetApis.Storage
{
public interface IReferenceStorage
{
/// <summary>
/// Returns the paths of reference folders available.
/// </summary>
Task<List<string>> GetFoldersAsync();
/// <summary>
/// Returns the paths of files within a specific folder. This includes .xml as well as .dll files.
/// </summary>
/// <param name="path">The path of the folder to search.</param>
Task<List<string>> GetFilesAsync(string path);
/// <summary>
/// Retrieves an assembly file from reference storage.
/// </summary>
/// <param name="path">The path of the file.</param>
Task<MemoryStream> DownloadAsync(string path);
}
public sealed class AzureReferenceStorage : IReferenceStorage
{
private readonly CloudBlobContainer _container;
public static string ContainerName { get; } = "reference";
public AzureReferenceStorage(CloudBlobContainer container)
{
_container = container;
}
public Task<List<string>> GetFoldersAsync() => ListAsync(null, results => results.OfType<CloudBlobDirectory>().Select(x => x.Prefix.TrimEnd('/')));
public Task<List<string>> GetFilesAsync(string path) => ListAsync(path + "/", results => results.OfType<CloudBlockBlob>().Select(x => x.Name));
private async Task<List<string>> ListAsync(string path, Func<IEnumerable<IListBlobItem>, IEnumerable<string>> handler)
{
var result = new List<string>();
BlobContinuationToken continuation = null;
do
{
var segment = await _container.ListBlobsSegmentedAsync(path, false, BlobListingDetails.None, null, continuation, null, null).ConfigureAwait(false);
continuation = segment.ContinuationToken;
result.AddRange(handler(segment.Results));
} while (continuation != null);
return result;
}
public async Task<MemoryStream> DownloadAsync(string path)
{
var result = new MemoryStream();
await _container.GetBlockBlobReference(path).DownloadToStreamAsync(result).ConfigureAwait(false);
result.Position = 0;
return result;
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using DotNetApis.Common;
using Microsoft.WindowsAzure.Storage.Blob;
namespace DotNetApis.Storage
{
public interface IReferenceStorage
{
/// <summary>
/// Returns the paths of reference folders available.
/// </summary>
Task<List<string>> GetFoldersAsync();
/// <summary>
/// Returns the paths of files within a specific folder. This includes .xml as well as .dll files.
/// </summary>
/// <param name="path">The path of the folder to search.</param>
Task<List<string>> GetFilesAsync(string path);
/// <summary>
/// Retrieves an assembly file from reference storage.
/// </summary>
/// <param name="path">The path of the file.</param>
Task<MemoryStream> DownloadAsync(string path);
}
public sealed class AzureReferenceStorage : IReferenceStorage
{
private readonly CloudBlobContainer _container;
public static string ContainerName { get; } = "reference";
public AzureReferenceStorage(CloudBlobContainer container)
{
_container = container;
}
public Task<List<string>> GetFoldersAsync() => ListAsync(null, results => results.OfType<CloudBlobDirectory>().Select(x => x.Prefix.TrimEnd('/')));
public Task<List<string>> GetFilesAsync(string path) => ListAsync(path, results => results.OfType<CloudBlockBlob>().Select(x => x.Name));
private async Task<List<string>> ListAsync(string path, Func<IEnumerable<IListBlobItem>, IEnumerable<string>> handler)
{
var result = new List<string>();
BlobContinuationToken continuation = null;
do
{
var segment = await _container.ListBlobsSegmentedAsync(path, false, BlobListingDetails.None, null, continuation, null, null).ConfigureAwait(false);
continuation = segment.ContinuationToken;
result.AddRange(handler(segment.Results));
} while (continuation != null);
return result;
}
public async Task<MemoryStream> DownloadAsync(string path)
{
var result = new MemoryStream();
await _container.GetBlockBlobReference(path).DownloadToStreamAsync(result).ConfigureAwait(false);
result.Position = 0;
return result;
}
}
}
| mit | C# |
8a9fec98fe5088fc4f5cad6ae57eff218490cfee | Fix for connection closing | koush/dblinq,Sectoid/dblinq,sharique/dbinq,sharique/dbinq,koush/dblinq,Sectoid/dblinq | DbLinq/util/ConnectionManager.cs | DbLinq/util/ConnectionManager.cs | using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DBLinq.util
{
/// <summary>
/// if a connection is initially closed, ConnectionManager closes it in Dispose().
/// if a connection is initially open, ConnectionManager does nothing.
/// </summary>
public class ConnectionManager : IDisposable
{
readonly IDbConnection _conn;
readonly bool _mustCloseConnection;
public ConnectionManager(IDbConnection conn)
{
_conn = conn;
switch (conn.State)
{
case System.Data.ConnectionState.Open:
_mustCloseConnection = false;
break;
case System.Data.ConnectionState.Closed:
_mustCloseConnection = true;
conn.Open();
break;
default:
throw new ApplicationException("L33: Can only handle Open or Closed connection states, not " + conn.State);
}
}
public void Dispose()
{
if (_mustCloseConnection)
{
try { _conn.Close(); }
catch { }
}
}
}
}
| using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DBLinq.util
{
/// <summary>
/// if a connection is initially closed, ConnectionManager closes it in Dispose().
/// if a connection is initially open, ConnectionManager does nothing.
/// </summary>
public class ConnectionManager : IDisposable
{
readonly IDbConnection _conn;
readonly bool _mustCloseConnection;
public ConnectionManager(IDbConnection conn)
{
_conn = conn;
switch (conn.State)
{
case System.Data.ConnectionState.Open:
_mustCloseConnection = true;
break;
case System.Data.ConnectionState.Closed:
_mustCloseConnection = false;
conn.Open();
break;
default:
throw new ApplicationException("L33: Can only handle Open or Closed connection states, not " + conn.State);
}
}
public void Dispose()
{
if (_mustCloseConnection)
{
try { _conn.Close(); }
catch { }
}
}
}
}
| mit | C# |
0c25dd52b2ed7c6cf6abaa2dc9042a5fc0f3a83e | change location to prebody | Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen | Dashen/Assets/ComponentAssetInfo.cs | Dashen/Assets/ComponentAssetInfo.cs | namespace Dashen.Assets
{
public class ComponentAssetInfo : AssetInfo
{
public ComponentAssetInfo(string path)
{
Tag = "script";
SelfClosing = false;
Location = AssetLocations.PreBody;
AddAttribute("type", "text/jsx");
AddAttribute("src", path);
}
}
}
| namespace Dashen.Assets
{
public class ComponentAssetInfo : AssetInfo
{
public ComponentAssetInfo(string path)
{
Tag = "script";
SelfClosing = false;
Location = AssetLocations.PostBody;
AddAttribute("type", "text/jsx");
AddAttribute("src", path);
}
}
}
| lgpl-2.1 | C# |
6236af6a5ca42b9665731bed6ff36e9e9255a9d1 | Bump version | pleonex/deblocus,pleonex/deblocus | Deblocus/Properties/AssemblyInfo.cs | Deblocus/Properties/AssemblyInfo.cs | //
// AssemblyInfo.cs
//
// Author:
// Benito Palacios Sánchez (aka pleonex) <benito356@gmail.com>
//
// Copyright (c) 2015 Benito Palacios Sánchez (c) 2015
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Deblocus")]
[assembly: AssemblyDescription("A card manager for students.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright (c) 2015 pleonex")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.3.0.*")]
| //
// AssemblyInfo.cs
//
// Author:
// Benito Palacios Sánchez (aka pleonex) <benito356@gmail.com>
//
// Copyright (c) 2015 Benito Palacios Sánchez (c) 2015
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Deblocus")]
[assembly: AssemblyDescription("A card manager for students.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright (c) 2015 pleonex")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.0.*")]
| agpl-3.0 | C# |
1dd24ec1a5e80c7ed9284a54343069cacadefeee | Fix IAssemblyResolver documentation | Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver | src/AsmResolver.DotNet/IAssemblyResolver.cs | src/AsmResolver.DotNet/IAssemblyResolver.cs | namespace AsmResolver.DotNet
{
/// <summary>
/// Provides members for resolving references to external .NET assemblies.
/// </summary>
public interface IAssemblyResolver
{
/// <summary>
/// Resolves a reference to an assembly.
/// </summary>
/// <param name="assembly">The reference to the assembly.</param>
/// <returns>The resolved assembly, or <c>null</c> if the resolution failed.</returns>
AssemblyDefinition Resolve(AssemblyDescriptor assembly);
/// <summary>
/// Adds the assembly to the cache.
/// </summary>
/// <param name="descriptor">The reference to the assembly.</param>
/// <param name="definition">The assembly.</param>
void AddToCache(AssemblyDescriptor descriptor, AssemblyDefinition definition);
/// <summary>
/// Removes the assembly from the cache.
/// </summary>
/// <param name="descriptor">The reference to the assembly.</param>
void RemoveFromCache(AssemblyDescriptor descriptor);
/// <summary>
/// Clears the cache.
/// </summary>
void ClearCache();
}
} | namespace AsmResolver.DotNet
{
/// <summary>
/// Provides members for resolving references to external .NET assemblies.
/// </summary>
public interface IAssemblyResolver
{
/// <summary>
/// Resolves a reference to an assembly.
/// </summary>
/// <param name="assembly">The reference to the assembly.</param>
/// <returns>The resolved assembly, or <c>null</c> if the resolution failed.</returns>
AssemblyDefinition Resolve(AssemblyDescriptor assembly);
/// <summary>
/// Adds the assembly to the cache.
/// </summary>
/// <param name="descriptor">The reference to the assembly.</param>
/// <param name="definition">The assembly.</param>
void AddToCache(AssemblyDescriptor descriptor, AssemblyDefinition definition);
/// <summary>
/// Removees the assembly from the cache.
/// </summary>
/// <param name="descriptor">The reference to the assembly.</param>
void RemoveFromCache(AssemblyDescriptor descriptor);
/// <summary>
/// Clears the cache.
/// </summary>
void ClearCache();
}
} | mit | C# |
073523001d5fc776b529487013a51241766b2e1a | fix bug | scheshan/DotNetBlog,scheshan/DotNetBlog | src/DotNetBlog.Web/Views/Admin/Index.cshtml | src/DotNetBlog.Web/Views/Admin/Index.cshtml | @inject ClientManager clientManager
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
</head>
<body class="skin-blue fixed">
<div id="main">
</div>
</body>
</html>
<script type="text/javascript">
var user = {
nickname: "@Html.Raw(clientManager.CurrentUser.Nickname)",
icon: "http://gravatar.duoshuo.com/"
}
</script>
<environment names="Development">
<!--please use webpack-dev-server to serve the development js file-->
<script src="http://localhost:3000/app.js"></script>
<script src="~/lib/tinymce/tinymce.min.js"></script>
<script src="~/scripts/tinymce.plugins/imageupload/plugin.js"></script>
</environment>
<environment names="Production">
<script src="~/dist/app.js"></script>
<script src="~/lib/tinymce/tinymce.min.js"></script>
<script src="~/scripts/tinymce.plugins/imageupload/plugin.js"></script>
</environment> | @inject ClientManager clientManager
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
</head>
<body class="skin-blue fixed">
<div id="main">
</div>
</body>
</html>
<script type="text/javascript">
var user = {
nickname: "@Html.Raw(clientManager.CurrentUser.Nickname)",
icon: "http://gravatar.duoshuo.com/"
}
</script>
<environment names="Development">
<!--please use webpack-dev-server to serve the development js file-->
<script src="http://localhost:3000/app.js"></script>
<script src="~/lib/tinymce/tinymce.min.js"></script>
<script src="~/scripts/tinymce.plugins/imageupload/plugin.js"></script>
</environment>
<environment names="Production">
<script src="~/dist/app.js"></script>
<script src="~/lib/tinymce/tinymce.min.js"></script>
</environment> | apache-2.0 | C# |
1aba4b4e3d411a5f1e3439299d7b84a587138622 | Make methods on ValidatorDescriptor virtual. | robv8r/FluentValidation,olcayseker/FluentValidation,pacificIT/FluentValidation,IRlyDontKnow/FluentValidation,glorylee/FluentValidation,roend83/FluentValidation,mgmoody42/FluentValidation,deluxetiky/FluentValidation,GDoronin/FluentValidation,ruisebastiao/FluentValidation,regisbsb/FluentValidation,cecilphillip/FluentValidation,roend83/FluentValidation | src/FluentValidation/ValidatorDescriptor.cs | src/FluentValidation/ValidatorDescriptor.cs | #region License
// Copyright 2008-2009 Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion
namespace FluentValidation {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Internal;
using Validators;
/// <summary>
/// Used for providing metadata about a validator.
/// </summary>
public class ValidatorDescriptor<T> : IValidatorDescriptor {
protected IEnumerable<IValidationRule<T>> Rules { get; private set; }
public ValidatorDescriptor(IEnumerable<IValidationRule<T>> ruleBuilders) {
this.Rules = ruleBuilders;
}
public virtual string GetName(string property) {
var nameUsed = Rules
.OfType<IPropertyRule<T>>()
.Where(x => x.Member.Name == property)
.Select(x => x.PropertyDescription).FirstOrDefault();
return nameUsed;
}
public virtual ILookup<string, IPropertyValidator> GetMembersWithValidators() {
return Rules.OfType<ISimplePropertyRule<T>>()
.ToLookup(x => x.Member.Name, x => x.Validator);
}
public IEnumerable<IPropertyValidator> GetValidatorsForMember(string name) {
return GetMembersWithValidators()[name];
}
public virtual string GetName(Expression<Func<T, object>> propertyExpression) {
var member = propertyExpression.GetMember();
if (member == null) {
throw new ArgumentException(string.Format("Cannot retrieve name as expression '{0}' as it does not specify a property.", propertyExpression));
}
return GetName(member.Name);
}
}
} | #region License
// Copyright 2008-2009 Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion
namespace FluentValidation {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Internal;
using Validators;
/// <summary>
/// Used for providing metadata about a validator.
/// </summary>
public class ValidatorDescriptor<T> : IValidatorDescriptor {
protected IEnumerable<IValidationRule<T>> Rules { get; private set; }
public ValidatorDescriptor(IEnumerable<IValidationRule<T>> ruleBuilders) {
this.Rules = ruleBuilders;
}
public string GetName(string property) {
var nameUsed = Rules
.OfType<IPropertyRule<T>>()
.Where(x => x.Member.Name == property)
.Select(x => x.PropertyDescription).FirstOrDefault();
return nameUsed;
}
public ILookup<string, IPropertyValidator> GetMembersWithValidators() {
return Rules.OfType<ISimplePropertyRule<T>>()
.ToLookup(x => x.Member.Name, x => x.Validator);
}
public IEnumerable<IPropertyValidator> GetValidatorsForMember(string name) {
return GetMembersWithValidators()[name];
}
public ILookup<string, IPropertyValidator> GetMemberNamesWithValidators() {
return Rules.OfType<ISimplePropertyRule<T>>()
.ToLookup(x => x.Member.Name, x => (IPropertyValidator)x.Validator);
}
public string GetName(Expression<Func<T, object>> propertyExpression) {
var member = propertyExpression.GetMember();
if (member == null) {
throw new ArgumentException(string.Format("Cannot retrieve name as expression '{0}' as it does not specify a property.", propertyExpression));
}
return GetName(member.Name);
}
}
} | apache-2.0 | C# |
e73fe95dd026329ebd54eda0f1cb6fb659269986 | add facets | ucdavis/Namster,ucdavis/Namster,ucdavis/Namster | src/Namster/Controllers/SearchController.cs | src/Namster/Controllers/SearchController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Namster.Models;
using Namster.Services;
namespace Namster.Controllers
{
public class SearchController : Controller
{
private readonly ISearchService _searchService;
public SearchController(ISearchService searchService)
{
_searchService = searchService;
}
public IActionResult Index()
{
return View();
}
public async Task<JsonResult> Query(string term)
{
var results = await _searchService.FindByMatchAsync(term, 25);
return new JsonResult(new
{
results = results.Hits.Select(h => h.Source),
aggregates = results.Aggregations
});
}
public async Task<IEnumerable<DataNam>> Filter(string field, string term)
{
var results = await _searchService.FilterByAsync(field, term);
return results.Hits.Select(h => h.Source);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Namster.Models;
using Namster.Services;
namespace Namster.Controllers
{
public class SearchController : Controller
{
private readonly ISearchService _searchService;
public SearchController(ISearchService searchService)
{
_searchService = searchService;
}
public IActionResult Index()
{
return View();
}
public async Task<IEnumerable<DataNam>> Query(string term)
{
var results = await _searchService.FindByMatchAsync(term, 25);
return results.Hits.Select(h => h.Source);
}
public async Task<IEnumerable<DataNam>> Filter(string field, string term)
{
var results = await _searchService.FilterByAsync(field, term);
return results.Hits.Select(h => h.Source);
}
}
}
| mit | C# |
074e5b767da5beffb2c4e89390590b5e52773663 | Simplify _ViewStart | martincostello/api,martincostello/api,martincostello/api | src/API/Views/_ViewStart.cshtml | src/API/Views/_ViewStart.cshtml | @{
Layout = "_Layout";
}
| @{
Layout = "~/Views/Shared/_Layout.cshtml";
}
| mit | C# |
9d8f13a09d6011510151cd53960c65390a95fc2b | Switch off the default diagnostic provider | MetSystem/Nancy,lijunle/Nancy,sloncho/Nancy,kekekeks/Nancy,jchannon/Nancy,tparnell8/Nancy,rudygt/Nancy,JoeStead/Nancy,dbabox/Nancy,xt0rted/Nancy,grumpydev/Nancy,joebuschmann/Nancy,NancyFx/Nancy,lijunle/Nancy,dbolkensteyn/Nancy,nicklv/Nancy,damianh/Nancy,asbjornu/Nancy,dbabox/Nancy,ccellar/Nancy,thecodejunkie/Nancy,tareq-s/Nancy,vladlopes/Nancy,anton-gogolev/Nancy,jonathanfoster/Nancy,adamhathcock/Nancy,jmptrader/Nancy,jongleur1983/Nancy,adamhathcock/Nancy,vladlopes/Nancy,daniellor/Nancy,SaveTrees/Nancy,danbarua/Nancy,sroylance/Nancy,hitesh97/Nancy,davidallyoung/Nancy,ccellar/Nancy,davidallyoung/Nancy,adamhathcock/Nancy,asbjornu/Nancy,malikdiarra/Nancy,khellang/Nancy,AIexandr/Nancy,dbolkensteyn/Nancy,khellang/Nancy,dbabox/Nancy,tsdl2013/Nancy,NancyFx/Nancy,AIexandr/Nancy,sadiqhirani/Nancy,fly19890211/Nancy,AlexPuiu/Nancy,jeff-pang/Nancy,NancyFx/Nancy,davidallyoung/Nancy,jmptrader/Nancy,tareq-s/Nancy,duszekmestre/Nancy,Worthaboutapig/Nancy,sadiqhirani/Nancy,thecodejunkie/Nancy,xt0rted/Nancy,nicklv/Nancy,AcklenAvenue/Nancy,tsdl2013/Nancy,guodf/Nancy,charleypeng/Nancy,hitesh97/Nancy,ayoung/Nancy,phillip-haydon/Nancy,jonathanfoster/Nancy,sloncho/Nancy,EliotJones/NancyTest,AlexPuiu/Nancy,blairconrad/Nancy,adamhathcock/Nancy,SaveTrees/Nancy,dbabox/Nancy,phillip-haydon/Nancy,nicklv/Nancy,damianh/Nancy,xt0rted/Nancy,Novakov/Nancy,rudygt/Nancy,blairconrad/Nancy,jongleur1983/Nancy,VQComms/Nancy,albertjan/Nancy,cgourlay/Nancy,SaveTrees/Nancy,jongleur1983/Nancy,sroylance/Nancy,charleypeng/Nancy,horsdal/Nancy,vladlopes/Nancy,fly19890211/Nancy,asbjornu/Nancy,MetSystem/Nancy,EliotJones/NancyTest,sloncho/Nancy,jchannon/Nancy,felipeleusin/Nancy,JoeStead/Nancy,AIexandr/Nancy,jonathanfoster/Nancy,felipeleusin/Nancy,danbarua/Nancy,ayoung/Nancy,daniellor/Nancy,hitesh97/Nancy,jeff-pang/Nancy,vladlopes/Nancy,EIrwin/Nancy,albertjan/Nancy,jmptrader/Nancy,dbolkensteyn/Nancy,AcklenAvenue/Nancy,grumpydev/Nancy,daniellor/Nancy,jeff-pang/Nancy,tparnell8/Nancy,felipeleusin/Nancy,albertjan/Nancy,cgourlay/Nancy,damianh/Nancy,VQComms/Nancy,joebuschmann/Nancy,VQComms/Nancy,lijunle/Nancy,rudygt/Nancy,EIrwin/Nancy,MetSystem/Nancy,VQComms/Nancy,jchannon/Nancy,NancyFx/Nancy,daniellor/Nancy,danbarua/Nancy,grumpydev/Nancy,wtilton/Nancy,asbjornu/Nancy,charleypeng/Nancy,khellang/Nancy,thecodejunkie/Nancy,Crisfole/Nancy,albertjan/Nancy,jchannon/Nancy,malikdiarra/Nancy,hitesh97/Nancy,tareq-s/Nancy,tsdl2013/Nancy,horsdal/Nancy,asbjornu/Nancy,EliotJones/NancyTest,malikdiarra/Nancy,fly19890211/Nancy,nicklv/Nancy,cgourlay/Nancy,guodf/Nancy,MetSystem/Nancy,murador/Nancy,cgourlay/Nancy,horsdal/Nancy,EIrwin/Nancy,davidallyoung/Nancy,thecodejunkie/Nancy,charleypeng/Nancy,tparnell8/Nancy,AIexandr/Nancy,jongleur1983/Nancy,blairconrad/Nancy,sadiqhirani/Nancy,malikdiarra/Nancy,Novakov/Nancy,Worthaboutapig/Nancy,grumpydev/Nancy,EIrwin/Nancy,felipeleusin/Nancy,sroylance/Nancy,danbarua/Nancy,SaveTrees/Nancy,sroylance/Nancy,davidallyoung/Nancy,Crisfole/Nancy,khellang/Nancy,lijunle/Nancy,AcklenAvenue/Nancy,rudygt/Nancy,jmptrader/Nancy,duszekmestre/Nancy,Novakov/Nancy,anton-gogolev/Nancy,jeff-pang/Nancy,AcklenAvenue/Nancy,guodf/Nancy,fly19890211/Nancy,jchannon/Nancy,duszekmestre/Nancy,Novakov/Nancy,murador/Nancy,murador/Nancy,ayoung/Nancy,Worthaboutapig/Nancy,duszekmestre/Nancy,kekekeks/Nancy,tsdl2013/Nancy,kekekeks/Nancy,horsdal/Nancy,charleypeng/Nancy,xt0rted/Nancy,ayoung/Nancy,JoeStead/Nancy,anton-gogolev/Nancy,jonathanfoster/Nancy,ccellar/Nancy,dbolkensteyn/Nancy,JoeStead/Nancy,blairconrad/Nancy,ccellar/Nancy,murador/Nancy,AlexPuiu/Nancy,tparnell8/Nancy,Crisfole/Nancy,phillip-haydon/Nancy,joebuschmann/Nancy,guodf/Nancy,joebuschmann/Nancy,Worthaboutapig/Nancy,wtilton/Nancy,AlexPuiu/Nancy,wtilton/Nancy,tareq-s/Nancy,AIexandr/Nancy,EliotJones/NancyTest,sloncho/Nancy,anton-gogolev/Nancy,phillip-haydon/Nancy,sadiqhirani/Nancy,VQComms/Nancy,wtilton/Nancy | src/Nancy/Diagnostics/DefaultDiagnostics.cs | src/Nancy/Diagnostics/DefaultDiagnostics.cs | namespace Nancy.Diagnostics
{
using System.Collections.Generic;
using System.Linq;
using ModelBinding;
using Nancy.Bootstrapper;
using Responses.Negotiation;
using Nancy.Culture;
/// <summary>
/// Wires up the diagnostics support at application startup.
/// </summary>
public class DefaultDiagnostics : IDiagnostics
{
private readonly DiagnosticsConfiguration diagnosticsConfiguration;
private readonly IEnumerable<IDiagnosticsProvider> diagnosticProviders;
private readonly IRootPathProvider rootPathProvider;
private readonly IEnumerable<ISerializer> serializers;
private readonly IRequestTracing requestTracing;
private readonly NancyInternalConfiguration configuration;
private readonly IModelBinderLocator modelBinderLocator;
private readonly IEnumerable<IResponseProcessor> responseProcessors;
private readonly ICultureService cultureService;
public DefaultDiagnostics(DiagnosticsConfiguration diagnosticsConfiguration, IEnumerable<IDiagnosticsProvider> diagnosticProviders, IRootPathProvider rootPathProvider, IEnumerable<ISerializer> serializers, IRequestTracing requestTracing, NancyInternalConfiguration configuration, IModelBinderLocator modelBinderLocator, IEnumerable<IResponseProcessor> responseProcessors, ICultureService cultureService)
{
this.diagnosticsConfiguration = diagnosticsConfiguration;
this.rootPathProvider = rootPathProvider;
this.serializers = serializers;
this.requestTracing = requestTracing;
this.configuration = configuration;
this.modelBinderLocator = modelBinderLocator;
this.responseProcessors = responseProcessors;
this.cultureService = cultureService;
if (diagnosticProviders.Count() > 2)
{
this.diagnosticProviders = diagnosticProviders.Where(diagProv => diagProv.GetType() != typeof(Nancy.Diagnostics.TestingDiagnosticProvider));
}
else
{
this.diagnosticProviders = diagnosticProviders;
}
}
/// <summary>
/// Initialise diagnostics
/// </summary>
/// <param name="pipelines">Application pipelines</param>
public void Initialize(IPipelines pipelines)
{
DiagnosticsHook.Enable(this.diagnosticsConfiguration, pipelines, this.diagnosticProviders, this.rootPathProvider, this.serializers, this.requestTracing, this.configuration, this.modelBinderLocator, this.responseProcessors, this.cultureService);
}
}
} | namespace Nancy.Diagnostics
{
using System.Collections.Generic;
using ModelBinding;
using Nancy.Bootstrapper;
using Responses.Negotiation;
using Nancy.Culture;
/// <summary>
/// Wires up the diagnostics support at application startup.
/// </summary>
public class DefaultDiagnostics : IDiagnostics
{
private readonly DiagnosticsConfiguration diagnosticsConfiguration;
private readonly IEnumerable<IDiagnosticsProvider> diagnosticProviders;
private readonly IRootPathProvider rootPathProvider;
private readonly IEnumerable<ISerializer> serializers;
private readonly IRequestTracing requestTracing;
private readonly NancyInternalConfiguration configuration;
private readonly IModelBinderLocator modelBinderLocator;
private readonly IEnumerable<IResponseProcessor> responseProcessors;
private readonly ICultureService cultureService;
public DefaultDiagnostics(DiagnosticsConfiguration diagnosticsConfiguration, IEnumerable<IDiagnosticsProvider> diagnosticProviders, IRootPathProvider rootPathProvider, IEnumerable<ISerializer> serializers, IRequestTracing requestTracing, NancyInternalConfiguration configuration, IModelBinderLocator modelBinderLocator, IEnumerable<IResponseProcessor> responseProcessors, ICultureService cultureService)
{
this.diagnosticsConfiguration = diagnosticsConfiguration;
this.diagnosticProviders = diagnosticProviders;
this.rootPathProvider = rootPathProvider;
this.serializers = serializers;
this.requestTracing = requestTracing;
this.configuration = configuration;
this.modelBinderLocator = modelBinderLocator;
this.responseProcessors = responseProcessors;
this.cultureService = cultureService;
}
/// <summary>
/// Initialise diagnostics
/// </summary>
/// <param name="pipelines">Application pipelines</param>
public void Initialize(IPipelines pipelines)
{
DiagnosticsHook.Enable(this.diagnosticsConfiguration, pipelines, this.diagnosticProviders, this.rootPathProvider, this.serializers, this.requestTracing, this.configuration, this.modelBinderLocator, this.responseProcessors, this.cultureService);
}
}
} | mit | C# |
9a09ca84f90b1bb7e3fab30b4a498552323cd04c | Fix for always using front | jamesmontemagno/MediaPlugin,jamesmontemagno/MediaPlugin | src/Media.Plugin.Android/IntentExtraExtensions.cs | src/Media.Plugin.Android/IntentExtraExtensions.cs | using Android.Content;
using Android.Hardware;
namespace Plugin.Media
{
internal static class IntentExtraExtensions
{
private const string extraFrontPre25 = "android.intent.extras.CAMERA_FACING";
private const string extraFrontPost25 = "android.intent.extras.LENS_FACING_FRONT";
private const string extraBackPost25 = "android.intent.extras.LENS_FACING_BACK";
private const string extraUserFront = "android.intent.extra.USE_FRONT_CAMERA";
public static void UseFrontCamera(this Intent intent)
{
// Android before API 25 (7.1)
intent.PutExtra(extraFrontPre25, (int)CameraFacing.Front);
// Android API 25 and up
intent.PutExtra(extraFrontPost25, 1);
intent.PutExtra(extraUserFront, true);
}
public static void UseBackCamera(this Intent intent)
{
// Android before API 25 (7.1)
intent.PutExtra(extraFrontPre25, (int)CameraFacing.Back);
// Android API 25 and up
intent.PutExtra(extraBackPost25, 1);
intent.PutExtra(extraUserFront, false);
}
}
} | using Android.Content;
using Android.Hardware;
namespace Plugin.Media
{
internal static class IntentExtraExtensions
{
private const string extraFrontPre25 = "android.intent.extras.CAMERA_FACING";
private const string extraFrontPost25 = "android.intent.extras.LENS_FACING_FRONT";
private const string extraBackPost25 = "android.intent.extras.LENS_FACING_BACK";
private const string extraUserFront = "android.intent.extra.USE_FRONT_CAMERA";
public static void UseFrontCamera(this Intent intent)
{
// Android before API 25 (7.1)
intent.PutExtra(extraFrontPre25, (int)CameraFacing.Front);
// Android API 25 and up
intent.PutExtra(extraFrontPost25, 1);
intent.PutExtra(extraUserFront, true);
}
public static void UseBackCamera(this Intent intent)
{
// Android before API 25 (7.1)
intent.PutExtra(extraFrontPre25, (int)CameraFacing.Front);
// Android API 25 and up
intent.PutExtra(extraBackPost25, 1);
intent.PutExtra(extraUserFront, false);
}
}
} | mit | C# |
1b5bc132cd3560a2fac57e23b64957c66dffe43e | Update ResolutionStatusType.cs | halex2005/diadocsdk-csharp,diadoc/diadocsdk-csharp,diadoc/diadocsdk-csharp,halex2005/diadocsdk-csharp | src/Com/ResolutionStatusType.cs | src/Com/ResolutionStatusType.cs | using System.Runtime.InteropServices;
using System.Xml.Serialization;
namespace Diadoc.Api.Com
{
[ComVisible(true)]
[Guid("B0A83874-31C1-400F-931B-646551A2A2F1")]
//NOTE: Это хотели, чтобы можно было использовать XML-сериализацию для классов
[XmlType(TypeName = "ResolutionStatusType", Namespace = "https://diadoc-api.kontur.ru")]
public enum ResolutionStatusType
{
None = 0,
Approved = 1,
Disapproved = 2,
ApprovementRequested = 3,
SignatureRequested = 4,
SignatureDenied = 5,
ActionsRequested = 6
}
}
| using System.Runtime.InteropServices;
using System.Xml.Serialization;
namespace Diadoc.Api.Com
{
[ComVisible(true)]
[Guid("B0A83874-31C1-400F-931B-646551A2A2F1")]
//NOTE: Это хотели, чтобы можно было использовать XML-сериализацию для классов
[XmlType(TypeName = "ResolutionStatusType", Namespace = "https://diadoc-api.kontur.ru")]
public enum ResolutionStatusType
{
None = 0,
Approved = 1,
Disapproved = 2,
ApprovementRequested = 3,
SignatureRequested = 4,
SignatureDenied = 5
}
} | mit | C# |
49048bfacb03c3917550b8e6fe00d04962635dc0 | Add support for localized descriptions | thunsaker/Humanizer,thunsaker/Humanizer,kikoanis/Humanizer,llehouerou/Humanizer,gyurisc/Humanizer,HalidCisse/Humanizer,mrchief/Humanizer,aloisdg/Humanizer,CodeFromJordan/Humanizer,vgrigoriu/Humanizer,cmaneu/Humanizer,Flatlineato/Humanizer,mexx/Humanizer,CodeFromJordan/Humanizer,harouny/Humanizer,llehouerou/Humanizer,preetksingh80/Humanizer,GeorgeHahn/Humanizer,cmaneu/Humanizer,preetksingh80/Humanizer,thunsaker/Humanizer,nigel-sampson/Humanizer,mrchief/Humanizer,GeorgeHahn/Humanizer,schalpat/Humanizer,kikoanis/Humanizer,micdenny/Humanizer,hazzik/Humanizer,HalidCisse/Humanizer,maximn/Humanizer,ErikSchierboom/Humanizer,ammachado/Humanizer,henriksen/Humanizer,micdenny/Humanizer,henriksen/Humanizer,vgrigoriu/Humanizer,MehdiK/Humanizer,mrchief/Humanizer,maximn/Humanizer,HalidCisse/Humanizer,nigel-sampson/Humanizer,CodeFromJordan/Humanizer,ErikSchierboom/Humanizer,jaxx-rep/Humanizer,preetksingh80/Humanizer,harouny/Humanizer,vgrigoriu/Humanizer,schalpat/Humanizer,ammachado/Humanizer,Flatlineato/Humanizer,llehouerou/Humanizer,mexx/Humanizer,cmaneu/Humanizer,gyurisc/Humanizer | src/Humanizer/EnumExtensions.cs | src/Humanizer/EnumExtensions.cs | // Copyright (C) 2012, Mehdi Khalili
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the <organization> nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.using System;
using System;
using System.ComponentModel;
using System.Reflection;
namespace Humanizer
{
public static class EnumExtensions
{
public static string Humanize(this Enum input)
{
Type type = input.GetType();
MemberInfo[] memInfo = type.GetMember(input.ToString());
if (memInfo.Length > 0)
{
object[] attrs = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), true);
if (attrs.Length > 0)
{
return ((DescriptionAttribute)attrs[0]).Description;
}
}
return input.ToString().Humanize();
}
public static string Humanize(this Enum input, LetterCasing casing)
{
var humanizedEnum = Humanize(input);
return humanizedEnum.ApplyCase(casing);
}
}
} | // Copyright (C) 2012, Mehdi Khalili
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the <organization> nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.using System;
using System;
using System.ComponentModel;
using System.Reflection;
namespace Humanizer
{
public static class EnumExtensions
{
public static string Humanize(this Enum input)
{
Type type = input.GetType();
MemberInfo[] memInfo = type.GetMember(input.ToString());
if (memInfo.Length > 0)
{
object[] attrs = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
if (attrs.Length > 0)
{
return ((DescriptionAttribute)attrs[0]).Description;
}
}
return input.ToString().Humanize();
}
public static string Humanize(this Enum input, LetterCasing casing)
{
var humanizedEnum = Humanize(input);
return humanizedEnum.ApplyCase(casing);
}
}
} | mit | C# |
f0c10c7eda93d3e64d8a195f6167549ac5d9358f | Fix #520 Prize Redemption Count error | MCLD/greatreadingadventure,MCLD/greatreadingadventure,MCLD/greatreadingadventure,MCLD/greatreadingadventure,MCLD/greatreadingadventure | src/GRA.Web/Areas/MissionControl/Views/Reporting/PrizeRedemptionCountCriteria.cshtml | src/GRA.Web/Areas/MissionControl/Views/Reporting/PrizeRedemptionCountCriteria.cshtml | @model GRA.Controllers.ViewModel.MissionControl.Reporting.ReportCriteriaViewModel
<form asp-controller="Reporting" asp-action="Run" method="post" role="form" class="form-horizontal" style="margin-top: 2rem; margin-bottom: 2rem;">
<input asp-for="ReportId" type="hidden" />
<div class="form-group">
<div class="col-xs-12">
<label asp-for="SystemId" class="control-label"></label>
<select asp-for="SystemId" asp-items="Model.SystemList" class="form-control">
<option value="">All Systems</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<label asp-for="TriggerList" class="control-label"></label>
<input id="triggerPlaceholder" class="form-control"/>
<select asp-for="TriggerList" asp-items="Model.PrizeList" class="form-control hidden" multiple="multiple" data-val="true" data-val-required="Please select one or more triggers."></select>
<span asp-validation-for="TriggerList" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<button type="submit" class="btn btn-primary">
<span class="fa fa-file-text"></span>
Run Report!
</button>
</div>
</div>
</form>
@section scripts {
<script>
$("#triggerPlaceholder").remove();
$("#TriggerList")
.removeClass("hidden")
.multiselect({
inheritClass: true,
buttonWidth: "100%",
nonSelectedText: "",
numberDisplayed: 3,
enableCaseInsensitiveFiltering: true
});
$(".glyphicon-search").removeClass("glypicon glyphicon-search").addClass("fas fa-search");
$(".glyphicon-remove-circle").removeClass("glypicon glyphicon-remove-circle").addClass("fas fa-times-circle");
</script>
} | @model GRA.Controllers.ViewModel.MissionControl.Reporting.ReportCriteriaViewModel
<form asp-controller="Reporting" asp-action="Run" method="post" role="form" class="form-horizontal" style="margin-top: 2rem; margin-bottom: 2rem;">
<input asp-for="ReportId" type="hidden" />
<div class="form-group">
<div class="col-xs-12">
<label asp-for="SystemId" class="control-label"></label>
<select asp-for="SystemId" asp-items="Model.SystemList" class="form-control">
<option value="">All Systems</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<label asp-for="TriggerList" class="control-label"></label>
<input id="triggerPlaceholder" class="form-control" />
<select asp-for="TriggerList" asp-items="Model.PrizeList" class="form-control hidden" multiple="multiple"></select>
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<button type="submit" class="btn btn-primary">
<span class="fa fa-file-text"></span>
Run Report!
</button>
</div>
</div>
</form>
@section scripts {
<script>
$("#triggerPlaceholder").remove();
$("#TriggerList")
.removeClass("hidden")
.multiselect({
inheritClass: true,
buttonWidth: "100%",
nonSelectedText: "",
numberDisplayed: 3,
enableCaseInsensitiveFiltering: true
});
$(".glyphicon-search").removeClass("glypicon glyphicon-search").addClass("fas fa-search");
$(".glyphicon-remove-circle").removeClass("glypicon glyphicon-remove-circle").addClass("fas fa-times-circle");
</script>
} | mit | C# |
e1e403caa3f85f283f10a360339dd886cb290627 | Fix timeout issue waiting for topics to be created. | SanSYS/MassTransit,phatboyg/MassTransit,MassTransit/MassTransit,SanSYS/MassTransit,MassTransit/MassTransit,jacobpovar/MassTransit,jacobpovar/MassTransit,phatboyg/MassTransit | src/MassTransit.Host/Program.cs | src/MassTransit.Host/Program.cs | // Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Host
{
using System;
using System.IO;
using log4net.Config;
using Log4NetIntegration.Logging;
using Topshelf;
using Topshelf.Logging;
class Program
{
static int Main()
{
SetupLogger();
return (int)HostFactory.Run(x =>
{
x.SetStartTimeout(TimeSpan.FromMinutes(2));
var configurator = new MassTransitHostConfigurator<MassTransitHostServiceBootstrapper>
{
Description = "MassTransit Host - A service host for MassTransit endpoints",
DisplayName = "MassTransit Host",
ServiceName = "MassTransitHost"
};
configurator.Configure(x);
});
}
static void SetupLogger()
{
var configFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MassTransit.Host.log4net.config"));
if (configFile.Exists)
XmlConfigurator.ConfigureAndWatch(configFile);
Log4NetLogWriterFactory.Use();
Log4NetLogger.Use();
}
}
} | // Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Host
{
using System;
using System.IO;
using log4net.Config;
using Log4NetIntegration.Logging;
using Topshelf;
using Topshelf.Logging;
class Program
{
static int Main()
{
SetupLogger();
return (int)HostFactory.Run(x =>
{
var configurator = new MassTransitHostConfigurator<MassTransitHostServiceBootstrapper>
{
Description = "MassTransit Host - A service host for MassTransit endpoints",
DisplayName = "MassTransit Host",
ServiceName = "MassTransitHost"
};
configurator.Configure(x);
});
}
static void SetupLogger()
{
var configFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MassTransit.Host.log4net.config"));
if (configFile.Exists)
XmlConfigurator.ConfigureAndWatch(configFile);
Log4NetLogWriterFactory.Use();
Log4NetLogger.Use();
}
}
} | apache-2.0 | C# |
f7db15590c197bf0e2cc02643d2642be6ce6cbff | Implement YAML remove instance | mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard | src/Okanshi.Dashboard/Config.cs | src/Okanshi.Dashboard/Config.cs | using System.Collections.Generic;
using System.IO;
using System.Linq;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
namespace Okanshi.Dashboard
{
public class Config : IConfiguration
{
private readonly Serializer _serializer;
static Config()
{
using (var reader = new StreamReader(File.OpenRead("config.yml")))
{
var deserializer = new Deserializer(namingConvention: new CamelCaseNamingConvention());
Instance = deserializer.Deserialize<Config>(reader);
}
}
public Config()
{
_serializer = new Serializer(namingConvention: new CamelCaseNamingConvention());
}
public static Config Instance { get; private set; }
public string Url { get; set; }
public IList<OkanshiServer> OkanshiInstances { get; set; }
public void Add(OkanshiServer server)
{
OkanshiInstances.Add(server);
Save();
}
public IEnumerable<OkanshiServer> GetAll()
{
return OkanshiInstances;
}
public void Remove(string name)
{
OkanshiInstances = OkanshiInstances.Where(x => x.Name != name).ToList();
Save();
}
private void Save()
{
using (var writer = new StreamWriter(File.OpenWrite("config.yml")))
{
_serializer.Serialize(writer, this);
writer.Flush();
}
}
}
} | using System.Collections.Generic;
using System.IO;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
namespace Okanshi.Dashboard
{
public class Config : IConfiguration
{
private readonly Serializer _serializer;
static Config()
{
using (var reader = new StreamReader(File.OpenRead("config.yml")))
{
var deserializer = new Deserializer(namingConvention: new CamelCaseNamingConvention());
Instance = deserializer.Deserialize<Config>(reader);
}
}
public Config()
{
_serializer = new Serializer(namingConvention: new CamelCaseNamingConvention());
}
public static Config Instance { get; private set; }
public string Url { get; set; }
public IList<OkanshiServer> OkanshiInstances { get; set; }
public void Add(OkanshiServer server)
{
OkanshiInstances.Add(server);
Save();
}
public IEnumerable<OkanshiServer> GetAll()
{
return OkanshiInstances;
}
private void Save()
{
using (var writer = new StreamWriter(File.OpenWrite("config.yml")))
{
_serializer.Serialize(writer, this);
writer.Flush();
}
}
}
} | mit | C# |
afeff50a46ed71521915f62c979ee84b3f8f2a4e | Remove extra whitespace in BoolAndExpression | exodrifter/unity-rumor | Expressions/BoolAndExpression.cs | Expressions/BoolAndExpression.cs | using Exodrifter.Rumor.Engine;
using System;
using System.Runtime.Serialization;
namespace Exodrifter.Rumor.Expressions
{
/// <summary>
/// Represents a boolean "and" operator.
/// </summary>
[Serializable]
public class BoolAndExpression : OpExpression
{
public BoolAndExpression(Expression left, Expression right)
: base(left, right)
{
}
public override Value Evaluate(Scope scope)
{
var l = left.Evaluate(scope);
var r = right.Evaluate(scope);
return l.BoolAnd(r);
}
public override string ToString()
{
return left + " and " + right;
}
#region Serialization
public BoolAndExpression
(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endregion
}
}
| using Exodrifter.Rumor.Engine;
using System;
using System.Runtime.Serialization;
namespace Exodrifter.Rumor.Expressions
{
/// <summary>
/// Represents a boolean "and" operator.
/// </summary>
[Serializable]
public class BoolAndExpression : OpExpression
{
public BoolAndExpression(Expression left, Expression right)
: base(left, right)
{
}
public override Value Evaluate(Scope scope)
{
var l = left.Evaluate(scope);
var r = right.Evaluate(scope);
return l.BoolAnd(r);
}
public override string ToString()
{
return left + " and " + right;
}
#region Serialization
public BoolAndExpression
(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endregion
}
}
| mit | C# |
7e3d1511c67d620ba2dc63059c6cec86ed25d244 | Hide "Rank Achieved" sorting mode until it's supported | ppy/osu,NeoAdonis/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu | osu.Game/Screens/Select/Filter/SortMode.cs | osu.Game/Screens/Select/Filter/SortMode.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.ComponentModel;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Screens.Select.Filter
{
public enum SortMode
{
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingArtist))]
Artist,
[Description("Author")]
Author,
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowStatsBpm))]
BPM,
[Description("Date Added")]
DateAdded,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingDifficulty))]
Difficulty,
[LocalisableDescription(typeof(SortStrings), nameof(SortStrings.ArtistTracksLength))]
Length,
// todo: pending support (https://github.com/ppy/osu/issues/4917)
// [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchFiltersRank))]
// RankAchieved,
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoSource))]
Source,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingTitle))]
Title,
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.ComponentModel;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Screens.Select.Filter
{
public enum SortMode
{
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingArtist))]
Artist,
[Description("Author")]
Author,
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowStatsBpm))]
BPM,
[Description("Date Added")]
DateAdded,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingDifficulty))]
Difficulty,
[LocalisableDescription(typeof(SortStrings), nameof(SortStrings.ArtistTracksLength))]
Length,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchFiltersRank))]
RankAchieved,
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoSource))]
Source,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.ListingSearchSortingTitle))]
Title,
}
}
| mit | C# |
186ee4df29906aa7e3725bb6ab2b6f05a9545d1d | Implement TextReaderCustomization#Customize | appharbor/appharbor-cli | src/AppHarbor.Tests/TextReaderCustomization.cs | src/AppHarbor.Tests/TextReaderCustomization.cs | using System.IO;
using Moq;
using Ploeh.AutoFixture;
namespace AppHarbor.Tests
{
public class TextReaderCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
var textReaderMock = new Mock<TextReader>();
fixture.Customize<TextReader>(x => x.FromFactory(() => { return textReaderMock.Object; }));
fixture.Customize<Mock<TextReader>>(x => x.FromFactory(() => { return textReaderMock; }));
}
}
}
| using System;
using Ploeh.AutoFixture;
namespace AppHarbor.Tests
{
public class TextReaderCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
76ceddeec0e2115b6f71c21e3c19c5b44cc085a7 | Remove conditional MoveRelative call from old BecomingActive scope | jlewin/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,mmoening/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,mmoening/MatterControl,mmoening/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl | MatterControlLib/ConfigurationPage/PrintLeveling/WizardPages/GetUltraFineBedHeight.cs | MatterControlLib/ConfigurationPage/PrintLeveling/WizardPages/GetUltraFineBedHeight.cs | /*
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System.Collections.Generic;
using MatterHackers.Localizations;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class GetUltraFineBedHeight : FindBedHeight
{
public GetUltraFineBedHeight(PrinterSetupWizard context, string pageDescription, List<ProbePosition> probePositions,
int probePositionsBeingEditedIndex, LevelingStrings levelingStrings)
: base(
context,
pageDescription,
"We will now finalize our measurement of the extruder height at this position.".Localize(),
levelingStrings.FineInstruction2,
.02,
probePositions,
probePositionsBeingEditedIndex)
{
}
}
} | /*
Copyright (c) 2018, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
using MatterHackers.Agg;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
public class GetUltraFineBedHeight : FindBedHeight
{
private bool haveDrawn = false;
public GetUltraFineBedHeight(PrinterSetupWizard context, string pageDescription, List<ProbePosition> probePositions,
int probePositionsBeingEditedIndex, LevelingStrings levelingStrings)
: base(
context,
pageDescription,
"We will now finalize our measurement of the extruder height at this position.".Localize(),
levelingStrings.FineInstruction2,
.02,
probePositions,
probePositionsBeingEditedIndex)
{
}
public override void OnDraw(Graphics2D graphics2D)
{
haveDrawn = true;
base.OnDraw(graphics2D);
}
public override void OnLoad(EventArgs args)
{
// TODO: Why conditional on haveDrawn?
if (haveDrawn)
{
printer.Connection.MoveRelative(PrinterConnection.Axis.Z, 2, printer.Settings.Helpers.ManualMovementSpeeds().Z);
}
base.OnLoad(args);
}
}
} | bsd-2-clause | C# |
32e3ca7df8497244f104fa8a74b552511a59df96 | correct error handling when tempalte not found | Fody/Validar | Fody/ValidationTemplateFinder.cs | Fody/ValidationTemplateFinder.cs | using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
public class ValidationTemplateFinder
{
public TypeDefinition TypeDefinition;
public MethodDefinition TemplateConstructor;
public List<TypeDefinition> AllTypes;
public void Execute()
{
TypeDefinition = AllTypes.FirstOrDefault(x => x.Name == "ValidationTemplate");
if (TypeDefinition== null)
{
throw new WeavingException("Could not find a type named ValidationTemplate");
}
TemplateConstructor = TypeDefinition
.Methods
.FirstOrDefault(x =>
x.IsConstructor &&
x.Parameters.Count == 1 &&
x.Parameters.First().ParameterType.Name == "INotifyPropertyChanged");
if (TemplateConstructor == null)
{
throw new WeavingException("Found ValidationTemplate but it did not have a constructor that takes INotifyPropertyChanged as a parameter");
}
}
} | using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
public class ValidationTemplateFinder
{
public TypeDefinition TypeDefinition;
public MethodDefinition TemplateConstructor;
public List<TypeDefinition> AllTypes;
public void Execute()
{
TypeDefinition = AllTypes.First(x => x.Name == "ValidationTemplate");
if (TypeDefinition== null)
{
throw new WeavingException("Could not find a type named ValidationTemplate");
}
TemplateConstructor = TypeDefinition
.Methods
.FirstOrDefault(x =>
x.IsConstructor &&
x.Parameters.Count == 1 &&
x.Parameters.First().ParameterType.Name == "INotifyPropertyChanged");
if (TemplateConstructor == null)
{
throw new WeavingException("Found ValidationTemplate but it did not have a constructor that takes INotifyPropertyChanged as a parameter");
}
}
} | mit | C# |
c603c7de06788b256585f0c7dab073f1dc27ea00 | refactor handler | louthy/language-ext,StefanBertels/language-ext,StanJav/language-ext | Samples/Contoso/Contoso.Application/Instructors/Queries/GetOfficeAssignmentHandler.cs | Samples/Contoso/Contoso.Application/Instructors/Queries/GetOfficeAssignmentHandler.cs | using System.Threading;
using System.Threading.Tasks;
using Contoso.Core.Domain;
using Contoso.Core.Interfaces.Repositories;
using LanguageExt;
using MediatR;
namespace Contoso.Application.Instructors.Queries
{
public class GetOfficeAssignmentHandler : IRequestHandler<GetOfficeAssignment, Option<OfficeAssignment>>
{
private readonly IOfficeAssignmentRepository _officeAssignmentRepository;
public GetOfficeAssignmentHandler(IOfficeAssignmentRepository officeAssignmentRepository) => _officeAssignmentRepository = officeAssignmentRepository;
public Task<Option<OfficeAssignment>> Handle(GetOfficeAssignment request, CancellationToken cancellationToken) =>
Fetch(request.InstructorId);
private Task<Option<OfficeAssignment>> Fetch(int id) =>
_officeAssignmentRepository.GetByInstructorId(id);
}
}
| using System.Threading;
using System.Threading.Tasks;
using Contoso.Core.Domain;
using Contoso.Core.Interfaces.Repositories;
using LanguageExt;
using MediatR;
namespace Contoso.Application.Instructors.Queries
{
public class GetOfficeAssignmentHandler : IRequestHandler<GetOfficeAssignment, Option<OfficeAssignment>>
{
private readonly IOfficeAssignmentRepository _officeAssignmentRepository;
public GetOfficeAssignmentHandler(IOfficeAssignmentRepository officeAssignmentRepository) => _officeAssignmentRepository = officeAssignmentRepository;
public Task<Option<OfficeAssignment>> Handle(GetOfficeAssignment request, CancellationToken cancellationToken) =>
Fetch(request.InstructorId).Map(Project);
private Option<OfficeAssignment> Project(Option<OfficeAssignment> o) =>
o.Map(oa => new OfficeAssignment
{
OfficeAssignmentId = oa.OfficeAssignmentId,
InstructorId = oa.InstructorId,
Location = oa.Location
});
private Task<Option<OfficeAssignment>> Fetch(int id) =>
_officeAssignmentRepository.GetByInstructorId(id);
}
}
| mit | C# |
6b33ebf8e012d66217e11dfd1e6ff79804ad9caf | Revert accidental change of async flag . | mdavid/nuget,mdavid/nuget | src/VsConsole/Console/PowerConsole/HostInfo.cs | src/VsConsole/Console/PowerConsole/HostInfo.cs | using System;
using System.Diagnostics;
namespace NuGetConsole.Implementation.PowerConsole {
/// <summary>
/// Represents a host with extra info.
/// </summary>
class HostInfo : ObjectWithFactory<PowerConsoleWindow> {
Lazy<IHostProvider, IHostMetadata> HostProvider { get; set; }
public HostInfo(PowerConsoleWindow factory, Lazy<IHostProvider, IHostMetadata> hostProvider)
: base(factory) {
UtilityMethods.ThrowIfArgumentNull(hostProvider);
this.HostProvider = hostProvider;
}
/// <summary>
/// Get the HostName attribute value of this host.
/// </summary>
public string HostName {
get { return HostProvider.Metadata.HostName; }
}
IWpfConsole _wpfConsole;
/// <summary>
/// Get/create the console for this host. If not already created, this
/// actually creates the (console, host) pair.
///
/// Note: Creating the console is handled by this package and mostly will
/// succeed. However, creating the host could be from other packages and
/// fail. In that case, this console is already created and can be used
/// subsequently in limited ways, such as displaying an error message.
/// </summary>
public IWpfConsole WpfConsole {
get {
if (_wpfConsole == null) {
_wpfConsole = Factory.WpfConsoleService.CreateConsole(
Factory.ServiceProvider, PowerConsoleWindow.ContentType, HostName);
_wpfConsole.Host = HostProvider.Value.CreateHost(_wpfConsole, @async: true);
}
return _wpfConsole;
}
}
}
}
| using System;
using System.Diagnostics;
namespace NuGetConsole.Implementation.PowerConsole {
/// <summary>
/// Represents a host with extra info.
/// </summary>
class HostInfo : ObjectWithFactory<PowerConsoleWindow> {
Lazy<IHostProvider, IHostMetadata> HostProvider { get; set; }
public HostInfo(PowerConsoleWindow factory, Lazy<IHostProvider, IHostMetadata> hostProvider)
: base(factory) {
UtilityMethods.ThrowIfArgumentNull(hostProvider);
this.HostProvider = hostProvider;
}
/// <summary>
/// Get the HostName attribute value of this host.
/// </summary>
public string HostName {
get { return HostProvider.Metadata.HostName; }
}
IWpfConsole _wpfConsole;
/// <summary>
/// Get/create the console for this host. If not already created, this
/// actually creates the (console, host) pair.
///
/// Note: Creating the console is handled by this package and mostly will
/// succeed. However, creating the host could be from other packages and
/// fail. In that case, this console is already created and can be used
/// subsequently in limited ways, such as displaying an error message.
/// </summary>
public IWpfConsole WpfConsole {
get {
if (_wpfConsole == null) {
_wpfConsole = Factory.WpfConsoleService.CreateConsole(
Factory.ServiceProvider, PowerConsoleWindow.ContentType, HostName);
_wpfConsole.Host = HostProvider.Value.CreateHost(_wpfConsole, @async: false);
}
return _wpfConsole;
}
}
}
}
| apache-2.0 | C# |
a1a90ae46e02ec09d96896da83800a043404c4bf | Update the example precondition to use IServiceProvider | RogueException/Discord.Net,Confruggy/Discord.Net,AntiTcb/Discord.Net | docs/guides/commands/samples/require_owner.cs | docs/guides/commands/samples/require_owner.cs | // (Note: This precondition is obsolete, it is recommended to use the RequireOwnerAttribute that is bundled with Discord.Commands)
using Discord.Commands;
using Discord.WebSocket;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
// Inherit from PreconditionAttribute
public class RequireOwnerAttribute : PreconditionAttribute
{
// Override the CheckPermissions method
public async override Task<PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo command, IServiceProvider services)
{
// Get the ID of the bot's owner
var ownerId = (await services.GetService<DiscordSocketClient>().GetApplicationInfoAsync()).Owner.Id;
// If this command was executed by that user, return a success
if (context.User.Id == ownerId)
return PreconditionResult.FromSuccess();
// Since it wasn't, fail
else
return PreconditionResult.FromError("You must be the owner of the bot to run this command.");
}
}
| // (Note: This precondition is obsolete, it is recommended to use the RequireOwnerAttribute that is bundled with Discord.Commands)
using Discord.Commands;
using Discord.WebSocket;
using System.Threading.Tasks;
// Inherit from PreconditionAttribute
public class RequireOwnerAttribute : PreconditionAttribute
{
// Override the CheckPermissions method
public async override Task<PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo command, IDependencyMap map)
{
// Get the ID of the bot's owner
var ownerId = (await map.Get<DiscordSocketClient>().GetApplicationInfoAsync()).Owner.Id;
// If this command was executed by that user, return a success
if (context.User.Id == ownerId)
return PreconditionResult.FromSuccess();
// Since it wasn't, fail
else
return PreconditionResult.FromError("You must be the owner of the bot to run this command.");
}
}
| mit | C# |
ac4ebe7a07005fc3a196ac68a5135ca53dc453a2 | Fix bug with suggestion route when app not in server root directory | opencolorado/.NET-Wrapper-for-CKAN-API,DenverDev/.NET-Wrapper-for-CKAN-API,DenverDev/.NET-Wrapper-for-CKAN-API,opencolorado/.NET-Wrapper-for-CKAN-API,opencolorado/.NET-Wrapper-for-CKAN-API | CkanDotNet.Web/Views/Shared/Search/_Search.cshtml | CkanDotNet.Web/Views/Shared/Search/_Search.cshtml | @using CkanDotNet.Api.Model
@using CkanDotNet.Web.Models
@using CkanDotNet.Web.Models.Helpers
@model PackageSearchResultsModel
@{
string query = String.Empty;
if (Model != null) {
query = Model.SearchParameters.Query;
}
}
@using (Html.BeginForm(actionName: "Index", controllerName: "Search", routeValues: null,
method: FormMethod.Get, htmlAttributes: new { @class = "search-form"}))
{
<div class="search">
<input name="q" type="text" tabindex="1" class="search-input" value="@query" />
<input type="submit" class="search-submit" value="Search" />
@if (!String.IsNullOrEmpty(query))
{
@Html.ActionLink("Clear", "Index", "Search");
}
</div>
}
<script language="javascript">
var $input = $('.search-input');
$input.watermark('Search...');
$input.focus(function() {
$(this).select();
});
@if (SettingsHelper.GetSuggestionsEnabled())
{
<text>
var suggestUrl = '@Url.Action("Index", "Suggestion", new { prefix = "_" })'.slice(0, -1);
var delay = @SettingsHelper.GetSuggestionsDelay();
$input.autocomplete({
source: function (request, response) {
$.getJSON(suggestUrl + request.term, null, function (json) {
response(json);
});
},
select: function (event, ui) {
if (ui.item) {
$input.val(ui.item.value);
}
$('.search-form').submit();
},
delay: delay
});
</text>
}
</script>
@if (SettingsHelper.GetGoogleAnalyticsEnabled())
{
<script language="javascript">
$('.search-submit').click(function () {
var value = $('.search-input').val();
// Track the search event in analytics
_gaq.push([
'_trackEvent',
'Search',
'Query',
value]);
});
</script>
} | @using CkanDotNet.Api.Model
@using CkanDotNet.Web.Models
@using CkanDotNet.Web.Models.Helpers
@model PackageSearchResultsModel
@{
string query = String.Empty;
if (Model != null) {
query = Model.SearchParameters.Query;
}
}
@using (Html.BeginForm(actionName: "Index", controllerName: "Search", routeValues: null,
method: FormMethod.Get, htmlAttributes: new { @class = "search-form"}))
{
<div class="search">
<input name="q" type="text" tabindex="1" class="search-input" value="@query" />
<input type="submit" class="search-submit" value="Search" />
@if (!String.IsNullOrEmpty(query))
{
@Html.ActionLink("Clear", "Index", "Search");
}
</div>
}
<script language="javascript">
var $input = $('.search-input');
$input.watermark('Search...');
$input.focus(function() {
$(this).select();
});
@if (SettingsHelper.GetSuggestionsEnabled())
{
<text>
var delay = @SettingsHelper.GetSuggestionsDelay();
$input.autocomplete({
// TODO: fix this route
source: function (request, response) {
$.getJSON("/suggest/" + request.term, null, function (json) {
response(json);
});
},
select: function (event, ui) {
if (ui.item) {
$input.val(ui.item.value);
}
$('.search-form').submit();
},
delay: delay
});
</text>
}
</script>
@if (SettingsHelper.GetGoogleAnalyticsEnabled())
{
<script language="javascript">
$('.search-submit').click(function () {
var value = $('.search-input').val();
// Track the search event in analytics
_gaq.push([
'_trackEvent',
'Search',
'Query',
value]);
});
</script>
} | apache-2.0 | C# |
b3db1580de634eb4f25fcbb7147d7d0564ae5f2a | Update library version. | yurko7/math-expression | math-expression/Properties/AssemblyInfo.cs | math-expression/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("math-expression")]
[assembly: AssemblyDescription("Simple compiler of mathematical expressions.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Yuriy Kushnir")]
[assembly: AssemblyProduct("math-expression")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a589158d-4bac-47e2-b5dd-476c5dcb5b67")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly:AssemblyInformationalVersion("1.0.0.0-rc2")]
| 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("math-expression")]
[assembly: AssemblyDescription("Simple compiler of mathematical expressions.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Yuriy Kushnir")]
[assembly: AssemblyProduct("math-expression")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a589158d-4bac-47e2-b5dd-476c5dcb5b67")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly:AssemblyInformationalVersion("1.0.0.0-rc")]
| mit | C# |
f75e660aac44f9337d78cef668682bb6f0438b9b | Add OpenWindowTest#OpenByGenericType. | nuitsjp/KAMISHIBAI | Source/Kamishibai.Test/Scenario/OpenWindowTest.cs | Source/Kamishibai.Test/Scenario/OpenWindowTest.cs | using Codeer.Friendly.Windows;
using Driver.TestController;
using NUnit.Framework;
using Driver.Windows;
using FluentAssertions;
namespace Scenario;
[TestFixture]
public class OpenWindowTest : TestBase
{
[Test]
public void OpenByType()
{
var mainWindow = app.AttachMainWindow();
var openWindowPage = app.AttachOpenWindowPage();
// Navigate OpenWindowPage
mainWindow.SelectedMenuItem.EmulateChangeSelectedIndex(1);
// Open window
openWindowPage.OpenByTypeCommand.EmulateClick();
var childWindow = app.AttachChildWindow();
childWindow.Core.Activate();
childWindow.IsLoaded.Should().BeTrue();
// check blocking
childWindow.BlockClosing.EmulateCheck(true);
childWindow.CloseCommand.EmulateClick();
childWindow.IsLoaded.Should().BeTrue();
// close window
childWindow.BlockClosing.EmulateCheck(false);
childWindow.CloseCommand.EmulateClick();
childWindow.IsLoaded.Should().BeFalse();
}
[Test]
public void OpenByGenericType()
{
var mainWindow = app.AttachMainWindow();
var openWindowPage = app.AttachOpenWindowPage();
// Navigate OpenWindowPage
mainWindow.SelectedMenuItem.EmulateChangeSelectedIndex(1);
// Open window
openWindowPage.SelectedWindowStartupLocation.EmulateChangeSelectedIndex(1);
openWindowPage.OpenByGenericTypeCommand.EmulateClick();
var childWindow = app.AttachChildWindow();
childWindow.IsLoaded.Should().BeTrue();
// close window
childWindow.Core.Activate();
childWindow.CloseSpecifiedWindowCommand.EmulateClick();
childWindow.IsLoaded.Should().BeFalse();
}
} | using Codeer.Friendly.Windows;
using Driver.TestController;
using NUnit.Framework;
using Driver.Windows;
using FluentAssertions;
namespace Scenario;
[TestFixture]
public class OpenWindowTest : TestBase
{
[Test]
public void OpenByType()
{
var mainWindow = app.AttachMainWindow();
var openWindowPage = app.AttachOpenWindowPage();
// Navigate OpenWindowPage
mainWindow.SelectedMenuItem.EmulateChangeSelectedIndex(1);
// Open window
openWindowPage.OpenByTypeCommand.EmulateClick();
var childWindow = app.AttachChildWindow();
childWindow.Core.Activate();
childWindow.IsLoaded.Should().BeTrue();
// check blocking
childWindow.BlockClosing.EmulateCheck(true);
childWindow.CloseCommand.EmulateClick();
childWindow.IsLoaded.Should().BeTrue();
// close window
childWindow.BlockClosing.EmulateCheck(false);
childWindow.CloseCommand.EmulateClick();
childWindow.IsLoaded.Should().BeFalse();
}
[Test]
public void OpenByGenericType()
{
}
} | mit | C# |
6561570c02f481cb308c5b149458144160121939 | Make Directory syntax coherent with OpenContent module | sachatrauwaen/openform,sachatrauwaen/openform,sachatrauwaen/openform | EditSettings.ascx.cs | EditSettings.ascx.cs | #region Copyright
//
// Copyright (c) 2015
// by Satrabel
//
#endregion
#region Using Statements
using System;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Common;
using DotNetNuke.Framework.JavaScriptLibraries;
using DotNetNuke.Framework;
using Satrabel.OpenContent.Components;
using Satrabel.OpenForm.Components;
using Satrabel.OpenContent.Components.Alpaca;
using System.IO;
#endregion
namespace Satrabel.OpenForm
{
public partial class EditSettings : PortalModuleBase
{
#region Event Handlers
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
hlCancel.NavigateUrl = Globals.NavigateURL();
//ServicesFramework.Instance.RequestAjaxScriptSupport();
//ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext, "DesktopModules/OpenForm/", "settings");
alpaca.RegisterAll();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!Page.IsPostBack)
{
hlTemplateExchange.NavigateUrl = EditUrl("ShareTemplate");
var scriptFileSetting = Settings["template"] as string;
scriptList.Items.AddRange(OpenFormUtils.GetTemplatesFiles(PortalSettings, ModuleId, scriptFileSetting).ToArray());
}
}
protected void cmdSave_Click(object sender, EventArgs e)
{
ModuleController mc = new ModuleController();
mc.UpdateModuleSetting(ModuleId, "template", scriptList.SelectedValue);
mc.UpdateModuleSetting(ModuleId, "data", HiddenField.Value);
Response.Redirect(Globals.NavigateURL(), true);
//DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "Update Successful", DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.GreenSuccess);
}
protected void cmdCancel_Click(object sender, EventArgs e)
{
}
#endregion
}
}
| #region Copyright
//
// Copyright (c) 2015
// by Satrabel
//
#endregion
#region Using Statements
using System;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Common;
using DotNetNuke.Framework.JavaScriptLibraries;
using DotNetNuke.Framework;
using Satrabel.OpenContent.Components;
using Satrabel.OpenForm.Components;
using Satrabel.OpenContent.Components.Alpaca;
using System.IO;
#endregion
namespace Satrabel.OpenForm
{
public partial class EditSettings : PortalModuleBase
{
#region Event Handlers
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
hlCancel.NavigateUrl = Globals.NavigateURL();
//ServicesFramework.Instance.RequestAjaxScriptSupport();
//ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
AlpacaEngine alpaca = new AlpacaEngine(Page, ModuleContext, "DesktopModules/OpenForm", "settings");
alpaca.RegisterAll();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!Page.IsPostBack)
{
hlTemplateExchange.NavigateUrl = EditUrl("ShareTemplate");
var scriptFileSetting = Settings["template"] as string;
scriptList.Items.AddRange(OpenFormUtils.GetTemplatesFiles(PortalSettings, ModuleId, scriptFileSetting).ToArray());
}
}
protected void cmdSave_Click(object sender, EventArgs e)
{
ModuleController mc = new ModuleController();
mc.UpdateModuleSetting(ModuleId, "template", scriptList.SelectedValue);
mc.UpdateModuleSetting(ModuleId, "data", HiddenField.Value);
Response.Redirect(Globals.NavigateURL(), true);
//DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, "Update Successful", DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.GreenSuccess);
}
protected void cmdCancel_Click(object sender, EventArgs e)
{
}
#endregion
}
}
| mit | C# |
b017e8690acf5025a2182fd05302e8d04edfcf67 | Fix errors in log caused by no prevalues beind selected. | mattbrailsford/Umbraco-CMS,dampee/Umbraco-CMS,rasmuseeg/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,sargin48/Umbraco-CMS,NikRimington/Umbraco-CMS,Door3Dev/HRI-Umbraco,tcmorris/Umbraco-CMS,Spijkerboer/Umbraco-CMS,abryukhov/Umbraco-CMS,ehornbostel/Umbraco-CMS,nvisage-gf/Umbraco-CMS,sargin48/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,rustyswayne/Umbraco-CMS,aadfPT/Umbraco-CMS,zidad/Umbraco-CMS,bjarnef/Umbraco-CMS,dampee/Umbraco-CMS,DaveGreasley/Umbraco-CMS,tcmorris/Umbraco-CMS,robertjf/Umbraco-CMS,rasmuseeg/Umbraco-CMS,AzarinSergey/Umbraco-CMS,Pyuuma/Umbraco-CMS,Myster/Umbraco-CMS,gregoriusxu/Umbraco-CMS,AzarinSergey/Umbraco-CMS,lars-erik/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,bjarnef/Umbraco-CMS,aadfPT/Umbraco-CMS,gregoriusxu/Umbraco-CMS,ehornbostel/Umbraco-CMS,mstodd/Umbraco-CMS,mstodd/Umbraco-CMS,Phosworks/Umbraco-CMS,base33/Umbraco-CMS,romanlytvyn/Umbraco-CMS,Myster/Umbraco-CMS,lingxyd/Umbraco-CMS,kgiszewski/Umbraco-CMS,nvisage-gf/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,marcemarc/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,Phosworks/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,Spijkerboer/Umbraco-CMS,dawoe/Umbraco-CMS,Myster/Umbraco-CMS,zidad/Umbraco-CMS,gkonings/Umbraco-CMS,wtct/Umbraco-CMS,countrywide/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,rajendra1809/Umbraco-CMS,engern/Umbraco-CMS,tompipe/Umbraco-CMS,neilgaietto/Umbraco-CMS,sargin48/Umbraco-CMS,lingxyd/Umbraco-CMS,lingxyd/Umbraco-CMS,arvaris/HRI-Umbraco,Jeavon/Umbraco-CMS-RollbackTweak,robertjf/Umbraco-CMS,AzarinSergey/Umbraco-CMS,marcemarc/Umbraco-CMS,nvisage-gf/Umbraco-CMS,iahdevelop/Umbraco-CMS,christopherbauer/Umbraco-CMS,mittonp/Umbraco-CMS,hfloyd/Umbraco-CMS,iahdevelop/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,zidad/Umbraco-CMS,mattbrailsford/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,mittonp/Umbraco-CMS,gkonings/Umbraco-CMS,mittonp/Umbraco-CMS,markoliver288/Umbraco-CMS,iahdevelop/Umbraco-CMS,tompipe/Umbraco-CMS,yannisgu/Umbraco-CMS,countrywide/Umbraco-CMS,Pyuuma/Umbraco-CMS,Khamull/Umbraco-CMS,Door3Dev/HRI-Umbraco,leekelleher/Umbraco-CMS,VDBBjorn/Umbraco-CMS,TimoPerplex/Umbraco-CMS,lars-erik/Umbraco-CMS,kasperhhk/Umbraco-CMS,markoliver288/Umbraco-CMS,rustyswayne/Umbraco-CMS,neilgaietto/Umbraco-CMS,christopherbauer/Umbraco-CMS,rajendra1809/Umbraco-CMS,romanlytvyn/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,wtct/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,NikRimington/Umbraco-CMS,AndyButland/Umbraco-CMS,hfloyd/Umbraco-CMS,Pyuuma/Umbraco-CMS,leekelleher/Umbraco-CMS,ehornbostel/Umbraco-CMS,timothyleerussell/Umbraco-CMS,robertjf/Umbraco-CMS,madsoulswe/Umbraco-CMS,TimoPerplex/Umbraco-CMS,rustyswayne/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,WebCentrum/Umbraco-CMS,base33/Umbraco-CMS,AzarinSergey/Umbraco-CMS,neilgaietto/Umbraco-CMS,leekelleher/Umbraco-CMS,gregoriusxu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,WebCentrum/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,sargin48/Umbraco-CMS,iahdevelop/Umbraco-CMS,abryukhov/Umbraco-CMS,Khamull/Umbraco-CMS,gavinfaux/Umbraco-CMS,kasperhhk/Umbraco-CMS,NikRimington/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,DaveGreasley/Umbraco-CMS,nvisage-gf/Umbraco-CMS,Khamull/Umbraco-CMS,gavinfaux/Umbraco-CMS,gregoriusxu/Umbraco-CMS,abjerner/Umbraco-CMS,base33/Umbraco-CMS,qizhiyu/Umbraco-CMS,qizhiyu/Umbraco-CMS,umbraco/Umbraco-CMS,abjerner/Umbraco-CMS,VDBBjorn/Umbraco-CMS,TimoPerplex/Umbraco-CMS,dawoe/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,wtct/Umbraco-CMS,christopherbauer/Umbraco-CMS,ordepdev/Umbraco-CMS,markoliver288/Umbraco-CMS,Phosworks/Umbraco-CMS,hfloyd/Umbraco-CMS,gavinfaux/Umbraco-CMS,VDBBjorn/Umbraco-CMS,mstodd/Umbraco-CMS,lingxyd/Umbraco-CMS,marcemarc/Umbraco-CMS,romanlytvyn/Umbraco-CMS,lars-erik/Umbraco-CMS,Phosworks/Umbraco-CMS,AndyButland/Umbraco-CMS,dawoe/Umbraco-CMS,qizhiyu/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,rasmusfjord/Umbraco-CMS,kgiszewski/Umbraco-CMS,tcmorris/Umbraco-CMS,neilgaietto/Umbraco-CMS,yannisgu/Umbraco-CMS,Myster/Umbraco-CMS,lars-erik/Umbraco-CMS,gkonings/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,aaronpowell/Umbraco-CMS,robertjf/Umbraco-CMS,madsoulswe/Umbraco-CMS,Khamull/Umbraco-CMS,timothyleerussell/Umbraco-CMS,Khamull/Umbraco-CMS,timothyleerussell/Umbraco-CMS,christopherbauer/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,m0wo/Umbraco-CMS,arknu/Umbraco-CMS,romanlytvyn/Umbraco-CMS,AndyButland/Umbraco-CMS,gregoriusxu/Umbraco-CMS,Tronhus/Umbraco-CMS,ordepdev/Umbraco-CMS,VDBBjorn/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,AndyButland/Umbraco-CMS,KevinJump/Umbraco-CMS,rajendra1809/Umbraco-CMS,neilgaietto/Umbraco-CMS,VDBBjorn/Umbraco-CMS,Tronhus/Umbraco-CMS,engern/Umbraco-CMS,TimoPerplex/Umbraco-CMS,hfloyd/Umbraco-CMS,engern/Umbraco-CMS,arvaris/HRI-Umbraco,m0wo/Umbraco-CMS,KevinJump/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,markoliver288/Umbraco-CMS,mittonp/Umbraco-CMS,qizhiyu/Umbraco-CMS,sargin48/Umbraco-CMS,tcmorris/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,rasmusfjord/Umbraco-CMS,jchurchley/Umbraco-CMS,iahdevelop/Umbraco-CMS,Pyuuma/Umbraco-CMS,countrywide/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,arvaris/HRI-Umbraco,engern/Umbraco-CMS,KevinJump/Umbraco-CMS,rasmusfjord/Umbraco-CMS,dawoe/Umbraco-CMS,Door3Dev/HRI-Umbraco,nul800sebastiaan/Umbraco-CMS,yannisgu/Umbraco-CMS,mstodd/Umbraco-CMS,dampee/Umbraco-CMS,KevinJump/Umbraco-CMS,countrywide/Umbraco-CMS,aaronpowell/Umbraco-CMS,Tronhus/Umbraco-CMS,engern/Umbraco-CMS,arknu/Umbraco-CMS,rajendra1809/Umbraco-CMS,corsjune/Umbraco-CMS,Spijkerboer/Umbraco-CMS,gkonings/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,Phosworks/Umbraco-CMS,markoliver288/Umbraco-CMS,Door3Dev/HRI-Umbraco,nvisage-gf/Umbraco-CMS,ehornbostel/Umbraco-CMS,zidad/Umbraco-CMS,TimoPerplex/Umbraco-CMS,tcmorris/Umbraco-CMS,madsoulswe/Umbraco-CMS,kasperhhk/Umbraco-CMS,wtct/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,DaveGreasley/Umbraco-CMS,kasperhhk/Umbraco-CMS,aaronpowell/Umbraco-CMS,yannisgu/Umbraco-CMS,corsjune/Umbraco-CMS,rasmusfjord/Umbraco-CMS,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,rustyswayne/Umbraco-CMS,rustyswayne/Umbraco-CMS,Spijkerboer/Umbraco-CMS,bjarnef/Umbraco-CMS,Pyuuma/Umbraco-CMS,mittonp/Umbraco-CMS,qizhiyu/Umbraco-CMS,timothyleerussell/Umbraco-CMS,yannisgu/Umbraco-CMS,Myster/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,gkonings/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,MicrosoftEdge/Umbraco-CMS,umbraco/Umbraco-CMS,dampee/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,DaveGreasley/Umbraco-CMS,zidad/Umbraco-CMS,dawoe/Umbraco-CMS,WebCentrum/Umbraco-CMS,bjarnef/Umbraco-CMS,markoliver288/Umbraco-CMS,umbraco/Umbraco-CMS,dampee/Umbraco-CMS,Tronhus/Umbraco-CMS,DaveGreasley/Umbraco-CMS,lars-erik/Umbraco-CMS,ordepdev/Umbraco-CMS,tompipe/Umbraco-CMS,Spijkerboer/Umbraco-CMS,marcemarc/Umbraco-CMS,wtct/Umbraco-CMS,rajendra1809/Umbraco-CMS,rasmusfjord/Umbraco-CMS,arvaris/HRI-Umbraco,kasperhhk/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,leekelleher/Umbraco-CMS,kgiszewski/Umbraco-CMS,romanlytvyn/Umbraco-CMS,AndyButland/Umbraco-CMS,gavinfaux/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,ordepdev/Umbraco-CMS,Tronhus/Umbraco-CMS,m0wo/Umbraco-CMS,christopherbauer/Umbraco-CMS,corsjune/Umbraco-CMS,ordepdev/Umbraco-CMS,hfloyd/Umbraco-CMS,AzarinSergey/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,Scott-Herbert/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,jchurchley/Umbraco-CMS,ehornbostel/Umbraco-CMS,arknu/Umbraco-CMS,mattbrailsford/Umbraco-CMS,jchurchley/Umbraco-CMS,corsjune/Umbraco-CMS,aadfPT/Umbraco-CMS,Jeavon/Umbraco-CMS-RollbackTweak,lingxyd/Umbraco-CMS,corsjune/Umbraco-CMS,rasmuseeg/Umbraco-CMS,gavinfaux/Umbraco-CMS,Door3Dev/HRI-Umbraco,mstodd/Umbraco-CMS,countrywide/Umbraco-CMS,m0wo/Umbraco-CMS,m0wo/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,timothyleerussell/Umbraco-CMS | src/umbraco.editorControls/DefaultDataKeyValue.cs | src/umbraco.editorControls/DefaultDataKeyValue.cs | using System;
using umbraco.DataLayer;
namespace umbraco.editorControls
{
/// <summary>
/// Summary description for cms.businesslogic.datatype.DefaultDataKeyValue.
/// </summary>
public class DefaultDataKeyValue : cms.businesslogic.datatype.DefaultData
{
public DefaultDataKeyValue(cms.businesslogic.datatype.BaseDataType DataType) : base(DataType)
{}
/// <summary>
/// Ov
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d)
{
// Get the value from
string v = "";
try
{
// Don't query if there's nothing to query for..
if (string.IsNullOrWhiteSpace(Value.ToString()) == false)
{
IRecordsReader dr = SqlHelper.ExecuteReader("Select [value] from cmsDataTypeprevalues where id in (@id)", SqlHelper.CreateParameter("id", Value.ToString()));
while (dr.Read())
{
if (v.Length == 0)
v += dr.GetString("value");
else
v += "," + dr.GetString("value");
}
dr.Close();
}
}
catch {}
return d.CreateCDataSection(v);
}
}
}
| using System;
using umbraco.DataLayer;
namespace umbraco.editorControls
{
/// <summary>
/// Summary description for cms.businesslogic.datatype.DefaultDataKeyValue.
/// </summary>
public class DefaultDataKeyValue : cms.businesslogic.datatype.DefaultData
{
public DefaultDataKeyValue(cms.businesslogic.datatype.BaseDataType DataType) : base(DataType)
{}
/// <summary>
/// Ov
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d)
{
// Get the value from
string v = "";
try
{
IRecordsReader dr = SqlHelper.ExecuteReader("Select [value] from cmsDataTypeprevalues where id in (" + SqlHelper.EscapeString(Value.ToString()) + ")");
while (dr.Read()) {
if (v.Length == 0)
v += dr.GetString("value");
else
v += "," + dr.GetString("value");
}
dr.Close();
}
catch {}
return d.CreateCDataSection(v);
}
}
}
| mit | C# |
6c3a8c15a2adca6c6b2124414ee3e1f44c23708e | fix for ETCH-56: UnwantedMessage.ToString method attempts to format using the java style formatting instead of csharp style | OBIGOGIT/etch,OBIGOGIT/etch,OBIGOGIT/etch,OBIGOGIT/etch,OBIGOGIT/etch,OBIGOGIT/etch,OBIGOGIT/etch,OBIGOGIT/etch | binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/UnwantedMessage.cs | binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/UnwantedMessage.cs | // $Id$
//
// Copyright 2007-2008 Cisco Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
using System;
using Org.Apache.Etch.Bindings.Csharp.Msg;
using Org.Apache.Etch.Bindings.Csharp.Util;
namespace Org.Apache.Etch.Bindings.Csharp.Transport
{
/// <summary>
/// Event class used with SessionNotify to report unwanted messages.
/// </summary>
public class UnwantedMessage
{
public UnwantedMessage(Who sender, Message msg)
{
this.sender = sender;
this.msg = msg;
}
public readonly Who sender;
public readonly Message msg;
public override String ToString()
{
return String.Format("Unwanted message from {0}: {1}", sender, msg);
}
}
}
| // $Id$
//
// Copyright 2007-2008 Cisco Systems Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
using System;
using Org.Apache.Etch.Bindings.Csharp.Msg;
using Org.Apache.Etch.Bindings.Csharp.Util;
namespace Org.Apache.Etch.Bindings.Csharp.Transport
{
/// <summary>
/// Event class used with SessionNotify to report unwanted messages.
/// </summary>
public class UnwantedMessage
{
public UnwantedMessage(Who sender, Message msg)
{
this.sender = sender;
this.msg = msg;
}
public readonly Who sender;
public readonly Message msg;
public override String ToString()
{
return String.Format("Unwanted message from %s: %s", sender, msg);
}
}
}
| apache-2.0 | C# |
0a42cd9012dfb2171945d935420b5ff47a81109c | Reorder properties | bcemmett/SurveyMonkeyApi-v3,davek17/SurveyMonkeyApi-v3 | SurveyMonkey/Containers/QuestionDisplayOptions.cs | SurveyMonkey/Containers/QuestionDisplayOptions.cs | using Newtonsoft.Json;
namespace SurveyMonkey.Containers
{
[JsonConverter(typeof(TolerantJsonConverter))]
public class QuestionDisplayOptions
{
public string LeftLabel { get; set; }
public string MiddleLabel { get; set; }
public string RightLabel { get; set; }
public string DisplayType { get; set; }
public string DisplaySubtype { get; set; }
public bool? ShowDisplayNumber { get; set; }
public QuestionDisplayOptionsCustomOptions CustomOptions { get; set; }
}
} | using Newtonsoft.Json;
namespace SurveyMonkey.Containers
{
[JsonConverter(typeof(TolerantJsonConverter))]
public class QuestionDisplayOptions
{
public string MiddleLabel { get; set; }
public bool? ShowDisplayNumber { get; set; }
public string DisplaySubtype { get; set; }
public string RightLabel { get; set; }
public string DisplayType { get; set; }
public string LeftLabel { get; set; }
public QuestionDisplayOptionsCustomOptions CustomOptions { get; set; }
}
} | mit | C# |
d6d29ddcd4e5ec5ed7937cf6ee8bd3c273b7cd9c | Format EnumCompletionProvider.cs | weltkante/roslyn,CyrusNajmabadi/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,physhi/roslyn,dotnet/roslyn,mavasani/roslyn,eriawan/roslyn,wvdd007/roslyn,physhi/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,mgoertz-msft/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,sharwell/roslyn,mavasani/roslyn,mgoertz-msft/roslyn,shyamnamboodiripad/roslyn,tmat/roslyn,tmat/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn,ErikSchierboom/roslyn,AmadeusW/roslyn,dotnet/roslyn,diryboy/roslyn,diryboy/roslyn,tmat/roslyn,AlekseyTs/roslyn,KevinRansom/roslyn,diryboy/roslyn,mavasani/roslyn,sharwell/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,weltkante/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,eriawan/roslyn,mgoertz-msft/roslyn,AmadeusW/roslyn,weltkante/roslyn,wvdd007/roslyn,wvdd007/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn | src/Features/CSharp/Portable/Completion/CompletionProviders/EnumCompletionProvider.cs | src/Features/CSharp/Portable/Completion/CompletionProviders/EnumCompletionProvider.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.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Completion.Providers;
using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Extensions.ContextQuery;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.CSharp.Completion.Providers
{
[ExportCompletionProvider(nameof(EnumCompletionProvider), LanguageNames.CSharp)]
[ExtensionOrder(After = nameof(ObjectAndWithInitializerCompletionProvider))]
[Shared]
internal class EnumCompletionProvider : AbstractEnumCompletionProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public EnumCompletionProvider()
{
}
internal override bool IsInsertionTrigger(SourceText text, int characterPosition, OptionSet options)
{
var ch = text[characterPosition];
return ch is ' ' or '(' or '=' ||
(SyntaxFacts.IsIdentifierStartCharacter(ch) && options.GetOption(CompletionOptions.TriggerOnTypingLetters2, LanguageNames.CSharp));
}
internal override ImmutableHashSet<char> TriggerCharacters { get; } = ImmutableHashSet.Create(' ', '(', '=');
protected override async Task<SyntaxContext> CreateContextAsync(Document document, int position, CancellationToken cancellationToken)
{
var semanticModel = await document.ReuseExistingSpeculativeModelAsync(position, cancellationToken).ConfigureAwait(false);
return CSharpSyntaxContext.CreateContext(document.Project.Solution.Workspace, semanticModel, position, cancellationToken);
}
protected override string GetInsertionText(CompletionItem item, char ch)
=> SymbolCompletionItem.GetInsertionText(item);
protected override (string displayText, string suffix, string insertionText) GetDefaultDisplayAndSuffixAndInsertionText(ISymbol symbol,
SyntaxContext context)
=> CompletionUtilities.GetDisplayAndSuffixAndInsertionText(symbol, context);
}
}
| // 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.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Completion.Providers;
using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Extensions.ContextQuery;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.CSharp.Completion.Providers
{
[ExportCompletionProvider(nameof(EnumCompletionProvider), LanguageNames.CSharp)]
[ExtensionOrder(After = nameof(ObjectAndWithInitializerCompletionProvider))]
[Shared]
internal class EnumCompletionProvider : AbstractEnumCompletionProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public EnumCompletionProvider()
{
}
internal override bool IsInsertionTrigger(SourceText text, int characterPosition, OptionSet options)
{
var ch = text[characterPosition];
return ch is ' ' or '(' or '=' ||
SyntaxFacts.IsIdentifierStartCharacter(ch) && options.GetOption(CompletionOptions.TriggerOnTypingLetters2, LanguageNames.CSharp);
}
internal override ImmutableHashSet<char> TriggerCharacters { get; } = ImmutableHashSet.Create(' ', '(', '=');
protected override async Task<SyntaxContext> CreateContextAsync(Document document, int position, CancellationToken cancellationToken)
{
var semanticModel = await document.ReuseExistingSpeculativeModelAsync(position, cancellationToken).ConfigureAwait(false);
return CSharpSyntaxContext.CreateContext(document.Project.Solution.Workspace, semanticModel, position, cancellationToken);
}
protected override string GetInsertionText(CompletionItem item, char ch)
=> SymbolCompletionItem.GetInsertionText(item);
protected override (string displayText, string suffix, string insertionText) GetDefaultDisplayAndSuffixAndInsertionText(ISymbol symbol, SyntaxContext context)
=> CompletionUtilities.GetDisplayAndSuffixAndInsertionText(symbol, context);
}
}
| mit | C# |
ec122631ea1211e2a2711d2d59dea830d4b2b487 | Fix unityadview vertical position. | Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x,Senspark/ee-x | unity/Runtime/Unity/UnityAdView.cs | unity/Runtime/Unity/UnityAdView.cs | using System.Threading.Tasks;
using UnityEngine;
namespace EE {
public class UnityAdView
: ObserverManager<IAdViewObserver>, IAdView {
private readonly IAdView _ad;
private readonly ObserverHandle _handle;
public UnityAdView(IAdView ad) {
_ad = ad;
_handle = new ObserverHandle();
_handle.Bind(ad).AddObserver(new IAdViewObserver {
OnLoaded = () => DispatchEvent(observer => observer.OnLoaded?.Invoke()),
OnClicked = () => DispatchEvent(observer => observer.OnClicked?.Invoke())
});
}
public void Destroy() {
_ad.Destroy();
_handle.Clear();
}
public bool IsLoaded => _ad.IsLoaded;
public Task<bool> Load() {
return _ad.Load();
}
public (float, float) Anchor {
get {
var (x, y) = _ad.Anchor;
return (x, 1 - y);
}
set {
var (x, y) = value;
_ad.Anchor = (x, 1 - y);
}
}
public (float, float) Position {
get {
var (x, y) = _ad.Position;
return (x, Screen.height - y);
}
set {
var (x, y) = value;
_ad.Position = (x, Screen.height - y);
}
}
public (float, float) Size {
get => _ad.Size;
set => _ad.Size = value;
}
public bool IsVisible {
get => _ad.IsVisible;
set => _ad.IsVisible = value;
}
}
} | using System.Threading.Tasks;
namespace EE {
public class UnityAdView
: ObserverManager<IAdViewObserver>, IAdView {
private readonly IAdView _ad;
private readonly ObserverHandle _handle;
public UnityAdView(IAdView ad) {
_ad = ad;
_handle = new ObserverHandle();
_handle.Bind(ad).AddObserver(new IAdViewObserver {
OnLoaded = () => DispatchEvent(observer => observer.OnLoaded?.Invoke()),
OnClicked = () => DispatchEvent(observer => observer.OnClicked?.Invoke())
});
}
public void Destroy() {
_ad.Destroy();
_handle.Clear();
}
public bool IsLoaded => _ad.IsLoaded;
public Task<bool> Load() {
return _ad.Load();
}
public (float, float) Anchor {
get {
var (x, y) = _ad.Anchor;
return (x, 1 - y);
}
set {
var (x, y) = value;
_ad.Anchor = (x, 1 - y);
}
}
public (float, float) Position {
get {
var (x, y) = _ad.Position;
return (x, 1 - y);
}
set {
var (x, y) = value;
_ad.Position = (x, 1 - y);
}
}
public (float, float) Size {
get => _ad.Size;
set => _ad.Size = value;
}
public bool IsVisible {
get => _ad.IsVisible;
set => _ad.IsVisible = value;
}
}
} | mit | C# |
60b7635a3c92953c1d0ce4b3565f8d2493baef7f | Update AssemblyInfo.cs | zoosk/testrail-client | TestRail/Properties/AssemblyInfo.cs | TestRail/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("TestRail Client")]
[assembly: AssemblyDescription("TestRail Client Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Zoosk")]
[assembly: AssemblyProduct("TestRail Client Library for .NET")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b91a1174-5709-412a-9e95-ccaad637454c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.7")]
[assembly: AssemblyFileVersion("1.0.0.7")]
| 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("TestRail Client")]
[assembly: AssemblyDescription("TestRail Client Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Zoosk")]
[assembly: AssemblyProduct("TestRail Client Library for .NET")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b91a1174-5709-412a-9e95-ccaad637454c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.6")]
[assembly: AssemblyFileVersion("1.0.0.6")]
| apache-2.0 | C# |
bf19b23bf9e1c619cdc69ff39ed70509fed8227d | Refactor to common AddToLogBox function | TimothyK/RxExamples | RxExamplesWPF/MainWindow.xaml.cs | RxExamplesWPF/MainWindow.xaml.cs | using System;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Windows;
namespace RxExamplesWPF
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
InitializeSubject();
}
private void Button1_Click(object sender, RoutedEventArgs e)
{
AddToLogBox("Click");
}
#region Subject
private Subject<RoutedEventArgs> _subject;
private void InitializeSubject()
{
_subject = new Subject<RoutedEventArgs>();
_subject
.Select(e => "Subject Next")
.Subscribe(AddToLogBox);
}
private void SubjectButton_Click(object sender, RoutedEventArgs e)
{
_subject.OnNext(e);
}
#endregion
private void AddToLogBox(string source)
{
LogBox.Text += DateTime.Now.ToString("HH:mm:ss.fffffff") + " - " + source + "\r\n";
LogBox.ScrollToEnd();
}
}
}
| using System;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Windows;
namespace RxExamplesWPF
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
InitializeSubject();
}
private void Button1_Click(object sender, RoutedEventArgs e)
{
LogBox.Text += DateTime.Now.ToString("HH:mm:ss.fffffff") + " - Click\r\n";
LogBox.ScrollToEnd();
}
#region Subject
private Subject<RoutedEventArgs> _subject;
private void InitializeSubject()
{
_subject = new Subject<RoutedEventArgs>();
_subject.Subscribe(Subject_Next);
}
private void Subject_Next(RoutedEventArgs e)
{
LogBox.Text += DateTime.Now.ToString("HH:mm:ss.fffffff") + " - Next Subject\r\n";
LogBox.ScrollToEnd();
}
private void SubjectButton_Click(object sender, RoutedEventArgs e)
{
_subject.OnNext(e);
}
#endregion
}
}
| unlicense | C# |
afb91626835e82b0211ef19dc6ca97ecf9b07dd7 | Configure data portal before using data portal | JasonBock/csla,rockfordlhotka/csla,JasonBock/csla,MarimerLLC/csla,MarimerLLC/csla,JasonBock/csla,rockfordlhotka/csla,rockfordlhotka/csla,MarimerLLC/csla | Samples/ProjectTracker/ProjectTracker.Ui.Xamarin/ProjectTracker.Ui.Xamarin/App.xaml.cs | Samples/ProjectTracker/ProjectTracker.Ui.Xamarin/ProjectTracker.Ui.Xamarin/App.xaml.cs | using Csla.Configuration;
using ProjectTracker.Library;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace ProjectTracker.Ui.Xamarin
{
public partial class App : Application
{
public static Page RootPage { get; private set; }
public App ()
{
InitializeComponent();
CslaConfiguration.Configure()
.DataPortal()
.DefaultProxy(typeof(Csla.DataPortalClient.HttpProxy), "https://ptrackerserver.azurewebsites.net/api/dataportal");
Library.Security.PTPrincipal.Logout();
MainPage = new NavigationPage(new XamarinFormsUi.Views.Dashboard());
RootPage = MainPage;
}
protected override async void OnStart ()
{
await Library.Security.PTPrincipal.LoginAsync("manager", "manager");
await RoleList.CacheListAsync();
}
protected override void OnSleep ()
{
// Handle when your app sleeps
}
protected override void OnResume ()
{
// Handle when your app resumes
}
public static async Task NavigateTo(Type page)
{
var target = (Page)Activator.CreateInstance(page);
await NavigateTo(target);
}
public static async Task NavigateTo(Type page, object parameter)
{
var target = (Page)Activator.CreateInstance(page, parameter);
await NavigateTo(target);
}
private static async Task NavigateTo(Page page)
{
await RootPage.Navigation.PushAsync(page);
}
}
}
| using Csla.Configuration;
using ProjectTracker.Library;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace ProjectTracker.Ui.Xamarin
{
public partial class App : Application
{
public static Page RootPage { get; private set; }
private ContentPage startPage = new XamarinFormsUi.Views.Dashboard();
public App ()
{
InitializeComponent();
MainPage = new NavigationPage(startPage);
RootPage = MainPage;
}
protected override async void OnStart ()
{
// Handle when your app starts
CslaConfiguration.Configure()
.DataPortal()
.DefaultProxy(typeof(Csla.DataPortalClient.HttpProxy), "https://ptrackerserver.azurewebsites.net/api/dataportal");
Library.Security.PTPrincipal.Logout();
await Library.Security.PTPrincipal.LoginAsync("manager", "manager");
await RoleList.CacheListAsync();
}
protected override void OnSleep ()
{
// Handle when your app sleeps
}
protected override void OnResume ()
{
// Handle when your app resumes
}
public static async Task NavigateTo(Type page)
{
var target = (Page)Activator.CreateInstance(page);
await NavigateTo(target);
}
public static async Task NavigateTo(Type page, object parameter)
{
var target = (Page)Activator.CreateInstance(page, parameter);
await NavigateTo(target);
}
private static async Task NavigateTo(Page page)
{
await RootPage.Navigation.PushAsync(page);
}
}
}
| mit | C# |
0ff1d764ef6d66092886b484ffc9ee6a2879e350 | Update RedisDatabaseExtensions.cs | verdentk/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,carldai0106/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ilyhacker/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,luchaoshuai/aspnetboilerplate,carldai0106/aspnetboilerplate,luchaoshuai/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,verdentk/aspnetboilerplate,verdentk/aspnetboilerplate,ilyhacker/aspnetboilerplate,carldai0106/aspnetboilerplate | src/Abp.RedisCache/Runtime/Caching/Redis/RedisDatabaseExtensions.cs | src/Abp.RedisCache/Runtime/Caching/Redis/RedisDatabaseExtensions.cs | using System;
using StackExchange.Redis;
namespace Abp.Runtime.Caching.Redis
{
/// <summary>
/// Extension methods for <see cref="IDatabase"/>.
/// </summary>
internal static class RedisDatabaseExtensions
{
public static void KeyDeleteWithPrefix(this IDatabase database, string prefix)
{
if (database == null)
{
throw new ArgumentException("Database cannot be null", nameof(database));
}
if (string.IsNullOrWhiteSpace(prefix))
{
throw new ArgumentException("Prefix cannot be empty", nameof(prefix));
}
database.ScriptEvaluate(@"
local keys = redis.call('keys', ARGV[1])
for i=1,#keys,5000 do
redis.call('del', unpack(keys, i, math.min(i+4999, #keys)))
end", values: new RedisValue[] { prefix });
}
public static int KeyCount(this IDatabase database, string prefix)
{
if (database == null)
{
throw new ArgumentException("Database cannot be null", nameof(database));
}
if (string.IsNullOrWhiteSpace(prefix))
{
throw new ArgumentException("Prefix cannot be empty", nameof(prefix));
}
var retVal = database.ScriptEvaluate("return table.getn(redis.call('keys', ARGV[1]))", values: new RedisValue[] { prefix });
if (retVal.IsNull)
{
return 0;
}
return (int)retVal;
}
}
}
| using System;
using StackExchange.Redis;
namespace Abp.Runtime.Caching.Redis
{
/// <summary>
/// Extension methods for <see cref="IDatabase"/>.
/// </summary>
internal static class RedisDatabaseExtensions
{
public static void KeyDeleteWithPrefix(this IDatabase database, string prefix)
{
if (database == null)
{
throw new ArgumentException("Database cannot be null", nameof(database));
}
if (string.IsNullOrWhiteSpace(prefix))
{
throw new ArgumentException("Prefix cannot be empty", nameof(database));
}
database.ScriptEvaluate(@"
local keys = redis.call('keys', ARGV[1])
for i=1,#keys,5000 do
redis.call('del', unpack(keys, i, math.min(i+4999, #keys)))
end", values: new RedisValue[] { prefix });
}
public static int KeyCount(this IDatabase database, string prefix)
{
if (database == null)
{
throw new ArgumentException("Database cannot be null", nameof(database));
}
if (string.IsNullOrWhiteSpace(prefix))
{
throw new ArgumentException("Prefix cannot be empty", nameof(database));
}
var retVal = database.ScriptEvaluate("return table.getn(redis.call('keys', ARGV[1]))", values: new RedisValue[] { prefix });
if (retVal.IsNull)
{
return 0;
}
return (int)retVal;
}
}
}
| mit | C# |
6307c79da41058521bba8056d3ecfa5c1d968e78 | Sort attribute types as documentation | pardahlman/akeneo-csharp | Akeneo/Model/AttributeType.cs | Akeneo/Model/AttributeType.cs | namespace Akeneo.Model
{
public class AttributeType
{
/// <summary>
/// It is the unique product’s identifier. The catalog can contain only one.
/// </summary>
public const string Identifier = "pim_catalog_identifier";
/// <summary>
/// Text
/// </summary>
public const string Text = "pim_catalog_text";
/// <summary>
/// Long texts
/// </summary>
public const string TextArea = "pim_catalog_textarea";
/// <summary>
/// Yes/No
/// </summary>
public const string Boolean = "pim_catalog_boolean";
/// <summary>
/// Number (integer and float)
/// </summary>
public const string Number = "pim_catalog_number";
/// <summary>
/// Simple choice list
/// </summary>
public const string SimpleSelect = "pim_catalog_simpleselect";
/// <summary>
/// Date
/// </summary>
public const string Date = "pim_catalog_date";
/// <summary>
/// Metric. It consists of a value and a unit (a weight for example).
/// </summary>
public const string Metric = "pim_catalog_metric";
/// <summary>
/// Collection of prices. Each price contains a value and a currency.
/// </summary>
public const string Price = "pim_catalog_price_collection";
}
} | namespace Akeneo.Model
{
public class AttributeType
{
public const string Date = "pim_catalog_date";
public const string Metric = "pim_catalog_metric";
public const string Price = "pim_catalog_price_collection";
public const string Number = "pim_catalog_number";
public const string Text = "pim_catalog_text";
public const string TextArea = "pim_catalog_textarea";
public const string Identifier = "pim_catalog_identifier";
public const string SimpleSelect = "pim_catalog_simpleselect";
public const string Boolean = "pim_catalog_boolean";
}
} | mit | C# |
f72a7bf306d89c9d827899e7518d29438c276a80 | use .localScale instead of .sizeDelta to remove orgSize[] | yasokada/unity-150905-dynamicDisplay | Assets/PanelDisplayControl.cs | Assets/PanelDisplayControl.cs | using UnityEngine;
using System.Collections;
using UnityEngine.UI;
/*
* v0.4 2015/09/06
* - use localScale instead of keeping original sizez at orgSize[]
* v0.3 2015/09/06
* - use Tag for Panel to find target panels, instead of panel name
* v0.2 2015/09/06
* - add sample UI components in each panel
* v0.1 2015/09/05
* - show/hide panels
*/
public class PanelDisplayControl : MonoBehaviour {
public GameObject PageSelect;
public GameObject PanelGroup;
void Start() {
int idx = 0;
foreach (Transform child in PanelGroup.transform) {
bool isOn = getIsOn (/* idx_st1= */ idx + 1);
DisplayPanel (/* idx_st1= */ idx + 1, isOn);
idx++;
}
}
bool getIsOn(int idx_st1) {
Toggle selected = null;
string name;
foreach (Transform child in PageSelect.transform) {
name = child.gameObject.name;
if (name.Contains(idx_st1.ToString())) { // e.g. "SelP1", "SelP2"...
selected = child.gameObject.GetComponent(typeof(Toggle)) as Toggle;
break;
}
}
return selected.isOn;
}
void DisplayPanel(int idx_st1, bool doShow)
{
GameObject [] panels = GameObject.FindGameObjectsWithTag ("TagP" + idx_st1.ToString ());
if (panels == null) {
return;
}
foreach (GameObject panel in panels) {
RectTransform rect = panel.GetComponent (typeof(RectTransform)) as RectTransform;
Vector2 size = rect.localScale;
if (doShow) {
size.x = 1.0f;
size.y = 1.0f;
} else {
size.x = 0;
size.y = 0;
}
rect.localScale = size;
}
}
public void ToggleValueChanged(int idx_st1) {
bool isOn = getIsOn (idx_st1);
DisplayPanel (idx_st1, isOn);
Debug.Log (isOn.ToString ());
}
}
| using UnityEngine;
using System.Collections;
using UnityEngine.UI;
/*
* v0.3 2015/09/06
* - use Tag for Panel to find target panels, instead of panel name
* v0.2 2015/09/06
* - add sample UI components in each panel
* v0.1 2015/09/05
* - show/hide panels
*/
public class PanelDisplayControl : MonoBehaviour {
public GameObject PageSelect;
public GameObject PanelGroup;
private Vector2[] orgSize;
void Start() {
orgSize = new Vector2[4];
int idx=0;
foreach (Transform child in PanelGroup.transform) {
orgSize[idx].x = child.gameObject.GetComponent<RectTransform>().rect.width;
orgSize[idx].y = child.gameObject.GetComponent<RectTransform>().rect.height;
bool isOn = getIsOn (idx + 1);
DisplayPanel (idx + 1, isOn);
idx++;
}
}
bool getIsOn(int idx_st1) {
Toggle selected = null;
string name;
foreach (Transform child in PageSelect.transform) {
name = child.gameObject.name;
if (name.Contains(idx_st1.ToString())) { // e.g. "SelP1", "SelP2"...
selected = child.gameObject.GetComponent(typeof(Toggle)) as Toggle;
break;
}
}
return selected.isOn;
}
void DisplayPanel(int idx_st1, bool doShow)
{
GameObject [] panels = GameObject.FindGameObjectsWithTag ("TagP" + idx_st1.ToString ());
if (panels == null) {
return;
}
foreach (GameObject panel in panels) {
RectTransform rect = panel.GetComponent (typeof(RectTransform)) as RectTransform;
Vector2 size = rect.sizeDelta;
if (doShow) {
size.x = orgSize [idx_st1 - 1].x;
size.y = orgSize [idx_st1 - 1].y;
} else {
size.x = 0;
size.y = 0;
}
rect.sizeDelta = size;
}
}
public void ToggleValueChanged(int idx_st1) {
bool isOn = getIsOn (idx_st1);
DisplayPanel (idx_st1, isOn);
Debug.Log (isOn.ToString ());
}
}
| mit | C# |
f3403fa76d60fed8507d26e9f2987d59a1f8dbbe | Fix error message | vasanthangel4/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,shrishrirang/azure-webjobs-sdk,Azure/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,gibwar/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,vasanthangel4/azure-webjobs-sdk,Azure/azure-webjobs-sdk,oliver-feng/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,brendankowitz/azure-webjobs-sdk,oaastest/azure-webjobs-sdk,oaastest/azure-webjobs-sdk | src/Microsoft.Azure.WebJobs.Host/Queues/Bindings/StringToCloudQueueMessageConverter.cs | src/Microsoft.Azure.WebJobs.Host/Queues/Bindings/StringToCloudQueueMessageConverter.cs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.Azure.WebJobs.Host.Converters;
using Microsoft.WindowsAzure.Storage.Queue;
namespace Microsoft.Azure.WebJobs.Host.Queues.Bindings
{
internal class StringToCloudQueueMessageConverter : IConverter<string, CloudQueueMessage>
{
public CloudQueueMessage Convert(string input)
{
if (input == null)
{
throw new InvalidOperationException("A queue message cannot contain a null string instance.");
}
return new CloudQueueMessage(input);
}
}
}
| // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.Azure.WebJobs.Host.Converters;
using Microsoft.WindowsAzure.Storage.Queue;
namespace Microsoft.Azure.WebJobs.Host.Queues.Bindings
{
internal class StringToCloudQueueMessageConverter : IConverter<string, CloudQueueMessage>
{
public CloudQueueMessage Convert(string input)
{
if (input == null)
{
throw new InvalidOperationException("A queue message cannot contain a null byte array instance.");
}
return new CloudQueueMessage(input);
}
}
}
| mit | C# |
cadfd37dcf00eda1cd0d56519071d07d7b93c7cb | Refactor `NUnitSettings.cs` of Atata.IntegrationTests project | atata-framework/atata,atata-framework/atata | test/Atata.IntegrationTests/NUnitSettings.cs | test/Atata.IntegrationTests/NUnitSettings.cs | [assembly: Parallelizable(ParallelScope.Fixtures)]
| using NUnit.Framework;
[assembly: Parallelizable(ParallelScope.Fixtures)]
| apache-2.0 | C# |
2f0fde43a82d42d2e13c56dcee44ff6c26a561c8 | Use await for synchronization | AngleSharp/AngleSharp,zedr0n/AngleSharp.Local,AngleSharp/AngleSharp,FlorianRappl/AngleSharp,zedr0n/AngleSharp.Local,Livven/AngleSharp,AngleSharp/AngleSharp,zedr0n/AngleSharp.Local,FlorianRappl/AngleSharp,Livven/AngleSharp,AngleSharp/AngleSharp,FlorianRappl/AngleSharp,AngleSharp/AngleSharp,Livven/AngleSharp,FlorianRappl/AngleSharp | AngleSharp.Samples.Demos/Program.cs | AngleSharp.Samples.Demos/Program.cs | namespace AngleSharp.Samples.Demos
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
class Program
{
static IEnumerable<ISnippet> FindSnippets()
{
var assembly = Assembly.GetExecutingAssembly();
var alltypes = assembly.GetTypes();
var types = alltypes.Where(m => m.GetInterfaces().Contains(typeof(ISnippet)));
return types.Select(m => m.GetConstructor(Type.EmptyTypes).Invoke(null) as ISnippet);
}
static void Main(String[] args)
{
var defaults = new
{
pause = false,
clear = false
};
var snippets = FindSnippets().ToList();
var usepause = args.Contains("--pause") || defaults.pause;
var clearscr = args.Contains("--clear") || defaults.clear;
RunSynchronously(async () =>
{
foreach (var snippet in snippets)
{
Console.WriteLine(">>> {0}", snippet.GetType().Name);
Console.WriteLine();
await snippet.Run();
Console.WriteLine();
if (usepause)
Console.ReadKey(true);
if (clearscr)
Console.Clear();
}
});
}
static void RunSynchronously(Func<Task> runner)
{
runner().Wait();
}
}
}
| namespace AngleSharp.Samples.Demos
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
class Program
{
static IEnumerable<ISnippet> FindSnippets()
{
var assembly = Assembly.GetExecutingAssembly();
var alltypes = assembly.GetTypes();
var types = alltypes.Where(m => m.GetInterfaces().Contains(typeof(ISnippet)));
return types.Select(m => m.GetConstructor(Type.EmptyTypes).Invoke(null) as ISnippet);
}
static void Main(String[] args)
{
var defaults = new
{
pause = false,
clear = false
};
var snippets = FindSnippets().ToList();
var usepause = args.Contains("--pause") || defaults.pause;
var clearscr = args.Contains("--clear") || defaults.clear;
foreach (var snippet in snippets)
{
Console.WriteLine(">>> {0}", snippet.GetType().Name);
Console.WriteLine();
snippet.Run().Wait();
Console.WriteLine();
if (usepause)
Console.ReadKey(true);
if (clearscr)
Console.Clear();
}
}
}
}
| mit | C# |
f4c9037b34600929ac6e1e55f8f76a12bcbc7047 | Make FastDepthFirstVisitor.Visit virtual | hmah/boo,wbardzinski/boo,Unity-Technologies/boo,BITechnologies/boo,wbardzinski/boo,KidFashion/boo,BitPuffin/boo,BITechnologies/boo,wbardzinski/boo,drslump/boo,drslump/boo,boo-lang/boo,wbardzinski/boo,rmboggs/boo,scottstephens/boo,Unity-Technologies/boo,rmartinho/boo,hmah/boo,bamboo/boo,boo-lang/boo,BitPuffin/boo,hmah/boo,bamboo/boo,BITechnologies/boo,KingJiangNet/boo,rmartinho/boo,rmboggs/boo,hmah/boo,BillHally/boo,rmboggs/boo,KidFashion/boo,scottstephens/boo,boo-lang/boo,BITechnologies/boo,boo-lang/boo,bamboo/boo,KingJiangNet/boo,KidFashion/boo,scottstephens/boo,KingJiangNet/boo,drslump/boo,BillHally/boo,Unity-Technologies/boo,boo-lang/boo,Unity-Technologies/boo,scottstephens/boo,bamboo/boo,scottstephens/boo,BillHally/boo,KingJiangNet/boo,BITechnologies/boo,BillHally/boo,drslump/boo,rmboggs/boo,bamboo/boo,BITechnologies/boo,rmboggs/boo,rmboggs/boo,BitPuffin/boo,bamboo/boo,Unity-Technologies/boo,boo-lang/boo,wbardzinski/boo,scottstephens/boo,drslump/boo,BitPuffin/boo,rmboggs/boo,Unity-Technologies/boo,rmartinho/boo,drslump/boo,KingJiangNet/boo,rmboggs/boo,BitPuffin/boo,rmartinho/boo,drslump/boo,KidFashion/boo,hmah/boo,hmah/boo,wbardzinski/boo,bamboo/boo,BITechnologies/boo,BitPuffin/boo,wbardzinski/boo,KidFashion/boo,KidFashion/boo,KingJiangNet/boo,rmartinho/boo,hmah/boo,BillHally/boo,scottstephens/boo,wbardzinski/boo,BillHally/boo,Unity-Technologies/boo,scottstephens/boo,boo-lang/boo,KidFashion/boo,BillHally/boo,rmartinho/boo,hmah/boo,hmah/boo,BITechnologies/boo,KingJiangNet/boo,rmartinho/boo,boo-lang/boo,rmartinho/boo,KingJiangNet/boo,Unity-Technologies/boo,BitPuffin/boo,BitPuffin/boo | scripts/Templates/FastDepthFirstVisitor.cs | scripts/Templates/FastDepthFirstVisitor.cs | ${header}
namespace Boo.Lang.Compiler.Ast
{
using System;
/// <summary>
/// Visitor implementation that avoids the overhead of cloning collections
/// before visiting them.
///
/// Avoid mutating collections when using this implementation.
/// </summary>
public partial class FastDepthFirstVisitor : IAstVisitor
{
<%
for item in model.GetConcreteAstNodes():
fields = model.GetVisitableFields(item)
%>
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
public virtual void On${item.Name}(Boo.Lang.Compiler.Ast.${item.Name} node)
{
<%
for field in fields:
localName = GetParameterName(field)
if model.IsCollectionField(field):
%> {
var ${localName} = node.${field.Name};
if (${localName} != null)
{
var innerList = ${localName}.InnerList;
var count = innerList.Count;
for (var i=0; i<count; ++i)
innerList.FastAt(i).Accept(this);
}
}
<%
else:
%> {
var ${localName} = node.${field.Name};
if (${localName} != null)
${localName}.Accept(this);
}
<%
end
end
%> }
<%
end
%>
protected virtual void Visit(Node node)
{
if (node == null)
return;
node.Accept(this);
}
protected virtual void Visit<T>(NodeCollection<T> nodes) where T: Node
{
if (nodes == null)
return;
var innerList = nodes.InnerList;
var count = innerList.Count;
for (var i = 0; i<count; ++i)
innerList.FastAt(i).Accept(this);
}
}
}
| ${header}
namespace Boo.Lang.Compiler.Ast
{
using System;
/// <summary>
/// Visitor implementation that avoids the overhead of cloning collections
/// before visiting them.
///
/// Avoid mutating collections when using this implementation.
/// </summary>
public partial class FastDepthFirstVisitor : IAstVisitor
{
<%
for item in model.GetConcreteAstNodes():
fields = model.GetVisitableFields(item)
%>
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
public virtual void On${item.Name}(Boo.Lang.Compiler.Ast.${item.Name} node)
{
<%
for field in fields:
localName = GetParameterName(field)
if model.IsCollectionField(field):
%> {
var ${localName} = node.${field.Name};
if (${localName} != null)
{
var innerList = ${localName}.InnerList;
var count = innerList.Count;
for (var i=0; i<count; ++i)
innerList.FastAt(i).Accept(this);
}
}
<%
else:
%> {
var ${localName} = node.${field.Name};
if (${localName} != null)
${localName}.Accept(this);
}
<%
end
end
%> }
<%
end
%>
protected void Visit(Node node)
{
if (node == null)
return;
node.Accept(this);
}
protected void Visit<T>(NodeCollection<T> nodes) where T: Node
{
if (nodes == null)
return;
var innerList = nodes.InnerList;
var count = innerList.Count;
for (var i = 0; i<count; ++i)
innerList.FastAt(i).Accept(this);
}
}
}
| bsd-3-clause | C# |
3875b0e696ad5feaab7c39eb3a5b01875d3faf70 | Change GDIFont.ToString() to return just the font name | opcon/QuickFont,opcon/QuickFont | QuickFont/GDIFont.cs | QuickFont/GDIFont.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
namespace QuickFont
{
public class GDIFont : IFont, IDisposable
{
private Font _font;
private FontFamily _fontFamily;
public float Size { get { return _font.Size; } }
/// <summary>
/// Creates a GDI+ Font from the specified font file
/// </summary>
/// <param name="fontPath">The path to the font file</param>
/// <param name="size"></param>
/// <param name="style"></param>
/// <param name="superSampleLevels"></param>
/// <param name="scale"></param>
public GDIFont(string fontPath, float size, FontStyle style, int superSampleLevels = 1, float scale = 1.0f)
{
try
{
var pfc = new PrivateFontCollection();
pfc.AddFontFile(fontPath);
_fontFamily = pfc.Families[0];
}
catch (System.IO.FileNotFoundException ex)
{
//font file could not be found, check if it exists in the installed font collection
var installed = new InstalledFontCollection();
_fontFamily = installed.Families.FirstOrDefault(family => string.Equals(fontPath, family.Name));
//if we can't find the font file at all, use the system default font
if (_fontFamily == null) _fontFamily = SystemFonts.DefaultFont.FontFamily;
}
if (!_fontFamily.IsStyleAvailable(style))
throw new ArgumentException("Font file: " + fontPath + " does not support style: " + style);
_font = new Font(_fontFamily, size * scale * superSampleLevels, style);
}
public Point DrawString(string s, Graphics graph, Brush color, int x, int y, float height)
{
graph.DrawString(s, _font, color, x, y);
Debug.WriteLine(string.Format("Loading character {0}, y position is {1}", s, y));
return Point.Empty;
}
public SizeF MeasureString(string s, Graphics graph)
{
return graph.MeasureString(s, _font);
}
public override string ToString()
{
return _font.Name;
}
public void Dispose()
{
_font.Dispose();
_fontFamily.Dispose();
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
namespace QuickFont
{
public class GDIFont : IFont, IDisposable
{
private Font _font;
private FontFamily _fontFamily;
public float Size { get { return _font.Size; } }
/// <summary>
/// Creates a GDI+ Font from the specified font file
/// </summary>
/// <param name="fontPath">The path to the font file</param>
/// <param name="size"></param>
/// <param name="style"></param>
/// <param name="superSampleLevels"></param>
/// <param name="scale"></param>
public GDIFont(string fontPath, float size, FontStyle style, int superSampleLevels = 1, float scale = 1.0f)
{
try
{
var pfc = new PrivateFontCollection();
pfc.AddFontFile(fontPath);
_fontFamily = pfc.Families[0];
}
catch (System.IO.FileNotFoundException ex)
{
//font file could not be found, check if it exists in the installed font collection
var installed = new InstalledFontCollection();
_fontFamily = installed.Families.FirstOrDefault(family => string.Equals(fontPath, family.Name));
//if we can't find the font file at all, use the system default font
if (_fontFamily == null) _fontFamily = SystemFonts.DefaultFont.FontFamily;
}
if (!_fontFamily.IsStyleAvailable(style))
throw new ArgumentException("Font file: " + fontPath + " does not support style: " + style);
_font = new Font(_fontFamily, size * scale * superSampleLevels, style);
}
public Point DrawString(string s, Graphics graph, Brush color, int x, int y, float height)
{
graph.DrawString(s, _font, color, x, y);
Debug.WriteLine(string.Format("Loading character {0}, y position is {1}", s, y));
return Point.Empty;
}
public SizeF MeasureString(string s, Graphics graph)
{
return graph.MeasureString(s, _font);
}
public override string ToString()
{
return _font.ToString();
}
public void Dispose()
{
_font.Dispose();
_fontFamily.Dispose();
}
}
}
| mit | C# |
f2ef896c84d8b362a87c27209bb10277a73d51a3 | Update AddingDataToCells.cs | 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,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,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 | Examples/CSharp/Data/Handling/AddingDataToCells.cs | Examples/CSharp/Data/Handling/AddingDataToCells.cs | using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.Data.Handling
{
public class AddingDataToCells
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Adding a string value to the cell
worksheet.Cells["A1"].PutValue("Hello World");
//Adding a double value to the cell
worksheet.Cells["A2"].PutValue(20.5);
//Adding an integer value to the cell
worksheet.Cells["A3"].PutValue(15);
//Adding a boolean value to the cell
worksheet.Cells["A4"].PutValue(true);
//Adding a date/time value to the cell
worksheet.Cells["A5"].PutValue(DateTime.Now);
//Setting the display format of the date
Style style = worksheet.Cells["A5"].GetStyle();
style.Number = 15;
worksheet.Cells["A5"].SetStyle(style);
//Saving the Excel file
workbook.Save(dataDir + "output.out.xls");
//ExEnd:1
}
}
}
| using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.Data.Handling
{
public class AddingDataToCells
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create directory if it is not already present.
bool IsExists = System.IO.Directory.Exists(dataDir);
if (!IsExists)
System.IO.Directory.CreateDirectory(dataDir);
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Adding a string value to the cell
worksheet.Cells["A1"].PutValue("Hello World");
//Adding a double value to the cell
worksheet.Cells["A2"].PutValue(20.5);
//Adding an integer value to the cell
worksheet.Cells["A3"].PutValue(15);
//Adding a boolean value to the cell
worksheet.Cells["A4"].PutValue(true);
//Adding a date/time value to the cell
worksheet.Cells["A5"].PutValue(DateTime.Now);
//Setting the display format of the date
Style style = worksheet.Cells["A5"].GetStyle();
style.Number = 15;
worksheet.Cells["A5"].SetStyle(style);
//Saving the Excel file
workbook.Save(dataDir + "output.out.xls");
}
}
} | mit | C# |
1379d1bef83bf8f188e770d07e3a3d899b278b66 | remove really odd utf character at the front of this class | intari/OpenSimMirror,N3X15/VoxelSim,cdbean/CySim,intari/OpenSimMirror,ft-/arribasim-dev-tests,ft-/arribasim-dev-extras,cdbean/CySim,QuillLittlefeather/opensim-1,ft-/opensim-optimizations-wip-extras,AlphaStaxLLC/taiga,TomDataworks/opensim,Michelle-Argus/ArribasimExtract,AlphaStaxLLC/taiga,M-O-S-E-S/opensim,justinccdev/opensim,ft-/arribasim-dev-extras,N3X15/VoxelSim,justinccdev/opensim,justinccdev/opensim,intari/OpenSimMirror,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-tests,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,AlphaStaxLLC/taiga,QuillLittlefeather/opensim-1,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-tests,zekizeki/agentservice,bravelittlescientist/opensim-performance,TechplexEngineer/Aurora-Sim,AlphaStaxLLC/taiga,rryk/omp-server,rryk/omp-server,ft-/arribasim-dev-extras,AlexRa/opensim-mods-Alex,zekizeki/agentservice,RavenB/opensim,ft-/arribasim-dev-tests,Michelle-Argus/ArribasimExtract,AlexRa/opensim-mods-Alex,RavenB/opensim,cdbean/CySim,zekizeki/agentservice,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,allquixotic/opensim-autobackup,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-extras,OpenSimian/opensimulator,OpenSimian/opensimulator,ft-/opensim-optimizations-wip-tests,allquixotic/opensim-autobackup,cdbean/CySim,M-O-S-E-S/opensim,AlphaStaxLLC/taiga,AlphaStaxLLC/taiga,rryk/omp-server,bravelittlescientist/opensim-performance,intari/OpenSimMirror,justinccdev/opensim,AlexRa/opensim-mods-Alex,rryk/omp-server,OpenSimian/opensimulator,BogusCurry/arribasim-dev,RavenB/opensim,QuillLittlefeather/opensim-1,RavenB/opensim,Michelle-Argus/ArribasimExtract,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,Michelle-Argus/ArribasimExtract,TomDataworks/opensim,bravelittlescientist/opensim-performance,N3X15/VoxelSim,allquixotic/opensim-autobackup,TomDataworks/opensim,TomDataworks/opensim,QuillLittlefeather/opensim-1,Michelle-Argus/ArribasimExtract,AlexRa/opensim-mods-Alex,ft-/opensim-optimizations-wip-tests,zekizeki/agentservice,ft-/arribasim-dev-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,cdbean/CySim,ft-/arribasim-dev-tests,intari/OpenSimMirror,AlphaStaxLLC/taiga,intari/OpenSimMirror,ft-/arribasim-dev-tests,allquixotic/opensim-autobackup,RavenB/opensim,N3X15/VoxelSim,justinccdev/opensim,N3X15/VoxelSim,TechplexEngineer/Aurora-Sim,QuillLittlefeather/opensim-1,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-tests,justinccdev/opensim,AlexRa/opensim-mods-Alex,TomDataworks/opensim,BogusCurry/arribasim-dev,TomDataworks/opensim,TomDataworks/opensim,TechplexEngineer/Aurora-Sim,BogusCurry/arribasim-dev,QuillLittlefeather/opensim-1,RavenB/opensim,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-extras,bravelittlescientist/opensim-performance,OpenSimian/opensimulator,allquixotic/opensim-autobackup,ft-/opensim-optimizations-wip,N3X15/VoxelSim,M-O-S-E-S/opensim,BogusCurry/arribasim-dev,allquixotic/opensim-autobackup,zekizeki/agentservice,OpenSimian/opensimulator,N3X15/VoxelSim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,zekizeki/agentservice,Michelle-Argus/ArribasimExtract,AlphaStaxLLC/taiga,bravelittlescientist/opensim-performance,bravelittlescientist/opensim-performance,N3X15/VoxelSim,ft-/arribasim-dev-extras,QuillLittlefeather/opensim-1,OpenSimian/opensimulator,ft-/opensim-optimizations-wip,OpenSimian/opensimulator,AlexRa/opensim-mods-Alex,M-O-S-E-S/opensim,BogusCurry/arribasim-dev,rryk/omp-server,ft-/opensim-optimizations-wip-extras,cdbean/CySim,TechplexEngineer/Aurora-Sim,M-O-S-E-S/opensim,BogusCurry/arribasim-dev,ft-/opensim-optimizations-wip,ft-/opensim-optimizations-wip-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip,rryk/omp-server | OpenSim/Data/AssetDataBase.cs | OpenSim/Data/AssetDataBase.cs | using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Data
{
public abstract class AssetDataBase : IAssetProvider
{
public abstract AssetBase FetchAsset(LLUUID uuid);
public abstract void CreateAsset(AssetBase asset);
public abstract void UpdateAsset(AssetBase asset);
public abstract bool ExistsAsset(LLUUID uuid);
public abstract void CommitAssets();
public abstract string Version { get; }
public abstract string Name { get; }
public abstract void Initialise();
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Data
{
public abstract class AssetDataBase : IAssetProvider
{
public abstract AssetBase FetchAsset(LLUUID uuid);
public abstract void CreateAsset(AssetBase asset);
public abstract void UpdateAsset(AssetBase asset);
public abstract bool ExistsAsset(LLUUID uuid);
public abstract void CommitAssets();
public abstract string Version { get; }
public abstract string Name { get; }
public abstract void Initialise();
}
}
| bsd-3-clause | C# |
f3f5fb1df3dc028cc33fd25caea9f691a6b3c98d | Remove unnecessary whitespace | setchi/FancyScrollView | Assets/FancyScrollView/Examples/Sources/08_GridView/FancyGridView.cs | Assets/FancyScrollView/Examples/Sources/08_GridView/FancyGridView.cs | using UnityEngine;
namespace FancyScrollView.Example08
{
public class FancyGridView : FancyGridView<ItemData, Context>
{
[SerializeField] int columnCount = 3;
[SerializeField] Cell cellPrefab = default;
[SerializeField] Row rowPrefab = default;
protected override FancyScrollViewCell<ItemData, Context> CellTemplate => cellPrefab;
protected override FancyGridViewRow<ItemData, Context> RowTemplate => rowPrefab;
protected override int ColumnCount => columnCount;
public float PaddingTop
{
get => paddingHead;
set
{
paddingHead = value;
Refresh();
}
}
public float PaddingBottom
{
get => paddingTail;
set
{
paddingTail = value;
Refresh();
}
}
public float SpacingY
{
get => spacing;
set
{
spacing = value;
Refresh();
}
}
public float SpacingX
{
get => columnSpacing;
set
{
columnSpacing = value;
Refresh();
}
}
public void UpdateSelection(int index)
{
if (Context.SelectedItemIndex == index)
{
return;
}
Context.SelectedItemIndex = index;
Refresh();
}
}
}
| using UnityEngine;
namespace FancyScrollView.Example08
{
public class FancyGridView : FancyGridView<ItemData, Context>
{
[SerializeField] int columnCount = 3;
[SerializeField] Cell cellPrefab = default;
[SerializeField] Row rowPrefab = default;
protected override FancyScrollViewCell<ItemData, Context> CellTemplate => cellPrefab;
protected override FancyGridViewRow<ItemData, Context> RowTemplate => rowPrefab;
protected override int ColumnCount => columnCount;
public float PaddingTop
{
get => paddingHead;
set
{
paddingHead = value;
Refresh();
}
}
public float PaddingBottom
{
get => paddingTail;
set
{
paddingTail = value;
Refresh();
}
}
public float SpacingY
{
get => spacing;
set
{
spacing = value;
Refresh();
}
}
public float SpacingX
{
get => columnSpacing;
set
{
columnSpacing = value;
Refresh();
}
}
public void UpdateSelection(int index)
{
if (Context.SelectedItemIndex == index)
{
return;
}
Context.SelectedItemIndex = index;
Refresh();
}
}
}
| mit | C# |
d697a397dbf5448fc3d36a33ed7b179d104bdae6 | test commit | s08cz1/DeveloperMeetup | DeveloperMeetup.root/DeveloperMeetup/Controllers/ValuesController.cs | DeveloperMeetup.root/DeveloperMeetup/Controllers/ValuesController.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace DeveloperMeetup.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace DeveloperMeetup.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
| mit | C# |
b439a4f8ba6c8e0bdc609a34c9cc7dfb820ac0cb | Remove GetMatchingLanguages_LanguageIsInMultipleCountries_JustTellHowMany test | ermshiperete/libpalaso,sillsdev/libpalaso,mccarthyrb/libpalaso,JohnThomson/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,darcywong00/libpalaso,chrisvire/libpalaso,ddaspit/libpalaso,hatton/libpalaso,glasseyes/libpalaso,ermshiperete/libpalaso,andrew-polk/libpalaso,darcywong00/libpalaso,sillsdev/libpalaso,gmartin7/libpalaso,hatton/libpalaso,gmartin7/libpalaso,andrew-polk/libpalaso,tombogle/libpalaso,ddaspit/libpalaso,glasseyes/libpalaso,hatton/libpalaso,mccarthyrb/libpalaso,glasseyes/libpalaso,andrew-polk/libpalaso,chrisvire/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,ddaspit/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,JohnThomson/libpalaso,gmartin7/libpalaso,mccarthyrb/libpalaso,JohnThomson/libpalaso,sillsdev/libpalaso,ddaspit/libpalaso,sillsdev/libpalaso,darcywong00/libpalaso,JohnThomson/libpalaso,hatton/libpalaso,tombogle/libpalaso,mccarthyrb/libpalaso,gmartin7/libpalaso,tombogle/libpalaso,andrew-polk/libpalaso,chrisvire/libpalaso,gtryus/libpalaso,chrisvire/libpalaso,gtryus/libpalaso | PalasoUIWindowsForms.Tests/WritingSystems/LookupIsoCodeModelTests.cs | PalasoUIWindowsForms.Tests/WritingSystems/LookupIsoCodeModelTests.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using System.Text;
using NUnit.Framework;
using Palaso.WritingSystems;
using Palaso.UI.WindowsForms.WritingSystems;
namespace PalasoUIWindowsForms.Tests.WritingSystems
{
[TestFixture]
public class LookupIsoCodeModelTests
{
private LookupIsoCodeModel _model;
[SetUp]
public void Setup()
{
_model = new LookupIsoCodeModel();
}
[Test, Ignore("By hand only")]
public void LookupISODialog()
{
var dialog = new LookupISOCodeDialog();
Application.Run(dialog);
MessageBox.Show("returned:" + dialog.SelectedLanguage.Code + " with desired name: " + dialog.SelectedLanguage.DesiredName);
}
[Test, Ignore("By hand only")]
public void LookupISODialog_WithInitialCodeAndCustomName()
{
var dialog = new LookupISOCodeDialog();
dialog.SelectedLanguage = new LanguageInfo() { Code = "etr", DesiredName = "Etoloooo" };
Application.Run(dialog);
MessageBox.Show("returned:" + dialog.SelectedLanguage.Code + " with desired name: " + dialog.SelectedLanguage.DesiredName);
}
[Test, Ignore("By hand only")]
public void LookupISODialog_WithInitialCodeOnly()
{
var dialog = new LookupISOCodeDialog();
dialog.SelectedLanguage = new LanguageInfo() { Code = "etr" };
Application.Run(dialog);
MessageBox.Show("returned:" + dialog.SelectedLanguage.Code + " with desired name: " + dialog.SelectedLanguage.DesiredName);
}
[Test, Ignore("By hand only")]
public void LookupISODialog_WithInitialQAACodeAndCustomName()
{
var dialog = new LookupISOCodeDialog();
dialog.SelectedLanguage = new LanguageInfo() { Code = "qaa", DesiredName = "Vulcan" };
Application.Run(dialog);
MessageBox.Show("returned:" + dialog.SelectedLanguage.Code + " with desired name: " + dialog.SelectedLanguage.DesiredName);
}
}
} | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using System.Text;
using NUnit.Framework;
using Palaso.WritingSystems;
using Palaso.UI.WindowsForms.WritingSystems;
namespace PalasoUIWindowsForms.Tests.WritingSystems
{
[TestFixture]
public class LookupIsoCodeModelTests
{
private LookupIsoCodeModel _model;
[SetUp]
public void Setup()
{
_model = new LookupIsoCodeModel();
}
[Test, Ignore("By hand only")]
public void LookupISODialog()
{
var dialog = new LookupISOCodeDialog();
Application.Run(dialog);
MessageBox.Show("returned:" + dialog.SelectedLanguage.Code + " with desired name: " + dialog.SelectedLanguage.DesiredName);
}
[Test, Ignore("By hand only")]
public void LookupISODialog_WithInitialCodeAndCustomName()
{
var dialog = new LookupISOCodeDialog();
dialog.SelectedLanguage = new LanguageInfo() { Code = "etr", DesiredName = "Etoloooo" };
Application.Run(dialog);
MessageBox.Show("returned:" + dialog.SelectedLanguage.Code + " with desired name: " + dialog.SelectedLanguage.DesiredName);
}
[Test, Ignore("By hand only")]
public void LookupISODialog_WithInitialCodeOnly()
{
var dialog = new LookupISOCodeDialog();
dialog.SelectedLanguage = new LanguageInfo() { Code = "etr" };
Application.Run(dialog);
MessageBox.Show("returned:" + dialog.SelectedLanguage.Code + " with desired name: " + dialog.SelectedLanguage.DesiredName);
}
[Test, Ignore("By hand only")]
public void LookupISODialog_WithInitialQAACodeAndCustomName()
{
var dialog = new LookupISOCodeDialog();
dialog.SelectedLanguage = new LanguageInfo() { Code = "qaa", DesiredName = "Vulcan" };
Application.Run(dialog);
MessageBox.Show("returned:" + dialog.SelectedLanguage.Code + " with desired name: " + dialog.SelectedLanguage.DesiredName);
}
[Test]
public void GetMatchingLanguages_LanguageIsInMultipleCountries_JustTellHowMany()
{
var model = new LookupIsoCodeModel();
var results = model.GetMatchingLanguages("Dutch");
Assert.AreEqual("5 Countries", results.First().Country);
}
}
} | mit | C# |
64b7dd0d45a2c9adf458dd9a1942bbd6c0f8056c | Add nothing | Pesh2003/MyFirstDemoInGitHub | HelloSharp/ThisTimeHello/Program.cs | HelloSharp/ThisTimeHello/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ThisTimeHello
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Helo Melo :)");
Console.WriteLine("Add another feature to the club :))");
Console.WriteLine("1234567");
Console.WriteLine("This is third ");
Console.WriteLine("67567");
Console.WriteLine("tyuiioo");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ThisTimeHello
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Helo Melo :)");
Console.WriteLine("Add another feature to the club :))");
Console.WriteLine("1234567");
Console.WriteLine("This is third ");
Console.WriteLine("67567");
}
}
}
| mit | C# |
5a3927951c08cbd2ac5babb0789b9652a4904a03 | remove not needed #if directives - AnalyticsServices | RadicalFx/radical | src/Radical/AnalyticsService.cs | src/Radical/AnalyticsService.cs | using System;
using System.Security.Principal;
using System.Threading;
namespace Radical
{
namespace ComponentModel
{
public interface IAnalyticsServices
{
Boolean IsEnabled { get; set; }
void TrackUserActionAsync(Analytics.AnalyticsEvent action);
}
}
namespace Services
{
class AnalyticsServices : ComponentModel.IAnalyticsServices
{
public void TrackUserActionAsync(Analytics.AnalyticsEvent action)
{
Analytics.AnalyticsServices.TrackUserActionAsync(action);
}
public bool IsEnabled
{
get { return Analytics.AnalyticsServices.IsEnabled; }
set { Analytics.AnalyticsServices.IsEnabled = value; }
}
}
}
namespace Analytics
{
public static class AnalyticsServices
{
public static Boolean IsEnabled { get; set; }
public static void TrackUserActionAsync(AnalyticsEvent action)
{
if (IsEnabled && UserActionTrackingHandler != null)
{
System.Threading.Tasks.Task.Factory.StartNew(() =>
{
UserActionTrackingHandler(action);
});
}
}
public static Action<AnalyticsEvent> UserActionTrackingHandler { get; set; }
}
/// <summary>
/// TODO
/// </summary>
public class AnalyticsEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="AnalyticsEvent" /> class.
/// </summary>
public AnalyticsEvent()
{
this.ExecutedOn = DateTimeOffset.Now;
}
public DateTimeOffset ExecutedOn { get; set; }
public String Name { get; set; }
public Object Data { get; set; }
}
}
} | using System;
using System.Security.Principal;
using System.Threading;
namespace Radical
{
namespace ComponentModel
{
public interface IAnalyticsServices
{
Boolean IsEnabled { get; set; }
void TrackUserActionAsync(Analytics.AnalyticsEvent action);
}
}
namespace Services
{
class AnalyticsServices : ComponentModel.IAnalyticsServices
{
public void TrackUserActionAsync(Analytics.AnalyticsEvent action)
{
Analytics.AnalyticsServices.TrackUserActionAsync(action);
}
public bool IsEnabled
{
get { return Analytics.AnalyticsServices.IsEnabled; }
set { Analytics.AnalyticsServices.IsEnabled = value; }
}
}
}
namespace Analytics
{
public static class AnalyticsServices
{
public static Boolean IsEnabled { get; set; }
public static void TrackUserActionAsync(AnalyticsEvent action)
{
if (IsEnabled && UserActionTrackingHandler != null)
{
System.Threading.Tasks.Task.Factory.StartNew(() =>
{
UserActionTrackingHandler(action);
});
}
}
public static Action<AnalyticsEvent> UserActionTrackingHandler { get; set; }
}
/// <summary>
/// TODO
/// </summary>
public class AnalyticsEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="AnalyticsEvent" /> class.
/// </summary>
public AnalyticsEvent()
{
this.ExecutedOn = DateTimeOffset.Now;
#if !SILVERLIGHT && !NETFX_CORE
this.Identity = Thread.CurrentPrincipal.Identity;
#endif
}
public DateTimeOffset ExecutedOn { get; set; }
public String Name { get; set; }
public Object Data { get; set; }
#if !SILVERLIGHT && !NETFX_CORE
public IIdentity Identity { get; set; }
#endif
}
}
} | mit | C# |
e673be4e911f7dbe499b7f043250e1863c6699eb | Add TestResult to example | irfanah/pickles,irfanah/pickles,blorgbeard/pickles,irfanah/pickles,irfanah/pickles,picklesdoc/pickles,magicmonty/pickles,dirkrombauts/pickles,magicmonty/pickles,ludwigjossieaux/pickles,ludwigjossieaux/pickles,dirkrombauts/pickles,magicmonty/pickles,blorgbeard/pickles,picklesdoc/pickles,blorgbeard/pickles,ludwigjossieaux/pickles,picklesdoc/pickles,picklesdoc/pickles,blorgbeard/pickles,dirkrombauts/pickles,dirkrombauts/pickles,magicmonty/pickles | src/Pickles/Pickles/ObjectModel/Example.cs | src/Pickles/Pickles/ObjectModel/Example.cs | #region License
/*
Copyright [2011] [Jeffrey Cameron]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#endregion
using System;
using PicklesDoc.Pickles.TestFrameworks;
namespace PicklesDoc.Pickles.ObjectModel
{
public class Example
{
public string Name { get; set; }
public string Description { get; set; }
public Table TableArgument { get; set; }
public TestResult Result { get; set; }
}
} | #region License
/*
Copyright [2011] [Jeffrey Cameron]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#endregion
using System;
namespace PicklesDoc.Pickles.ObjectModel
{
public class Example
{
public string Name { get; set; }
public string Description { get; set; }
public Table TableArgument { get; set; }
}
} | apache-2.0 | C# |
00e703b8ac24c848969aabe5c22a8b1053909698 | add Clear function to reuse instances | spriest487/spacetrader-utils | SubmeshTextureMap.cs | SubmeshTextureMap.cs | using System.Collections.Generic;
using UnityEngine;
namespace SpaceTrader.Util {
public class SubmeshTextureMap {
private readonly Dictionary<Texture2D, int> submeshByTexture;
private readonly List<Texture2D> textures;
public IReadOnlyList<Texture2D> Textures => this.textures;
private int nextIndex;
public SubmeshTextureMap() {
this.submeshByTexture = new Dictionary<Texture2D, int>();
this.textures = new List<Texture2D>();
this.nextIndex = 0;
}
public int GetSubmeshIndex(Texture2D texture) {
if (this.submeshByTexture.TryGetValue(texture, out var index)) {
return index;
}
index = this.nextIndex;
this.submeshByTexture.Add(texture, index);
this.textures.Add(texture);
this.nextIndex += 1;
return index;
}
public void Clear() {
this.textures.Clear();
this.submeshByTexture.Clear();
this.nextIndex = 0;
}
}
}
| using System.Collections.Generic;
using UnityEngine;
namespace SpaceTrader.Util {
public class SubmeshTextureMap {
private readonly Dictionary<Texture2D, int> textureSubmeshes;
private List<Texture2D> textures;
public IReadOnlyList<Texture2D> Textures => this.textures;
private int nextIndex;
public SubmeshTextureMap() {
this.textureSubmeshes = new Dictionary<Texture2D, int>();
this.textures = new List<Texture2D>();
this.nextIndex = 0;
}
public int GetSubmeshIndex(Texture2D texture) {
if (this.textureSubmeshes.TryGetValue(texture, out var index)) {
return index;
}
index = this.nextIndex;
this.textureSubmeshes.Add(texture, index);
this.textures.Add(texture);
this.nextIndex += 1;
return index;
}
}
}
| mit | C# |
d9d25b72656d2b88f69d0707006ea44434c54415 | Make the deployments wait until the server is ready. | jacksonh/MCloud,jacksonh/MCloud | src/MultiStepDeployment.cs | src/MultiStepDeployment.cs |
using System;
using System.Collections;
using System.Collections.Generic;
namespace MCloud {
public class MultiStepDeployment : Deployment, IEnumerable {
public MultiStepDeployment ()
{
Steps = new List<Deployment> ();
}
public List<Deployment> Steps {
get;
private set;
}
public void Add (Deployment step)
{
Steps.Add (step);
}
protected override void RunImpl (Node node, NodeAuth auth)
{
foreach (Deployment d in Steps) {
d.Run (node, auth);
}
}
IEnumerator IEnumerable.GetEnumerator ()
{
return Steps.GetEnumerator ();
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
namespace MCloud {
public class MultiStepDeployment : Deployment, IEnumerable {
public MultiStepDeployment ()
{
Steps = new List<Deployment> ();
}
public List<Deployment> Steps {
get;
private set;
}
public void Add (Deployment step)
{
Steps.Add (step);
}
public override void Run (Node node, NodeAuth auth)
{
foreach (Deployment d in Steps) {
d.Run (node, auth);
}
}
IEnumerator IEnumerable.GetEnumerator ()
{
return Steps.GetEnumerator ();
}
}
}
| mit | C# |
27574e89f066253ec9bf4280b187ed1b44d8aff1 | Update QueryableExtensions.cs | keith-hall/Extensions,keith-hall/Extensions | src/QueryableExtensions.cs | src/QueryableExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace HallLibrary.Extensions
{
/// <summary>
/// Contains static methods for working with queryables.
/// </summary>
public static class QueryableExtensions
{
/// <summary>
/// Returns a single value from the specified <paramref name="queryable"/>, or throws an Exception if it contains no or multiple values.
/// </summary>
/// <typeparam name="T">The type of elements in the queryable.</typeparam>
/// <param name="queryable">The queryable sequence to get the single value of.</param>
/// <returns>Returns the single value from the specified <paramref name="queryable"/>, using the most efficient method possible to determine that it is a single value.</returns>
/// <remarks>More efficient than the built in LINQ to SQL "Single" method, because this one takes the minimum number of results necessary to determine if the queryable contains a single value or not.</remarks>
public static T EnsureSingle<T>(this IQueryable<T> queryable)
{
return queryable.Take(2).Single();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace HallLibrary.Extensions
{
/// <summary>
/// Contains static methods for working with queryables.
/// </summary>
public static class QueryableExtensions
{
/// <summary>
/// Returns a single value from the specified <paramref name="queryable"/>, or throws an Exception if it contains multiple values.
/// </summary>
/// <typeparam name="T">The type of elements in the queryable.</typeparam>
/// <param name="queryable">The queryable sequence to get the single value of.</param>
/// <returns>Returns the single value from the specified <paramref name="queryable"/>, using the most efficient method possible to determine that it is a single value.</returns>
/// <remarks>More efficient than the built in LINQ to SQL "Single" method, because this one takes the minimum number of results necessary to determine if the queryable contains a single value or not.</remarks>
public static T EnsureSingle<T>(this IQueryable<T> queryable)
{
return queryable.Take(2).Single();
}
}
}
| apache-2.0 | C# |
842004e0484ae0752e848852150bdb3dbc8e7872 | Update StringExtensions class (#115) | tjscience/RoboSharp,tjscience/RoboSharp | RoboSharp/StringExtensions.cs | RoboSharp/StringExtensions.cs | namespace RoboSharp
{
/// <summary>
/// Static Class - Houses Extension Methods for strings
/// </summary>
internal static class StringExtensions
{
/// <remarks> Extension method provided by RoboSharp package </remarks>
/// <inheritdoc cref="System.String.IsNullOrWhiteSpace(string)"/>
internal static bool IsNullOrWhiteSpace(this string value)
{
if (value == null)
{
return true;
}
return string.IsNullOrEmpty(value.Trim());
}
}
}
| namespace RoboSharp
{
public static class StringExtensions
{
public static bool IsNullOrWhiteSpace(this string value)
{
if (value == null)
{
return true;
}
return string.IsNullOrEmpty(value.Trim());
}
}
}
| mit | C# |
1798c27884961e903805a89322287cdd39982797 | add back referenced to user account to get implicit cascade delete | vinneyk/BrockAllen.MembershipReboot,eric-swann-q2/BrockAllen.MembershipReboot,tomascassidy/BrockAllen.MembershipReboot,rvdkooy/BrockAllen.MembershipReboot,brockallen/BrockAllen.MembershipReboot,DosGuru/MembershipReboot,rajendra1809/BrockAllen.MembershipReboot,vankooch/BrockAllen.MembershipReboot | BrockAllen.MembershipReboot/Models/UserClaim.cs | BrockAllen.MembershipReboot/Models/UserClaim.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BrockAllen.MembershipReboot
{
public class UserClaim
{
[Key]
public virtual int ID { get; set; }
[Required]
public UserAccount User { get; set; }
public virtual string Type { get; set; }
public virtual string Value { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BrockAllen.MembershipReboot
{
public class UserClaim
{
[Key]
public virtual int ID { get; set; }
public virtual string Type { get; set; }
public virtual string Value { get; set; }
}
}
| bsd-3-clause | C# |
f4479808ac4f50ca9ab8ce608ab9f2176067a09c | Add implementation for change tracking. | AlexGhiondea/SmugMug.NET | src/SmugMugModel.v2/Types/SmugMugEntity.cs | src/SmugMugModel.v2/Types/SmugMugEntity.cs | // Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System.Diagnostics;
namespace SmugMug.v2.Types
{
public class SmugMugEntity
{
private Dictionary<string, object> _storage = new Dictionary<string, object>();
private readonly object _syncLock = new object();
protected void NotifyPropertyValueChanged(string propertyName, object newValue)
{
object firstCapturedData;
if (_storage.TryGetValue(propertyName, out firstCapturedData))
{
// currentData is the value that was first captured.
// setting it back to that value should remove this property from the
// list of changed values
if (firstCapturedData.Equals(newValue))
{
Debug.WriteLine("Same as original {0}, remove tracking", newValue);
lock (_syncLock)
{
_storage.Remove(propertyName);
}
}
return;
}
lock (_syncLock)
{
Debug.WriteLine("New value! '{0}'", newValue);
_storage.Add(propertyName, newValue);
}
}
}
}
| // Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace SmugMug.v2.Types
{
public class SmugMugEntity
{
protected void NotifyPropertyValueChanged(string name, object value)
{
}
}
}
| mit | C# |
1913ea9c0faf86929822c0596ce3f246a340104e | Remove uniqueness constraint from DbUser.Email | samcook/AspNet.Identity.Shaolinq | AspNet.Identity.Shaolinq/DataModel/DbUser.cs | AspNet.Identity.Shaolinq/DataModel/DbUser.cs | using System;
using AspNet.Identity.Shaolinq.DataModel.Interfaces;
using Shaolinq;
namespace AspNet.Identity.Shaolinq.DataModel
{
[DataAccessObject(Name = "User")]
public abstract class DbUser : DataAccessObject<Guid>, IShaolinqIdentityDbUser<Guid>
{
[Index(Unique = true)]
[PersistedMember]
public abstract string UserName { get; set; }
[PersistedMember]
public abstract string Name { get; set; }
[PersistedMember]
[Index]
public abstract string Email { get; set; }
[PersistedMember]
public abstract bool EmailConfirmed { get; set; }
[PersistedMember]
public abstract string PasswordHash { get; set; }
[PersistedMember]
public abstract string SecurityStamp { get; set; }
[PersistedMember]
public abstract bool IsAnonymousUser { get; set; }
[PersistedMember]
public abstract DateTime ActivationDate { get; set; }
[RelatedDataAccessObjects]
public abstract RelatedDataAccessObjects<DbUserLogin> UserLogins { get; }
[RelatedDataAccessObjects]
public abstract RelatedDataAccessObjects<DbUserClaim> UserClaims { get; }
[RelatedDataAccessObjects]
public abstract RelatedDataAccessObjects<DbUserRole> UserRoles { get; }
}
} | using System;
using AspNet.Identity.Shaolinq.DataModel.Interfaces;
using Shaolinq;
namespace AspNet.Identity.Shaolinq.DataModel
{
[DataAccessObject(Name = "User")]
public abstract class DbUser : DataAccessObject<Guid>, IShaolinqIdentityDbUser<Guid>
{
[Index(Unique = true)]
[PersistedMember]
public abstract string UserName { get; set; }
[PersistedMember]
public abstract string Name { get; set; }
[PersistedMember]
[Index(Unique = true)]
public abstract string Email { get; set; }
[PersistedMember]
public abstract bool EmailConfirmed { get; set; }
[PersistedMember]
public abstract string PasswordHash { get; set; }
[PersistedMember]
public abstract string SecurityStamp { get; set; }
[PersistedMember]
public abstract bool IsAnonymousUser { get; set; }
[PersistedMember]
public abstract DateTime ActivationDate { get; set; }
[RelatedDataAccessObjects]
public abstract RelatedDataAccessObjects<DbUserLogin> UserLogins { get; }
[RelatedDataAccessObjects]
public abstract RelatedDataAccessObjects<DbUserClaim> UserClaims { get; }
[RelatedDataAccessObjects]
public abstract RelatedDataAccessObjects<DbUserRole> UserRoles { get; }
}
} | mit | C# |
20409615cccbf1a041d422ade05ca77f32abeace | Add flag to know if the package is bundled or not. | NaosFramework/Naos.Deployment,NaosProject/Naos.Deployment | Naos.Deployment.Contract/Package.cs | Naos.Deployment.Contract/Package.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="Package.cs" company="Naos">
// Copyright 2015 Naos
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Naos.Deployment.Contract
{
using System;
using System.Security.Cryptography;
/// <summary>
/// A full package, description and the file bytes as of a date and time.
/// </summary>
public class Package
{
/// <summary>
/// Gets or sets the description of the package.
/// </summary>
public PackageDescription PackageDescription { get; set; }
/// <summary>
/// Gets or sets the bytes of the package file at specified date and time.
/// </summary>
public byte[] PackageFileBytes { get; set; }
/// <summary>
/// Gets or sets the date and time UTC that the package file bytes were retrieved.
/// </summary>
public DateTime PackageFileBytesRetrievalDateTimeUtc { get; set; }
/// <summary>
/// Gets or sets a value indicating whether or not the dependencies have been bundled with the specific package.
/// </summary>
public bool AreDependenciesBundled { get; set; }
}
}
| // --------------------------------------------------------------------------------------------------------------------
// <copyright file="Package.cs" company="Naos">
// Copyright 2015 Naos
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Naos.Deployment.Contract
{
using System;
using System.Security.Cryptography;
/// <summary>
/// A full package, description and the file bytes as of a date and time.
/// </summary>
public class Package
{
/// <summary>
/// Gets or sets the description of the package.
/// </summary>
public PackageDescription PackageDescription { get; set; }
/// <summary>
/// Gets or sets the bytes of the package file at specified date and time.
/// </summary>
public byte[] PackageFileBytes { get; set; }
/// <summary>
/// Gets or sets the date and time UTC that the package file bytes were retrieved.
/// </summary>
public DateTime PackageFileBytesRetrievalDateTimeUtc { get; set; }
}
}
| mit | C# |
59c4602eb956125b1e492432b908fc26ff1a44f4 | Update Name column for linking to the edit view | Neurothustra/ProductGrid,Neurothustra/ProductGrid,Neurothustra/ProductGrid | ProductGrid/Views/Home/Index.cshtml | ProductGrid/Views/Home/Index.cshtml | @model IEnumerable<ProductGrid.Models.Product>
@{
ViewBag.Title = "Index";
//WebGrid displays data on a web page using an HTML table element.
//In this instance, I've provided the constructor with a couple of arguments: Model is obviously the data object,
//ajaxUpdateContainerId looks in the DOM for the Id container to make dynamic Ajax updates, defaultSort indicates the default
//column on which to begin filtering
//more info at https://msdn.microsoft.com/en-us/library/system.web.helpers.webgrid(v=vs.111).aspx
WebGrid grid = new WebGrid(Model, ajaxUpdateContainerId: "productGrid", defaultSort: "Name");
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<div id="productGrid">
@*Returns the HTML markup that is used to render the WebGrid instance and using the specified paging options.
more information at https://msdn.microsoft.com/en-us/library/system.web.helpers.webgrid.gethtml(v=vs.111).aspx*@
@grid.GetHtml(tableStyle: "grid",
headerStyle: "header",
footerStyle: "footer",
alternatingRowStyle: "alternate",
selectedRowStyle: "selected",
columns: grid.Columns(
//Create the ActionLink to enable linking to other views, such as Details or Edit
grid.Column("Name", format: @<text>@Html.ActionLink((string)item.Name, "Edit", "Home", new {id=item.ProductId}, null)</text>),
grid.Column("Description", "Description", style: "description"),
grid.Column("Quantity", "Quantity")
))
</div> | @model IEnumerable<ProductGrid.Models.Product>
@{
ViewBag.Title = "Index";
//WebGrid displays data on a web page using an HTML table element.
//In this instance, I've provided the constructor with a couple of arguments: Model is obviously the data object,
//ajaxUpdateContainerId looks in the DOM for the Id container to make dynamic Ajax updates, defaultSort indicates the default
//column on which to begin filtering
//more info at https://msdn.microsoft.com/en-us/library/system.web.helpers.webgrid(v=vs.111).aspx
WebGrid grid = new WebGrid(Model, ajaxUpdateContainerId: "productGrid", defaultSort: "Name");
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<div id="productGrid">
@*Returns the HTML markup that is used to render the WebGrid instance and using the specified paging options.
more information at https://msdn.microsoft.com/en-us/library/system.web.helpers.webgrid.gethtml(v=vs.111).aspx*@
@grid.GetHtml(tableStyle: "grid",
headerStyle: "header",
footerStyle: "footer",
alternatingRowStyle: "alternate",
selectedRowStyle: "selected",
columns: grid.Columns(
grid.Column("Name", "Name"),
grid.Column("Description", "Description", style: "description"),
grid.Column("Quantity", "Quantity")
))
</div> | mit | C# |
6fdc825a5ca65df8be907ee784de256c5d81dcf5 | stop using webservice as a singleton - it should be possible to do multiple fetch requests at once | mgj/MvvmCross-Plugins,mgj/MvvmCross-Plugins | Fetcher/artm.MvxPlugins.Fetcher.Touch/Plugin.cs | Fetcher/artm.MvxPlugins.Fetcher.Touch/Plugin.cs | using MvvmCross.Platform.Plugins;
using MvvmCross.Platform;
using artm.Fetcher.Core.Services;
using artm.Fetcher.Touch.Services;
using SQLite.Net;
using SQLite.Net.Platform.XamarinIOS;
using System.Threading.Tasks;
namespace artm.MvxPlugins.Fetcher.Touch
{
public class Plugin : IMvxPlugin
{
public void Load()
{
Mvx.ConstructAndRegisterSingleton<IFetcherLoggerService, FetcherLoggerService>();
Mvx.RegisterType<IFetcherWebService, FetcherWebService>();
Mvx.ConstructAndRegisterSingleton<IFetcherRepositoryStoragePathService, FetcherRepositoryStoragePathService>();
Mvx.LazyConstructAndRegisterSingleton<IFetcherRepositoryService>(() => new FetcherRepositoryService(Mvx.Resolve<IFetcherLoggerService>(), () => CreateConnection(Mvx.Resolve<IFetcherRepositoryStoragePathService>())));
Mvx.ConstructAndRegisterSingleton<IFetcherService, FetcherService>();
// Force construction of singletons
var repository = Mvx.Resolve<IFetcherRepositoryService>() as FetcherRepositoryService;
// Ensure database tables are created
Task.Run(async () => await repository.Initialize());
}
private static SQLiteConnectionWithLock CreateConnection(IFetcherRepositoryStoragePathService path)
{
var str = new SQLiteConnectionString(path.GetPath(), false);
return new SQLiteConnectionWithLock(new SQLitePlatformIOS(), str);
}
}
} | using MvvmCross.Platform.Plugins;
using MvvmCross.Platform;
using artm.Fetcher.Core.Services;
using artm.Fetcher.Touch.Services;
using SQLite.Net;
using SQLite.Net.Platform.XamarinIOS;
using System.Threading.Tasks;
namespace artm.MvxPlugins.Fetcher.Touch
{
public class Plugin : IMvxPlugin
{
public void Load()
{
Mvx.ConstructAndRegisterSingleton<IFetcherLoggerService, FetcherLoggerService>();
Mvx.ConstructAndRegisterSingleton<IFetcherWebService, FetcherWebService>();
Mvx.ConstructAndRegisterSingleton<IFetcherRepositoryStoragePathService, FetcherRepositoryStoragePathService>();
Mvx.LazyConstructAndRegisterSingleton<IFetcherRepositoryService>(() => new FetcherRepositoryService(Mvx.Resolve<IFetcherLoggerService>(), () => CreateConnection(Mvx.Resolve<IFetcherRepositoryStoragePathService>())));
Mvx.LazyConstructAndRegisterSingleton<IFetcherService>(() => new FetcherService(Mvx.Resolve<IFetcherWebService>(), Mvx.Resolve<IFetcherRepositoryService>(), Mvx.Resolve<IFetcherLoggerService>()));
// Force construction of singletons
var repository = Mvx.Resolve<IFetcherRepositoryService>() as FetcherRepositoryService;
Mvx.Resolve<IFetcherService>();
// Ensure database tables are created
Task.Run(async () => await repository.Initialize());
}
private static SQLiteConnectionWithLock CreateConnection(IFetcherRepositoryStoragePathService path)
{
var str = new SQLiteConnectionString(path.GetPath(), false);
return new SQLiteConnectionWithLock(new SQLitePlatformIOS(), str);
}
}
} | apache-2.0 | C# |
bf83bdbc95c2c534c9bf15ec2a895802d48684e2 | Switch back to hello world example, | tiesmaster/DCC,tiesmaster/DCC | Dcc/Startup.cs | Dcc/Startup.cs | using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace Tiesmaster.Dcc
{
public class Startup
{
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
if(env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.Run(RunDccProxyAsync);
}
private static async Task RunDccProxyAsync(HttpContext context)
{
await context.Response.WriteAsync("Hello from DCC ;)");
}
}
} | using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
namespace Tiesmaster.Dcc
{
public class Startup
{
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
if(env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.RunProxy(new ProxyOptions { Host = "jsonplaceholder.typicode.com" });
}
}
} | mit | C# |
a1d539af8085e9468a28187a09d9315b17ea1c60 | optimize filter condition for DependencyContextAssemblyFinder | serilog/serilog-settings-configuration | src/Serilog.Settings.Configuration/Settings/Configuration/Assemblies/DependencyContextAssemblyFinder.cs | src/Serilog.Settings.Configuration/Settings/Configuration/Assemblies/DependencyContextAssemblyFinder.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.DependencyModel;
namespace Serilog.Settings.Configuration.Assemblies
{
sealed class DependencyContextAssemblyFinder : AssemblyFinder
{
readonly DependencyContext _dependencyContext;
public DependencyContextAssemblyFinder(DependencyContext dependencyContext)
{
_dependencyContext = dependencyContext ?? throw new ArgumentNullException(nameof(dependencyContext));
}
public override IReadOnlyList<AssemblyName> FindAssembliesContainingName(string nameToFind)
{
var query = from library in _dependencyContext.RuntimeLibraries
where IsReferencingSerilog(library)
from assemblyName in library.GetDefaultAssemblyNames(_dependencyContext)
where IsCaseInsensitiveMatch(assemblyName.Name, nameToFind)
select assemblyName;
return query.ToList().AsReadOnly();
static bool IsReferencingSerilog(Library library)
{
return library.Dependencies.Any(dependency => dependency.Name.Equals("serilog", StringComparison.OrdinalIgnoreCase));
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.DependencyModel;
namespace Serilog.Settings.Configuration.Assemblies
{
sealed class DependencyContextAssemblyFinder : AssemblyFinder
{
readonly DependencyContext _dependencyContext;
public DependencyContextAssemblyFinder(DependencyContext dependencyContext)
{
_dependencyContext = dependencyContext ?? throw new ArgumentNullException(nameof(dependencyContext));
}
public override IReadOnlyList<AssemblyName> FindAssembliesContainingName(string nameToFind)
{
var query = from library in _dependencyContext.RuntimeLibraries
where IsReferencingSerilog(library)
from assemblyName in library.GetDefaultAssemblyNames(_dependencyContext)
where IsCaseInsensitiveMatch(assemblyName.Name, nameToFind)
select assemblyName;
return query.ToList().AsReadOnly();
static bool IsReferencingSerilog(Library library)
{
return library.Dependencies.Any(dependency => dependency.Name.ToLowerInvariant() == "serilog");
}
}
}
}
| apache-2.0 | C# |
793ef33e27ec19b4e153ed3441c178af1d5000fe | Add placeholder for agent config | zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype | src/Glimpse.Agent.AspNet.Sample/Startup.cs | src/Glimpse.Agent.AspNet.Sample/Startup.cs | using Glimpse.Agent.Web;
using Microsoft.AspNet.Builder;
using Glimpse.Host.Web.AspNet;
using Microsoft.Framework.DependencyInjection;
namespace Glimpse.Agent.AspNet.Sample
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddGlimpse()
.RunningAgent()
.ForWeb()
.Configure<GlimpseAgentWebOptions>(options =>
{
//options.IgnoredStatusCodes.Add(200);
})
.WithRemoteStreamAgent();
//.WithRemoteHttpAgent();
}
public void Configure(IApplicationBuilder app)
{
app.UseGlimpse();
app.UseWelcomePage();
}
}
}
| using Microsoft.AspNet.Builder;
using Glimpse.Host.Web.AspNet;
using Microsoft.Framework.DependencyInjection;
namespace Glimpse.Agent.AspNet.Sample
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddGlimpse()
.RunningAgent()
.ForWeb()
.WithRemoteStreamAgent();
//.WithRemoteHttpAgent();
}
public void Configure(IApplicationBuilder app)
{
app.UseGlimpse();
app.UseWelcomePage();
}
}
}
| mit | C# |
bf3c8c71cc08a040b77578bb061784d96062ed47 | Fix Missing magic extension and max version of decoder | dacucar/fenixlib | FenixLib/FenixLib/IO/DivFilePaletteDecoder.cs | FenixLib/FenixLib/IO/DivFilePaletteDecoder.cs | /* Copyright 2016 Daro Cutillas Carrillo
*
* 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 FenixLib.Core;
using static FenixLib.IO.NativeFormat;
namespace FenixLib.IO
{
public sealed class DivFilePaletteDecoder : NativeDecoder<Palette>
{
public override int MaxSupportedVersion { get; } = 0;
protected override string[] KnownFileExtensions { get; } = { "pal", "map", "fpg", "fnt" };
protected override string[] KnownFileMagics { get; } =
{
"fnt", "map", "fpg", "pal"
};
protected override Palette ReadBody ( Header header, NativeFormatReader reader )
{
// Map files have the Palette data in a different position than the
// rest of the files
if ( header.Magic == "map" )
reader.ReadBytes ( 40 );
return reader.ReadPalette ();
}
}
}
| /* Copyright 2016 Daro Cutillas Carrillo
*
* 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 FenixLib.Core;
using static FenixLib.IO.NativeFormat;
namespace FenixLib.IO
{
public sealed class DivFilePaletteDecoder : NativeDecoder<Palette>
{
public override int MaxSupportedVersion { get; }
protected override string[] KnownFileExtensions { get; }
protected override string[] KnownFileMagics { get; }
protected override Palette ReadBody ( Header header, NativeFormatReader reader )
{
// Map files have the Palette data in a different position than the
// rest of the files
if ( header.Magic == "map" )
reader.ReadBytes ( 40 );
return reader.ReadPalette ();
}
}
}
| apache-2.0 | C# |
6e7a24a1eb2d69634190c7fd61fd494e8e818c6f | Remove unused using | matsprea/AspNetIdentity_U2F,matsprea/AspNetIdentity_U2F,matsprea/AspNetIdentity_U2F | U2F/Client/Impl/CryptoImpl.cs | U2F/Client/Impl/CryptoImpl.cs | using System;
using System.Security.Cryptography;
namespace U2F.Client.Impl
{
public class CryptoImpl : ICrypto
{
public byte[] ComputeSha256(String message)
{
try
{
var mySHA256 = SHA256Cng.Create();
var hash = mySHA256.ComputeHash(message.GetBytes());
return hash;
}
catch (Exception e)
{
throw new U2FException("Cannot compute SHA-256", e);
}
}
}
}
| using System;
using System.Security.Cryptography;
using Newtonsoft.Json.Linq;
namespace U2F.Client.Impl
{
public class CryptoImpl : ICrypto
{
public byte[] ComputeSha256(String message)
{
try
{
var mySHA256 = SHA256Cng.Create();
var hash = mySHA256.ComputeHash(message.GetBytes());
return hash;
}
catch (Exception e)
{
throw new U2FException("Cannot compute SHA-256", e);
}
}
}
}
| apache-2.0 | C# |
4e302fb0b652fce5ff08e874a2026f29cb35d2bc | refactor snapshots save+load tests | Pondidum/Ledger.Stores.Fs,Pondidum/Ledger.Stores.Fs | Ledger.Stores.Fs.Tests/SnapshotSaveLoadTests.cs | Ledger.Stores.Fs.Tests/SnapshotSaveLoadTests.cs | using System;
using System.IO;
using Shouldly;
using TestsDomain;
using Xunit;
namespace Ledger.Stores.Fs.Tests
{
public class SnapshotSaveLoadTests : IDisposable
{
private readonly string _root;
private readonly FileEventStore<Guid> _store;
public SnapshotSaveLoadTests()
{
_root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(_root);
_store = new FileEventStore<Guid>(_root);
}
[Fact]
public void A_snapshot_should_maintain_type()
{
var id = Guid.NewGuid();
_store.SaveSnapshot(id, new CandidateMemento());
var loaded = _store.LoadLatestSnapshotFor(id);
loaded.ShouldBeOfType<CandidateMemento>();
}
[Fact]
public void Only_the_latest_snapshot_should_be_loaded()
{
var id = Guid.NewGuid();
_store.SaveSnapshot(id, new CandidateMemento { SequenceID = 4 });
_store.SaveSnapshot(id, new CandidateMemento { SequenceID = 5 });
_store
.LoadLatestSnapshotFor(id)
.SequenceID
.ShouldBe(5);
}
[Fact]
public void The_most_recent_snapshot_id_should_be_found()
{
var id = Guid.NewGuid();
_store.SaveSnapshot(id, new CandidateMemento { SequenceID = 4 });
_store.SaveSnapshot(id, new CandidateMemento { SequenceID = 5 });
_store
.GetLatestSnapshotSequenceFor(id)
.ShouldBe(5);
}
[Fact]
public void When_there_is_no_snapshot_file_and_load_is_called()
{
var id = Guid.NewGuid();
var loaded = _store.LoadLatestSnapshotFor(id);
loaded.ShouldBe(null);
}
public void Dispose()
{
try
{
Directory.Delete(_root, true);
}
catch (Exception)
{
}
}
}
}
| using System;
using System.IO;
using Shouldly;
using TestsDomain;
using Xunit;
namespace Ledger.Stores.Fs.Tests
{
public class SnapshotSaveLoadTests : IDisposable
{
private readonly string _root;
public SnapshotSaveLoadTests()
{
_root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(_root);
}
[Fact]
public void A_snapshot_should_maintain_type()
{
var id = Guid.NewGuid();
var store = new FileEventStore<Guid>(_root);
store.SaveSnapshot(id, new CandidateMemento());
var loaded = store.LoadLatestSnapshotFor(id);
loaded.ShouldBeOfType<CandidateMemento>();
}
[Fact]
public void Only_the_latest_snapshot_should_be_loaded()
{
var id = Guid.NewGuid();
var store = new FileEventStore<Guid>(_root);
store.SaveSnapshot(id, new CandidateMemento { SequenceID = 4 });
store.SaveSnapshot(id, new CandidateMemento { SequenceID = 5 });
store
.LoadLatestSnapshotFor(id)
.SequenceID
.ShouldBe(5);
}
[Fact]
public void The_most_recent_snapshot_id_should_be_found()
{
var id = Guid.NewGuid();
var store = new FileEventStore<Guid>(_root);
store.SaveSnapshot(id, new CandidateMemento { SequenceID = 4 });
store.SaveSnapshot(id, new CandidateMemento { SequenceID = 5 });
store
.GetLatestSnapshotSequenceFor(id)
.ShouldBe(5);
}
[Fact]
public void When_there_is_no_snapshot_file_and_load_is_called()
{
var id = Guid.NewGuid();
var store = new FileEventStore<Guid>(_root);
var loaded = store.LoadLatestSnapshotFor(id);
loaded.ShouldBe(null);
}
public void Dispose()
{
try
{
Directory.Delete(_root, true);
}
catch (Exception)
{
}
}
}
}
| lgpl-2.1 | C# |
3cef1ad91d041d8ae6cb2eab25151c3959ef6054 | Clean up ModMonoConfig | stormleoxia/xsp,stormleoxia/xsp,arthot/xsp,stormleoxia/xsp,stormleoxia/xsp,murador/xsp,murador/xsp,murador/xsp,arthot/xsp,arthot/xsp,arthot/xsp,murador/xsp | src/Mono.WebServer.Apache/ModMonoConfig.cs | src/Mono.WebServer.Apache/ModMonoConfig.cs | //
// Mono.WebServer.ModMonoConfig
//
// Authors:
// Daniel Lopez Ridruejo
// Gonzalo Paniagua Javier
//
// Copyright (c) 2002 Daniel Lopez Ridruejo.
// (c) 2002,2003 Ximian, Inc.
// All rights reserved.
// (C) Copyright 2004-2010 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace Mono.WebServer
{
struct ModMonoConfig
{
bool outputBuffering;
public bool Changed { get; set; }
public bool OutputBuffering {
get { return outputBuffering; }
set {
Changed |= (value != outputBuffering);
outputBuffering = value;
}
}
}
}
| //
// Mono.WebServer.ModMonoConfig
//
// Authors:
// Daniel Lopez Ridruejo
// Gonzalo Paniagua Javier
//
// Copyright (c) 2002 Daniel Lopez Ridruejo.
// (c) 2002,2003 Ximian, Inc.
// All rights reserved.
// (C) Copyright 2004-2010 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace Mono.WebServer
{
struct ModMonoConfig
{
bool changed;
bool outputBuffering;
public bool Changed {
get { return changed; }
set { changed = value; }
}
public bool OutputBuffering {
get { return outputBuffering; }
set {
changed |= (value != outputBuffering);
outputBuffering = value;
}
}
}
}
| mit | C# |
ea3b44111bd3bf4f997aedd8e8295535c9c18523 | fix fallback phase not recognized bug | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | HiddenWallet/ChaumianCoinJoin/TumblerPhase.cs | HiddenWallet/ChaumianCoinJoin/TumblerPhase.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace HiddenWallet.ChaumianCoinJoin
{
public enum TumblerPhase
{
InputRegistration,
ConnectionConfirmation,
OutputRegistration,
Signing,
}
public static class TumblerPhaseHelpers
{
public static TumblerPhase GetTumblerPhase(string phase)
{
if (phase == null) throw new ArgumentNullException(nameof(phase));
foreach (TumblerPhase p in Enum.GetValues(typeof(TumblerPhase)))
{
if (phase.Equals(p.ToString(), StringComparison.OrdinalIgnoreCase)
|| phase.Equals("FallBack" + p.ToString(), StringComparison.OrdinalIgnoreCase))
{
return p;
}
}
throw new NotSupportedException($"Phase does not exist: {phase}");
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace HiddenWallet.ChaumianCoinJoin
{
public enum TumblerPhase
{
InputRegistration,
ConnectionConfirmation,
OutputRegistration,
Signing,
}
public static class TumblerPhaseHelpers
{
public static TumblerPhase GetTumblerPhase(string phase)
{
if (phase == null) throw new ArgumentNullException(nameof(phase));
if (phase == "FallBack" + phase.ToString()) return TumblerPhase.InputRegistration;
foreach (TumblerPhase p in Enum.GetValues(typeof(TumblerPhase)))
{
if (phase.Equals(p.ToString(), StringComparison.OrdinalIgnoreCase))
{
return p;
}
}
throw new NotSupportedException($"Phase does not exist: {phase}");
}
}
}
| mit | C# |
e6f9009549980b185913b5c9fcd6bc9fffbd51da | Remove VerifyMessage extension (implemented in NBitcoin) | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | HiddenWallet/Extensions/NBitcoinExtensions.cs | HiddenWallet/Extensions/NBitcoinExtensions.cs | using HiddenWallet.Models;
using System;
using System.Collections.Generic;
using System.Text;
namespace NBitcoin
{
public static class NBitcoinExtensions
{
public static ChainedBlock GetBlock(this ConcurrentChain me, Height height)
=> me.GetBlock(height.Value);
public static string ToHex(this IBitcoinSerializable me)
{
return HexHelpers.ToString(me.ToBytes());
}
public static void FromHex(this IBitcoinSerializable me, string hex)
{
if (me == null) throw new ArgumentNullException(nameof(me));
me.FromBytes(HexHelpers.GetBytes(hex));
}
}
}
| using HiddenWallet.Models;
using System;
using System.Collections.Generic;
using System.Text;
namespace NBitcoin
{
public static class NBitcoinExtensions
{
public static ChainedBlock GetBlock(this ConcurrentChain me, Height height)
=> me.GetBlock(height.Value);
public static string ToHex(this IBitcoinSerializable me)
{
return HexHelpers.ToString(me.ToBytes());
}
public static void FromHex(this IBitcoinSerializable me, string hex)
{
if (me == null) throw new ArgumentNullException(nameof(me));
me.FromBytes(HexHelpers.GetBytes(hex));
}
public static bool VerifyMessage(this BitcoinWitPubKeyAddress me, string message, string signature)
{
var key = PubKey.RecoverFromMessage(message, signature);
return key.Hash == me.Hash;
}
}
}
| mit | C# |
c9847c05487b8b381fcff9558a3c49a1c9c852b6 | Bump version | canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor | src/SyncTrayzor/Properties/AssemblyInfo.cs | src/SyncTrayzor/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("SyncTrayzor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SyncTrayzor")]
[assembly: AssemblyCopyright("Copyright © Antony Male 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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.13.0")]
[assembly: AssemblyFileVersion("1.0.13.0")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("SyncTrayzor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SyncTrayzor")]
[assembly: AssemblyCopyright("Copyright © Antony Male 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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.12.0")]
[assembly: AssemblyFileVersion("1.0.12.0")]
| mit | C# |
547b679c01ab4117107bacd34edbbe106e5f6570 | Remove this | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Gui/MainWindow.xaml.cs | WalletWasabi.Gui/MainWindow.xaml.cs | using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace WalletWasabi.Gui
{
internal class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.AttachDevTools();
//Renderer.DrawFps = true;
//Renderer.DrawDirtyRects = Renderer.DrawFps = true;
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
| using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace WalletWasabi.Gui
{
internal class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
this.AttachDevTools();
//Renderer.DrawFps = true;
//Renderer.DrawDirtyRects = Renderer.DrawFps = true;
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
| mit | C# |
8367e58500937241b0a4738216b35e8c8757efb1 | Rename tests to reflect recent naming changes. | hahmed/octokit.net,shana/octokit.net,M-Zuber/octokit.net,SamTheDev/octokit.net,forki/octokit.net,shiftkey/octokit.net,gabrielweyer/octokit.net,cH40z-Lord/octokit.net,ivandrofly/octokit.net,chunkychode/octokit.net,yonglehou/octokit.net,takumikub/octokit.net,khellang/octokit.net,ChrisMissal/octokit.net,daukantas/octokit.net,SLdragon1989/octokit.net,nsnnnnrn/octokit.net,fake-organization/octokit.net,nsrnnnnn/octokit.net,khellang/octokit.net,darrelmiller/octokit.net,hahmed/octokit.net,gdziadkiewicz/octokit.net,ivandrofly/octokit.net,kdolan/octokit.net,rlugojr/octokit.net,chunkychode/octokit.net,editor-tools/octokit.net,gdziadkiewicz/octokit.net,Red-Folder/octokit.net,TattsGroup/octokit.net,dampir/octokit.net,geek0r/octokit.net,shiftkey/octokit.net,adamralph/octokit.net,dlsteuer/octokit.net,SmithAndr/octokit.net,mminns/octokit.net,SamTheDev/octokit.net,Sarmad93/octokit.net,michaKFromParis/octokit.net,eriawan/octokit.net,alfhenrik/octokit.net,thedillonb/octokit.net,bslliw/octokit.net,shana/octokit.net,octokit-net-test/octokit.net,gabrielweyer/octokit.net,devkhan/octokit.net,eriawan/octokit.net,rlugojr/octokit.net,editor-tools/octokit.net,M-Zuber/octokit.net,yonglehou/octokit.net,Sarmad93/octokit.net,thedillonb/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,magoswiat/octokit.net,octokit-net-test-org/octokit.net,devkhan/octokit.net,brramos/octokit.net,hitesh97/octokit.net,fffej/octokit.net,octokit/octokit.net,shiftkey-tester/octokit.net,dampir/octokit.net,mminns/octokit.net,kolbasov/octokit.net,shiftkey-tester/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,SmithAndr/octokit.net,naveensrinivasan/octokit.net,TattsGroup/octokit.net,alfhenrik/octokit.net,octokit-net-test-org/octokit.net,octokit/octokit.net | Nocto.Tests.Integration/UsersEndpointTests.cs | Nocto.Tests.Integration/UsersEndpointTests.cs | using System;
using System.Threading.Tasks;
using Xunit;
namespace Nocto.Tests.Integration
{
public class UsersEndpointTests
{
public class TheGetMethod
{
[Fact]
public async Task ReturnsSpecifiedUser()
{
var github = new GitHubClient { Login = "xapitestaccountx", Password = "octocat11" };
// Get a user by username
var user = await github.User.Get("tclem");
Assert.Equal("GitHub", user.Company);
}
}
public class TheCurrentMethod
{
[Fact]
public async Task ReturnsSpecifiedUser()
{
var github = new GitHubClient { Login = "xapitestaccountx", Password = "octocat11" };
// Get a user by username
var user = await github.User.Current();
Assert.Equal("xapitestaccountx", user.Login);
}
}
public class TheGetAllMethod
{
[Fact]
public async Task ReturnsAllUsers()
{
var github = new GitHubClient();
// Get a user by username
var users = await github.User.GetAll();
Console.WriteLine(users);
}
}
}
}
| using System;
using System.Threading.Tasks;
using Xunit;
namespace Nocto.Tests.Integration
{
public class UsersEndpointTests
{
public class TheGetUserAsyncMethod
{
[Fact]
public async Task ReturnsSpecifiedUser()
{
var github = new GitHubClient { Login = "xapitestaccountx", Password = "octocat11" };
// Get a user by username
var user = await github.User.Get("tclem");
Assert.Equal("GitHub", user.Company);
}
}
public class TheGetAuthenticatedUserAsyncMethod
{
[Fact]
public async Task ReturnsSpecifiedUser()
{
var github = new GitHubClient { Login = "xapitestaccountx", Password = "octocat11" };
// Get a user by username
var user = await github.User.Current();
Assert.Equal("xapitestaccountx", user.Login);
}
}
public class TheGetUsersAsyncMethod
{
[Fact]
public async Task ReturnsAllUsers()
{
var github = new GitHubClient();
// Get a user by username
var users = await github.User.GetAll();
Console.WriteLine(users);
}
}
}
}
| mit | C# |
d8f193a544ae7dd01e892b8cba3ac41c66aa3517 | Fix license | ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,Tom94/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework | osu.Framework/Allocation/CacheInfo.cs | osu.Framework/Allocation/CacheInfo.cs | // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
using osu.Framework.Extensions.TypeExtensions;
namespace osu.Framework.Allocation
{
public struct CacheInfo
{
/// <summary>
/// The name of the cached member.
/// </summary>
public readonly string Name;
/// <summary>
/// The type containing the cached member.
/// </summary>
public readonly Type Parent;
/// <summary>
/// The type of the cached member.
/// </summary>
internal Type Type;
public CacheInfo(string name = null, Type parent = null)
{
Type = null;
Name = name;
Parent = parent;
}
public override string ToString() => $"{nameof(Type)} = {Type?.ReadableName()}, {nameof(Name)} = {Name}, {nameof(Parent)} = {Parent?.ReadableName()}";
}
}
| // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Extensions.TypeExtensions;
namespace osu.Framework.Allocation
{
public struct CacheInfo
{
/// <summary>
/// The name of the cached member.
/// </summary>
public readonly string Name;
/// <summary>
/// The type containing the cached member.
/// </summary>
public readonly Type Parent;
/// <summary>
/// The type of the cached member.
/// </summary>
internal Type Type;
public CacheInfo(string name = null, Type parent = null)
{
Type = null;
Name = name;
Parent = parent;
}
public override string ToString() => $"{nameof(Type)} = {Type?.ReadableName()}, {nameof(Name)} = {Name}, {nameof(Parent)} = {Parent?.ReadableName()}";
}
} | mit | C# |
db6a157a902c2e74ece109cde26eb75bbbd2d38c | Update ILocalizationContext.cs | tiksn/TIKSN-Framework | TIKSN.Core/Localization/ILocalizationContext.cs | TIKSN.Core/Localization/ILocalizationContext.cs | using System.Collections.Generic;
using System.Globalization;
namespace TIKSN.Localization
{
public interface ILocalizationContext
{
IReadOnlyCollection<CultureInfo> SupportedCultures { get; }
}
}
| using System.Collections.Generic;
using System.Globalization;
namespace TIKSN.Localization
{
public interface ILocalizationContext
{
IReadOnlyCollection<CultureInfo> SupportedCultures { get; }
}
} | mit | C# |
213a43af220679a9562e0909c6739feddaa961cb | Fix warning CA2208: provide a message to exception | fareloz/AttachToolbar | EngineType.cs | EngineType.cs | using System;
using System.Reflection;
namespace AttachToolbar
{
public enum EngineType
{
[EngineName("Native")]
Native = 1,
[EngineName("Managed")]
Managed = 2,
[EngineName("Managed/Native")]
Both = 3
}
public static class AttachEngineTypeConverter
{
public static string GetEngineName(this EngineType type)
{
Type atTypeDesc = type.GetType();
MemberInfo[] info = atTypeDesc.GetMember(type.ToString());
EngineNameAttribute engineNameAttr = Attribute.GetCustomAttribute(info[0], typeof(EngineNameAttribute))
as EngineNameAttribute;
if (engineNameAttr == null)
throw new NullReferenceException("Cannot get engine name");
return engineNameAttr.EngineName;
}
public static EngineType GetAttachType(this string engineName)
{
Array enumValues = Enum.GetValues(typeof(EngineType));
foreach (EngineType type in enumValues)
{
if (type.GetEngineName() == engineName)
{
return type;
}
}
return EngineType.Native;
}
}
}
| using System;
using System.Reflection;
namespace AttachToolbar
{
public enum EngineType
{
[EngineName("Native")]
Native = 1,
[EngineName("Managed")]
Managed = 2,
[EngineName("Managed/Native")]
Both = 3
}
public static class AttachEngineTypeConverter
{
public static string GetEngineName(this EngineType type)
{
Type atTypeDesc = type.GetType();
MemberInfo[] info = atTypeDesc.GetMember(type.ToString());
EngineNameAttribute engineNameAttr = Attribute.GetCustomAttribute(info[0], typeof(EngineNameAttribute))
as EngineNameAttribute;
if (engineNameAttr == null)
throw new ArgumentException();
return engineNameAttr.EngineName;
}
public static EngineType GetAttachType(this string engineName)
{
Array enumValues = Enum.GetValues(typeof(EngineType));
foreach (EngineType type in enumValues)
{
if (type.GetEngineName() == engineName)
{
return type;
}
}
return EngineType.Native;
}
}
}
| mit | C# |
acff802524d2fdffcbc480812da8ed5f7630cbf2 | Add on click omni towers behavior | hay-espacio-en-el-taco/Alerta-Minerva,lordzero0000/Alerta-Minerva | Assets/Scripts/Torres/OmniDirectionalTower.cs | Assets/Scripts/Torres/OmniDirectionalTower.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OmniDirectionalTower : MonoBehaviour {
public Collider attackObject;
public GameObject spawnPoint;
public float maxScale = 2;
public float Speed = 1;
private GameObject currentWave = null;
private Vector3 originalScale;
[SerializeField]
private bool _isAttacking = false;
public bool isAttacking
{
get { return this._isAttacking; }
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButton(0))
{
RaycastHit hitInfo = new RaycastHit();
bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo);
if (hit)
{
//Debug.Log("Hit " + hitInfo.transform.gameObject.name);
if (hitInfo.transform.gameObject.name == this.transform.gameObject.name)
{
_isAttacking = true;
}
else
{
_isAttacking = false;
}
}
else
{
_isAttacking = false;
}
}
else
{
_isAttacking = false;
}
if (isAttacking)
{
Attack();
}
else
{
cleanUp(this.spawnPoint.transform);
}
}
private void Attack()
{
if (this.currentWave != null)
{
if (Mathf.Abs(this.currentWave.transform.localScale.x) > this.maxScale)
{// Tamaño máximo alcanzado
this.currentWave.transform.localScale = this.originalScale;
}
else
{// Sigue creciendo
this.currentWave.transform.localScale += -1 * Vector3.one * Time.deltaTime * this.Speed;
}
}
else
{
this.currentWave = Instantiate(attackObject.gameObject) as GameObject;
this.currentWave.transform.parent = this.spawnPoint.transform;
this.currentWave.transform.localPosition = Vector3.zero;
this.originalScale = this.currentWave.transform.localScale;
}
}
private void cleanUp(Transform parent)
{
Object.Destroy(this.currentWave);
this.currentWave = null;
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OmniDirectionalTower : MonoBehaviour {
public Collider attackObject;
public GameObject spawnPoint;
public float maxScale = 2;
public float Speed = 1;
private GameObject currentWave = null;
private Vector3 originalScale;
[SerializeField]
private bool _isAttacking = false;
public bool isAttacking
{
get { return this._isAttacking; }
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (isAttacking)
{
Attack();
}
else
{
cleanUp(this.spawnPoint.transform);
}
}
private void Attack()
{
if (this.currentWave != null)
{
if (Mathf.Abs(this.currentWave.transform.localScale.x) > this.maxScale)
{// Tamaño máximo alcanzado
this.currentWave.transform.localScale = this.originalScale;
}
else
{// Sigue creciendo
this.currentWave.transform.localScale += -1 * Vector3.one * Time.deltaTime * this.Speed;
}
}
else
{
this.currentWave = Instantiate(attackObject.gameObject) as GameObject;
this.currentWave.transform.parent = this.spawnPoint.transform;
this.currentWave.transform.localPosition = Vector3.zero;
this.originalScale = this.currentWave.transform.localScale;
}
}
private void cleanUp(Transform parent)
{
Object.Destroy(this.currentWave);
this.currentWave = null;
}
}
| mit | C# |
cd343a7a727c58faa6dc71adb10aa31756ca2867 | Revert "fix(logging): 🐛 try alt AppInsights IKey init" | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs | services/SharedKernel/FilterLists.SharedKernel.Logging/HostRunner.cs | using System;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
namespace FilterLists.SharedKernel.Logging
{
public static class HostRunner
{
public static async Task TryRunWithLoggingAsync(this IHost host, Func<Task>? runPreHostAsync = default)
{
_ = host ?? throw new ArgumentNullException(nameof(host));
Log.Logger = ConfigurationBuilder.BaseLoggerConfiguration
.WriteTo.Conditional(
_ => host.Services.GetService<IHostEnvironment>().IsProduction(),
c => c.ApplicationInsights(
host.Services.GetRequiredService<TelemetryConfiguration>(),
TelemetryConverter.Traces))
.CreateLogger();
try
{
// TODO: rm, for debugging
var client = host.Services.GetService<TelemetryClient>();
Log.Warning("Application Insights Instrumentation Key: {InstrumentationKey}", client.InstrumentationKey);
if (runPreHostAsync != null)
{
Log.Information("Initializing pre-host");
await runPreHostAsync();
}
Log.Information("Initializing host");
await host.RunAsync();
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly");
throw;
}
finally
{
Log.CloseAndFlush();
}
}
}
}
| using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
namespace FilterLists.SharedKernel.Logging
{
public static class HostRunner
{
public static async Task TryRunWithLoggingAsync(this IHost host, Func<Task>? runPreHostAsync = default)
{
_ = host ?? throw new ArgumentNullException(nameof(host));
Log.Logger = ConfigurationBuilder.BaseLoggerConfiguration
.WriteTo.Conditional(
_ => host.Services.GetService<IHostEnvironment>().IsProduction(),
c => c.ApplicationInsights(
((IConfiguration)host.Services.GetService(typeof(IConfiguration)))[
"ApplicationInsights:InstrumentationKey"],
TelemetryConverter.Traces))
.CreateLogger();
try
{
if (runPreHostAsync != null)
{
Log.Information("Initializing pre-host");
await runPreHostAsync();
}
Log.Information("Initializing host");
await host.RunAsync();
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly");
throw;
}
finally
{
Log.CloseAndFlush();
}
}
}
}
| mit | C# |
82b882dbc4b3d7ba8e40055455b2478a46a99dd1 | Remove mikelovesrobots from PlayerOptions | mikelovesrobots/daft-pong,mikelovesrobots/daft-pong | app/Assets/Scripts/PlayerOptions.cs | app/Assets/Scripts/PlayerOptions.cs | using UnityEngine;
using System.Collections;
public class PlayerOptions {
public static Color Color = new Color(122f/255f, 196f/255f, 205f/255f, 9f/255f);
public static string Name = "";
}
| using UnityEngine;
using System.Collections;
public class PlayerOptions {
public static Color Color = new Color(122f/255f, 196f/255f, 205f/255f, 9f/255f);
public static string Name = "mikelovesrobots";
}
| mit | C# |
297c1a033e52794af4362f5562bf6475329526eb | change version | idoku/EChartsSDK,idoku/EChartsSDK,idoku/EChartsSDK | EChartsSDK/ECharts/Properties/AssemblyInfo.cs | EChartsSDK/ECharts/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("ECharts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ECharts")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("653de17a-f178-46f8-8e47-2d7586883e32")]
// 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("3.6.1.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ECharts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ECharts")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("653de17a-f178-46f8-8e47-2d7586883e32")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
1603c83efc83e1aff53ba0e14cddb09ae9beed1e | refactor to cover more of the machine and be more explanatory | Pondidum/Finite,Pondidum/Finite | Finite.Tests/Acceptance/LightsStateMachine.cs | Finite.Tests/Acceptance/LightsStateMachine.cs | using System.Linq;
using Finite.StateProviders;
using Finite.Tests.Acceptance.States;
using Shouldly;
using Xunit;
namespace Finite.Tests.Acceptance
{
public class LightsStateMachineAcceptanceTest
{
public StateMachine<LightsSwitches> Machine { get; private set; }
public LightsStateMachineAcceptanceTest()
{
var allStates = new State<LightsSwitches>[]
{
new LightOff(),
new LightOnDim(),
new LightOnFull(),
};
Machine = new StateMachine<LightsSwitches>(
new ManualStateProvider<LightsSwitches>(allStates),
new LightsSwitches());
}
}
public class InitialStateAcceptanceTest : LightsStateMachineAcceptanceTest
{
[Fact]
public void When_the_machine_has_not_been_set_to_initial_state()
{
Should.Throw<StateMachineException>(() => Machine.TransitionTo<LightOnFull>());
}
}
public class ValidStateAcceptanceTest : LightsStateMachineAcceptanceTest
{
public ValidStateAcceptanceTest()
{
Machine.ResetTo<LightOff>();
}
[Fact]
public void The_current_state_should_be()
{
Machine.CurrentState.ShouldBeOfType<LightOff>();
}
[Fact]
public void All_target_states()
{
Machine.AllTargetStates
.Select(state => state.GetType())
.ShouldBe(new[] { typeof(LightOnDim), typeof(LightOnFull) }, true);
}
[Fact]
public void All_active_target_states()
{
Machine.ActiveTargetStates
.Select(state => state.GetType())
.ShouldBe(new[] { typeof(LightOnFull) });
}
[Fact]
public void All_inactive_target_states()
{
Machine.InactiveTargetStates
.Select(state => state.GetType())
.ShouldBe(new[] { typeof(LightOnDim) });
}
}
public class InvalidStateAcceptanceTest : LightsStateMachineAcceptanceTest
{
public InvalidStateAcceptanceTest()
{
Machine.ResetTo<LightOff>();
}
[Fact]
public void Transitioning_to_an_invalid_state()
{
Should.Throw<InvalidTransitionException>(() => Machine.TransitionTo<LightOnDim>());
Machine.CurrentState.ShouldBeOfType<LightOff>();
}
}
}
| using System.Linq;
using Finite.StateProviders;
using Finite.Tests.Acceptance.States;
using Shouldly;
using Xunit;
namespace Finite.Tests.Acceptance
{
public class LightsStateMachine
{
[Fact]
public void Configuring_the_machine()
{
var allStates = new State<LightsSwitches>[]
{
new LightOff(),
new LightOnDim(),
new LightOnFull(),
};
var switches = new LightsSwitches();
var machine = new StateMachine<LightsSwitches>(new ManualStateProvider<LightsSwitches>(allStates), switches);
machine.ResetTo<LightOff>();
machine.CurrentState.ShouldBeOfType<LightOff>();
machine.AllTargetStates
.Select(state => state.GetType())
.ShouldBe(new[] { typeof(LightOnDim), typeof(LightOnFull) }, true);
machine.ActiveTargetStates
.Select(state => state.GetType())
.ShouldBe(new[] { typeof(LightOnFull) });
machine.InactiveTargetStates
.Select(state => state.GetType())
.ShouldBe(new[] { typeof(LightOnDim) });
Should.Throw<InvalidTransitionException>(() => machine.TransitionTo<LightOnDim>());
machine.CurrentState.ShouldBeOfType<LightOff>();
machine.TransitionTo<LightOnFull>();
machine.CurrentState.ShouldBeOfType<LightOnFull>();
}
}
}
| lgpl-2.1 | C# |
054c8c5612e176bf0eec9abf36adc327dcf4b580 | Update Constants.cs | maikebing/GitLab.VisualStudio | src/GitLab.VisualStudio/Constants.cs | src/GitLab.VisualStudio/Constants.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitLab.VisualStudio
{
static class PackageGuids
{
public const string guidGitLabPkgString = "54803a44-49e0-4935-bba4-7d7d91682273";
public const string guidOpenOnGitLabPkgString = "F43CFE82-0372-4230-9162-038E51408B2F";
public const string guidOpenOnGitLabCmdSetString = "72B54F2E-FE93-4950-88BF-C536D1CFD91F";
public const string Version = "1.0";
public static readonly Guid guidOpenOnGitLabCmdSet = new Guid(guidOpenOnGitLabCmdSetString);
};
static class PackageCommanddIDs
{
public const uint OpenMaster = 0x100;
public const uint OpenBranch = 0x200;
public const uint OpenRevision = 0x300;
public const uint OpenRevisionFull = 0x400;
public const uint OpenBlame = 0x500;
public const uint OpenCommits = 0x600;
public const uint CreateSnippet = 0x700;
};
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitLab.VisualStudio
{
static class PackageGuids
{
public const string guidGitLabPkgString = "54803a44-49e0-4935-bba4-7d7d91682273";
public const string guidOpenOnGitLabPkgString = "F43CFE82-0372-4230-9162-038E51408B2F";
public const string guidOpenOnGitLabCmdSetString = "72B54F2E-FE93-4950-88BF-C536D1CFD91F";
public static readonly Guid guidOpenOnGitLabCmdSet = new Guid(guidOpenOnGitLabCmdSetString);
};
static class PackageCommanddIDs
{
public const uint OpenMaster = 0x100;
public const uint OpenBranch = 0x200;
public const uint OpenRevision = 0x300;
public const uint OpenRevisionFull = 0x400;
public const uint OpenBlame = 0x500;
public const uint OpenCommits = 0x600;
public const uint CreateSnippet = 0x700;
};
}
| mit | C# |
99220420abf0f0bbae55a3e5497537eeb036d1e0 | update version number | klnkr/EnsageSharp | AutoDeward/AutoDeward/Properties/AssemblyInfo.cs | AutoDeward/AutoDeward/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("AutoDeward")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AutoDeward")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0fd0a152-889f-4d4a-83df-c387c6f9075b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
| 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("AutoDeward")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AutoDeward")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0fd0a152-889f-4d4a-83df-c387c6f9075b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
fbe8980cbe52b815dd160518078e8e5e9e59ec1d | rename node to key | xirqlz/blueprint41 | Blueprint41/Neo4j/Refactoring/IRefactorEntity.cs | Blueprint41/Neo4j/Refactoring/IRefactorEntity.cs | using System;
using System.Dynamic;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using Blueprint41.Dynamic;
namespace Blueprint41.Neo4j.Refactoring
{
public interface IRefactorEntity
{
/// <summary>
///
/// </summary>
/// <param name="newName"></param>
void Rename(string newName);
void SetDefaultValue(Action<dynamic> values);
void CopyValue(string source, string target);
void ApplyLabels();
void ChangeInheritance(Entity entity);
void ApplyConstraints();
void CreateIndexes();
dynamic CreateNode(object node);
dynamic MatchNode(object key);
void DeleteNode(object key);
void Deprecate();
/// <summary>
/// Remove the FunctionalId pattern assigned to the property. Previously assigned primary key values (if any) will not be reset.
/// </summary>
void ResetFunctionalId();
/// <summary>
/// Assign a new FunctionalId pattern to the property. Previously assigned primary key values (if any) will be set according to the chosen algorithm.
/// </summary>
void SetFunctionalId(FunctionalId functionalId, ApplyAlgorithm algorithm = ApplyAlgorithm.DoNotApply);
}
}
| using System;
using System.Dynamic;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using Blueprint41.Dynamic;
namespace Blueprint41.Neo4j.Refactoring
{
public interface IRefactorEntity
{
/// <summary>
///
/// </summary>
/// <param name="newName"></param>
void Rename(string newName);
void SetDefaultValue(Action<dynamic> values);
void CopyValue(string source, string target);
void ApplyLabels();
void ChangeInheritance(Entity entity);
void ApplyConstraints();
void CreateIndexes();
dynamic CreateNode(object node);
dynamic MatchNode(object key);
void DeleteNode(object node);
void Deprecate();
/// <summary>
/// Remove the FunctionalId pattern assigned to the property. Previously assigned primary key values (if any) will not be reset.
/// </summary>
void ResetFunctionalId();
/// <summary>
/// Assign a new FunctionalId pattern to the property. Previously assigned primary key values (if any) will be set according to the chosen algorithm.
/// </summary>
void SetFunctionalId(FunctionalId functionalId, ApplyAlgorithm algorithm = ApplyAlgorithm.DoNotApply);
}
}
| mit | C# |
4b1a293eb5652a915e39832fcfcdac79ce756915 | Fix #57 | secana/PeNet | src/PEditor/TabItems/Imports.xaml.cs | src/PEditor/TabItems/Imports.xaml.cs | using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;
using PeNet;
namespace PEditor.TabItems
{
/// <summary>
/// Interaction logic for Imports.xaml
/// </summary>
public partial class Imports : UserControl
{
private PeFile _peFile;
public Imports()
{
InitializeComponent();
}
private void lbImportDlls_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
lbImportFunctions.Items.Clear();
if (e.AddedItems.Count == 0)
return;
dynamic selected = e.AddedItems[0];
var functions = _peFile.ImportedFunctions.Where(x => x.DLL == selected.DLL);
foreach (var function in functions)
{
lbImportFunctions.Items.Add(new { function.Name, function.Hint });
}
}
public void SetImports(PeFile peFile)
{
_peFile = peFile;
lbImportDlls.Items.Clear();
if (peFile.ImportedFunctions == null)
return;
var dllNames = peFile.ImportedFunctions?.Select(x => x.DLL).Distinct();
var dllFunctions = new Dictionary<string, IEnumerable<ImportFunction>>();
foreach (var dllName in peFile.ImportedFunctions?.Select(x => x.DLL).Distinct())
{
lbImportDlls.Items.Add(new { DLL = dllName });
}
}
}
}
| using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;
using PeNet;
namespace PEditor.TabItems
{
/// <summary>
/// Interaction logic for Imports.xaml
/// </summary>
public partial class Imports : UserControl
{
private PeFile _peFile;
public Imports()
{
InitializeComponent();
}
private void lbImportDlls_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
lbImportFunctions.Items.Clear();
if (e.AddedItems.Count == 0)
return;
dynamic selected = e.AddedItems[0];
var functions = _peFile.ImportedFunctions.Where(x => x.DLL == selected.DLL);
foreach (var function in functions)
{
lbImportFunctions.Items.Add(new { function.Name, function.Hint });
}
}
public void SetImports(PeFile peFile)
{
_peFile = peFile;
lbImportDlls.Items.Clear();
if (peFile.ImportedFunctions == null)
return;
var dllNames = peFile.ImportedFunctions?.Select(x => x.DLL).Distinct();
var dllFunctions = new Dictionary<string, IEnumerable<ImportFunction>>();
foreach (var dllName in dllNames)
{
var functions = peFile.ImportedFunctions.Where(x => x.DLL == dllName);
dllFunctions.Add(dllName, functions);
}
foreach (var kv in dllFunctions)
{
lbImportDlls.Items.Add(new { DLL = kv.Key });
}
}
}
}
| apache-2.0 | C# |
01ca9ea40599dd478cbb352465e8c81af3bb6435 | Remove specific references to .sln files. | AmadeusW/SourceBrowser,CodeConnect/SourceBrowser,AmadeusW/SourceBrowser,AmadeusW/SourceBrowser,CodeConnect/SourceBrowser | src/SourceBrowser.Samples/Program.cs | src/SourceBrowser.Samples/Program.cs | using System;
using System.IO;
using SourceBrowser.Generator;
namespace SourceBrowser.Samples
{
class Program
{
static void Main(string[] args)
{
// Combined with, or replaced by, provided paths to create absolute paths
string userProfilePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
// For developers that set test variables in code:
string solutionPath = @"";
string saveDirectory = @"";
// For developers that provide test variables in arguments:
if (args.Length == 2)
{
solutionPath = args[0];
saveDirectory = args[1];
}
// Combine user's root with relative solution paths, or use absolute paths.
// (Path.Combine returns just second argument if it is an absolute path)
string absoluteSolutionPath = Path.Combine(userProfilePath, solutionPath);
string absoluteSaveDirectory = Path.Combine(userProfilePath, saveDirectory);
// Open and analyze the solution.
try
{
Console.Write("Opening " + absoluteSolutionPath);
Console.WriteLine("...");
var solutionAnalyzer = new SolutionAnalayzer(absoluteSolutionPath);
Console.Write("Analyzing and saving into " + absoluteSaveDirectory);
Console.WriteLine("...");
solutionAnalyzer.AnalyzeAndSave(saveDirectory);
Console.WriteLine("Job successful!");
}
catch (Exception ex)
{
Console.WriteLine("Error:");
Console.WriteLine(ex.ToString());
}
}
}
} | using System;
using System.IO;
using SourceBrowser.Generator;
namespace SourceBrowser.Samples
{
class Program
{
static void Main(string[] args)
{
// Combined with, or replaced by, provided paths to create absolute paths
string userProfilePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
// For developers that set test variables in code:
string solutionPath = @"Documents\GitHub\Kiwi\TestSolution\TestSolution.sln";
string saveDirectory = @"Documents\SourceBrowserResult\";
// For developers that provide test variables in arguments:
if (args.Length == 2)
{
solutionPath = args[0];
saveDirectory = args[1];
}
// Combine user's root with relative solution paths, or use absolute paths.
// (Path.Combine returns just second argument if it is an absolute path)
string absoluteSolutionPath = Path.Combine(userProfilePath, solutionPath);
string absoluteSaveDirectory = Path.Combine(userProfilePath, saveDirectory);
// Open and analyze the solution.
try
{
Console.Write("Opening " + absoluteSolutionPath);
Console.WriteLine("...");
var solutionAnalyzer = new SolutionAnalayzer(absoluteSolutionPath);
Console.Write("Analyzing and saving into " + absoluteSaveDirectory);
Console.WriteLine("...");
solutionAnalyzer.AnalyzeAndSave(saveDirectory);
Console.WriteLine("Job successful!");
}
catch (Exception ex)
{
Console.WriteLine("Error:");
Console.WriteLine(ex.ToString());
}
}
}
} | mit | C# |
a7c15f3d0de12a82c7dade3c8ef88770dee81aef | remove redundant teardown handling from CurrentScenario | modulexcite/xbehave.net,hitesh97/xbehave.net,hitesh97/xbehave.net,adamralph/xbehave.net,modulexcite/xbehave.net,mvalipour/xbehave.net,xbehave/xbehave.net,mvalipour/xbehave.net | src/Xbehave.2/Sdk/CurrentScenario.cs | src/Xbehave.2/Sdk/CurrentScenario.cs | // <copyright file="CurrentScenario.cs" company="xBehave.net contributors">
// Copyright (c) xBehave.net contributors. All rights reserved.
// </copyright>
namespace Xbehave.Sdk
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
public static class CurrentScenario
{
[ThreadStatic]
private static bool addingBackgroundSteps;
[ThreadStatic]
private static List<Step> steps;
public static bool AddingBackgroundSteps
{
get { return CurrentScenario.addingBackgroundSteps; }
set { CurrentScenario.addingBackgroundSteps = value; }
}
private static List<Step> Steps
{
get { return steps ?? (steps = new List<Step>()); }
}
public static Step AddStep(string name, Action body)
{
var step = new Step(EmbellishStepName(name), body);
Steps.Add(step);
return step;
}
public static Step AddStep(string name, Func<Task> body)
{
var step = new Step(EmbellishStepName(name), body);
Steps.Add(step);
return step;
}
public static IEnumerable<Step> ExtractSteps()
{
try
{
return Steps;
}
finally
{
steps = null;
}
}
private static string EmbellishStepName(string name)
{
return addingBackgroundSteps ? "(Background) " + name : name;
}
}
} | // <copyright file="CurrentScenario.cs" company="xBehave.net contributors">
// Copyright (c) xBehave.net contributors. All rights reserved.
// </copyright>
namespace Xbehave.Sdk
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
public static class CurrentScenario
{
[ThreadStatic]
private static bool addingBackgroundSteps;
[ThreadStatic]
private static List<Step> steps;
[ThreadStatic]
private static List<Action> teardowns;
public static bool AddingBackgroundSteps
{
get { return CurrentScenario.addingBackgroundSteps; }
set { CurrentScenario.addingBackgroundSteps = value; }
}
private static List<Step> Steps
{
get { return steps ?? (steps = new List<Step>()); }
}
private static List<Action> Teardowns
{
get { return teardowns ?? (teardowns = new List<Action>()); }
}
public static Step AddStep(string name, Action body)
{
var step = new Step(EmbellishStepName(name), body);
Steps.Add(step);
return step;
}
public static Step AddStep(string name, Func<Task> body)
{
var step = new Step(EmbellishStepName(name), body);
Steps.Add(step);
return step;
}
public static void AddTeardown(Action teardown)
{
if (teardown != null)
{
Teardowns.Add(teardown);
}
}
public static IEnumerable<Action> ExtractTeardowns()
{
try
{
return Teardowns;
}
finally
{
teardowns = null;
}
}
public static IEnumerable<Step> ExtractSteps()
{
try
{
return Steps;
}
finally
{
steps = null;
}
}
private static string EmbellishStepName(string name)
{
return addingBackgroundSteps ? "(Background) " + name : name;
}
}
} | mit | C# |
0d0179cb476450b4c580efb95f5c6b785270e3e1 | Use constants in upgrade migration | abryukhov/Umbraco-CMS,madsoulswe/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,rasmuseeg/Umbraco-CMS,WebCentrum/Umbraco-CMS,tcmorris/Umbraco-CMS,tompipe/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,NikRimington/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,leekelleher/Umbraco-CMS,rasmuseeg/Umbraco-CMS,bjarnef/Umbraco-CMS,KevinJump/Umbraco-CMS,KevinJump/Umbraco-CMS,WebCentrum/Umbraco-CMS,tcmorris/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS,tompipe/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,madsoulswe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tcmorris/Umbraco-CMS,WebCentrum/Umbraco-CMS,madsoulswe/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abjerner/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,NikRimington/Umbraco-CMS,mattbrailsford/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS,bjarnef/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,tompipe/Umbraco-CMS,NikRimington/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,rasmuseeg/Umbraco-CMS,KevinJump/Umbraco-CMS,leekelleher/Umbraco-CMS,leekelleher/Umbraco-CMS,tcmorris/Umbraco-CMS,umbraco/Umbraco-CMS,hfloyd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS | src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourteenZero/UpdateMemberGroupPickerData.cs | src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourteenZero/UpdateMemberGroupPickerData.cs | using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFourteenZero
{
/// <summary>
/// Migrates member group picker properties from NVarchar to NText. See https://github.com/umbraco/Umbraco-CMS/issues/3268.
/// </summary>
[Migration("7.14.0", 1, Constants.System.UmbracoMigrationName)]
public class UpdateMemberGroupPickerData : MigrationBase
{
public UpdateMemberGroupPickerData(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger)
{
}
public override void Up()
{
// move the data for all member group properties from the NVarchar to the NText column and clear the NVarchar column
Execute.Sql($@"UPDATE cmsPropertyData SET dataNtext = dataNvarchar, dataNvarchar = NULL
WHERE dataNtext IS NULL AND id IN (
SELECT id FROM cmsPropertyData WHERE propertyTypeId in (
SELECT id from cmsPropertyType where dataTypeID IN (
SELECT nodeId FROM cmsDataType WHERE propertyEditorAlias = '{Constants.PropertyEditors.MemberGroupPickerAlias}'
)
)
)");
// ensure that all exising member group properties are defined as NText
Execute.Sql($"UPDATE cmsDataType SET dbType = 'Ntext' WHERE propertyEditorAlias = '{Constants.PropertyEditors.MemberGroupPickerAlias}'");
}
public override void Down()
{
}
}
}
| using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFourteenZero
{
/// <summary>
/// Migrates member group picker properties from NVarchar to NText. See https://github.com/umbraco/Umbraco-CMS/issues/3268.
/// </summary>
[Migration("7.14.0", 1, Constants.System.UmbracoMigrationName)]
public class UpdateMemberGroupPickerData : MigrationBase
{
public UpdateMemberGroupPickerData(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger)
{
}
public override void Up()
{
// move the data for all member group properties from the NVarchar to the NText column and clear the NVarchar column
Execute.Sql(@"UPDATE cmsPropertyData SET dataNtext = dataNvarchar, dataNvarchar = NULL
WHERE dataNtext IS NULL AND id IN (
SELECT id FROM cmsPropertyData WHERE propertyTypeId in (
SELECT id from cmsPropertyType where dataTypeID IN (
SELECT nodeId FROM cmsDataType WHERE propertyEditorAlias = 'Umbraco.MemberGroupPicker'
)
)
)");
// ensure that all exising member group properties are defined as NText
Execute.Sql("UPDATE cmsDataType SET dbType = 'Ntext' WHERE propertyEditorAlias = 'Umbraco.MemberGroupPicker'");
}
public override void Down()
{
}
}
}
| mit | C# |
33cefc3273b5510a83a3af4368923142babd5334 | Use .NET 6. | FacilityApi/FacilityJavaScript,FacilityApi/FacilityJavaScript,FacilityApi/FacilityCSharp,FacilityApi/Facility,FacilityApi/FacilityJavaScript | tools/Build/Build.cs | tools/Build/Build.cs | using Faithlife.Build;
using static Faithlife.Build.BuildUtility;
using static Faithlife.Build.DotNetRunner;
return BuildRunner.Execute(args, build =>
{
var codegen = "fsdgen___";
var gitLogin = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? "");
var dotNetBuildSettings = new DotNetBuildSettings
{
NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
DocsSettings = new DotNetDocsSettings
{
GitLogin = gitLogin,
GitAuthor = new GitAuthorInfo("FacilityApiBot", "facilityapi@gmail.com"),
SourceCodeUrl = "https://github.com/FacilityApi/RepoTemplate/tree/master/src",
ProjectHasDocs = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
},
PackageSettings = new DotNetPackageSettings
{
GitLogin = gitLogin,
PushTagOnPublish = x => $"nuget.{x.Version}",
},
};
build.AddDotNetTargets(dotNetBuildSettings);
build.Target("codegen")
.DependsOn("build")
.Describe("Generates code from the FSD")
.Does(() => CodeGen(verify: false));
build.Target("verify-codegen")
.DependsOn("build")
.Describe("Ensures the generated code is up-to-date")
.Does(() => CodeGen(verify: true));
build.Target("test")
.DependsOn("verify-codegen");
void CodeGen(bool verify)
{
var configuration = dotNetBuildSettings.GetConfiguration();
var toolPath = FindFiles($"src/{codegen}/bin/{configuration}/net6.0/{codegen}.dll").FirstOrDefault() ?? throw new BuildException($"Missing {codegen}.dll.");
var verifyOption = verify ? "--verify" : null;
RunDotNet(toolPath, "___", "___", "--newline", "lf", verifyOption);
}
});
| using Faithlife.Build;
using static Faithlife.Build.BuildUtility;
using static Faithlife.Build.DotNetRunner;
return BuildRunner.Execute(args, build =>
{
var codegen = "fsdgen___";
var gitLogin = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? "");
var dotNetBuildSettings = new DotNetBuildSettings
{
NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
DocsSettings = new DotNetDocsSettings
{
GitLogin = gitLogin,
GitAuthor = new GitAuthorInfo("FacilityApiBot", "facilityapi@gmail.com"),
SourceCodeUrl = "https://github.com/FacilityApi/RepoTemplate/tree/master/src",
ProjectHasDocs = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
},
PackageSettings = new DotNetPackageSettings
{
GitLogin = gitLogin,
PushTagOnPublish = x => $"nuget.{x.Version}",
},
};
build.AddDotNetTargets(dotNetBuildSettings);
build.Target("codegen")
.DependsOn("build")
.Describe("Generates code from the FSD")
.Does(() => CodeGen(verify: false));
build.Target("verify-codegen")
.DependsOn("build")
.Describe("Ensures the generated code is up-to-date")
.Does(() => CodeGen(verify: true));
build.Target("test")
.DependsOn("verify-codegen");
void CodeGen(bool verify)
{
var configuration = dotNetBuildSettings.GetConfiguration();
var toolPath = FindFiles($"src/{codegen}/bin/{configuration}/net5.0/{codegen}.dll").FirstOrDefault() ?? throw new BuildException($"Missing {codegen}.dll.");
var verifyOption = verify ? "--verify" : null;
RunDotNet(toolPath, "___", "___", "--newline", "lf", verifyOption);
}
});
| mit | C# |
b33411e3345ec0cd25c32749a172c2cdaacc7096 | Add missing using for UWP | thomasgalliker/ValueConverters.NET | ValueConverters.Shared/ValueConverterGroup.cs | ValueConverters.Shared/ValueConverterGroup.cs | using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
#if (NETFX || WINDOWS_PHONE)
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;
#elif (NETFX_CORE)
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
#elif (XAMARIN)
using Xamarin.Forms;
#endif
namespace ValueConverters
{
/// <summary>
/// Value converters which aggregates the results of a sequence of converters: Converter1 >> Converter2 >> Converter3
/// The output of converter N becomes the input of converter N+1.
/// </summary>
#if (NETFX || XAMARIN || WINDOWS_PHONE)
[ContentProperty(nameof(Converters))]
#elif (NETFX_CORE)
[ContentProperty(Name = nameof(Converters))]
#endif
public class ValueConverterGroup : SingletonConverterBase<ValueConverterGroup>
{
public List<IValueConverter> Converters { get; set; } = new List<IValueConverter>();
protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return this.Converters?.Aggregate(value, (current, converter) => converter.Convert(current, targetType, parameter, culture));
}
protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return this.Converters?.Reverse<IValueConverter>().Aggregate(value, (current, converter) => converter.Convert(current, targetType, parameter, culture));
}
}
}
| using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
#if (NETFX || WINDOWS_PHONE)
using System.Windows.Data;
using System.Windows.Markup;
#elif (NETFX_CORE)
using Windows.UI.Xaml;
using Windows.UI.Xaml.Markup;
#elif (XAMARIN)
using Xamarin.Forms;
#endif
namespace ValueConverters
{
/// <summary>
/// Value converters which aggregates the results of a sequence of converters: Converter1 >> Converter2 >> Converter3
/// The output of converter N becomes the input of converter N+1.
/// </summary>
#if (NETFX || WINDOWS_PHONE)
[ContentProperty(nameof(Converters))]
#elif (NETFX_CORE)
[ContentProperty(Name = nameof(Converters))]
#endif
public class ValueConverterGroup : SingletonConverterBase<ValueConverterGroup>
{
public List<IValueConverter> Converters { get; set; } = new List<IValueConverter>();
protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return this.Converters?.Aggregate(value, (current, converter) => converter.Convert(current, targetType, parameter, culture));
}
protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return this.Converters?.Reverse<IValueConverter>().Aggregate(value, (current, converter) => converter.Convert(current, targetType, parameter, culture));
}
}
}
| mit | C# |
ddf765ac95b916b30285de5b94ce0909ea5e3843 | add some basic details about bank transactions | arrowflex/FreeAgent | src/FreeAgent/Model/BankTransactionExplanation.cs | src/FreeAgent/Model/BankTransactionExplanation.cs | using System;
using System.Collections.Generic;
namespace FreeAgent.Model
{
public class BankTransactionExplanation : IUrl
{
public Uri Url { get; set; }
public Uri BankAccount { get; set; } //TODO - accoutn or transaction when creating
public Uri BankTransaction { get; set; }
public DateTime DatedOn { get; set; }
public string Description { get; set; }
public Uri Category { get; set; }
// public double manual_sales_tax_amount
// public double gross_value
// public double foreign_currency_value
//rebill_type
//rebill_factor
//paid_invoice (Required when paying an invoice)
//paid_bill (Required when paying a bill receipt)
//paid_user (Required when paying a user)
//transfer_bank_account (Required when transferring money between accounts)
//asset_life_years (Required for capital asset purchase. The integer number of years over which the asset should be depreciated.)
public Attachment Attachment { get; set; }
}
public class BankTransactionExplanationWrapper
{
public BankTransactionExplanation BankTransactionExplanation { get; set; }
public List<BankTransactionExplanation> BankTransactionExplanations { get; set; }
}
} | using System;
using System.Collections.Generic;
namespace FreeAgent.Model
{
public class BankTransactionExplanation : IUrl
{
public Uri Url { get; set; }
}
public class BankTransactionExplanationWrapper
{
public BankTransactionExplanation BankTransactionExplanation { get; set; }
public List<BankTransactionExplanation> BankTransactionExplanations { get; set; }
}
} | apache-2.0 | C# |
12ca870b74e3883ccc3396e32e160d239f419193 | Fix osu!catch relax mod | UselessToucan/osu,peppy/osu,smoogipoo/osu,ppy/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu | osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs | osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play;
using osuTK;
namespace osu.Game.Rulesets.Catch.Mods
{
public class CatchModRelax : ModRelax, IApplicableToDrawableRuleset<CatchHitObject>, IApplicableToPlayer
{
public override string Description => @"Use the mouse to control the catcher.";
private DrawableRuleset<CatchHitObject> drawableRuleset;
public void ApplyToDrawableRuleset(DrawableRuleset<CatchHitObject> drawableRuleset)
{
this.drawableRuleset = drawableRuleset;
}
public void ApplyToPlayer(Player player)
{
if (!drawableRuleset.HasReplayLoaded.Value)
drawableRuleset.Cursor.Add(new MouseInputHelper((CatchPlayfield)drawableRuleset.Playfield));
}
private class MouseInputHelper : Drawable, IKeyBindingHandler<CatchAction>, IRequireHighFrequencyMousePosition
{
private readonly Catcher catcher;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public MouseInputHelper(CatchPlayfield playfield)
{
catcher = playfield.CatcherArea.MovableCatcher;
RelativeSizeAxes = Axes.Both;
}
// disable keyboard controls
public bool OnPressed(CatchAction action) => true;
public void OnReleased(CatchAction action)
{
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
catcher.UpdatePosition(e.MousePosition.X / DrawSize.X * CatchPlayfield.WIDTH);
return base.OnMouseMove(e);
}
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play;
using osuTK;
namespace osu.Game.Rulesets.Catch.Mods
{
public class CatchModRelax : ModRelax, IApplicableToDrawableRuleset<CatchHitObject>, IApplicableToPlayer
{
public override string Description => @"Use the mouse to control the catcher.";
private DrawableRuleset<CatchHitObject> drawableRuleset;
public void ApplyToDrawableRuleset(DrawableRuleset<CatchHitObject> drawableRuleset)
{
this.drawableRuleset = drawableRuleset;
}
public void ApplyToPlayer(Player player)
{
if (!drawableRuleset.HasReplayLoaded.Value)
drawableRuleset.Cursor.Add(new MouseInputHelper((CatchPlayfield)drawableRuleset.Playfield));
}
private class MouseInputHelper : Drawable, IKeyBindingHandler<CatchAction>, IRequireHighFrequencyMousePosition
{
private readonly Catcher catcher;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public MouseInputHelper(CatchPlayfield playfield)
{
catcher = playfield.CatcherArea.MovableCatcher;
RelativeSizeAxes = Axes.Both;
}
// disable keyboard controls
public bool OnPressed(CatchAction action) => true;
public void OnReleased(CatchAction action)
{
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
catcher.UpdatePosition(e.MousePosition.X / DrawSize.X);
return base.OnMouseMove(e);
}
}
}
}
| mit | C# |
62f8eadbef9c6a395efd42fa6c3d09a4668e1696 | Update cfg to multiboot2 | zarlo/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos | source/Cosmos.Build.Tasks/CreateGrubConfig.cs | source/Cosmos.Build.Tasks/CreateGrubConfig.cs | using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Cosmos.Build.Tasks
{
public class CreateGrubConfig: Task
{
[Required]
public string TargetDirectory { get; set; }
[Required]
public string BinName { get; set; }
private string Indentation = " ";
public override bool Execute()
{
if (!Directory.Exists(TargetDirectory))
{
Log.LogError($"Invalid target directory! Target directory: '{TargetDirectory}'");
return false;
}
var xBinName = BinName;
var xLabelName = Path.GetFileNameWithoutExtension(xBinName);
using (var xWriter = File.CreateText(Path.Combine(TargetDirectory + "/boot/grub/", "grub.cfg")))
{
xWriter.WriteLine("menuentry '" + xLabelName + "' {");
WriteIndentedLine(xWriter, "multiboot2 /boot/" + xBinName);
WriteIndentedLine(xWriter, "boot");
xWriter.WriteLine("}");
}
return true;
}
private void WriteIndentedLine(TextWriter aWriter, string aText)
{
aWriter.WriteLine(Indentation + aText);
}
}
}
| using System.Diagnostics;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Cosmos.Build.Tasks
{
public class CreateGrubConfig: Task
{
[Required]
public string TargetDirectory { get; set; }
[Required]
public string BinName { get; set; }
private string Indentation = " ";
public override bool Execute()
{
if (!Directory.Exists(TargetDirectory))
{
Log.LogError($"Invalid target directory! Target directory: '{TargetDirectory}'");
return false;
}
var xBinName = BinName;
var xLabelName = Path.GetFileNameWithoutExtension(xBinName);
using (var xWriter = File.CreateText(Path.Combine(TargetDirectory + "/boot/grub/", "grub.cfg")))
{
xWriter.WriteLine("menuentry '" + xLabelName + "' {");
WriteIndentedLine(xWriter, "multiboot /boot/" + xBinName);
xWriter.WriteLine("}");
}
return true;
}
private void WriteIndentedLine(TextWriter aWriter, string aText)
{
aWriter.WriteLine(Indentation + aText);
}
}
}
| bsd-3-clause | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.