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
9604fcfae252cc6eb755ddb18ddff5cd5e960485
update version
gaochundong/Cowboy
Cowboy/SolutionVersion.cs
Cowboy/SolutionVersion.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyDescription("Cowboy is a library for building sockets based services.")] [assembly: AssemblyCompany("Dennis Gao")] [assembly: AssemblyProduct("Cowboy")] [assembly: AssemblyCopyright("Copyright © 2015-2016 Dennis Gao.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.2.7.0")] [assembly: AssemblyFileVersion("1.2.7.0")] [assembly: ComVisible(false)]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyDescription("Cowboy is a library for building sockets based services.")] [assembly: AssemblyCompany("Dennis Gao")] [assembly: AssemblyProduct("Cowboy")] [assembly: AssemblyCopyright("Copyright © 2015-2016 Dennis Gao.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.2.6.0")] [assembly: AssemblyFileVersion("1.2.6.0")] [assembly: ComVisible(false)]
mit
C#
0147aa0f2d65b9207d91c8c2b36deed2041a3b64
Add comment to IEventAggregator so that the project builds
adamveld12/Xenon.Core
src/Xenon.Core/IEventAggregator.cs
src/Xenon.Core/IEventAggregator.cs
using System; namespace Xenon.Core { /// <summary> /// Routes events to multiple handlers /// </summary> public interface IEventAggregator : IDisposable { /// <summary> /// Sends a message to all of the listeners /// </summary> /// <param name="message"></param> /// <typeparam name="TMessage"></typeparam> void SendMessage<TMessage>(TMessage message = default(TMessage)) where TMessage : struct; /// <summary> /// Subscribes a <see cref="IEventHandler{TEventType}"/> to this <see cref="IEventAggregator"/> /// </summary> /// <typeparam name="TEventType"></typeparam> void Subscribe<TEventType>(IEventHandler<TEventType> eventHandler) where TEventType : struct; /// <summary> /// Removes a subscription from the <see cref="IEventAggregator"/> /// </summary> /// <param name="eventHandler"></param> /// <typeparam name="TEventType"></typeparam> void Unsubscribe<TEventType>(IEventHandler<TEventType> eventHandler) where TEventType : struct; /// <summary> /// Clears all subscriptions /// </summary> void Clear(); } }
using System; namespace Xenon.Core { public interface IEventAggregator : IDisposable { /// <summary> /// Sends a message to all of the listeners /// </summary> /// <param name="message"></param> /// <typeparam name="TMessage"></typeparam> void SendMessage<TMessage>(TMessage message = default(TMessage)) where TMessage : struct; /// <summary> /// Subscribes a <see cref="IEventHandler{TEventType}"/> to this <see cref="IEventAggregator"/> /// </summary> /// <typeparam name="TEventType"></typeparam> void Subscribe<TEventType>(IEventHandler<TEventType> eventHandler) where TEventType : struct; /// <summary> /// Removes a subscription from the <see cref="IEventAggregator"/> /// </summary> /// <param name="eventHandler"></param> /// <typeparam name="TEventType"></typeparam> void Unsubscribe<TEventType>(IEventHandler<TEventType> eventHandler) where TEventType : struct; /// <summary> /// Clears all subscriptions /// </summary> void Clear(); } }
mit
C#
efcf11778334500890830f7046aa2b6a91e11781
Set DBContext database initializer thingie to MigrateDatabaseToLatestVersion.
leo90skk/qdms,KBurov/qdms,qusma/qdms,leo90skk/qdms,Jumaga2015/qdms,qusma/qdms,underwater/qdms,underwater/qdms
EntityData/MyDBContext.cs
EntityData/MyDBContext.cs
// ----------------------------------------------------------------------- // <copyright file="MyDBContext.cs" company=""> // Copyright 2013 Alexander Soffronow Pagonidis // </copyright> // ----------------------------------------------------------------------- using System.Data.Entity; using EntityData.Migrations; using QDMS; namespace EntityData { public partial class MyDBContext : DbContext { public MyDBContext() : base("Name=qdmsEntitiesMySql") { } public DbSet<Instrument> Instruments { get; set; } public DbSet<Tag> Tags { get; set; } public DbSet<Exchange> Exchanges { get; set; } public DbSet<Datasource> Datasources { get; set; } public DbSet<SessionTemplate> SessionTemplates { get; set; } public DbSet<ExchangeSession> ExchangeSessions { get; set; } public DbSet<InstrumentSession> InstrumentSessions { get; set; } public DbSet<TemplateSession> TemplateSessions { get; set; } public DbSet<UnderlyingSymbol> UnderlyingSymbols { get; set; } public DbSet<ContinuousFuture> ContinuousFutures { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { Database.SetInitializer(new MigrateDatabaseToLatestVersion<MyDBContext, Configuration>()); modelBuilder.Entity<ExchangeSession>().ToTable("exchangesessions"); modelBuilder.Entity<InstrumentSession>().ToTable("instrumentsessions"); modelBuilder.Entity<TemplateSession>().ToTable("templatesessions"); modelBuilder.Configurations.Add(new InstrumentConfig()); modelBuilder.Configurations.Add(new TagConfig()); modelBuilder.Configurations.Add(new ExchangeConfig()); modelBuilder.Configurations.Add(new DatasourceConfig()); modelBuilder.Configurations.Add(new UnderlyingSymbolConfig()); modelBuilder.Configurations.Add(new ContinuousFutureConfig()); modelBuilder.Entity<Instrument>() .HasMany(c => c.Tags) .WithMany() .Map(x => { x.MapLeftKey("InstrumentID"); x.MapRightKey("TagID"); x.ToTable("tag_map"); }); } } }
// ----------------------------------------------------------------------- // <copyright file="MyDBContext.cs" company=""> // Copyright 2013 Alexander Soffronow Pagonidis // </copyright> // ----------------------------------------------------------------------- using System.Data.Entity; using QDMS; namespace EntityData { public partial class MyDBContext : DbContext { public MyDBContext() : base("Name=qdmsEntitiesMySql") { } public DbSet<Instrument> Instruments { get; set; } public DbSet<Tag> Tags { get; set; } public DbSet<Exchange> Exchanges { get; set; } public DbSet<Datasource> Datasources { get; set; } public DbSet<SessionTemplate> SessionTemplates { get; set; } public DbSet<ExchangeSession> ExchangeSessions { get; set; } public DbSet<InstrumentSession> InstrumentSessions { get; set; } public DbSet<TemplateSession> TemplateSessions { get; set; } public DbSet<UnderlyingSymbol> UnderlyingSymbols { get; set; } public DbSet<ContinuousFuture> ContinuousFutures { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Entity<ExchangeSession>().ToTable("exchangesessions"); modelBuilder.Entity<InstrumentSession>().ToTable("instrumentsessions"); modelBuilder.Entity<TemplateSession>().ToTable("templatesessions"); modelBuilder.Configurations.Add(new InstrumentConfig()); modelBuilder.Configurations.Add(new TagConfig()); modelBuilder.Configurations.Add(new ExchangeConfig()); modelBuilder.Configurations.Add(new DatasourceConfig()); modelBuilder.Configurations.Add(new UnderlyingSymbolConfig()); modelBuilder.Configurations.Add(new ContinuousFutureConfig()); modelBuilder.Entity<Instrument>() .HasMany(c => c.Tags) .WithMany() .Map(x => { x.MapLeftKey("InstrumentID"); x.MapRightKey("TagID"); x.ToTable("tag_map"); }); } } }
bsd-3-clause
C#
16e658f5cb0d7e74dd37557c469d649d434f8241
Fix lastval in PostgresCompiler for SqlKata.Execution
sqlkata/querybuilder
QueryBuilder/Compilers/PostgresCompiler.cs
QueryBuilder/Compilers/PostgresCompiler.cs
namespace SqlKata.Compilers { public class PostgresCompiler : Compiler { public PostgresCompiler() { LastId = "SELECT lastval() AS id"; } public override string EngineCode { get; } = EngineCodes.PostgreSql; protected override string CompileBasicDateCondition(SqlResult ctx, BasicDateCondition condition) { var column = Wrap(condition.Column); string left; if (condition.Part == "time") { left = $"{column}::time"; } else if (condition.Part == "date") { left = $"{column}::date"; } else { left = $"DATE_PART('{condition.Part.ToUpper()}', {column})"; } var sql = $"{left} {condition.Operator} {Parameter(ctx, condition.Value)}"; if (condition.IsNot) { return $"NOT ({sql})"; } return sql; } } }
namespace SqlKata.Compilers { public class PostgresCompiler : Compiler { public PostgresCompiler() { LastId = "SELECT lastval()"; } public override string EngineCode { get; } = EngineCodes.PostgreSql; protected override string CompileBasicDateCondition(SqlResult ctx, BasicDateCondition condition) { var column = Wrap(condition.Column); string left; if (condition.Part == "time") { left = $"{column}::time"; } else if (condition.Part == "date") { left = $"{column}::date"; } else { left = $"DATE_PART('{condition.Part.ToUpper()}', {column})"; } var sql = $"{left} {condition.Operator} {Parameter(ctx, condition.Value)}"; if (condition.IsNot) { return $"NOT ({sql})"; } return sql; } } }
mit
C#
705ea3cd45ad0c411850675099b2faf449af3df7
Use a simple list instead of a state machine.
jesterret/ReClass.NET,jesterret/ReClass.NET,KN4CK3R/ReClass.NET,KN4CK3R/ReClass.NET,KN4CK3R/ReClass.NET,jesterret/ReClass.NET
ReClass.NET/MemoryScanner/ScannerWorker.cs
ReClass.NET/MemoryScanner/ScannerWorker.cs
using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Threading; using ReClassNET.MemoryScanner.Comparer; namespace ReClassNET.MemoryScanner { internal class ScannerWorker { private readonly ScanSettings settings; private readonly IScanComparer comparer; public ScannerWorker(ScanSettings settings, IScanComparer comparer) { Contract.Requires(settings != null); Contract.Requires(comparer != null); this.settings = settings; this.comparer = comparer; } /// <summary> /// Uses the <see cref="IScanComparer"/> to scan the byte array for results. /// </summary> /// <param name="data">The data to scan.</param> /// <param name="count">The length of the <paramref name="data"/> parameter.</param> /// <param name="ct">The <see cref="CancellationToken"/> to stop the scan.</param> /// <returns>An enumeration of all <see cref="ScanResult"/>s.</returns> public IList<ScanResult> Search(byte[] data, int count, CancellationToken ct) { Contract.Requires(data != null); var results = new List<ScanResult>(); var endIndex = count - comparer.ValueSize; for (var i = 0; i < endIndex; i += settings.FastScanAlignment) { if (ct.IsCancellationRequested) { break; } if (comparer.Compare(data, i, out var result)) { result.Address = (IntPtr)i; results.Add(result); } } return results; } /// <summary> /// Uses the <see cref="IScanComparer"/> to scan the byte array for results. /// The comparer uses the provided previous results to compare to the current value. /// </summary> /// <param name="data">The data to scan.</param> /// <param name="count">The length of the <paramref name="data"/> parameter.</param> /// <param name="previousResults">The previous results to use.</param> /// <param name="ct">The <see cref="CancellationToken"/> to stop the scan.</param> /// <returns>An enumeration of all <see cref="ScanResult"/>s.</returns> public IList<ScanResult> Search(byte[] data, int count, IEnumerable<ScanResult> previousResults, CancellationToken ct) { Contract.Requires(data != null); Contract.Requires(previousResults != null); var results = new List<ScanResult>(); var endIndex = count - comparer.ValueSize; foreach (var previousResult in previousResults) { if (ct.IsCancellationRequested) { break; } var offset = previousResult.Address.ToInt32(); if (offset <= endIndex) { if (comparer.Compare(data, offset, previousResult, out var result)) { result.Address = previousResult.Address; results.Add(result); } } } return results; } } }
using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Threading; using ReClassNET.MemoryScanner.Comparer; namespace ReClassNET.MemoryScanner { internal class ScannerWorker { private readonly ScanSettings settings; private readonly IScanComparer comparer; public ScannerWorker(ScanSettings settings, IScanComparer comparer) { Contract.Requires(settings != null); Contract.Requires(comparer != null); this.settings = settings; this.comparer = comparer; } /// <summary> /// Uses the <see cref="IScanComparer"/> to scan the byte array for results. /// </summary> /// <param name="data">The data to scan.</param> /// <param name="count">The length of the <paramref name="data"/> parameter.</param> /// <param name="ct">The <see cref="CancellationToken"/> to stop the scan.</param> /// <returns>An enumeration of all <see cref="ScanResult"/>s.</returns> public IEnumerable<ScanResult> Search(byte[] data, int count, CancellationToken ct) { Contract.Requires(data != null); var endIndex = count - comparer.ValueSize; for (var i = 0; i < endIndex; i += settings.FastScanAlignment) { if (ct.IsCancellationRequested) { break; } if (comparer.Compare(data, i, out var result)) { result.Address = (IntPtr)i; yield return result; } } } /// <summary> /// Uses the <see cref="IScanComparer"/> to scan the byte array for results. /// The comparer uses the provided previous results to compare to the current value. /// </summary> /// <param name="data">The data to scan.</param> /// <param name="count">The length of the <paramref name="data"/> parameter.</param> /// <param name="results">The previous results to use.</param> /// <param name="ct">The <see cref="CancellationToken"/> to stop the scan.</param> /// <returns>An enumeration of all <see cref="ScanResult"/>s.</returns> public IEnumerable<ScanResult> Search(byte[] data, int count, IEnumerable<ScanResult> results, CancellationToken ct) { Contract.Requires(data != null); Contract.Requires(results != null); var endIndex = count - comparer.ValueSize; foreach (var previous in results) { if (ct.IsCancellationRequested) { break; } var offset = previous.Address.ToInt32(); if (offset <= endIndex) { if (comparer.Compare(data, offset, previous, out var result)) { result.Address = previous.Address; yield return result; } } } } } }
mit
C#
92ad156d83af9051d2214878c468116bdf7f616e
Add test that default value of TextBlock.Text property is empty string.
SuperJMN/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,jkoritzinsky/Perspex,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,akrisiun/Perspex,grokys/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia
tests/Avalonia.Controls.UnitTests/TextBlockTests.cs
tests/Avalonia.Controls.UnitTests/TextBlockTests.cs
// Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using Avalonia.Data; using Xunit; namespace Avalonia.Controls.UnitTests { public class TextBlockTests { [Fact] public void DefaultBindingMode_Should_Be_OneWay() { Assert.Equal( BindingMode.OneWay, TextBlock.TextProperty.GetMetadata(typeof(TextBlock)).DefaultBindingMode); } [Fact] public void Default_Text_Value_Should_Be_EmptyString() { var textBlock = new TextBlock(); Assert.Equal( "", textBlock.Text); } } }
// Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using Avalonia.Data; using Xunit; namespace Avalonia.Controls.UnitTests { public class TextBlockTests { [Fact] public void DefaultBindingMode_Should_Be_OneWay() { Assert.Equal( BindingMode.OneWay, TextBlock.TextProperty.GetMetadata(typeof(TextBlock)).DefaultBindingMode); } } }
mit
C#
1cf262217e74b8c5933da5200d24ab46e4a9eba0
fix connection encapsulation.
volkanceylan/Serenity,rolembergfilho/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,dfaruque/Serenity
Serenity.Data.Entity/Row/RowValidationContext.cs
Serenity.Data.Entity/Row/RowValidationContext.cs
using Serenity.Data; using System; using System.Data; namespace Serenity.Services { public class RowValidationContext : IValidationContext { private Row row; public RowValidationContext(IDbConnection connection, Row row) { this.row = row; this.Connection = connection; } public object GetFieldValue(string fieldName) { var field = row.FindFieldByPropertyName(fieldName) ?? row.FindField(fieldName); if (ReferenceEquals(null, field)) return null; return field.AsObject(row); } public IDbConnection Connection { get; private set; } public object Value { get; set; } } }
using Serenity.Data; using System; using System.Data; namespace Serenity.Services { public class RowValidationContext : IValidationContext { private Row row; private IDbConnection connection; public RowValidationContext(IDbConnection connection, Row row) { this.row = row; this.connection = connection; } public object GetFieldValue(string fieldName) { var field = row.FindFieldByPropertyName(fieldName) ?? row.FindField(fieldName); if (ReferenceEquals(null, field)) return null; return field.AsObject(row); } public IDbConnection Connection { get; private set; } public object Value { get; set; } } }
mit
C#
6608172719fc8189686e39675d22511d8d473989
Extend messages API.
chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet
Source/MQTTnet.Server/Controllers/MessagesController.cs
Source/MQTTnet.Server/Controllers/MessagesController.cs
using System; using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using MQTTnet.Protocol; using MQTTnet.Server.Mqtt; namespace MQTTnet.Server.Controllers { [Authorize] [ApiController] public class MessagesController : Controller { private readonly MqttServerService _mqttServerService; public MessagesController(MqttServerService mqttServerService) { _mqttServerService = mqttServerService ?? throw new ArgumentNullException(nameof(mqttServerService)); } [Route("api/v1/messages")] [HttpPost] public async Task<ActionResult> PostMessage(MqttApplicationMessage message) { await _mqttServerService.PublishAsync(message); return Ok(); } [Route("api/v1/messages/{*topic}")] [HttpPost] public async Task<ActionResult> PostMessage(string topic, int qosLevel = 0) { byte[] payload; using (var memoryStream = new MemoryStream()) { await HttpContext.Request.Body.CopyToAsync(memoryStream); payload = memoryStream.ToArray(); } var message = new MqttApplicationMessageBuilder() .WithTopic(topic) .WithPayload(payload) .WithQualityOfServiceLevel((MqttQualityOfServiceLevel)qosLevel) .Build(); return await PostMessage(message); } } }
using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using MQTTnet.Server.Mqtt; namespace MQTTnet.Server.Controllers { [Authorize] [ApiController] public class MessagesController : Controller { private readonly MqttServerService _mqttServerService; public MessagesController(MqttServerService mqttServerService) { _mqttServerService = mqttServerService ?? throw new ArgumentNullException(nameof(mqttServerService)); } [Route("api/v1/messages")] [HttpPost] public async Task<ActionResult> PostMessage(MqttApplicationMessage message) { await _mqttServerService.PublishAsync(message); return Ok(); } [Route("api/v1/messages/{*topic}")] [HttpPost] public Task<ActionResult> PostMessage(string topic, string payload) { var message = new MqttApplicationMessageBuilder() .WithTopic(topic) .WithPayload(payload) .Build(); return PostMessage(message); } } }
mit
C#
4b946e4237e908b162c88e693c718157373aea62
Improve test code quality
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Tests/IntegrationTests/ExternalApiTests.cs
WalletWasabi.Tests/IntegrationTests/ExternalApiTests.cs
using NBitcoin; using System.Collections.Generic; using System.Threading.Tasks; using WalletWasabi.Backend.Models; using WalletWasabi.WebClients.BlockchainInfo; using WalletWasabi.WebClients.Coinbase; using WalletWasabi.WebClients.CoinGecko; using WalletWasabi.WebClients.Bitstamp; using WalletWasabi.WebClients.Gemini; using WalletWasabi.WebClients.ItBit; using WalletWasabi.WebClients.SmartBit; using Xunit; using WalletWasabi.Interfaces; namespace WalletWasabi.Tests.IntegrationTests { public class ExternalApiTests { [Fact] public async Task SmartBitExchangeRateProviderTestAsync() => await AssertProviderAsync(new SmartBitExchangeRateProvider(new SmartBitClient(Network.Main))); [Fact] public async Task CoinbaseExchangeRateProviderTestsAsync() => await AssertProviderAsync(new CoinbaseExchangeRateProvider()); [Fact] public async Task BlockchainInfoExchangeRateProviderTestsAsync() => await AssertProviderAsync(new BlockchainInfoExchangeRateProvider()); [Fact] public async Task CoinGeckoExchangeRateProviderTestsAsync() => await AssertProviderAsync(new CoinGeckoExchangeRateProvider()); [Fact] public async Task BitstampExchangeRateProviderTestsAsync() => await AssertProviderAsync(new BitstampExchangeRateProvider()); [Fact] public async Task GeminiExchangeRateProviderTestsAsync() => await AssertProviderAsync(new GeminiExchangeRateProvider()); [Fact] public async Task ItBitExchangeRateProviderTestsAsync() => await AssertProviderAsync(new ItBitExchangeRateProvider()); private async Task AssertProviderAsync(IExchangeRateProvider provider) { IEnumerable<ExchangeRate> rates = await provider.GetExchangeRateAsync(); var usdRate = Assert.Single(rates, x => x.Ticker == "USD"); Assert.NotEqual(0.0m, usdRate.Rate); } } }
using NBitcoin; using System.Collections.Generic; using System.Threading.Tasks; using WalletWasabi.Backend.Models; using WalletWasabi.WebClients.BlockchainInfo; using WalletWasabi.WebClients.Coinbase; using WalletWasabi.WebClients.CoinGecko; using WalletWasabi.WebClients.Bitstamp; using WalletWasabi.WebClients.Gemini; using WalletWasabi.WebClients.ItBit; using WalletWasabi.WebClients.SmartBit; using Xunit; namespace WalletWasabi.Tests.IntegrationTests { public class ExternalApiTests { [Theory] [InlineData("test")] [InlineData("main")] public async Task SmartBitExchangeRateProviderTestAsync(string networkString) { var network = Network.GetNetwork(networkString); var client = new SmartBitClient(network); var rateProvider = new SmartBitExchangeRateProvider(client); IEnumerable<ExchangeRate> rates = await rateProvider.GetExchangeRateAsync(); var usdRate = Assert.Single(rates, x => x.Ticker == "USD"); Assert.NotEqual(0.0m, usdRate.Rate); } [Fact] public async Task CoinbaseExchangeRateProviderTestsAsync() { var client = new CoinbaseExchangeRateProvider(); IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync(); var usdRate = Assert.Single(rates, x => x.Ticker == "USD"); Assert.NotEqual(0.0m, usdRate.Rate); } [Fact] public async Task BlockchainInfoExchangeRateProviderTestsAsync() { var client = new BlockchainInfoExchangeRateProvider(); IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync(); var usdRate = Assert.Single(rates, x => x.Ticker == "USD"); Assert.NotEqual(0.0m, usdRate.Rate); } [Fact] public async Task CoinGeckoExchangeRateProviderTestsAsync() { var client = new CoinGeckoExchangeRateProvider(); IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync(); var usdRate = Assert.Single(rates, x => x.Ticker == "USD"); Assert.NotEqual(0.0m, usdRate.Rate); } [Fact] public async Task BitstampExchangeRateProviderTestsAsync() { var client = new BitstampExchangeRateProvider(); IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync(); var usdRate = Assert.Single(rates, x => x.Ticker == "USD"); Assert.NotEqual(0.0m, usdRate.Rate); } [Fact] public async Task GeminiExchangeRateProviderTestsAsync() { var client = new GeminiExchangeRateProvider(); IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync(); var usdRate = Assert.Single(rates, x => x.Ticker == "USD"); Assert.NotEqual(0.0m, usdRate.Rate); } [Fact] public async Task ItBitExchangeRateProviderTestsAsync() { var client = new ItBitExchangeRateProvider(); IEnumerable<ExchangeRate> rates = await client.GetExchangeRateAsync(); var usdRate = Assert.Single(rates, x => x.Ticker == "USD"); Assert.NotEqual(0.0m, usdRate.Rate); } } }
mit
C#
b1162b376054a999820a50c81c579f52516c1619
deploy settings
sd-f/orbi,sd-f/orbi
Orbi-App/Assets/Scripts/Game/Client/Client.cs
Orbi-App/Assets/Scripts/Game/Client/Client.cs
using GameController.Services; using UnityEngine; namespace GameController { [AddComponentMenu("App/Game/Client")] class Client : MonoBehaviour { // prod server, dev server or localhost public ServerType serverType = ServerType.LOCAL; public static int VERSION = 14; //private AuthService authService = new AuthService(); private int runningRequests = 0; public void IncRunningRequests() { this.runningRequests++; } public void DecRunningRequests() { if (this.runningRequests > 0) this.runningRequests--; } public bool IsRequestRunning() { return (this.runningRequests > 0); } } }
using GameController.Services; using UnityEngine; namespace GameController { [AddComponentMenu("App/Game/Client")] class Client : MonoBehaviour { // prod server, dev server or localhost public ServerType serverType = ServerType.LOCAL; public static int VERSION = 13; //private AuthService authService = new AuthService(); private int runningRequests = 0; public void IncRunningRequests() { this.runningRequests++; } public void DecRunningRequests() { if (this.runningRequests > 0) this.runningRequests--; } public bool IsRequestRunning() { return (this.runningRequests > 0); } } }
mit
C#
aaed874379b179cdacfd9a4e64adffcf035a6567
fix enum field get value
rolembergfilho/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,rolembergfilho/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity
Serenity.Data.Entity/FieldTypes/EnumField.cs
Serenity.Data.Entity/FieldTypes/EnumField.cs
using System; using System.Collections.Generic; namespace Serenity.Data { public class EnumField<TEnum> : Int32Field where TEnum: struct, IComparable, IFormattable, IConvertible { public EnumField(ICollection<Field> collection, string name, LocalText caption = null, int size = 0, FieldFlags flags = FieldFlags.Default, Func<Row, Int32?> getValue = null, Action<Row, Int32?> setValue = null) : base(collection, name, caption, size, flags, getValue, setValue) { if (!typeof(TEnum).IsEnum) throw new InvalidProgramException(typeof(TEnum).FullName + " is used as type parameter for an EnumField but it is not an enum type!"); if (Enum.GetUnderlyingType(typeof(TEnum)) != typeof(Int32)) throw new InvalidProgramException(typeof(TEnum).FullName + " is used as type parameter for an EnumField but it is not based on Int32!"); this.EnumType = typeof(TEnum); } public new TEnum? this[Row row] { get { CheckUnassignedRead(row); var value = _getValue(row); if (value == null) return null; return (TEnum)(object)value; } set { _setValue(row, (Int32?)(object)value); if (row.tracking) row.FieldAssignedValue(this); } } } }
using System; using System.Collections.Generic; namespace Serenity.Data { public class EnumField<TEnum> : Int32Field where TEnum: struct, IComparable, IFormattable, IConvertible { public EnumField(ICollection<Field> collection, string name, LocalText caption = null, int size = 0, FieldFlags flags = FieldFlags.Default, Func<Row, Int32?> getValue = null, Action<Row, Int32?> setValue = null) : base(collection, name, caption, size, flags, getValue, setValue) { if (!typeof(TEnum).IsEnum) throw new InvalidProgramException(typeof(TEnum).FullName + " is used as type parameter for an EnumField but it is not an enum type!"); if (Enum.GetUnderlyingType(typeof(TEnum)) != typeof(Int32)) throw new InvalidProgramException(typeof(TEnum).FullName + " is used as type parameter for an EnumField but it is not based on Int32!"); this.EnumType = typeof(TEnum); } public new TEnum? this[Row row] { get { CheckUnassignedRead(row); return (TEnum?)(object)_getValue(row); } set { _setValue(row, (Int32?)(object)value); if (row.tracking) row.FieldAssignedValue(this); } } } }
mit
C#
fa6fa95f21019ff323b095ebdeb33e45244158a3
fix appveyor build errors
WasimAhmad/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,rolembergfilho/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,rolembergfilho/Serenity,dfaruque/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,dfaruque/Serenity,WasimAhmad/Serenity
Serenity.Script.Imports/Q/Q.Authorization.cs
Serenity.Script.Imports/Q/Q.Authorization.cs
using System.Runtime.CompilerServices; namespace Serenity { public static partial class Q { [Imported] public static class Authorization { [IntrinsicProperty] public static UserDefinition UserDefinition { [InlineCode("Q.Authorization.userDefinition")] get { return null; } } [IntrinsicProperty] public static string Username { [InlineCode("Q.Authorization.username")] get { return null; } } [IntrinsicProperty] public static bool IsLoggedIn { [InlineCode("Q.Authorization.isLoggedIn")] get { return false; } } [InlineCode("Q.Authorization.hasPermission({permission})")] public static bool HasPermission(string permission) { return false; } [InlineCode("Q.Authorization.validatePermission({permission})")] public static void ValidatePermission(string permission) { } } } }
using System.Runtime.CompilerServices; namespace Serenity { public static partial class Q { [Imported] public static class Authorization { [IntrinsicProperty] public static UserDefinition UserDefinition { [InlineCode("Q.Authorization.userDefinition")] get; } [IntrinsicProperty] public static string Username { [InlineCode("Q.Authorization.username")] get; } [IntrinsicProperty] public static string IsLoggedIn { [InlineCode("Q.Authorization.isLoggedIn")] get; } [InlineCode("Q.Authorization.hasPermission({permission})")] public static bool HasPermission(string permission) { return false; } [InlineCode("Q.Authorization.validatePermission({permission})")] public static void ValidatePermission(string permission) { } } } }
mit
C#
15bf8d9c1581d3755bd4367938947e561207b770
Remove unused Middleware definition
sharper-library/Sharper.C.HttpValues
Sharper.C.HttpValues/Data/Http/Middleware.cs
Sharper.C.HttpValues/Data/Http/Middleware.cs
namespace Sharper.C.Data.Http { public delegate Handler<B, J> Middleware<B, A, J, I>(Handler<A, I> ab); public static class Middleware { public static Middleware<C, A, K, I> Then<C, B, A, K, J, I> ( this Middleware<C, B, K, J> m2 , Middleware<B, A, J, I> m1 ) => h => m2(m1(h)); } }
namespace Sharper.C.Data.Http { public delegate Handler<B, J> Middleware<B, A, J, I>(Handler<A, I> ab); public delegate Handler<J> Middleware<J, I>(Handler<I> h); public static class Middleware { public static Middleware<C, A, K, I> Then<C, B, A, K, J, I> ( this Middleware<C, B, K, J> m2 , Middleware<B, A, J, I> m1 ) => h => m2(m1(h)); public static Middleware<K, I> Then<K, J, I> ( this Middleware<K, J> m2 , Middleware<J, I> m1 ) => h => m2(m1(h)); } }
mit
C#
e61e2cb0e9faf60fbb11efa3f5166b545042f685
disable telemetry crashes
bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core
src/Icons/Startup.cs
src/Icons/Startup.cs
using System; using Bit.Icons.Services; using Microsoft.ApplicationInsights.Extensibility; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Bit.Icons { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) { // Options services.AddOptions(); // Settings var iconsSettings = new IconsSettings(); ConfigurationBinder.Bind(Configuration.GetSection("IconsSettings"), iconsSettings); services.AddSingleton(s => iconsSettings); // Cache services.AddMemoryCache(options => { options.SizeLimit = iconsSettings.CacheSizeLimit; }); services.AddResponseCaching(); // Services services.AddSingleton<IDomainMappingService, DomainMappingService>(); // Mvc services.AddMvc(); } public void Configure( IApplicationBuilder app, IHostingEnvironment env) { if(env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseResponseCaching(); app.UseMvc(); } } }
using System; using Bit.Icons.Services; using Microsoft.ApplicationInsights.Extensibility; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Bit.Icons { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) { // Options services.AddOptions(); // Settings var iconsSettings = new IconsSettings(); ConfigurationBinder.Bind(Configuration.GetSection("IconsSettings"), iconsSettings); services.AddSingleton(s => iconsSettings); // Cache services.AddMemoryCache(options => { options.SizeLimit = iconsSettings.CacheSizeLimit; }); services.AddResponseCaching(); // Services services.AddSingleton<IDomainMappingService, DomainMappingService>(); // Mvc services.AddMvc(); } public void Configure( IApplicationBuilder app, IHostingEnvironment env, TelemetryConfiguration telemetry) { if(env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } try { telemetry.DisableTelemetry = true; } catch { } app.UseResponseCaching(); app.UseMvc(); } } }
agpl-3.0
C#
074bf195ebc0c59b1335983904ab0176996ceef5
Add test for reading files with UTF-8 BOM
mwilliamson/java-mammoth
dotnet/Mammoth.Tests/DocumentConverterTests.cs
dotnet/Mammoth.Tests/DocumentConverterTests.cs
using Xunit; using System.IO; namespace Mammoth.Tests { public class DocumentConverterTests { [Fact] public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() { assertSuccessfulConversion( ConvertToHtml("single-paragraph.docx"), "<p>Walking on imported air</p>"); } [Fact] public void CanReadFilesWithUtf8Bom() { assertSuccessfulConversion( ConvertToHtml("utf8-bom.docx"), "<p>This XML has a byte order mark.</p>"); } private void assertSuccessfulConversion(IResult<string> result, string expectedValue) { Assert.Empty(result.Warnings); Assert.Equal(expectedValue, result.Value); } private IResult<string> ConvertToHtml(string name) { return new DocumentConverter().ConvertToHtml(TestFilePath(name)); } private string TestFilePath(string name) { return Path.Combine("../../TestData", name); } } }
using Xunit; using System.IO; namespace Mammoth.Tests { public class DocumentConverterTests { [Fact] public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() { assertSuccessfulConversion( convertToHtml("single-paragraph.docx"), "<p>Walking on imported air</p>"); } private void assertSuccessfulConversion(IResult<string> result, string expectedValue) { Assert.Empty(result.Warnings); Assert.Equal(expectedValue, result.Value); } private IResult<string> convertToHtml(string name) { return new DocumentConverter().ConvertToHtml(TestFilePath(name)); } private string TestFilePath(string name) { return Path.Combine("../../TestData", name); } } }
bsd-2-clause
C#
a12686aa17b186e5474826914a1088334a4cb14c
Fix encoding in file
pergerch/DotSpatial,pergerch/DotSpatial,DotSpatial/DotSpatial,DotSpatial/DotSpatial,pergerch/DotSpatial,DotSpatial/DotSpatial
Source/DotSpatial.Data/ShapefilePackage.cs
Source/DotSpatial.Data/ShapefilePackage.cs
// Copyright (c) DotSpatial Team. All rights reserved. // Licensed under the MIT license. See License.txt file in the project root for full license information. using System.IO; namespace DotSpatial.Data { /// <summary> /// A container for shapefile components. /// </summary> public class ShapefilePackage { /// <summary> /// Gets or sets the shapefile. /// </summary> public Stream ShpFile { get; set; } /// <summary> /// Gets or sets the shapefile index. /// </summary> public Stream ShxFile { get; set; } /// <summary> /// Gets or sets the shapefile database. /// </summary> public Stream DbfFile { get; set; } /// <summary> /// Gets or sets the shapefile projection. /// </summary> public Stream PrjFile { get; set; } } }
// Copyright (c) DotSpatial Team. All rights reserved. // Licensed under the MIT license. See License.txt file in the project root for full license information. using System.IO; namespace DotSpatial.Data { /// <summary> /// A container for shapefile components. /// </summary> public class ShapefilePackage { /// <summary> /// Gets or sets the shapefile. /// </summary> public Stream ShpFile { get; set; } /// <summary> /// Gets or sets the shapefile index. /// </summary> public Stream ShxFile { get; set; } /// <summary> /// Gets or sets the shapefile database. /// </summary> public Stream DbfFile { get; set; } /// <summary> /// Gets or sets the shapefile projection. /// </summary> public Stream PrjFile { get; set; } } }
mit
C#
ea903eda407c1fba541a3d3d828c7c791a884f87
Update IRegionFactory.cs
tiksn/TIKSN-Framework
TIKSN.Core/Globalization/IRegionFactory.cs
TIKSN.Core/Globalization/IRegionFactory.cs
using System.Globalization; namespace TIKSN.Globalization { public interface IRegionFactory { RegionInfo Create(string name); } }
using System.Globalization; namespace TIKSN.Globalization { public interface IRegionFactory { RegionInfo Create(string name); } }
mit
C#
633810f139f43b39999f99fb0669e02029df1612
Make initial task easier given the number of refactorings needed.
Tom-Kuhn/scratch-UnitTest,Tom-Kuhn/scratch-UnitTest
Testing-001/MyApplication/PersonService.cs
Testing-001/MyApplication/PersonService.cs
using System; using System.Linq; using MyApplication.dependencies; using System.Collections.Generic; namespace MyApplication { public class PersonService { /// <summary> /// Initializes a new instance of the <see cref="PersonService"/> class. /// </summary> public PersonService() { AgeGroupMap = new Dictionary<int,AgeGroup>(); AgeGroupMap[14] = AgeGroup.Child; AgeGroupMap[18] = AgeGroup.Teen; AgeGroupMap[25] = AgeGroup.YoungAdult; AgeGroupMap[75] = AgeGroup.Adult; AgeGroupMap[999] = AgeGroup.Retired; } public Dictionary<int, AgeGroup> AgeGroupMap { get; set; } /// <summary> /// Gets the age group for a particular customer. /// </summary> /// <param name="customer">The customer to calculate the AgeGroup of.</param> /// <returns>The correct age group for the customer</returns> /// <exception cref="System.ApplicationException">If the customer is invalid</exception> public AgeGroup GetAgeGroup(Person customer) { if (!customer.IsValid()) { throw new ApplicationException("customer is invalid"); } // Calculate age DateTime zeroTime = new DateTime(1, 1, 1); int age = (zeroTime + (DateTime.Today - customer.DOB)).Year; // Return the correct age group var viableBuckets = AgeGroupMap.Where(x => x.Key >= age); return AgeGroupMap[viableBuckets.Min(x => x.Key)]; } } }
using System; using System.Linq; using MyApplication.dependencies; using System.Collections.Generic; namespace MyApplication { public class PersonService { /// <summary> /// Initializes a new instance of the <see cref="PersonService"/> class. /// </summary> public PersonService() { AgeGroupMap = new Dictionary<int,AgeGroup>(); AgeGroupMap[14] = AgeGroup.Child; AgeGroupMap[18] = AgeGroup.Teen; AgeGroupMap[25] = AgeGroup.YoungAdult; AgeGroupMap[75] = AgeGroup.Adult; AgeGroupMap[999] = AgeGroup.Retired; } public Dictionary<int, AgeGroup> AgeGroupMap { get; set; } /// <summary> /// Gets the age group for a particular customer. /// </summary> /// <param name="customer">The customer to calculate the AgeGroup of.</param> /// <returns>The correct age group for the customer</returns> /// <exception cref="System.ApplicationException">If the customer is invalid</exception> public AgeGroup GetAgeGroup(Person customer) { if (!customer.IsValid()) { throw new ApplicationException("customer is invalid"); } // Calculate age DateTime zeroTime = new DateTime(1, 1, 1); int age = (zeroTime + (DateTime.Today - customer.DOB)).Year; // Return the correct age group return AgeGroupMap.OrderBy(x => x.Key).First(x => x.Key < age).Value; } } }
mit
C#
484b444ea18cacd248ca523f07aa6f3dfcc4cad9
Add todo
VegasoftTI/ChameleonForms,VegasoftTI/ChameleonForms,GiscardBiamby/NancyContrib.Chameleon,GiscardBiamby/NancyContrib.Chameleon,VegasoftTI/ChameleonForms
ChameleonForms/Templates/HtmlHelperExtensions.cs
ChameleonForms/Templates/HtmlHelperExtensions.cs
using System.Web; namespace ChameleonForms.Templates { public static class Html { public static IHtmlString Attribute(string name, string value) { if (value == null) return new HtmlString(string.Empty); //Todo: encode the values here return new HtmlString(string.Format(" {0}=\"{1}\"", name, value)); } } }
using System.Web; namespace ChameleonForms.Templates { public static class Html { public static IHtmlString Attribute(string name, string value) { if (value == null) return new HtmlString(string.Empty); return new HtmlString(string.Format(" {0}=\"{1}\"", name, value)); } } }
mit
C#
3a656a7bc575c482de6f169945629d771c3d6b3a
Add release action to journal transaction
ON-IT/Visma.Net
Visma.net/lib/DAta/JournalTransactionData.cs
Visma.net/lib/DAta/JournalTransactionData.cs
using ONIT.VismaNetApi.Models; using System.Threading.Tasks; namespace ONIT.VismaNetApi.Lib.Data { public class JournalTransactionData : BaseCrudDataClass<JournalTransaction> { public JournalTransactionData(VismaNetAuthorization auth) : base(auth) { ApiControllerUri = VismaNetControllers.JournalTransaction; } public async Task AddAttachment(JournalTransaction journalTransaction, byte[] data, string filename) { await VismaNetApiHelper.AddAttachment(Authorization, ApiControllerUri, journalTransaction.GetIdentificator(), data, filename); } public async Task AddAttachment(JournalTransaction journalTransaction, int lineNumber, byte[] data, string filename) { await VismaNetApiHelper.AddAttachment(Authorization, ApiControllerUri, $"{journalTransaction.GetIdentificator()}/{lineNumber}", data, filename); } public async Task<VismaActionResult> Release(JournalTransaction transaction) { return await VismaNetApiHelper.Action(Authorization, ApiControllerUri, transaction.GetIdentificator(), "release"); } } }
using ONIT.VismaNetApi.Models; using System.Threading.Tasks; namespace ONIT.VismaNetApi.Lib.Data { public class JournalTransactionData : BaseCrudDataClass<JournalTransaction> { public JournalTransactionData(VismaNetAuthorization auth) : base(auth) { ApiControllerUri = VismaNetControllers.JournalTransaction; } public async Task AddAttachment(JournalTransaction journalTransaction, byte[] data, string filename) { await VismaNetApiHelper.AddAttachment(Authorization, ApiControllerUri, journalTransaction.GetIdentificator(), data, filename); } public async Task AddAttachment(JournalTransaction journalTransaction, int lineNumber, byte[] data, string filename) { await VismaNetApiHelper.AddAttachment(Authorization, ApiControllerUri, $"{journalTransaction.GetIdentificator()}/{lineNumber}", data, filename); } } }
mit
C#
89dc280c468a7369417b055719a40e98569c4b84
Add test cases for wall avoidance settings
mysticfall/Alensia
Assets/Alensia/Tests/Camera/ThirdPersonCameraTest.cs
Assets/Alensia/Tests/Camera/ThirdPersonCameraTest.cs
using Alensia.Core.Actor; using Alensia.Core.Camera; using Alensia.Tests.Actor; using NUnit.Framework; using UnityEngine; namespace Alensia.Tests.Camera { [TestFixture, Description("Test suite for ThirdPersonCamera class.")] public class ThirdPersonCameraTest : BaseOrbitingCameraTest<ThirdPersonCamera, IHumanoid> { private GameObject _obstacle; [TearDown] public override void TearDown() { base.TearDown(); if (_obstacle == null) return; Object.Destroy(_obstacle); _obstacle = null; } protected override ThirdPersonCamera CreateCamera(UnityEngine.Camera camera) { var cam = new ThirdPersonCamera(camera); cam.RotationalConstraints.Up = 90; cam.RotationalConstraints.Down = 90; cam.RotationalConstraints.Side = 180; cam.WallAvoidanceSettings.AvoidWalls = false; cam.Initialize(Actor); return cam; } protected override IHumanoid CreateActor() { return new DummyHumanoid(); } [Test, Description("It should adjust camera position according to obstacles when AvoidWalls is true.")] [TestCase(0, 0, 10, 1, 4)] [TestCase(0, 0, 2, 1, 2)] [TestCase(0, 0, 10, 2, 3)] [TestCase(45, 0, 10, 1, 10)] [TestCase(0, 45, 10, 1, 10)] public void ShouldAdjustCameraPositionAccordingToObstacles( float heading, float elevation, float distance, float proximity, float actual) { var transform = Actor.Transform; _obstacle = GameObject.CreatePrimitive(PrimitiveType.Cylinder); _obstacle.transform.position = transform.position + new Vector3(0, 1, -5); Camera.WallAvoidanceSettings.AvoidWalls = true; Camera.WallAvoidanceSettings.MinimumDistance = proximity; Camera.Heading = heading; Camera.Elevation = elevation; Camera.Distance = distance; Expect( ActualDistance, Is.EqualTo(actual).Within(Tolerance), "Unexpected camera distance."); } } }
using Alensia.Core.Actor; using Alensia.Core.Camera; using Alensia.Tests.Actor; using NUnit.Framework; namespace Alensia.Tests.Camera { [TestFixture, Description("Test suite for ThirdPersonCamera class.")] public class ThirdPersonCameraTest : BaseOrbitingCameraTest<ThirdPersonCamera, IHumanoid> { protected override ThirdPersonCamera CreateCamera(UnityEngine.Camera camera) { var cam = new ThirdPersonCamera(camera); cam.RotationalConstraints.Up = 90; cam.RotationalConstraints.Down = 90; cam.RotationalConstraints.Side = 180; cam.WallAvoidanceSettings.AvoidWalls = false; cam.Initialize(Actor); return cam; } protected override IHumanoid CreateActor() { return new DummyHumanoid(); } } }
apache-2.0
C#
30aceb1e15f2c1aa050e8134012a9a989f3cc7c6
Add new macOS versions to MacSystemInformation
mono/xwt,antmicro/xwt,TheBrainTech/xwt,hwthomas/xwt,lytico/xwt
Xwt.XamMac/Xwt.Mac/MacSystemInformation.cs
Xwt.XamMac/Xwt.Mac/MacSystemInformation.cs
// // MacSystemInformation.cs // // Author: // Alan McGovern <alan@xamarin.com> // // Copyright (c) 2011, Xamarin Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Text; namespace Xwt.Mac { class MacSystemInformation { public static readonly Version Mojave = new Version(10, 14); public static readonly Version HighSierra = new Version(10, 13); public static readonly Version Sierra = new Version (10, 12); public static readonly Version ElCapitan = new Version (10, 11); public static readonly Version Yosemite = new Version (10, 10); public static readonly Version Mavericks = new Version (10, 9); public static readonly Version MountainLion = new Version (10, 8); public static readonly Version Lion = new Version (10, 7); public static readonly Version SnowLeopard = new Version (10, 6); static Version version; [System.Runtime.InteropServices.DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] static extern int Gestalt (int selector, out int result); //TODO: there are other gestalt selectors that return info we might want to display //mac API for obtaining info about the system static int Gestalt (string selector) { System.Diagnostics.Debug.Assert (selector != null && selector.Length == 4); int cc = selector[3] | (selector[2] << 8) | (selector[1] << 16) | (selector[0] << 24); int result; int ret = Gestalt (cc, out result); if (ret != 0) throw new Exception (string.Format ("Error reading gestalt for selector '{0}': {1}", selector, ret)); return result; } static MacSystemInformation () { version = new Version (Gestalt ("sys1"), Gestalt ("sys2"), Gestalt ("sys3")); } public static Version OsVersion { get { return version; } } } }
// // MacSystemInformation.cs // // Author: // Alan McGovern <alan@xamarin.com> // // Copyright (c) 2011, Xamarin Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Text; namespace Xwt.Mac { class MacSystemInformation { public static readonly Version Sierra = new Version (10, 12); public static readonly Version ElCapitan = new Version (10, 11); public static readonly Version Yosemite = new Version (10, 10); public static readonly Version Mavericks = new Version (10, 9); public static readonly Version MountainLion = new Version (10, 8); public static readonly Version Lion = new Version (10, 7); public static readonly Version SnowLeopard = new Version (10, 6); static Version version; [System.Runtime.InteropServices.DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] static extern int Gestalt (int selector, out int result); //TODO: there are other gestalt selectors that return info we might want to display //mac API for obtaining info about the system static int Gestalt (string selector) { System.Diagnostics.Debug.Assert (selector != null && selector.Length == 4); int cc = selector[3] | (selector[2] << 8) | (selector[1] << 16) | (selector[0] << 24); int result; int ret = Gestalt (cc, out result); if (ret != 0) throw new Exception (string.Format ("Error reading gestalt for selector '{0}': {1}", selector, ret)); return result; } static MacSystemInformation () { version = new Version (Gestalt ("sys1"), Gestalt ("sys2"), Gestalt ("sys3")); } public static Version OsVersion { get { return version; } } } }
mit
C#
0d55878a458cd19f9ebc622756586f0bda760d5a
fix version number padding
jonsequitur/cli,nguerrera/cli,AbhitejJohn/cli,mlorbetske/cli,blackdwarf/cli,JohnChen0/cli,stuartleeks/dotnet-cli,johnbeisner/cli,FubarDevelopment/cli,mylibero/cli,schellap/cli,JohnChen0/cli,schellap/cli,harshjain2/cli,FubarDevelopment/cli,marono/cli,nguerrera/cli,jkotas/cli,ravimeda/cli,mylibero/cli,JohnChen0/cli,dasMulli/cli,gkhanna79/cli,gkhanna79/cli,naamunds/cli,marono/cli,mylibero/cli,weshaggard/cli,schellap/cli,mylibero/cli,stuartleeks/dotnet-cli,mlorbetske/cli,svick/cli,MichaelSimons/cli,EdwardBlair/cli,naamunds/cli,MichaelSimons/cli,Faizan2304/cli,borgdylan/dotnet-cli,danquirk/cli,dasMulli/cli,danquirk/cli,jonsequitur/cli,Faizan2304/cli,AbhitejJohn/cli,krwq/cli,mylibero/cli,schellap/cli,svick/cli,borgdylan/dotnet-cli,anurse/Cli,borgdylan/dotnet-cli,krwq/cli,marono/cli,gkhanna79/cli,marono/cli,stuartleeks/dotnet-cli,MichaelSimons/cli,EdwardBlair/cli,johnbeisner/cli,danquirk/cli,stuartleeks/dotnet-cli,MichaelSimons/cli,naamunds/cli,naamunds/cli,ravimeda/cli,JohnChen0/cli,jonsequitur/cli,ravimeda/cli,gkhanna79/cli,MichaelSimons/cli,harshjain2/cli,AbhitejJohn/cli,weshaggard/cli,blackdwarf/cli,AbhitejJohn/cli,jkotas/cli,FubarDevelopment/cli,jonsequitur/cli,livarcocc/cli-1,weshaggard/cli,danquirk/cli,jkotas/cli,svick/cli,EdwardBlair/cli,mlorbetske/cli,livarcocc/cli-1,krwq/cli,blackdwarf/cli,stuartleeks/dotnet-cli,weshaggard/cli,mlorbetske/cli,naamunds/cli,blackdwarf/cli,borgdylan/dotnet-cli,weshaggard/cli,jkotas/cli,schellap/cli,livarcocc/cli-1,borgdylan/dotnet-cli,schellap/cli,krwq/cli,FubarDevelopment/cli,gkhanna79/cli,johnbeisner/cli,harshjain2/cli,dasMulli/cli,krwq/cli,nguerrera/cli,Faizan2304/cli,nguerrera/cli,danquirk/cli,marono/cli,jkotas/cli
scripts/dotnet-cli-build/Utils/BuildVersion.cs
scripts/dotnet-cli-build/Utils/BuildVersion.cs
namespace Microsoft.DotNet.Cli.Build { public class BuildVersion { public int Major { get; set; } public int Minor { get; set; } public int Patch { get; set; } public int CommitCount { get; set; } public string CommitCountString => CommitCount.ToString("000000"); public string ReleaseSuffix { get; set; } public string SimpleVersion => $"{Major}.{Minor}.{Patch}.{CommitCountString}"; public string VersionSuffix => $"{ReleaseSuffix}-{CommitCountString}"; public string NuGetVersion => $"{Major}.{Minor}.{Patch}-{VersionSuffix}"; public string GenerateMsiVersion() { // MSI versioning // Encode the CLI version to fit into the MSI versioning scheme - https://msdn.microsoft.com/en-us/library/windows/desktop/aa370859(v=vs.85).aspx // MSI versions are 3 part // major.minor.build // Size(bits) of each part 8 8 16 // So we have 32 bits to encode the CLI version // Starting with most significant bit this how the CLI version is going to be encoded as MSI Version // CLI major -> 6 bits // CLI minor -> 6 bits // CLI patch -> 6 bits // CLI commitcount -> 14 bits var major = Major << 26; var minor = Minor << 20; var patch = Patch << 14; var msiVersionNumber = major | minor | patch | CommitCount; var msiMajor = (msiVersionNumber >> 24) & 0xFF; var msiMinor = (msiVersionNumber >> 16) & 0xFF; var msiBuild = msiVersionNumber & 0xFFFF; return $"{msiMajor}.{msiMinor}.{msiBuild}"; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Microsoft.DotNet.Cli.Build { public class BuildVersion { public int Major { get; set; } public int Minor { get; set; } public int Patch { get; set; } public int CommitCount { get; set; } public string CommitCountString => CommitCount.ToString("000000"); public string ReleaseSuffix { get; set; } public string SimpleVersion => $"{Major}.{Minor}.{Patch}.{CommitCount}"; public string VersionSuffix => $"{ReleaseSuffix}-{CommitCount}"; public string NuGetVersion => $"{Major}.{Minor}.{Patch}-{VersionSuffix}"; public string GenerateMsiVersion() { // MSI versioning // Encode the CLI version to fit into the MSI versioning scheme - https://msdn.microsoft.com/en-us/library/windows/desktop/aa370859(v=vs.85).aspx // MSI versions are 3 part // major.minor.build // Size(bits) of each part 8 8 16 // So we have 32 bits to encode the CLI version // Starting with most significant bit this how the CLI version is going to be encoded as MSI Version // CLI major -> 6 bits // CLI minor -> 6 bits // CLI patch -> 6 bits // CLI commitcount -> 14 bits var major = Major << 26; var minor = Minor << 20; var patch = Patch << 14; var msiVersionNumber = major | minor | patch | CommitCount; var msiMajor = (msiVersionNumber >> 24) & 0xFF; var msiMinor = (msiVersionNumber >> 16) & 0xFF; var msiBuild = msiVersionNumber & 0xFFFF; return $"{msiMajor}.{msiMinor}.{msiBuild}"; } } }
mit
C#
88f28cce87143130229fe77c20a12fd245499933
Add missing disposal
yevhen/Orleankka,OrleansContrib/Orleankka,llytvynenko/Orleankka,AntyaDev/Orleankka,mhertis/Orleankka,pkese/Orleankka,AntyaDev/Orleankka,llytvynenko/Orleankka,yevhen/Orleankka,pkese/Orleankka,OrleansContrib/Orleankka,mhertis/Orleankka
Source/Example.Chat.Server/Program.cs
Source/Example.Chat.Server/Program.cs
using System; using System.Reflection; using Orleankka; using Orleankka.Cluster; using Orleans.Runtime.Configuration; namespace Example.Chat.TypedActor.Server { internal class Program { private static void Main(string[] args) { Console.WriteLine("Running demo. Booting cluster might take some time ...\n"); var assembly = Assembly.GetExecutingAssembly(); var config = new ClusterConfiguration().LoadFromEmbeddedResource<Program>("Server.xml"); var system = ActorSystem.Configure() .Cluster() .From(config) .Register(assembly) .Done(); Console.WriteLine("Finished booting cluster..."); Console.ReadLine(); system.Dispose(); } } }
using System; using System.Reflection; using Orleankka; using Orleankka.Cluster; using Orleans.Runtime.Configuration; namespace Example.Chat.TypedActor.Server { internal class Program { private static void Main(string[] args) { Console.WriteLine("Running demo. Booting cluster might take some time ...\n"); var assembly = Assembly.GetExecutingAssembly(); var config = new ClusterConfiguration().LoadFromEmbeddedResource<Program>("Server.xml"); var system = ActorSystem.Configure() .Cluster() .From(config) .Register(assembly) .Done(); Console.WriteLine("Finished booting cluster..."); Console.ReadLine(); } } }
apache-2.0
C#
547ae34dd0d1580a736e1fdabe36989e4efbd835
Update Index.cshtml
LoveJenny/EasyRight,LoveJenny/EasyRight
EasyRight/EasyRight/Views/Home/Index.cshtml
EasyRight/EasyRight/Views/Home/Index.cshtml
@{ ViewBag.Title = "Home Page"; } <h3>We suggest the following:</h3> <ol class="round"> <li class="one"> <h5>Getting Started</h5> Hello, I'm cute Dog <p><img src="../../Images/dog.png" /></p> <a href="http://go.microsoft.com/fwlink/?LinkId=245151">Learn more…</a> </li> <li class="two"> <h5>Add NuGet packages and jump-start your coding</h5> NuGet makes it easy to install and update free libraries and tools. <a href="http://go.microsoft.com/fwlink/?LinkId=245153">Learn more…</a> </li> <li class="three"> <h5>Find Web Hosting</h5> You can easily find a web hosting company that offers the right mix of features and price for your applications. <a href="http://go.microsoft.com/fwlink/?LinkId=245157">Learn more…</a> </li> </ol>
@{ ViewBag.Title = "Home Page"; } <h3>We suggest the following:</h3> <ol class="round"> <li class="one"> <h5>Getting Started</h5> Hello, I'm Qi Wang <p><img src="../../Images/dog.png" /></p> <a href="http://go.microsoft.com/fwlink/?LinkId=245151">Learn more…</a> </li> <li class="two"> <h5>Add NuGet packages and jump-start your coding</h5> NuGet makes it easy to install and update free libraries and tools. <a href="http://go.microsoft.com/fwlink/?LinkId=245153">Learn more…</a> </li> <li class="three"> <h5>Find Web Hosting</h5> You can easily find a web hosting company that offers the right mix of features and price for your applications. <a href="http://go.microsoft.com/fwlink/?LinkId=245157">Learn more…</a> </li> </ol>
apache-2.0
C#
2189573c444522c781be9bcf9ece363894f579c9
Update copyright year
jozefizso/FogBugz-ExtendedEvents,jozefizso/FogBugz-ExtendedEvents
FBExtendedEvents/Properties/AssemblyInfo.cs
FBExtendedEvents/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Extended Events")] [assembly: AssemblyDescription("Show events from external sources like Subversion, TeamCity and Jenkins.")] [assembly: AssemblyCompany("Jozef Izso")] [assembly: AssemblyProduct("FBExtendedEvents")] [assembly: AssemblyCopyright("Copyright © 2015-2017 Jozef Izso")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("dc011599-24b0-4a15-acc5-bc3fa9a446d8")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: AssemblyVersion("1.7.0.*")] [assembly: AssemblyFileVersion("1.7.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Extended Events")] [assembly: AssemblyDescription("Show events from external sources like Subversion, TeamCity and Jenkins.")] [assembly: AssemblyCompany("Jozef Izso")] [assembly: AssemblyProduct("FBExtendedEvents")] [assembly: AssemblyCopyright("Copyright © 2015-2016 Jozef Izso")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("dc011599-24b0-4a15-acc5-bc3fa9a446d8")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: AssemblyVersion("1.7.0.*")] [assembly: AssemblyFileVersion("1.7.0.0")]
mit
C#
0c3b5cf40a630944319ba39444a2643ed6ab7050
Fix decryption on WinRT.
kmjonmastro/Akavache,shana/Akavache,bbqchickenrobot/Akavache,gimsum/Akavache,akavache/Akavache,jcomtois/Akavache,PureWeen/Akavache,christer155/Akavache,ghuntley/AkavacheSandpit,mms-/Akavache,MathieuDSTP/MyAkavache,shana/Akavache,Loke155/Akavache,martijn00/Akavache,MarcMagnin/Akavache
Akavache/Facades_WinRT.cs
Akavache/Facades_WinRT.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Runtime.InteropServices.WindowsRuntime; using System.Reflection; using Windows.Security.Cryptography.DataProtection; using Windows.Storage; namespace Akavache { public static class Encryption { public static async Task<byte[]> EncryptBlock(byte[] block) { var dpapi = new DataProtectionProvider("LOCAL=user"); var ret = await dpapi.ProtectAsync(block.AsBuffer()); return ret.ToArray(); } public static async Task<byte[]> DecryptBlock(byte[] block) { // Do not include a protectionDescriptor // http://msdn.microsoft.com/en-us/library/windows/apps/windows.security.cryptography.dataprotection.dataprotectionprovider.unprotectasync.aspx var dpapi = new DataProtectionProvider(); var ret = await dpapi.UnprotectAsync(block.AsBuffer()); return ret.ToArray(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Runtime.InteropServices.WindowsRuntime; using System.Reflection; using Windows.Security.Cryptography.DataProtection; using Windows.Storage; namespace Akavache { public static class Encryption { public static async Task<byte[]> EncryptBlock(byte[] block) { var dpapi = new DataProtectionProvider("LOCAL=user"); var ret = await dpapi.ProtectAsync(block.AsBuffer()); return ret.ToArray(); } public static async Task<byte[]> DecryptBlock(byte[] block) { var dpapi = new DataProtectionProvider("LOCAL=user"); var ret = await dpapi.UnprotectAsync(block.AsBuffer()); return ret.ToArray(); } } }
mit
C#
5dce89e6d43449fa300e14ce7c6addd68c7fb80f
remove whitespace
NuKeeperDotNet/NuKeeper,NuKeeperDotNet/NuKeeper,skolima/NuKeeper,NuKeeperDotNet/NuKeeper,NuKeeperDotNet/NuKeeper,AnthonySteele/NuKeeper,skolima/NuKeeper,skolima/NuKeeper,skolima/NuKeeper,AnthonySteele/NuKeeper,AnthonySteele/NuKeeper,AnthonySteele/NuKeeper
NuKeeper/Configuration/RepositoryModeSettings.cs
NuKeeper/Configuration/RepositoryModeSettings.cs
using System; using NuKeeper.Github; namespace NuKeeper.Configuration { public class RepositoryModeSettings { public RepositoryModeSettings() { } public RepositoryModeSettings(GithubRepository repository, Uri githubApi, string githubToken) { GithubApiBase = githubApi; GithubToken = githubToken; GithubUri = new Uri(repository.HtmlUrl); RepositoryOwner = repository.Owner.Login; RepositoryName = repository.Name; } public Uri GithubUri { get; set; } public Uri GithubApiBase { get; set; } public string GithubToken { get; set; } public string RepositoryOwner { get; set; } public string RepositoryName { get; set; } } }
using System; using NuKeeper.Github; namespace NuKeeper.Configuration { public class RepositoryModeSettings { public RepositoryModeSettings() { } public RepositoryModeSettings(GithubRepository repository, Uri githubApi, string githubToken) { GithubApiBase = githubApi; GithubToken = githubToken; GithubUri = new Uri(repository.HtmlUrl); RepositoryOwner = repository.Owner.Login; RepositoryName = repository.Name; } public Uri GithubUri { get; set; } public Uri GithubApiBase { get; set; } public string GithubToken { get; set; } public string RepositoryOwner { get; set; } public string RepositoryName { get; set; } } }
apache-2.0
C#
ad419b3d2a68eec545b56e8fcee2259e73749585
change parameter values for reactions
M-Zuber/octokit.net,Sarmad93/octokit.net,SmithAndr/octokit.net,ivandrofly/octokit.net,TattsGroup/octokit.net,devkhan/octokit.net,shiftkey-tester/octokit.net,shana/octokit.net,ivandrofly/octokit.net,editor-tools/octokit.net,dampir/octokit.net,rlugojr/octokit.net,editor-tools/octokit.net,eriawan/octokit.net,shana/octokit.net,Sarmad93/octokit.net,khellang/octokit.net,alfhenrik/octokit.net,thedillonb/octokit.net,shiftkey/octokit.net,alfhenrik/octokit.net,octokit/octokit.net,eriawan/octokit.net,shiftkey/octokit.net,thedillonb/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,TattsGroup/octokit.net,devkhan/octokit.net,gdziadkiewicz/octokit.net,dampir/octokit.net,shiftkey-tester/octokit.net,octokit/octokit.net,gdziadkiewicz/octokit.net,SmithAndr/octokit.net,khellang/octokit.net,M-Zuber/octokit.net,adamralph/octokit.net,rlugojr/octokit.net,shiftkey-tester-org-blah-blah/octokit.net
Octokit/Models/Response/CommitCommentReaction.cs
Octokit/Models/Response/CommitCommentReaction.cs
using Octokit.Internal; using System; using System.Diagnostics; using System.Globalization; namespace Octokit { public enum Reaction { [Parameter(Value = "+1")] Plus1 = 0, [Parameter(Value = "-1")] Minus1 = 1, [Parameter(Value = "laugh")] Laugh = 2, [Parameter(Value = "confused")] Confused = 3, [Parameter(Value = "heart")] Heart = 4, [Parameter(Value = "hooray")] Hooray = 5 } [DebuggerDisplay("{DebuggerDisplay,nq}")] public class CommitCommentReaction { public CommitCommentReaction() { } public CommitCommentReaction(int id, int userId, Reaction content) { Id = id; UserId = userId; Content = content; } /// <summary> /// The Id for this reaction. /// </summary> public int Id { get; protected set; } /// <summary> /// The UserId. /// </summary> public int UserId { get; protected set; } /// <summary> /// The reaction type for this commit comment. /// </summary> [Parameter(Key = "content")] public Reaction Content { get; protected set; } internal string DebuggerDisplay { get { return string.Format(CultureInfo.InvariantCulture, "Id: {0}, Reaction: {1}", Id, Content); } } } }
using Octokit.Internal; using System; using System.Diagnostics; using System.Globalization; namespace Octokit { public enum Reaction { [Parameter(Value = "plus_one")] Plus1 = 0, [Parameter(Value = "minus_one")] Minus1 = 1, [Parameter(Value = "laugh")] Laugh = 2, [Parameter(Value = "confused")] Confused = 3, [Parameter(Value = "heart")] Heart = 4, [Parameter(Value = "hooray")] Hooray = 5 } [DebuggerDisplay("{DebuggerDisplay,nq}")] public class CommitCommentReaction { public CommitCommentReaction() { } public CommitCommentReaction(int id, int userId, Reaction content) { Id = id; UserId = userId; Content = content; } /// <summary> /// The Id for this reaction. /// </summary> public int Id { get; protected set; } /// <summary> /// The UserId. /// </summary> public int UserId { get; protected set; } /// <summary> /// The reaction type for this commit comment. /// </summary> [Parameter(Key = "content")] public Reaction Content { get; protected set; } internal string DebuggerDisplay { get { return string.Format(CultureInfo.InvariantCulture, "Id: {0}, Reaction: {1}", Id, Content); } } } }
mit
C#
6051712bcee8f3f1b4de73c6f3901a10e6494343
test fix for PostreSQL
AK107/linq2db,enginekit/linq2db,inickvel/linq2db,AK107/linq2db,MaceWindu/linq2db,MaceWindu/linq2db,linq2db/linq2db,LinqToDB4iSeries/linq2db,sdanyliv/linq2db,ronnyek/linq2db,genusP/linq2db,lvaleriu/linq2db,linq2db/linq2db,jogibear9988/linq2db,LinqToDB4iSeries/linq2db,sdanyliv/linq2db,genusP/linq2db,jogibear9988/linq2db,lvaleriu/linq2db
Tests/Linq/UserTests/Issue513Tests.cs
Tests/Linq/UserTests/Issue513Tests.cs
using LinqToDB; using LinqToDB.Data; using LinqToDB.Mapping; using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Tests.UserTests { [TestFixture] public class Issue513Tests : TestBase { System.Threading.Semaphore _semaphore = new System.Threading.Semaphore(0, 10); [Table ("Child")] [Column("ParentID", "Parent.ParentID")] public class Child513 { [Association(ThisKey = "Parent.ParentID", OtherKey = "ParentID")] public Parent513 Parent; } [Table("Parent")] public class Parent513 { [Column] public int ParentID; } [DataContextSource(false)] public void Test(string context) { var tasks = new Task[10]; for (var i = 0; i < 10; i++) tasks[i] = new Task(() => TestInternal(context)); for (var i = 0; i < 10; i++) tasks[i].Start(); System.Threading.Thread.Sleep(1000); _semaphore.Release(10); Task.WaitAll(tasks); } public void TestInternal(string context) { using (var db = GetDataContext(context)) { _semaphore.WaitOne(); var r = db.GetTable<Child513>().Select(_ => _.Parent).Distinct(); Assert.IsNotEmpty(r); } } } }
using LinqToDB; using LinqToDB.Data; using LinqToDB.Mapping; using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Tests.UserTests { [TestFixture] public class Issue513Tests : TestBase { System.Threading.Semaphore _semaphore = new System.Threading.Semaphore(0, 10); [Table ("Child")] [Column("ParentId", "Parent.ParentId")] public class Child513 { [Association(ThisKey = "Parent.ParentId", OtherKey = "ParentId")] public Parent513 Parent; } [Table("Parent")] public class Parent513 { [Column] public int ParentId; } [DataContextSource(false)] public void Test(string context) { var tasks = new Task[10]; for (var i = 0; i < 10; i++) tasks[i] = new Task(() => TestInternal(context)); for (var i = 0; i < 10; i++) tasks[i].Start(); System.Threading.Thread.Sleep(1000); _semaphore.Release(10); Task.WaitAll(tasks); } public void TestInternal(string context) { using (var db = GetDataContext(context)) { _semaphore.WaitOne(); var r = db.GetTable<Child513>().Select(_ => _.Parent).Distinct(); Assert.IsNotEmpty(r); } } } }
mit
C#
48e267a0b494de2d605a42422998e36bce56a4ce
Update exception messages.
jamiehumphries/Elmah.SqlServer.EFInitializer,jamiehumphries/Elmah.SqlServer.EFInitializer,Leon-O/Elmah.SqlServer.EFInitializer
Elmah.SqlServer.EFInitializer/ElmahContext.cs
Elmah.SqlServer.EFInitializer/ElmahContext.cs
namespace Elmah.SqlServer.EFInitializer { using System; using System.Collections; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Configuration; using System.Data.Entity; public class ElmahContext : DbContext { public ElmahContext() : this(GetConnectionStringFromConfig()) {} public ElmahContext(string nameOrConnectionString) : base(nameOrConnectionString) {} // ReSharper disable once InconsistentNaming public virtual DbSet<ELMAH_Error> ELMAH_Errors { get; set; } private static string GetConnectionStringFromConfig() { var errorLogSection = ConfigurationManager.GetSection("elmah/errorLog") as IDictionary; if (errorLogSection == null) { throw new ConfigurationErrorsException("The elmah/errorLog section is missing from the application's configuration file."); } if (!errorLogSection.Contains("connectionStringName")) { throw new ConfigurationErrorsException("The elmah/errorLog section in the application's configuration file is missing the connectionStringName attribute."); } return errorLogSection["connectionStringName"].ToString(); } } // ReSharper disable once InconsistentNaming public class ELMAH_Error { [Key] public Guid ErrorId { get; set; } [Required] [StringLength(60)] public string Application { get; set; } [Required] [StringLength(50)] public string Host { get; set; } [Required] [StringLength(100)] public string Type { get; set; } [Required] [StringLength(60)] public string Source { get; set; } [Required] [StringLength(500)] public string Message { get; set; } [Required] [StringLength(50)] public string User { get; set; } public int StatusCode { get; set; } public DateTime TimeUtc { get; set; } [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Sequence { get; set; } [Column(TypeName = "ntext")] [Required] public string AllXml { get; set; } } }
namespace Elmah.SqlServer.EFInitializer { using System; using System.Collections; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Configuration; using System.Data.Entity; public class ElmahContext : DbContext { public ElmahContext() : this(GetConnectionStringFromConfig()) {} public ElmahContext(string nameOrConnectionString) : base(nameOrConnectionString) {} // ReSharper disable once InconsistentNaming public virtual DbSet<ELMAH_Error> ELMAH_Errors { get; set; } private static string GetConnectionStringFromConfig() { var errorLogSection = ConfigurationManager.GetSection("elmah/errorLog") as IDictionary; if (errorLogSection == null) { throw new ConfigurationErrorsException("The elmah/errorLog section in web.config is missing."); } if (!errorLogSection.Contains("connectionStringName")) { throw new ConfigurationErrorsException("The elmah/errorLog section in web.config is missing the \"connectionStringName\" property."); } return errorLogSection["connectionStringName"].ToString(); } } // ReSharper disable once InconsistentNaming public class ELMAH_Error { [Key] public Guid ErrorId { get; set; } [Required] [StringLength(60)] public string Application { get; set; } [Required] [StringLength(50)] public string Host { get; set; } [Required] [StringLength(100)] public string Type { get; set; } [Required] [StringLength(60)] public string Source { get; set; } [Required] [StringLength(500)] public string Message { get; set; } [Required] [StringLength(50)] public string User { get; set; } public int StatusCode { get; set; } public DateTime TimeUtc { get; set; } [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Sequence { get; set; } [Column(TypeName = "ntext")] [Required] public string AllXml { get; set; } } }
mit
C#
65fee5b4a1be2f487584a890b749837c65e3608b
add missing 'InternalsVisibleTo' for tests
dwmkerr/sharpshell,dwmkerr/sharpshell,dwmkerr/sharpshell,dwmkerr/sharpshell
SharpShell/SharpShell/Properties/AssemblyInfo.cs
SharpShell/SharpShell/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("SharpShell")] [assembly: AssemblyDescription("Core SharpShell Library")] [assembly: AssemblyConfiguration("")] [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("a5aa1830-0ac4-4291-8089-b3183d29a0e2")] // Expose internals to the SRM and unit tests. [assembly: InternalsVisibleTo("ServerRegistrationManager, PublicKey=0024000004800000940000000602000000240000525341310004000001000100a5981b638f37c9bdd36af30b4a7c34b7e8fce33c5e424f37538f7dbd4e108c12909a2efcc4a2eb6dd4ef509cb53443a07f90504a7c8ec1a51813bd6696d21ab20d68d823ef8e840a3c4cdcf95c21122e153b389566c23c20f8e58fa4d15c810538443a303e6049d3ce9c8e589bb2277fab465f8bb2cfd2e4740688bc8f5b95e7")] [assembly: InternalsVisibleTo("SharpShell.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100fdbcb0cdaebf9bb65494552e5ca20ddae849ac94b8a14a02cee7fa7594bcaf918a8e89dabd1b1b29f5ef542253409a00ddf7055d1208a21d6b41f4b9b49ccac58beba7413f3ba74f10671ceae891f6e62bb9f504198ae30e9318bc3cfd0e4966dcc041b9b339b36ec893bf3e452add7d719958d36e7627b4b4e4835b2f07aba7")]
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("SharpShell")] [assembly: AssemblyDescription("Core SharpShell Library")] [assembly: AssemblyConfiguration("")] [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("a5aa1830-0ac4-4291-8089-b3183d29a0e2")] // Expose internals to the SRM. [assembly: InternalsVisibleTo("ServerRegistrationManager, PublicKey=0024000004800000940000000602000000240000525341310004000001000100a5981b638f37c9bdd36af30b4a7c34b7e8fce33c5e424f37538f7dbd4e108c12909a2efcc4a2eb6dd4ef509cb53443a07f90504a7c8ec1a51813bd6696d21ab20d68d823ef8e840a3c4cdcf95c21122e153b389566c23c20f8e58fa4d15c810538443a303e6049d3ce9c8e589bb2277fab465f8bb2cfd2e4740688bc8f5b95e7")]
mit
C#
e4f6c6d255b4ec4d68eb182883edc3cf00b4828a
Fix the viewbag title, used for the page title
malcolmr/nodatime,malcolmr/nodatime,malcolmr/nodatime,nodatime/nodatime,BenJenkinson/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,nodatime/nodatime,jskeet/nodatime,jskeet/nodatime
src/NodaTime.Web/Views/Documentation/Docs.cshtml
src/NodaTime.Web/Views/Documentation/Docs.cshtml
@model MarkdownPage @{ ViewBag.Title = Model.Title; } <section class="body"> <div class="row"> <div class="large-9 columns"> <h1>@Model.Title</h1> @Model.Content </div> <div class="large-3 columns"> <div class="section-container accordian"> @foreach (var category in Model.Bundle.Categories) { <section> <p class="title" data-section-title>@category.Title</p> <div class="content" data-section-content> <ul class="side-nav"> @foreach (var page in category.Pages) { <li><a href="@page.Id">@page.Title</a></li> } </ul> </div> </section> } @if (Model.Bundle.Name != "developer") { <footer>Version @Model.Bundle.Name</footer> } </div> </div> </div> </section>
@model MarkdownPage <section class="body"> <div class="row"> <div class="large-9 columns"> <h1>@Model.Title</h1> @Model.Content </div> <div class="large-3 columns"> <div class="section-container accordian"> @foreach (var category in Model.Bundle.Categories) { <section> <p class="title" data-section-title>@category.Title</p> <div class="content" data-section-content> <ul class="side-nav"> @foreach (var page in category.Pages) { <li><a href="@page.Id">@page.Title</a></li> } </ul> </div> </section> } @if (Model.Bundle.Name != "developer") { <footer>Version @Model.Bundle.Name</footer> } </div> </div> </div> </section>
apache-2.0
C#
3d90e66d36d92054ae416c7294d69fe89ef19121
Bump version number
Khamull/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,AzarinSergey/Umbraco-CMS,NikRimington/Umbraco-CMS,gavinfaux/Umbraco-CMS,DaveGreasley/Umbraco-CMS,abryukhov/Umbraco-CMS,iahdevelop/Umbraco-CMS,nvisage-gf/Umbraco-CMS,zidad/Umbraco-CMS,jchurchley/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,Spijkerboer/Umbraco-CMS,christopherbauer/Umbraco-CMS,dawoe/Umbraco-CMS,m0wo/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,AzarinSergey/Umbraco-CMS,VDBBjorn/Umbraco-CMS,yannisgu/Umbraco-CMS,aaronpowell/Umbraco-CMS,mattbrailsford/Umbraco-CMS,countrywide/Umbraco-CMS,ehornbostel/Umbraco-CMS,mstodd/Umbraco-CMS,KevinJump/Umbraco-CMS,zidad/Umbraco-CMS,gregoriusxu/Umbraco-CMS,m0wo/Umbraco-CMS,mstodd/Umbraco-CMS,rasmusfjord/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,AzarinSergey/Umbraco-CMS,Khamull/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,rasmusfjord/Umbraco-CMS,arvaris/HRI-Umbraco,leekelleher/Umbraco-CMS,Khamull/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,mstodd/Umbraco-CMS,ordepdev/Umbraco-CMS,timothyleerussell/Umbraco-CMS,Phosworks/Umbraco-CMS,aaronpowell/Umbraco-CMS,rajendra1809/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arvaris/HRI-Umbraco,rasmusfjord/Umbraco-CMS,markoliver288/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,engern/Umbraco-CMS,christopherbauer/Umbraco-CMS,rasmusfjord/Umbraco-CMS,hfloyd/Umbraco-CMS,neilgaietto/Umbraco-CMS,Door3Dev/HRI-Umbraco,Khamull/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,qizhiyu/Umbraco-CMS,KevinJump/Umbraco-CMS,kgiszewski/Umbraco-CMS,Phosworks/Umbraco-CMS,m0wo/Umbraco-CMS,countrywide/Umbraco-CMS,corsjune/Umbraco-CMS,kasperhhk/Umbraco-CMS,rajendra1809/Umbraco-CMS,KevinJump/Umbraco-CMS,rajendra1809/Umbraco-CMS,gavinfaux/Umbraco-CMS,Pyuuma/Umbraco-CMS,neilgaietto/Umbraco-CMS,m0wo/Umbraco-CMS,rasmuseeg/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,sargin48/Umbraco-CMS,nvisage-gf/Umbraco-CMS,engern/Umbraco-CMS,rasmusfjord/Umbraco-CMS,ordepdev/Umbraco-CMS,umbraco/Umbraco-CMS,gavinfaux/Umbraco-CMS,qizhiyu/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,TimoPerplex/Umbraco-CMS,yannisgu/Umbraco-CMS,KevinJump/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,ordepdev/Umbraco-CMS,ordepdev/Umbraco-CMS,markoliver288/Umbraco-CMS,qizhiyu/Umbraco-CMS,mstodd/Umbraco-CMS,robertjf/Umbraco-CMS,mittonp/Umbraco-CMS,tcmorris/Umbraco-CMS,arknu/Umbraco-CMS,mattbrailsford/Umbraco-CMS,gkonings/Umbraco-CMS,bjarnef/Umbraco-CMS,TimoPerplex/Umbraco-CMS,Door3Dev/HRI-Umbraco,aadfPT/Umbraco-CMS,AzarinSergey/Umbraco-CMS,base33/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,tompipe/Umbraco-CMS,lars-erik/Umbraco-CMS,DaveGreasley/Umbraco-CMS,countrywide/Umbraco-CMS,gkonings/Umbraco-CMS,dawoe/Umbraco-CMS,zidad/Umbraco-CMS,lars-erik/Umbraco-CMS,arvaris/HRI-Umbraco,leekelleher/Umbraco-CMS,WebCentrum/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,lingxyd/Umbraco-CMS,christopherbauer/Umbraco-CMS,rustyswayne/Umbraco-CMS,umbraco/Umbraco-CMS,Door3Dev/HRI-Umbraco,sargin48/Umbraco-CMS,abryukhov/Umbraco-CMS,nvisage-gf/Umbraco-CMS,sargin48/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,Door3Dev/HRI-Umbraco,abryukhov/Umbraco-CMS,kasperhhk/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,VDBBjorn/Umbraco-CMS,yannisgu/Umbraco-CMS,zidad/Umbraco-CMS,markoliver288/Umbraco-CMS,kasperhhk/Umbraco-CMS,christopherbauer/Umbraco-CMS,abjerner/Umbraco-CMS,bjarnef/Umbraco-CMS,timothyleerussell/Umbraco-CMS,iahdevelop/Umbraco-CMS,nvisage-gf/Umbraco-CMS,arknu/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,romanlytvyn/Umbraco-CMS,tcmorris/Umbraco-CMS,markoliver288/Umbraco-CMS,yannisgu/Umbraco-CMS,mittonp/Umbraco-CMS,bjarnef/Umbraco-CMS,timothyleerussell/Umbraco-CMS,sargin48/Umbraco-CMS,lingxyd/Umbraco-CMS,hfloyd/Umbraco-CMS,aaronpowell/Umbraco-CMS,rustyswayne/Umbraco-CMS,abjerner/Umbraco-CMS,DaveGreasley/Umbraco-CMS,lars-erik/Umbraco-CMS,gavinfaux/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,Pyuuma/Umbraco-CMS,iahdevelop/Umbraco-CMS,aadfPT/Umbraco-CMS,leekelleher/Umbraco-CMS,kgiszewski/Umbraco-CMS,romanlytvyn/Umbraco-CMS,lingxyd/Umbraco-CMS,qizhiyu/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,Tronhus/Umbraco-CMS,base33/Umbraco-CMS,romanlytvyn/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,qizhiyu/Umbraco-CMS,christopherbauer/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,markoliver288/Umbraco-CMS,TimoPerplex/Umbraco-CMS,rustyswayne/Umbraco-CMS,hfloyd/Umbraco-CMS,corsjune/Umbraco-CMS,tompipe/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,gregoriusxu/Umbraco-CMS,rasmuseeg/Umbraco-CMS,romanlytvyn/Umbraco-CMS,timothyleerussell/Umbraco-CMS,neilgaietto/Umbraco-CMS,engern/Umbraco-CMS,rustyswayne/Umbraco-CMS,Tronhus/Umbraco-CMS,rasmuseeg/Umbraco-CMS,sargin48/Umbraco-CMS,bjarnef/Umbraco-CMS,NikRimington/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,Pyuuma/Umbraco-CMS,tcmorris/Umbraco-CMS,mattbrailsford/Umbraco-CMS,madsoulswe/Umbraco-CMS,robertjf/Umbraco-CMS,Pyuuma/Umbraco-CMS,Spijkerboer/Umbraco-CMS,engern/Umbraco-CMS,DaveGreasley/Umbraco-CMS,gregoriusxu/Umbraco-CMS,gregoriusxu/Umbraco-CMS,neilgaietto/Umbraco-CMS,ehornbostel/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,ehornbostel/Umbraco-CMS,ordepdev/Umbraco-CMS,engern/Umbraco-CMS,Tronhus/Umbraco-CMS,TimoPerplex/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,gavinfaux/Umbraco-CMS,corsjune/Umbraco-CMS,dawoe/Umbraco-CMS,Door3Dev/HRI-Umbraco,Spijkerboer/Umbraco-CMS,gkonings/Umbraco-CMS,mittonp/Umbraco-CMS,Spijkerboer/Umbraco-CMS,arknu/Umbraco-CMS,Tronhus/Umbraco-CMS,Phosworks/Umbraco-CMS,WebCentrum/Umbraco-CMS,zidad/Umbraco-CMS,TimoPerplex/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,arvaris/HRI-Umbraco,nvisage-gf/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,AzarinSergey/Umbraco-CMS,lingxyd/Umbraco-CMS,Spijkerboer/Umbraco-CMS,mittonp/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,kgiszewski/Umbraco-CMS,mittonp/Umbraco-CMS,VDBBjorn/Umbraco-CMS,iahdevelop/Umbraco-CMS,Tronhus/Umbraco-CMS,gkonings/Umbraco-CMS,leekelleher/Umbraco-CMS,Pyuuma/Umbraco-CMS,lingxyd/Umbraco-CMS,rajendra1809/Umbraco-CMS,Phosworks/Umbraco-CMS,VDBBjorn/Umbraco-CMS,tcmorris/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,rustyswayne/Umbraco-CMS,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,ehornbostel/Umbraco-CMS,mstodd/Umbraco-CMS,ehornbostel/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,robertjf/Umbraco-CMS,yannisgu/Umbraco-CMS,base33/Umbraco-CMS,NikRimington/Umbraco-CMS,jchurchley/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,Khamull/Umbraco-CMS,lars-erik/Umbraco-CMS,corsjune/Umbraco-CMS,markoliver288/Umbraco-CMS,countrywide/Umbraco-CMS,hfloyd/Umbraco-CMS,gkonings/Umbraco-CMS,lars-erik/Umbraco-CMS,WebCentrum/Umbraco-CMS,madsoulswe/Umbraco-CMS,rajendra1809/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,m0wo/Umbraco-CMS,robertjf/Umbraco-CMS,madsoulswe/Umbraco-CMS,neilgaietto/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,aadfPT/Umbraco-CMS,gregoriusxu/Umbraco-CMS,corsjune/Umbraco-CMS,jchurchley/Umbraco-CMS,kasperhhk/Umbraco-CMS,iahdevelop/Umbraco-CMS,DaveGreasley/Umbraco-CMS,VDBBjorn/Umbraco-CMS,timothyleerussell/Umbraco-CMS,marcemarc/Umbraco-CMS,tompipe/Umbraco-CMS,countrywide/Umbraco-CMS,hfloyd/Umbraco-CMS,kasperhhk/Umbraco-CMS,Phosworks/Umbraco-CMS,tcmorris/Umbraco-CMS,romanlytvyn/Umbraco-CMS
src/Umbraco.Core/Configuration/UmbracoVersion.cs
src/Umbraco.Core/Configuration/UmbracoVersion.cs
using System; using System.Reflection; namespace Umbraco.Core.Configuration { public class UmbracoVersion { private static readonly Version Version = new Version("7.0.0"); /// <summary> /// Gets the current version of Umbraco. /// Version class with the specified major, minor, build (Patch), and revision numbers. /// </summary> /// <remarks> /// CURRENT UMBRACO VERSION ID. /// </remarks> public static Version Current { get { return Version; } } /// <summary> /// Gets the version comment (like beta or RC). /// </summary> /// <value>The version comment.</value> public static string CurrentComment { get { return ""; } } // Get the version of the umbraco.dll by looking at a class in that dll // Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx public static string AssemblyVersion { get { return new AssemblyName(typeof(ActionsResolver).Assembly.FullName).Version.ToString(); } } } }
using System; using System.Reflection; namespace Umbraco.Core.Configuration { public class UmbracoVersion { private static readonly Version Version = new Version("7.0.0"); /// <summary> /// Gets the current version of Umbraco. /// Version class with the specified major, minor, build (Patch), and revision numbers. /// </summary> /// <remarks> /// CURRENT UMBRACO VERSION ID. /// </remarks> public static Version Current { get { return Version; } } /// <summary> /// Gets the version comment (like beta or RC). /// </summary> /// <value>The version comment.</value> public static string CurrentComment { get { return "RC"; } } // Get the version of the umbraco.dll by looking at a class in that dll // Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx public static string AssemblyVersion { get { return new AssemblyName(typeof(ActionsResolver).Assembly.FullName).Version.ToString(); } } } }
mit
C#
1d32908dcfc29d8bcfb6c54b4926c4f7717f5a4f
Update version
paralin/D2Moddin
ClientCommon/Version.cs
ClientCommon/Version.cs
namespace ClientCommon { public class Version { public const string ClientVersion = "2.7.0"; } }
namespace ClientCommon { public class Version { public const string ClientVersion = "2.6.6"; } }
apache-2.0
C#
ebbfc2c26dc90e364946dfded77fb72d17a217fa
add AllowApplyToAll support in AlertDialogBackend
cra0zy/xwt,akrisiun/xwt,hwthomas/xwt,mono/xwt,mminns/xwt,iainx/xwt,directhex/xwt,lytico/xwt,antmicro/xwt,hamekoz/xwt,TheBrainTech/xwt,steffenWi/xwt,mminns/xwt,residuum/xwt
Xwt.Mac/Xwt.Mac/AlertDialogBackend.cs
Xwt.Mac/Xwt.Mac/AlertDialogBackend.cs
// // AlertDialogBackend.cs // // Author: // Thomas Ziegler <ziegler.thomas@web.de> // // Copyright (c) 2012 Thomas Ziegler // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using MonoMac.AppKit; using MonoMac.Foundation; using Xwt.Backends; using Xwt.Drawing; namespace Xwt.Mac { public class AlertDialogBackend : NSAlert, IAlertDialogBackend { ApplicationContext Context; public AlertDialogBackend () { } public AlertDialogBackend (System.IntPtr intptr) { } public void Initialize (ApplicationContext actx) { Context = actx; } #region IAlertDialogBackend implementation public Command Run (WindowFrame transientFor, MessageDescription message) { this.MessageText = (message.Text != null) ? message.Text : String.Empty; this.InformativeText = (message.SecondaryText != null) ? message.SecondaryText : String.Empty; if (message.Icon != null) Icon = message.Icon.ToImageDescription (Context).ToNSImage (); var sortedButtons = new Command [message.Buttons.Count]; var j = 0; if (message.DefaultButton >= 0) { sortedButtons [0] = message.Buttons [message.DefaultButton]; this.AddButton (message.Buttons [message.DefaultButton].Label); j = 1; } for (var i = 0; i < message.Buttons.Count; i++) { if (i == message.DefaultButton) continue; sortedButtons [j++] = message.Buttons [i]; this.AddButton (message.Buttons [i].Label); } if (message.AllowApplyToAll) { ShowsSuppressionButton = true; SuppressionButton.State = NSCellStateValue.Off; SuppressionButton.Activated += (sender, e) => ApplyToAll = SuppressionButton.State == NSCellStateValue.On; } var win = (WindowBackend)Toolkit.GetBackend (transientFor); if (win != null) return sortedButtons [this.RunSheetModal (win) - 1000]; return sortedButtons [this.RunModal () - 1000]; } public bool ApplyToAll { get; set; } #endregion } }
// // AlertDialogBackend.cs // // Author: // Thomas Ziegler <ziegler.thomas@web.de> // // Copyright (c) 2012 Thomas Ziegler // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using MonoMac.AppKit; using MonoMac.Foundation; using Xwt.Backends; using Xwt.Drawing; namespace Xwt.Mac { public class AlertDialogBackend : NSAlert, IAlertDialogBackend { ApplicationContext Context; public AlertDialogBackend () { } public AlertDialogBackend (System.IntPtr intptr) { } public void Initialize (ApplicationContext actx) { Context = actx; } #region IAlertDialogBackend implementation public Command Run (WindowFrame transientFor, MessageDescription message) { this.MessageText = (message.Text != null) ? message.Text : String.Empty; this.InformativeText = (message.SecondaryText != null) ? message.SecondaryText : String.Empty; if (message.Icon != null) Icon = message.Icon.ToImageDescription (Context).ToNSImage (); var sortedButtons = new Command [message.Buttons.Count]; var j = 0; if (message.DefaultButton >= 0) { sortedButtons [0] = message.Buttons [message.DefaultButton]; this.AddButton (message.Buttons [message.DefaultButton].Label); j = 1; } for (var i = 0; i < message.Buttons.Count; i++) { if (i == message.DefaultButton) continue; sortedButtons [j++] = message.Buttons [i]; this.AddButton (message.Buttons [i].Label); } var win = (WindowBackend)Toolkit.GetBackend (transientFor); if (win != null) return sortedButtons [this.RunSheetModal (win) - 1000]; return sortedButtons [this.RunModal () - 1000]; } public bool ApplyToAll { get; set; } #endregion } }
mit
C#
4e0ada188226723b76244254c6f530c1da5c6041
Remove IEquatable<T> inheritance from ITabsterDocument.
GetTabster/Tabster.Core
FileTypes/ITabsterDocument.cs
FileTypes/ITabsterDocument.cs
#region using System; using System.IO; #endregion namespace Tabster.Core.FileTypes { public interface ITabsterDocument { Version FileVersion { get; } FileInfo FileInfo { get; } void Load(string filename); void Save(); void Save(string fileName); void Update(); } }
#region using System; using System.IO; #endregion namespace Tabster.Core.FileTypes { public interface ITabsterDocument : IEquatable<ITabsterDocument> { Version FileVersion { get; } FileInfo FileInfo { get; } void Load(string filename); void Save(); void Save(string fileName); void Update(); } }
apache-2.0
C#
751d339e188dd75dc3bd240c4442d53db840daa4
Fix exception AGAIN.
Branimir123/PhotoLife,Branimir123/PhotoLife,Branimir123/PhotoLife
PhotoLife/PhotoLife.Services/UserService.cs
PhotoLife/PhotoLife.Services/UserService.cs
using System; using System.Linq; using PhotoLife.Data.Contracts; using PhotoLife.Models; using PhotoLife.Services.Contracts; namespace PhotoLife.Services { public class UserService : IUserService { private readonly IRepository<User> userRepository; private readonly IUnitOfWork unitOfWork; public UserService( IRepository<User> userRepository, IUnitOfWork unitOfWork) { if (userRepository == null) { throw new ArgumentNullException("userRepository"); } if (unitOfWork == null) { throw new ArgumentNullException("unitOfWork"); } this.userRepository = userRepository; this.unitOfWork = unitOfWork; } public User GetUserById(string id) { return this.userRepository.GetById(id); } public User GetUserByUsername(string username) { return this.userRepository .GetAll(u => u.UserName.Equals(username)) .FirstOrDefault(); } public void EditUser(string id, string username, string name, string description, string profilePicUrl) { var user = this.userRepository.GetById(id); if (user != null) { user.UserName = username; user.Name = name; user.Description = description; user.ProfilePicUrl = profilePicUrl; this.userRepository.Update(user); this.unitOfWork.Commit(); } } } }
using System; using System.Linq; using PhotoLife.Data.Contracts; using PhotoLife.Models; using PhotoLife.Services.Contracts; namespace PhotoLife.Services { public class UserService : IUserService { private readonly IRepository<User> userRepository; private readonly IUnitOfWork unitOfWork; public UserService( IRepository<User> userRepository, IUnitOfWork unitOfWork) { if (userRepository == null) { throw new ArgumentNullException(nameof(userRepository)); } if (unitOfWork == null) { throw new ArgumentNullException(nameof(unitOfWork)); } this.userRepository = userRepository; this.unitOfWork = unitOfWork; } public User GetUserById(string id) { return this.userRepository.GetById(id); } public User GetUserByUsername(string username) { return this.userRepository .GetAll(u => u.UserName.Equals(username)) .FirstOrDefault(); } public void EditUser(string id, string username, string name, string description, string profilePicUrl) { var user = this.userRepository.GetById(id); if (user != null) { user.UserName = username; user.Name = name; user.Description = description; user.ProfilePicUrl = profilePicUrl; this.userRepository.Update(user); this.unitOfWork.Commit(); } } } }
mit
C#
718c7238efbf9cf4da913799289570a530af3cf9
update copyright
andrewconnell/aci-orchardcms,andrewconnell/aci-orchardcms,andrewconnell/aci-orchardcms,andrewconnell/aci-orchardcms
Themes/AndrewConnell-v1.0/Views/Copyright.cshtml
Themes/AndrewConnell-v1.0/Views/Copyright.cshtml
Copyright &copy; @(DateTime.Now.Year) Andrew Connell
Copyright &copy; 2003 - @(DateTime.Now.Year) Andrew Connell
bsd-3-clause
C#
ae380d6e5e0d487009fde7bfea85f0835412c202
Save work items after starting.
n-develop/tickettimer
TicketTimer.Core/Services/WorkItemServiceImpl.cs
TicketTimer.Core/Services/WorkItemServiceImpl.cs
using TicketTimer.Core.Infrastructure; namespace TicketTimer.Core.Services { // TODO this should have a better name public class WorkItemServiceImpl : WorkItemService { private readonly WorkItemStore _workItemStore; private readonly DateProvider _dateProvider; public WorkItemServiceImpl(WorkItemStore workItemStore, DateProvider dateProvider) { _workItemStore = workItemStore; _dateProvider = dateProvider; } public void StartWorkItem(string ticketNumber) { StartWorkItem(ticketNumber, string.Empty); } public void StartWorkItem(string ticketNumber, string comment) { var workItem = new WorkItem(ticketNumber) { Comment = comment, Started = _dateProvider.Now }; _workItemStore.Add(workItem); _workItemStore.Save(); } public void StopWorkItem() { throw new System.NotImplementedException(); } } }
using TicketTimer.Core.Infrastructure; namespace TicketTimer.Core.Services { // TODO this should have a better name public class WorkItemServiceImpl : WorkItemService { private readonly WorkItemStore _workItemStore; private readonly DateProvider _dateProvider; public WorkItemServiceImpl(WorkItemStore workItemStore, DateProvider dateProvider) { _workItemStore = workItemStore; _dateProvider = dateProvider; } public void StartWorkItem(string ticketNumber) { StartWorkItem(ticketNumber, string.Empty); } public void StartWorkItem(string ticketNumber, string comment) { var workItem = new WorkItem(ticketNumber) { Comment = comment, Started = _dateProvider.Now }; _workItemStore.Add(workItem); } public void StopWorkItem() { throw new System.NotImplementedException(); } } }
mit
C#
d8535b8736e5ef265ff7c97599f6180d3f59ea81
Add Stephanie to contact page.
jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox
ZirMed.TrainingSandbox/Views/Home/Contact.cshtml
ZirMed.TrainingSandbox/Views/Home/Contact.cshtml
@{ ViewBag.Title = "Contact"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <address> One Microsoft Way<br /> Redmond, WA 98052-6399<br /> <abbr title="Phone">P:</abbr> 425.555.0100 </address> <address> <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br /> <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a> <strong>Pat:</strong> <a href="mailto:patrick.fulton@zirmed.com">patrick.fulton@zirmed.com</a> <strong>Dustin:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> <strong>Nicolas:</strong> <a href="mailto:nick.wolf@zirmed.com">nick.wolf@zirmed.com</a> <strong>Dustin2:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> <strong>Travis:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a> <strong>Travis2:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a> <strong>Stephanie:</strong> <a href="mailto:stephanie.craig@zirmed.com">stephanie.craig@zirmed.com</a> </address>
@{ ViewBag.Title = "Contact"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <address> One Microsoft Way<br /> Redmond, WA 98052-6399<br /> <abbr title="Phone">P:</abbr> 425.555.0100 </address> <address> <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br /> <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a> <strong>Pat:</strong> <a href="mailto:patrick.fulton@zirmed.com">patrick.fulton@zirmed.com</a> <strong>Dustin:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> <strong>Nicolas:</strong> <a href="mailto:nick.wolf@zirmed.com">nick.wolf@zirmed.com</a> <strong>Dustin2:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> <strong>Travis:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a> <strong>Travis2:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a> </address>
mit
C#
ba3935047e74124a67729ca8bb6bb036afca82c8
Increment version.
Reddit-Mud/RMUD,Blecki/RMUD
RMUD/Commands/Version.cs
RMUD/Commands/Version.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace RMUD.Commands { internal class Version : CommandFactory { public override void Create(CommandParser Parser) { Parser.AddCommand( new Or( new KeyWord("VERSION", false), new KeyWord("VER", false)), new VersionProcessor(), "See what version the server is running."); } } internal class VersionProcessor : CommandProcessor { public void Perform(PossibleMatch Match, Actor Actor) { if (Actor.ConnectedClient == null) return; Mud.SendMessage(Actor, "RMUD Veritas III\r\n"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace RMUD.Commands { internal class Version : CommandFactory { public override void Create(CommandParser Parser) { Parser.AddCommand( new Or( new KeyWord("VERSION", false), new KeyWord("VER", false)), new VersionProcessor(), "See what version the server is running."); } } internal class VersionProcessor : CommandProcessor { public void Perform(PossibleMatch Match, Actor Actor) { if (Actor.ConnectedClient == null) return; Mud.SendMessage(Actor, "RMUD Veritas II\r\n"); } } }
mit
C#
4af9397061691a59081fc2f12a2a9cd8a5ed3c02
Replace Array.Copy with Assigning
CosmosOS/Cosmos,jp2masa/Cosmos,zarlo/Cosmos,zarlo/Cosmos,fanoI/Cosmos,fanoI/Cosmos,tgiphil/Cosmos,zarlo/Cosmos,jp2masa/Cosmos,fanoI/Cosmos,tgiphil/Cosmos,CosmosOS/Cosmos,jp2masa/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,tgiphil/Cosmos,CosmosOS/Cosmos
Tests/Cosmos.Compiler.Tests.Bcl/System/ArrayTests.cs
Tests/Cosmos.Compiler.Tests.Bcl/System/ArrayTests.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Cosmos.TestRunner; namespace Cosmos.Compiler.Tests.Bcl.System { class ArrayTests { public static void Execute() { byte[] xByteResult = { 1, 2, 3, 4, 5, 6, 7, 8 }; byte[] xByteExpectedResult = { 1, 2, 3, 4, 5, 6, 7, 1 }; byte[] xByteSource = { 1 }; Array.Copy(xByteSource, 0, xByteResult, 7, 1); Assert.IsTrue((xByteResult[7] == xByteExpectedResult[7]), "Array.Copy doesn't work: xResult[7] = " + (uint)xByteResult[7] + " != " + (uint)xByteExpectedResult[7]); // Single[] Test float[] xSingleResult = { 1.25, 2.50, 3.51, 4.31, 9.28, 18.56 }; float[] xSingleExpectedResult = { 1.25, 2.598, 5.39, 4.31, 9.28, 18.56 }; float[] xSingleSource = { 0.49382, 1.59034, 2.598, 5.39, 7.48392, 4.2839 }; xSingleResult[1] = xSingleSource[2]; xSingleResult[2] = xSingleSource[3]; Assert.IsTrue(((xSingleResult[1] + xSingleResult[2]) == (xSingleExpectedResult[1] + xSingleExpectedResult[2])), "Assinging values to single array elements doesn't work: xResult[1] = " + (uint)xSingleResult[1] + " != " + (uint)xSingleExpectedResult[1] " and xResult[2] = " + (uint)xResult[2] + " != " + (uint)xExpectedResult[2]); // Double[] Test double[] xDoubleResult = { 0.384, 1.5823, 2.5894, 2.9328539, 3.9201, 4.295 }; double[] xDoubleExpectedResult = { 0.384, 1.5823, 2.5894, 95.32815, 3.9201, 4.295 }; double[] xDoubleSource = { 95.32815 }; xDoubleResult[3] = xDoubleSource[0]; Assert.IsTrue(xDoubleResult[3] == xDoubleExpectedResult[3], "Assinging values to double array elements doesn't work: xResult[1] = " + (uint)xDoubleResult[3] + " != " + (uint)xDoubleExpectedResult[3]); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Cosmos.TestRunner; namespace Cosmos.Compiler.Tests.Bcl.System { class ArrayTests { public static void Execute() { if (true) { byte[] xResult = { 1, 2, 3, 4, 5, 6, 7, 8 }; byte[] xExpectedResult = { 1, 2, 3, 4, 5, 6, 7, 1 }; byte[] xSource = { 1 }; Array.Copy(xSource, 0, xResult, 7, 1); Assert.IsTrue((xResult[7] == xExpectedResult[7]), "Array.Copy doesn't work: xResult[7] = " + (uint)xResult[7] + " != " + (uint)xExpectedResult[7]); } // Single[] Test float[] xResult = { 1.25, 2.50, 3.51, 4.31, 9.28, 18.56 }; float[] xExpectedResult = { 1.25, 2.598, 5.39, 4.31, 9.28, 18.56 }; float[] xSource = { 0.49382, 1.59034, 2.598, 5.39, 7.48392, 4.2839 }; Array.Copy(xSource, 2, xResult, 1, 2); Assert.IsTrue((xResult[1] + xResult[2]) == (xExpectedResult[1] + xExpectedResult[2]), "Array.Copy doesn't work with Singles: xResult[1] = " + (uint)xResult[1] + " != " + (uint)xExpectedResult[1] " and xResult[2] = " + (uint)xResult[2] + " != " + (uint)xExpectedResult[2]); // Double[] Test double[] xResult = { 0.384, 1.5823, 2.5894, 2.9328539, 3.9201, 4.295 }; double[] xExpectedResult = { 0.384, 1.5823, 2.5894, 95.32815, 3.9201, 4.295 }; double[] xSource = { 95.32815 }; Array.Copy(xSource, 0, xResult, 3, 1); Assert.IsTrue(xResult[3] == xExpectedResult[3], "Array.Copy doesn't work with Doubles: xResult[1] = " + (uint)xResult[3] + " != " + (uint)xExpectedResult[3]); } } }
bsd-3-clause
C#
6fc84985c334ab302ee4cab02e07cffcad024338
Clean up
alvivar/Hasten
Experimental/Timeline/Plugins/TimelineFlow.cs
Experimental/Timeline/Plugins/TimelineFlow.cs
 // Timeline animation flow using TeaTime. // @matnesis // 2016/05/14 12:15 AM using UnityEngine; using matnesis.TeaTime; [RequireComponent(typeof(Timeline))] public class TimelineFlow : MonoBehaviour { public int index = 0; private Timeline timeline; void Start() { timeline = GetComponent<Timeline>(); } // void Update() // { // // Debug // if (Input.GetKeyDown(KeyCode.M)) // GoTo(index + 1, 2); // if (Input.GetKeyDown(KeyCode.N)) // GoTo(index - 1, 2); // } /// <summary> /// Reseteable smooth transition to the selected Timeline index. /// </summary> public void GoTo(int index, float seconds) { index = index > timeline.positions.Count ? 0 : index; index = index < 0 ? timeline.positions.Count - 1 : index; this.index = index; this.tt("@goto").Reset().Add((ttHandler t) => { t.Wait(this.ttMove(transform, timeline.positions[index], seconds)); t.Wait(this.ttRotate(transform, timeline.rotations[index], seconds)); t.Wait(this.ttScale(transform, timeline.scales[index], seconds)); }); } }
 // Timeline animation flow using TeaTime. // @matnesis ~ // 2016/05/14 12:15 AM using UnityEngine; using matnesis.TeaTime; [RequireComponent(typeof(Timeline))] public class TimelineFlow : MonoBehaviour { public int index = 0; private Timeline timeline; void Start() { timeline = GetComponent<Timeline>(); } // void Update() // { // // Debug // if (Input.GetKeyDown(KeyCode.M)) // GoTo(index + 1, 2); // if (Input.GetKeyDown(KeyCode.N)) // GoTo(index - 1, 2); // } /// <summary> /// Reseteable smooth transition to the selected Timeline index. /// </summary> public void GoTo(int index, float seconds) { index = index > timeline.positions.Count ? 0 : index; index = index < 0 ? timeline.positions.Count - 1 : index; this.index = index; this.tt("@goto").Reset().Add((ttHandler t) => { t.Wait(this.ttMove(transform, timeline.positions[index], seconds)); t.Wait(this.ttRotate(transform, timeline.rotations[index], seconds)); t.Wait(this.ttScale(transform, timeline.scales[index], seconds)); }); } }
mit
C#
61d3774fbe9c70c57b15fdc0d6c28a558b575cd0
Fix Win64 namespace
pruiz/FreeSwitchSharp
FreeSwitchSharp.Win64/Win64LibrariesBundle.cs
FreeSwitchSharp.Win64/Win64LibrariesBundle.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace FreeSwitchSharp.Win64 { using FreeSwitchSharp.Native; public class Win64LibrariesBundle : INativeLibraryBundle { private static readonly Assembly Assembly = Assembly.GetExecutingAssembly(); private static readonly string ResourcesPath = typeof(Win64LibrariesBundle).Namespace + ".Libs."; private static readonly List<INativeLibraryResource> _resources = new List<INativeLibraryResource>(); static Win64LibrariesBundle() { foreach (var res in Assembly.GetManifestResourceNames()) { if (res.StartsWith(ResourcesPath)) { var fileName = res.Substring(ResourcesPath.Length); _resources.Add(new EmbeddedNativeLibraryResource(Assembly, res, fileName)); } } } #region INativeLibraryBundle Members public bool SupportsCurrentPlatform { get { return Environment.OSVersion.Platform == PlatformID.Win32NT && NativeLibrariesManager.RunningIn64Bits; } } public IEnumerable<INativeLibraryResource> Resources { get { return _resources; } } #endregion } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace FreeSwitchSharp.Win32 { using FreeSwitchSharp.Native; public class Win64LibrariesBundle : INativeLibraryBundle { private static readonly Assembly Assembly = Assembly.GetExecutingAssembly(); private static readonly string ResourcesPath = typeof(Win64LibrariesBundle).Namespace + ".Libs."; private static readonly List<INativeLibraryResource> _resources = new List<INativeLibraryResource>(); static Win64LibrariesBundle() { foreach (var res in Assembly.GetManifestResourceNames()) { if (res.StartsWith(ResourcesPath)) { var fileName = res.Substring(ResourcesPath.Length); _resources.Add(new EmbeddedNativeLibraryResource(Assembly, res, fileName)); } } } #region INativeLibraryBundle Members public bool SupportsCurrentPlatform { get { return Environment.OSVersion.Platform == PlatformID.Win32NT && NativeLibrariesManager.RunningIn64Bits; } } public IEnumerable<INativeLibraryResource> Resources { get { return _resources; } } #endregion } }
mpl-2.0
C#
e432efb4b5ae608302f579f5fb42cbdad59aafb5
update to palaso usage api.
sillsdev/solid,sillsdev/solid,sillsdev/solid
src/SolidGui/Program.cs
src/SolidGui/Program.cs
using System; using System.Collections.Generic; using System.Windows.Forms; using Palaso.Reporting; using SolidGui.Properties; namespace SolidGui { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(params string[]args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //bring in settings from any previous version if (Settings.Default.NeedUpgrade) { //see http://stackoverflow.com/questions/3498561/net-applicationsettingsbase-should-i-call-upgrade-every-time-i-load Settings.Default.Upgrade(); Settings.Default.NeedUpgrade = false; Settings.Default.Save(); } SetupErrorHandling(); SetupUsageTracking(); MainWindowPM model = new MainWindowPM(); MainWindowView form = new MainWindowView(model); if(args.Length > 0 && args[0].EndsWith(".solid")) { model.OpenDictionary(args[0]); form.OnFileLoaded(args[0]); } Application.Run(form); Settings.Default.Save(); } private static void SetupErrorHandling() { ExceptionHandler.Init(); Logger.Init(); ErrorReport.Init("solid@projects.palaso.org"); } private static void SetupUsageTracking() { if (Settings.Default.Reporting == null) { Settings.Default.Reporting = new ReportingSettings(); Settings.Default.Save(); } UsageReporter.Init(Settings.Default.Reporting, "solid.palaso.org", "UA-22170471-4", #if DEBUG true #else false #endif ); } } }
using System; using System.Collections.Generic; using System.Windows.Forms; using Palaso.Reporting; using SolidGui.Properties; namespace SolidGui { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(params string[]args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //bring in settings from any previous version if (Settings.Default.NeedUpgrade) { //see http://stackoverflow.com/questions/3498561/net-applicationsettingsbase-should-i-call-upgrade-every-time-i-load Settings.Default.Upgrade(); Settings.Default.NeedUpgrade = false; Settings.Default.Save(); } SetupErrorHandling(); SetupUsageTracking(); MainWindowPM model = new MainWindowPM(); MainWindowView form = new MainWindowView(model); if(args.Length > 0 && args[0].EndsWith(".solid")) { model.OpenDictionary(args[0]); form.OnFileLoaded(args[0]); } Application.Run(form); Settings.Default.Save(); } private static void SetupErrorHandling() { ExceptionHandler.Init(); Logger.Init(); ErrorReport.Init("solid@projects.palaso.org"); } private static void SetupUsageTracking() { if (Settings.Default.Reporting == null) { Settings.Default.Reporting = new ReportingSettings(); Settings.Default.Save(); } UsageReporter.Init(Settings.Default.Reporting, "solid.palaso.org", "UA-22170471-4"); } } }
mit
C#
d6413f93dcf29a0fbe7375e0e2cea97673417861
clean up old code
stwalkerster/eyeinthesky,stwalkerster/eyeinthesky,stwalkerster/eyeinthesky
EyeInTheSky/StalkList.cs
EyeInTheSky/StalkList.cs
using System.Collections.Generic; using System.Xml; using System.Xml.XPath; namespace EyeInTheSky { public class StalkList : SortedList<string,Stalk> { public Stalk search(RecentChange rc) { foreach (KeyValuePair<string,Stalk> s in this) { if(s.Value.match(rc)) { return s.Value; } } return null; } internal static StalkList fetch(XPathNavigator nav, XmlNamespaceManager nsManager) { StalkList list = new StalkList(); return list; } } }
using System.Collections.Generic; using System.Xml; using System.Xml.XPath; namespace EyeInTheSky { public class StalkList : SortedList<string,Stalk> { public Stalk search(RecentChange rc) { foreach (KeyValuePair<string,Stalk> s in this) { if(s.Value.match(rc)) { return s.Value; } } return null; } internal static StalkList fetch(XPathNavigator nav, XmlNamespaceManager nsManager) { StalkList list = new StalkList(); while(xpni.MoveNext()) { SimpleStalk s = new SimpleStalk(xpni.Current.GetAttribute("flag", "")); XPathDocument xpd = new XPathDocument(xpni.Current.ReadSubtree()); var xpn = xpd.CreateNavigator(); XmlNameTable xnt = xpn.NameTable; XmlNamespaceManager xnm = new XmlNamespaceManager(xnt); xnm.AddNamespace("e", "https://github.com/stwalkerster/eyeinthesky/raw/master/EyeInTheSky/DataFileSchema.xsd"); var it = xpn.Select("//e:user", xnm); if(it.Count == 1) { it.MoveNext(); s.setUserSearch(it.Current.GetAttribute("value", "")); } it = xpn.Select("//e:page", xnm); if(it.Count == 1) { it.MoveNext(); s.setPageSearch(it.Current.GetAttribute("value","")); } it = xpn.Select("//e:summary", xnm); if(it.Count == 1) { it.MoveNext(); s.setSummarySearch(it.Current.GetAttribute("value","")); } list.Add(s.Flag,s); } return list; } } }
mit
C#
9fee9f7eda12e9e6713dadf787a15df2e57e03b3
test commit
lumenitb/HumanDetection,lumenrobot/HumanDetection
HumanDetection/Program.cs
HumanDetection/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace HumanDetection { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new HumanDet()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace HumanDetection { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new HumanDet()); } } }
epl-1.0
C#
7fe18c7ff134cc948bb086f18c33eec22b56c42b
Update IShapeRendererState.cs
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D
src/Core2D/Model/Renderer/IShapeRendererState.cs
src/Core2D/Model/Renderer/IShapeRendererState.cs
using Core2D.Shapes; using Core2D.Style; namespace Core2D.Renderer { /// <summary> /// Defines shape renderer state contract. /// </summary> public interface IShapeRendererState : IObservableObject, ISelection { /// <summary> /// The X coordinate of current pan position. /// </summary> double PanX { get; set; } /// <summary> /// The Y coordinate of current pan position. /// </summary> double PanY { get; set; } /// <summary> /// The X component of current zoom value. /// </summary> double ZoomX { get; set; } /// <summary> /// The Y component of current zoom value. /// </summary> double ZoomY { get; set; } /// <summary> /// Flag indicating shape state to enable its drawing. /// </summary> IShapeState DrawShapeState { get; set; } /// <summary> /// Image cache repository. /// </summary> IImageCache ImageCache { get; set; } /// <summary> /// Gets or sets style used to draw points. /// </summary> IShapeStyle PointStyle { get; set; } /// <summary> /// Gets or sets selection rectangle style. /// </summary> IShapeStyle SelectionStyle { get; set; } /// <summary> /// Gets or sets editor helper shapes style. /// </summary> IShapeStyle HelperStyle { get; set; } } }
using Core2D.Shapes; using Core2D.Style; namespace Core2D.Renderer { /// <summary> /// Defines shape renderer state contract. /// </summary> public interface IShapeRendererState : IObservableObject, ISelection { /// <summary> /// The X coordinate of current pan position. /// </summary> double PanX { get; set; } /// <summary> /// The Y coordinate of current pan position. /// </summary> double PanY { get; set; } /// <summary> /// The X component of current zoom value. /// </summary> double ZoomX { get; set; } /// <summary> /// The Y component of current zoom value. /// </summary> double ZoomY { get; set; } /// <summary> /// Flag indicating shape state to enable its drawing. /// </summary> IShapeState DrawShapeState { get; set; } /// <summary> /// Image cache repository. /// </summary> IImageCache ImageCache { get; set; } /// <summary> /// Gets or sets shape used to draw points. /// </summary> IBaseShape PointShape { get; set; } /// <summary> /// Gets or sets selection rectangle style. /// </summary> IShapeStyle SelectionStyle { get; set; } /// <summary> /// Gets or sets editor helper shapes style. /// </summary> IShapeStyle HelperStyle { get; set; } } }
mit
C#
f290ebe2709268501acb4c69211f82525d29b8d3
Remove change
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Fluent/Controls/Dialog.xaml.cs
WalletWasabi.Fluent/Controls/Dialog.xaml.cs
using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; namespace WalletWasabi.Fluent.Controls { /// <summary> /// A simple overlay Dialog control. /// </summary> public class Dialog : ContentControl { public static readonly StyledProperty<bool> IsDialogOpenProperty = AvaloniaProperty.Register<Dialog, bool>(nameof(IsDialogOpen)); public static readonly StyledProperty<double> MaxContentHeightProperty = AvaloniaProperty.Register<Dialog, double>(nameof(MaxContentHeight), double.PositiveInfinity); public static readonly StyledProperty<double> MaxContentWidthProperty = AvaloniaProperty.Register<Dialog, double>(nameof(MaxContentWidth), double.PositiveInfinity); public bool IsDialogOpen { get => GetValue(IsDialogOpenProperty); set => SetValue(IsDialogOpenProperty, value); } public double MaxContentHeight { get { return GetValue(MaxContentHeightProperty); } set { SetValue(MaxContentHeightProperty, value); } } public double MaxContentWidth { get { return GetValue(MaxContentWidthProperty); } set { SetValue(MaxContentWidthProperty, value); } } protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change) { base.OnPropertyChanged(change); if (change.Property == IsDialogOpenProperty) { PseudoClasses.Set(":open", change.NewValue.GetValueOrDefault<bool>()); } } protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); var overlayButton = e.NameScope.Find<Panel>("PART_Overlay"); overlayButton.PointerPressed += (_, __) => IsDialogOpen = false; } } }
using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using ReactiveUI; namespace WalletWasabi.Fluent.Controls { /// <summary> /// A simple overlay Dialog control. /// </summary> public class Dialog : ContentControl { public static readonly StyledProperty<bool> IsDialogOpenProperty = AvaloniaProperty.Register<Dialog, bool>(nameof(IsDialogOpen)); public static readonly StyledProperty<double> MaxContentHeightProperty = AvaloniaProperty.Register<Dialog, double>(nameof(MaxContentHeight), double.PositiveInfinity); public static readonly StyledProperty<double> MaxContentWidthProperty = AvaloniaProperty.Register<Dialog, double>(nameof(MaxContentWidth), double.PositiveInfinity); public bool IsDialogOpen { get => GetValue(IsDialogOpenProperty); set => SetValue(IsDialogOpenProperty, value); } public double MaxContentHeight { get { return GetValue(MaxContentHeightProperty); } set { SetValue(MaxContentHeightProperty, value); } } public double MaxContentWidth { get { return GetValue(MaxContentWidthProperty); } set { SetValue(MaxContentWidthProperty, value); } } protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change) { base.OnPropertyChanged(change); if (change.Property == IsDialogOpenProperty) { PseudoClasses.Set(":open", change.NewValue.GetValueOrDefault<bool>()); } } protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); var overlayButton = e.NameScope.Find<Panel>("PART_Overlay"); overlayButton.PointerPressed += (_, __) => IsDialogOpen = false; } } }
mit
C#
4ef24b0dc2a95c9de30ee16dcbe426abac2cd981
Handle forcefull connection close.
vtsingaras/SharpOCSP
SharpOCSP/HttpHandler.cs
SharpOCSP/HttpHandler.cs
using System; using System.Net; using System.Threading; using System.Text; using System.IO; namespace SharpOCSP { public class HttpHandler { private readonly HttpListener _listener = new HttpListener(); private readonly Func<HttpListenerRequest, byte[]> _responderMethod; public HttpHandler(string[] prefixes, Func<HttpListenerRequest, byte[]> method) { // URI prefixes are required, for example // "http://localhost:8080/index/". if (prefixes == null || prefixes.Length == 0) throw new ArgumentException("prefixes"); // A responder method is required if (method == null) throw new ArgumentException("method"); foreach (string s in prefixes) _listener.Prefixes.Add(s); _responderMethod = method; _listener.Start(); } public HttpHandler(Func<HttpListenerRequest, byte[]> method, params string[] prefixes) : this(prefixes, method) { } public void Run() { ThreadPool.QueueUserWorkItem((o) => { Console.WriteLine("HTTP handler running..."); try { while (_listener.IsListening) { ThreadPool.QueueUserWorkItem((c) => { var ctx = c as HttpListenerContext; byte[] buf = _responderMethod(ctx.Request); ctx.Response.AppendHeader("Content-Type", "application/ocsp-response"); ctx.Response.ContentLength64 = buf.Length; ctx.Response.OutputStream.Write(buf, 0, buf.Length); ctx.Response.OutputStream.Close(); }, _listener.GetContext()); } } //TODO: implement proper exception handling catch (HttpListenerException e ){ Console.WriteLine("Error handling http." + e.Message); } catch (System.ObjectDisposedException e){ SharpOCSP.log.Warn("Remote endpoint closed the connection.", e); } }); } public void Stop() { _listener.Stop(); _listener.Close(); } } }
using System; using System.Net; using System.Threading; using System.Text; using System.IO; namespace SharpOCSP { public class HttpHandler { private readonly HttpListener _listener = new HttpListener(); private readonly Func<HttpListenerRequest, byte[]> _responderMethod; public HttpHandler(string[] prefixes, Func<HttpListenerRequest, byte[]> method) { // URI prefixes are required, for example // "http://localhost:8080/index/". if (prefixes == null || prefixes.Length == 0) throw new ArgumentException("prefixes"); // A responder method is required if (method == null) throw new ArgumentException("method"); foreach (string s in prefixes) _listener.Prefixes.Add(s); _responderMethod = method; _listener.Start(); } public HttpHandler(Func<HttpListenerRequest, byte[]> method, params string[] prefixes) : this(prefixes, method) { } public void Run() { ThreadPool.QueueUserWorkItem((o) => { Console.WriteLine("HTTP handler running..."); try { while (_listener.IsListening) { ThreadPool.QueueUserWorkItem((c) => { var ctx = c as HttpListenerContext; byte[] buf = _responderMethod(ctx.Request); ctx.Response.AppendHeader("Content-Type", "application/ocsp-response"); ctx.Response.ContentLength64 = buf.Length; ctx.Response.OutputStream.Write(buf, 0, buf.Length); ctx.Response.OutputStream.Close(); }, _listener.GetContext()); } } //TODO: implement proper exception handling catch (HttpListenerException e ){ Console.WriteLine("Error handling http." + e.Message); } }); } public void Stop() { _listener.Stop(); _listener.Close(); } } }
mit
C#
8a621a8889b8109d9befe4bf486e5030d6b1dacc
Update Ledger.cs
MetacoSA/NBitpayClient
NBitpayClient/Ledger.cs
NBitpayClient/Ledger.cs
using Newtonsoft.Json; using System; using System.Collections.Generic; namespace NBitpayClient { public class Ledger { public const String LEDGER_AUD = "AUD"; public const String LEDGER_BTC = "BTC"; public const String LEDGER_CAD = "CAD"; public const String LEDGER_EUR = "EUR"; public const String LEDGER_GBP = "GBP"; public const String LEDGER_MXN = "MXN"; public const String LEDGER_NDZ = "NDZ"; public const String LEDGER_USD = "USD"; public const String LEDGER_ZAR = "ZAR"; public List<LedgerEntry> Entries = null; [JsonProperty(PropertyName = "currency")] public string Currency { get; set; } [JsonProperty(PropertyName = "balance")] public decimal Balance { get; set; } public Ledger(string currency, decimal balance = 0, List<LedgerEntry> entries = null) { Currency = currency; Balance = balance; Entries = entries; } } }
using Newtonsoft.Json; using System; using System.Collections.Generic; namespace NBitpayClient { public class Ledger { public const String LEDGER_AUD = "AUD"; public const String LEDGER_BTC = "BTC"; public const String LEDGER_CAD = "CAD"; public const String LEDGER_EUR = "EUR"; public const String LEDGER_GBP = "GBP"; public const String LEDGER_MXN = "MXN"; public const String LEDGER_NDZ = "NDZ"; public const String LEDGER_USD = "USD"; public const String LEDGER_ZAR = "ZAR"; public List<LedgerEntry> Entries = null; /// <summary> /// Creates an uninitialized invoice request object. /// </summary> public Ledger(List<LedgerEntry> entries) { Entries = entries; } } }
mit
C#
2b55773c62dc451f4991d7c3d356b7402d20316e
test ParallelOptions
zhouyongtao/my_aspnetmvc_learning,zhouyongtao/my_aspnetmvc_learning
my_aspnetmvc_learning/Controllers/ParallelController.cs
my_aspnetmvc_learning/Controllers/ParallelController.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Web; using System.Web.Mvc; namespace my_aspnetmvc_learning.Controllers { public class ParallelController : Controller { // GET: Parallel public ActionResult Index() { var options = new ParallelOptions {MaxDegreeOfParallelism = 1}; //指定使用的硬件线程数为1 Parallel.For(0, 10000, options,(i,state) => { if (i == 100) { state.Break(); return; } }); return View(); } } }
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Web; using System.Web.Mvc; namespace my_aspnetmvc_learning.Controllers { public class ParallelController : Controller { // GET: Parallel public ActionResult Index() { var options = new ParallelOptions {MaxDegreeOfParallelism = 1}; //指定使用的硬件线程数为1 Parallel.For(0, 20000000, options,(i,state) => { if (i == 1000) { state.Break(); return; } }); return View(); } } }
mit
C#
0342f70a394e97612b1c20ee614c4bef555dbbe5
Remove redundant code.
DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS,modulexcite/DartVS,DartVS/DartVS
DanTup.DartAnalysis.Tests/FormattingTests.cs
DanTup.DartAnalysis.Tests/FormattingTests.cs
using System.Linq; using System.Threading.Tasks; using DanTup.DartAnalysis.Json; using FluentAssertions; using Xunit; namespace DanTup.DartAnalysis.Tests { public class FormattingTests : Tests { // TODO: Clean up tests; map over to FluentAssertions [Fact] public async Task FormatText() { const string text = @"main() { print('test'); }"; const string expectedText = @"main() { print('test'); } "; using (var service = CreateTestService()) { // Set the roots to our known project and wait for the analysis to complete. await service.SetAnalysisRoots(new[] { SampleDartProject }); await service.WaitForAnalysis(); await service.UpdateContent(HelloWorldFile, new AddContentOverlay { Type = "add", Content = text }); var results = await service.Format(HelloWorldFile, 1, 1); results.Edits.Should().HaveCount(1); results.Edits.Single().Replacement.Should().Be(expectedText); results.Edits.Single().Offset.Should().Be(0); results.Edits.Single().Length.Should().Be(36); results.SelectionOffset.Should().Be(1); results.SelectionLength.Should().Be(1); } } } }
using System.Linq; using System.Threading.Tasks; using DanTup.DartAnalysis.Json; using FluentAssertions; using Xunit; namespace DanTup.DartAnalysis.Tests { public class FormattingTests : Tests { // TODO: Clean up tests; map over to FluentAssertions [Fact] public async Task FormatText() { const string text = @"main() { print('test'); }"; const string expectedText = @"main() { print('test'); } "; using (var service = CreateTestService()) { // Set the roots to our known project and wait for the analysis to complete. await service.SetAnalysisRoots(new[] { SampleDartProject }); await service.WaitForAnalysis(); //var edit = new SourceEdit { Replacement = text, Offset = 1, Length = 2 }; // TODO: Set this to whole file.. await service.UpdateContent(HelloWorldFile, new AddContentOverlay { Type = "add", Content = text }); var results = await service.Format(HelloWorldFile, 1, 1); results.Edits.Should().HaveCount(1); results.Edits.Single().Replacement.Should().Be(expectedText); results.Edits.Single().Offset.Should().Be(0); results.Edits.Single().Length.Should().Be(36); results.SelectionOffset.Should().Be(1); results.SelectionLength.Should().Be(1); } } } }
mit
C#
262f7e57344795f1507ce0e5e2167a3f9c809bec
fix bug
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Tests/Helpers/TestNodeBuilder.cs
WalletWasabi.Tests/Helpers/TestNodeBuilder.cs
using System; using System.Collections.Generic; using System.IO; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using WalletWasabi.BitcoinCore; using WalletWasabi.Helpers; namespace WalletWasabi.Tests.Helpers { public class TestNodeBuilder { public static async Task<CoreNode> CreateAsync([CallerFilePath]string callerFilePath = null, [CallerMemberName]string callerMemberName = null, string additionalFolder = null) => await CoreNode.CreateAsync(Path.Combine(Global.Instance.DataDir, EnvironmentHelpers.ExtractFileName(callerFilePath), callerMemberName, additionalFolder ?? "")); } }
using System; using System.Collections.Generic; using System.IO; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using WalletWasabi.BitcoinCore; using WalletWasabi.Helpers; namespace WalletWasabi.Tests.Helpers { public class TestNodeBuilder { public static async Task<CoreNode> CreateAsync([CallerFilePath]string callerFilePath = null, [CallerMemberName]string callerMemberName = null, string additionalFolder = null) => await TestNodeBuilder.CreateAsync(Path.Combine(Global.Instance.DataDir, EnvironmentHelpers.ExtractFileName(callerFilePath), callerMemberName, additionalFolder ?? "")); } }
mit
C#
a5a71fca5ba9f3b8442fd78a36762d15543334f5
Use inheritence
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Crypto/ZeroKnowledge/Verifier.cs
WalletWasabi/Crypto/ZeroKnowledge/Verifier.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using WalletWasabi.Crypto.Groups; using WalletWasabi.Helpers; namespace WalletWasabi.Crypto.ZeroKnowledge { public static class Verifier { public static bool Verify(KnowledgeOfDiscreteLog proof, GroupElement publicPoint, GroupElement generator) { Guard.False($"{nameof(generator)}.{nameof(generator.IsInfinity)}", generator.IsInfinity); Guard.False($"{nameof(publicPoint)}.{nameof(publicPoint.IsInfinity)}", publicPoint.IsInfinity); if (publicPoint == proof.Nonce) { throw new InvalidOperationException($"{nameof(publicPoint)} and {nameof(proof.Nonce)} should not be equal."); } return Verify(proof, publicPoint, new[] { generator }); } public static bool Verify(KnowledgeOfRepresentation proof, GroupElement publicPoint, IEnumerable<GroupElement> generators) { foreach (var generator in generators) { Guard.False($"{nameof(generator)}.{nameof(generator.IsInfinity)}", generator.IsInfinity); } var nonce = proof.Nonce; var responses = proof.Responses; var challenge = Challenge.Build(publicPoint, nonce, generators); var a = challenge * publicPoint + nonce; var b = GroupElement.Infinity; foreach (var (response, generator) in responses.TupleWith(generators)) { b += response * generator; } return a == b; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using WalletWasabi.Crypto.Groups; using WalletWasabi.Helpers; namespace WalletWasabi.Crypto.ZeroKnowledge { public static class Verifier { public static bool Verify(KnowledgeOfDiscreteLog proof, GroupElement publicPoint, GroupElement generator) { Guard.False($"{nameof(generator)}.{nameof(generator.IsInfinity)}", generator.IsInfinity); Guard.False($"{nameof(publicPoint)}.{nameof(publicPoint.IsInfinity)}", publicPoint.IsInfinity); if (publicPoint == proof.Nonce) { throw new InvalidOperationException($"{nameof(publicPoint)} and {nameof(proof.Nonce)} should not be equal."); } var knowledge = new KnowledgeOfRepresentation(proof.Nonce, new[] { proof.Response }); return Verify(knowledge, publicPoint, new[] { generator }); } public static bool Verify(KnowledgeOfRepresentation proof, GroupElement publicPoint, IEnumerable<GroupElement> generators) { foreach (var generator in generators) { Guard.False($"{nameof(generator)}.{nameof(generator.IsInfinity)}", generator.IsInfinity); } var nonce = proof.Nonce; var responses = proof.Responses; var challenge = Challenge.Build(publicPoint, nonce, generators); var a = challenge * publicPoint + nonce; var b = GroupElement.Infinity; foreach (var (response, generator) in responses.TupleWith(generators)) { b += response * generator; } return a == b; } } }
mit
C#
df6cc8e49d38fa3dba65a79effb73a89d24beb7c
Hide the Ulterius Agent when its ran.
Ulterius/server
UlteriusAgent/Program.cs
UlteriusAgent/Program.cs
#region using System; using System.IO; using System.Net.Security; using System.Runtime.InteropServices; using System.ServiceModel; using System.Text; using AgentInterface; using UlteriusAgent.Networking; #endregion namespace UlteriusAgent { internal class Program { private const int SW_HIDE = 0; private const int SW_SHOW = 5; [DllImport("user32.dll")] private static extern bool SetProcessDPIAware(); [DllImport("kernel32.dll")] private static extern IntPtr GetConsoleWindow(); [DllImport("user32.dll")] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); private static void Main(string[] args) { if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); } var handle = GetConsoleWindow(); // Hide ShowWindow(handle, SW_HIDE); Tools.KillAllButMe(); try { string address = "net.pipe://localhost/ulterius/Agent"; ServiceHost serviceHost = new ServiceHost(typeof(ServerAgent)); NetNamedPipeBinding binding = new NetNamedPipeBinding { Security = new NetNamedPipeSecurity { Transport = {ProtectionLevel = ProtectionLevel.EncryptAndSign}, Mode = NetNamedPipeSecurityMode.Transport }, MaxReceivedMessageSize = int.MaxValue }; serviceHost.AddServiceEndpoint(typeof(ITUlteriusContract), binding, address); serviceHost.Open(); Console.Read(); } catch (Exception ex) { Console.WriteLine(ex.Message + " \n " + ex.StackTrace); } Console.Read(); } } }
#region using System; using System.IO; using System.Net.Security; using System.Runtime.InteropServices; using System.ServiceModel; using System.Text; using AgentInterface; using UlteriusAgent.Networking; #endregion namespace UlteriusAgent { internal class Program { private const int SW_HIDE = 0; private const int SW_SHOW = 5; [DllImport("user32.dll")] private static extern bool SetProcessDPIAware(); [DllImport("kernel32.dll")] private static extern IntPtr GetConsoleWindow(); [DllImport("user32.dll")] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); private static void Main(string[] args) { if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); } var handle = GetConsoleWindow(); // Hide // ShowWindow(handle, SW_HIDE); Tools.KillAllButMe(); try { string address = "net.pipe://localhost/ulterius/Agent"; ServiceHost serviceHost = new ServiceHost(typeof(ServerAgent)); NetNamedPipeBinding binding = new NetNamedPipeBinding { Security = new NetNamedPipeSecurity { Transport = {ProtectionLevel = ProtectionLevel.EncryptAndSign}, Mode = NetNamedPipeSecurityMode.Transport }, MaxReceivedMessageSize = int.MaxValue }; serviceHost.AddServiceEndpoint(typeof(ITUlteriusContract), binding, address); serviceHost.Open(); Console.Read(); } catch (Exception ex) { Console.WriteLine(ex.Message + " \n " + ex.StackTrace); } Console.Read(); } } }
mpl-2.0
C#
223d38786d1f13f61205cec2a64290e6388275bf
Add --help option to UndisposedExe
ermshiperete/undisposed-fody,ermshiperete/undisposed-fody
UndisposedExe/Program.cs
UndisposedExe/Program.cs
// Copyright (c) 2014 Eberhard Beilharz // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using Undisposed; namespace UndisposedExe { class MainClass { private static void Usage() { Console.WriteLine("Usage"); Console.WriteLine("Undisposed.exe [-o outputfile] assemblyname"); } private static void ProcessFile(string inputFile, string outputFile) { Console.WriteLine("Processing {0} -> {1}", inputFile, outputFile); var def = Mono.Cecil.ModuleDefinition.ReadModule(inputFile); var moduleWeaver = new ModuleWeaver { ModuleDefinition = def }; moduleWeaver.Execute(); def.Write(outputFile); } public static void Main(string[] args) { if (args.Length < 1 || args[0] == "--help" || args[0] == "-h") { Usage(); return; } var inputFile = args[args.Length - 1]; var outputFile = string.Empty; var isOutputFileSet = false; if (args.Length >= 3) { if (args[0] == "-o" || args[0] == "--output") { outputFile = args[1]; isOutputFileSet = true; } else { Usage(); return; } } if (!isOutputFileSet) { foreach (var arg in args) { inputFile = arg; ProcessFile(inputFile, inputFile); } } else ProcessFile(inputFile, outputFile); } } }
// Copyright (c) 2014 Eberhard Beilharz // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using Undisposed; namespace UndisposedExe { class MainClass { private static void Usage() { Console.WriteLine("Usage"); Console.WriteLine("Undisposed.exe [-o outputfile] assemblyname"); } private static void ProcessFile(string inputFile, string outputFile) { Console.WriteLine("Processing {0} -> {1}", inputFile, outputFile); var def = Mono.Cecil.ModuleDefinition.ReadModule(inputFile); var moduleWeaver = new ModuleWeaver { ModuleDefinition = def }; moduleWeaver.Execute(); def.Write(outputFile); } public static void Main(string[] args) { if (args.Length < 1) { Usage(); return; } var inputFile = args[args.Length - 1]; var outputFile = string.Empty; var isOutputFileSet = false; if (args.Length >= 3) { if (args[0] == "-o" || args[0] == "--output") { outputFile = args[1]; isOutputFileSet = true; } else { Usage(); return; } } if (!isOutputFileSet) { foreach (var arg in args) { inputFile = arg; ProcessFile(inputFile, inputFile); } } else ProcessFile(inputFile, outputFile); } } }
mit
C#
d10c0f15ed66c82c4669a9d51cde27cccec9cbb8
Allow standalone program to process multiple files at once
ermshiperete/undisposed-fody,ermshiperete/undisposed-fody
UndisposedExe/Program.cs
UndisposedExe/Program.cs
// Copyright (c) 2014 Eberhard Beilharz // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using Undisposed; namespace UndisposedExe { class MainClass { private static void Usage() { Console.WriteLine("Usage"); Console.WriteLine("Undisposed.exe [-o outputfile] assemblyname"); } private static void ProcessFile(string inputFile, string outputFile) { Console.WriteLine("Processing {0} -> {1}", inputFile, outputFile); var def = Mono.Cecil.ModuleDefinition.ReadModule(inputFile); var moduleWeaver = new ModuleWeaver(); moduleWeaver.ModuleDefinition = def; moduleWeaver.Execute(); def.Write(outputFile); } public static void Main(string[] args) { if (args.Length < 1) { Usage(); return; } string inputFile = args[args.Length - 1]; string outputFile = string.Empty; bool isOutputFileSet = false; if (args.Length >= 3) { if (args[0] == "-o" || args[0] == "--output") { outputFile = args[1]; isOutputFileSet = true; } else { Usage(); return; } } if (!isOutputFileSet) { for (int i = 0; i < args.Length; i++) { inputFile = args[i]; ProcessFile(inputFile, inputFile); } } else ProcessFile(inputFile, outputFile); } } }
// Copyright (c) 2014 Eberhard Beilharz // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using Undisposed; namespace UndisposedExe { class MainClass { private static void Usage() { Console.WriteLine("Usage"); Console.WriteLine("Undisposed.exe [-o outputfile] assemblyname"); } public static void Main(string[] args) { if (args.Length < 1) { Usage(); return; } string inputFile = args[args.Length - 1]; string outputFile; if (args.Length >= 3) { if (args[0] == "-o" || args[0] == "--output") { outputFile = args[1]; } else { Usage(); return; } } else outputFile = inputFile; var def = Mono.Cecil.ModuleDefinition.ReadModule(inputFile); var moduleWeaver = new ModuleWeaver(); moduleWeaver.ModuleDefinition = def; moduleWeaver.Execute(); def.Write(outputFile); } } }
mit
C#
f2cd6551ff08c5671429bf8aab87fcc06e3eed8e
Add documentation to flags
Lohikar/XenoBot2
XenoBot2.Shared/Flags.cs
XenoBot2.Shared/Flags.cs
using System; namespace XenoBot2.Shared { [Flags] public enum PermissionFlag { /// <summary> /// No permissions required. /// </summary> None = 0, /// <summary> /// Invoker must be able to speak in the affected channel. /// </summary> User = 1, /// <summary> /// Invoker must be a moderator for the affected channel. /// </summary> Moderator = 2, /// <summary> /// Invoker must be an administrator for the server of the affected channel. /// </summary> Administrator = 4, /// <summary> /// Invoker must be the bot administrator. /// </summary> BotAdministrator = 8 } [Flags] public enum CommandFlag { None = 0, /// <summary> /// Command is disallowed in normal channels. /// </summary> NoPublicChannel = 1, /// <summary> /// Command is disallowed in private messaging. /// </summary> NoPrivateChannel = 2, /// <summary> /// Command can be used while user is ignored by bot. /// </summary> UsableWhileIgnored = 4, /// <summary> /// Command cannot be disabled. /// </summary> NonDisableable = 8, /// <summary> /// Command does not show in help index pages. /// </summary> Hidden = 16 } }
using System; namespace XenoBot2.Shared { [Flags] public enum PermissionFlag { None = 0, User = 1, Moderator = 2, Administrator = 4, BotAdministrator = 8 } [Flags] public enum CommandFlag { None = 0, NoPublicChannel = 1, NoPrivateChannel = 2, UsableWhileIgnored = 4, NonDisableable = 8, Hidden = 16, } }
mit
C#
e45ccd7d61cfa68c19a5f13e0b6ec95d30109b95
Change comment to doc comment
LianwMS/WebApi,chimpinano/WebApi,scz2011/WebApi,chimpinano/WebApi,congysu/WebApi,LianwMS/WebApi,abkmr/WebApi,congysu/WebApi,lewischeng-ms/WebApi,abkmr/WebApi,scz2011/WebApi,yonglehou/WebApi,lungisam/WebApi,lewischeng-ms/WebApi,yonglehou/WebApi,lungisam/WebApi
src/System.Web.Http/ModelBinding/IModelBinder.cs
src/System.Web.Http/ModelBinding/IModelBinder.cs
using System.Web.Http.Controllers; namespace System.Web.Http.ModelBinding { /// <summary> /// Interface for model binding. /// </summary> public interface IModelBinder { bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext); } }
using System.Web.Http.Controllers; namespace System.Web.Http.ModelBinding { // Interface for model binding public interface IModelBinder { bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext); } }
mit
C#
d0bbb4935343093e898be314578df8cf5deec719
remove comments and move public methods togather
DuncanButler/DemoCheckoutBasket
CheckoutBasket.API/Domain/Basket.cs
CheckoutBasket.API/Domain/Basket.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml.Serialization; using CheckoutBasket.API.Events; namespace CheckoutBasket.API.Domain { public class Basket { private IList<object> _items; private Basket() { _items = new List<object>(); } public bool IsEmpty { get { return ! _items.Any(); } } public string Id { get; set; } public static Basket CreateWithId() { string id = GenerateBasketId(); var basketEvent = new CreateBasketEvent {Id = id}; var filename = string.Format("./EventStore/Basket/{0}", id); var sterilizer = new XmlSerializer(typeof (List<ApplicationEvent>)); var writer = new StreamWriter(filename); sterilizer.Serialize(writer,new List<ApplicationEvent>{basketEvent}); writer.Close(); return new Basket { Id = id }; } public static Basket GetWithId(string basketId) { var filename = string.Format("./EventStore/Basket/{0}", basketId); var sterilizer = new XmlSerializer(typeof (List<ApplicationEvent>)); var reader = new StreamReader(filename); var events = (List<ApplicationEvent>) sterilizer.Deserialize(reader); reader.Close(); return new Basket {Id = ((CreateBasketEvent)events[0]).Id}; } private static string GenerateBasketId() { return Guid.NewGuid().ToString().Replace("-", ""); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml.Serialization; using CheckoutBasket.API.Events; namespace CheckoutBasket.API.Domain { public class Basket { private IList<object> _items; private Basket() { _items = new List<object>(); } public bool IsEmpty { get { return ! _items.Any(); } } public string Id { get; set; } public static Basket CreateWithId() { string id = GenerateBasketId(); // create event var basketEvent = new CreateBasketEvent {Id = id}; // store event in basket event store var filename = string.Format("./EventStore/Basket/{0}", id); var sterilizer = new XmlSerializer(typeof (List<ApplicationEvent>)); var writer = new StreamWriter(filename); sterilizer.Serialize(writer,new List<ApplicationEvent>{basketEvent}); writer.Close(); // return new basket return new Basket { Id = id }; } private static string GenerateBasketId() { return Guid.NewGuid().ToString().Replace("-", ""); } public static Basket GetWithId(string basketId) { var filename = string.Format("./EventStore/Basket/{0}", basketId); var sterilizer = new XmlSerializer(typeof (List<ApplicationEvent>)); var reader = new StreamReader(filename); var events = (List<ApplicationEvent>) sterilizer.Deserialize(reader); reader.Close(); return new Basket(){Id = ((CreateBasketEvent)events[0]).Id}; } } }
apache-2.0
C#
93a72764fbe3c5ef7a91b5ed1b33b6b2d47196c3
Update to End Game Screen
MasonSchneider/BattleAntz
BattleAntz/Assets/Scripts/Menus/GameOverMenu.cs
BattleAntz/Assets/Scripts/Menus/GameOverMenu.cs
using UnityEngine; using System.Collections; public class GameOverMenu : MonoBehaviour { private string gameResult; private GUIStyle style = new GUIStyle(); public int workers; public int armyants; public int bullants; public int fireants; public int sugar; public int killed; // Use this for initialization void Start () { enabled = false; style.fontSize = 30; // playerHive = gameObject.GetComponent<GameMenu>().playerHive; } // Update is called once per frame void Update () { } public void gameOver(string result, int workersCreated, int armyantsCreated, int bullantsCreated, int fireantsCreated, int sugarProduced, int antsKilled){ gameObject.GetComponent<GameMenu> ().paused = true; workers = workersCreated; sugar = sugarProduced; armyants = armyantsCreated; bullants = bullantsCreated; fireants = fireantsCreated; killed = antsKilled; gameResult = result; enabled = true; Time.timeScale = 0; } void OnGUI () { GUI.Box(new Rect(Screen.width/2-200,Screen.height/2-200,400,400), ""); GUI.TextField(new Rect(Screen.width/2-60,Screen.height/2-195,300,50), gameResult, style); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2-120,300,50), "Total Sugar Collected: "+sugar); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2-95,300,50), "Workers Created: "+workers); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2-70,300,50), "Army Ants Created: "+armyants); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2-45,300,50), "Bull Ants Created: "+bullants); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2-15,300,50), "Fire Ants Created: "+fireants); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2+10,300,50), "Units Killed: "+killed); if(GUI.Button(new Rect(Screen.width/2-150,Screen.height/2+60,300,50),"Main Menu")) { Application.LoadLevel("MainMenu"); Time.timeScale = 1; } if(GUI.Button(new Rect(Screen.width/2-150,Screen.height/2+125,300,50),"Restart")) { Application.LoadLevel("GameScene"); Time.timeScale = 1; } } }
using UnityEngine; using System.Collections; public class GameOverMenu : MonoBehaviour { private string gameResult; private GUIStyle style = new GUIStyle(); public int workers; public int armyants; public int bullants; public int fireants; public int sugar; public int killed; // Use this for initialization void Start () { enabled = false; style.fontSize = 30; // playerHive = gameObject.GetComponent<GameMenu>().playerHive; } // Update is called once per frame void Update () { } public void gameOver(string result, int workersCreated, int armyantsCreated, int bullantsCreated, int fireantsCreated, int sugarProduced, int antsKilled){ gameObject.GetComponent<GameMenu> ().paused = true; workers = workersCreated; sugar = sugarProduced; armyants = armyantsCreated; bullants = bullantsCreated; fireants = fireantsCreated; killed = antsKilled; gameResult = result; enabled = true; Time.timeScale = 0; } void OnGUI () { GUI.Box(new Rect(Screen.width/2-200,Screen.height/2-200,400,400), ""); GUI.TextField(new Rect(Screen.width/2-60,Screen.height/2-195,300,50), gameResult, style); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2-120,300,50), "Total Sugar Collected: "+sugar); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2-95,300,50), "Workers: "+workers); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2-70,300,50), "Army Ants Created: "+armyants); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2-45,300,50), "Bull Ants: "+bullants); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2-15,300,50), "Fire Ants: "+fireants); GUI.Label(new Rect(Screen.width/2-150,Screen.height/2+10,300,50), "Units Killed: "+killed); if(GUI.Button(new Rect(Screen.width/2-150,Screen.height/2+60,300,50),"Main Menu")) { Application.LoadLevel("MainMenu"); Time.timeScale = 1; } if(GUI.Button(new Rect(Screen.width/2-150,Screen.height/2+125,300,50),"Restart")) { Application.LoadLevel("GameScene"); Time.timeScale = 1; } } }
mit
C#
c04325c0838bb90af2b689383d68c023cf28a91e
Add comment
mspons/DiceApi
test/DiceApi.Core.Tests/DieTest.cs
test/DiceApi.Core.Tests/DieTest.cs
using System; using Xunit; using DiceApi.Core; namespace DiceApi.Core.Tests { /// <summary> /// Test class for <see cref="Die" />. /// </summary> public class DieTest { /// <summary> /// Verifies the constructor throws an ArgumentOutOfRangeException when given /// an invalid number of sides. /// </summary> [Fact] public void Constructor_GivenZeroSides_ThrowsException() { var exception = Record.Exception(() => new Die(0)); Assert.NotNull(exception); Assert.IsType<ArgumentOutOfRangeException>(exception); } /// <summary> /// Verifies that die rolls return a value within the expected range for its /// number of sides. /// </summary> [Fact] public void Roll_GivenValidSides_ReturnsValueWithinRange() { int sides = 6; var die = new Die(sides); // Naive brute force verification that we always get a correct value // within range. for (int i = 0; i < 100; i++) { var result = die.Roll(); Assert.True(this.WithinRange(sides, result)); } } /// <summary> /// Helper method to check whether value falls within the /// valid range for a die with given number of sides /// </summary> /// <param name="sides">Number of sides on die, defines max of range.</param> /// <param name="value">Value to check</param> /// <returns>True if it's a valid result for die, false otherwise.</returns> private bool WithinRange(int sides, int value) { if (value > 0 && value <= sides) { return true; } return false; } } }
using System; using Xunit; using DiceApi.Core; namespace DiceApi.Core.Tests { public class DieTest { /// <summary> /// Verifies the constructor throws an ArgumentOutOfRangeException when given /// an invalid number of sides. /// </summary> [Fact] public void Constructor_GivenZeroSides_ThrowsException() { var exception = Record.Exception(() => new Die(0)); Assert.NotNull(exception); Assert.IsType<ArgumentOutOfRangeException>(exception); } /// <summary> /// Verifies that die rolls return a value within the expected range for its /// number of sides. /// </summary> [Fact] public void Roll_GivenValidSides_ReturnsValueWithinRange() { int sides = 6; var die = new Die(sides); // Naive brute force verification that we always get a correct value // within range. for (int i = 0; i < 100; i++) { var result = die.Roll(); Assert.True(this.WithinRange(sides, result)); } } /// <summary> /// Helper method to check whether value falls within the /// valid range for a die with given number of sides /// </summary> /// <param name="sides">Number of sides on die, defines max of range.</param> /// <param name="value">Value to check</param> /// <returns>True if it's a valid result for die, false otherwise.</returns> private bool WithinRange(int sides, int value) { if (value > 0 && value <= sides) { return true; } return false; } } }
mit
C#
144b5736d625a0afae357517d0b12a43af306d47
Fix bug that caused exceptions to be swallowed
prescottadam/ConsoleWritePrettyOneDay
ConsoleWritePrettyOneDay/Spinner.cs
ConsoleWritePrettyOneDay/Spinner.cs
using System; using System.Diagnostics; using System.Threading.Tasks; namespace ConsoleWritePrettyOneDay { public static class Spinner { private static char[] _chars = new[] { '|', '/', '-', '\\', '|', '/', '-', '\\' }; /// <summary> /// Displays a spinner while the provided <paramref name="action"/> is performed. /// If provided, <paramref name="message"/> will be displayed along with the elapsed time in milliseconds. /// </summary> public static void Wait(Action action, string message = null) { var task = Task.Run(action); Wait(task, message); if (task.IsFaulted) { throw task.Exception?.InnerException ?? task.Exception; } } /// <summary> /// Displays a spinner while the provided <paramref name="task"/> is executed. /// If provided, <paramref name="message"/> will be displayed along with the elapsed time in milliseconds. /// </summary> public static void Wait(Task task, string message = null) { WaitAsync(task, message).Wait(); } /// <summary> /// Displays a spinner while the provided <paramref name="task"/> is executed. /// If provided, <paramref name="message"/> will be displayed along with the elapsed time in milliseconds. /// </summary> public static async Task WaitAsync(Task task, string message = null) { int index = 0; int max = _chars.Length; if (!string.IsNullOrWhiteSpace(message) && !message.EndsWith(" ")) { message += " "; } var timer = new Stopwatch(); timer.Start(); while (!task.IsCompleted) { await Task.Delay(35); index = ++index % max; Console.Write($"\r{message}{_chars[index]}"); } timer.Stop(); Console.WriteLine($"\r{message}[{(timer.ElapsedMilliseconds / 1000m).ToString("0.0##")}s]"); } } }
using System; using System.Diagnostics; using System.Threading.Tasks; namespace ConsoleWritePrettyOneDay { public static class Spinner { private static char[] _chars = new[] { '|', '/', '-', '\\', '|', '/', '-', '\\' }; /// <summary> /// Displays a spinner while the provided <paramref name="action"/> is performed. /// If provided, <paramref name="message"/> will be displayed along with the elapsed time in milliseconds. /// </summary> public static void Wait(Action action, string message = null) { Wait(Task.Run(action), message); } /// <summary> /// Displays a spinner while the provided <paramref name="task"/> is executed. /// If provided, <paramref name="message"/> will be displayed along with the elapsed time in milliseconds. /// </summary> public static void Wait(Task task, string message = null) { WaitAsync(task, message).Wait(); } /// <summary> /// Displays a spinner while the provided <paramref name="task"/> is executed. /// If provided, <paramref name="message"/> will be displayed along with the elapsed time in milliseconds. /// </summary> public static async Task WaitAsync(Task task, string message = null) { int index = 0; int max = _chars.Length; if (!string.IsNullOrWhiteSpace(message) && !message.EndsWith(" ")) { message += " "; } var timer = new Stopwatch(); timer.Start(); while (!task.IsCompleted) { await Task.Delay(35); index = ++index % max; Console.Write($"\r{message}{_chars[index]}"); } timer.Stop(); Console.WriteLine($"\r{message}[{(timer.ElapsedMilliseconds / 1000m).ToString("0.0##")}s]"); } } }
mit
C#
6989e558b5c2789ba255236900b3707ab108472d
Remove NextFrame
LaserHydra/Oxide,bawNg/Oxide,bawNg/Oxide,Nogrod/Oxide-2,Visagalis/Oxide,Nogrod/Oxide-2,Visagalis/Oxide,LaserHydra/Oxide
Extensions/Oxide.Ext.CSharp/Covalence/Plugin.cs
Extensions/Oxide.Ext.CSharp/Covalence/Plugin.cs
using System; using Oxide.Core; using Oxide.Core.Libraries.Covalence; namespace Oxide.Plugins { public class CovalencePlugin : CSharpPlugin { new static readonly Covalence covalence = Interface.Oxide.GetLibrary<Covalence>(); protected string game = covalence.Game; protected IServer server = covalence.Server; protected IPlayerManager players = covalence.Players; public CovalencePlugin() { } /// <summary> /// Print an info message using the oxide root logger /// </summary> /// <param name="format"></param> /// <param name="args"></param> protected void Log(string format, params object[] args) { Interface.Oxide.LogInfo("[{0}] {1}", Title, args.Length > 0 ? string.Format(format, args) : format); } /// <summary> /// Print a warning message using the oxide root logger /// </summary> /// <param name="format"></param> /// <param name="args"></param> protected void LogWarning(string format, params object[] args) { Interface.Oxide.LogWarning("[{0}] {1}", Title, args.Length > 0 ? string.Format(format, args) : format); } /// <summary> /// Print an error message using the oxide root logger /// </summary> /// <param name="format"></param> /// <param name="args"></param> protected void LogError(string format, params object[] args) { Interface.Oxide.LogError("[{0}] {1}", Title, args.Length > 0 ? string.Format(format, args) : format); } } }
using System; using Oxide.Core; using Oxide.Core.Libraries.Covalence; namespace Oxide.Plugins { public class CovalencePlugin : CSharpPlugin { new static readonly Covalence covalence = Interface.Oxide.GetLibrary<Covalence>(); protected string game = covalence.Game; protected IServer server = covalence.Server; protected IPlayerManager players = covalence.Players; public CovalencePlugin() { } /// <summary> /// Print an info message using the oxide root logger /// </summary> /// <param name="format"></param> /// <param name="args"></param> protected void Log(string format, params object[] args) { Interface.Oxide.LogInfo("[{0}] {1}", Title, args.Length > 0 ? string.Format(format, args) : format); } /// <summary> /// Print a warning message using the oxide root logger /// </summary> /// <param name="format"></param> /// <param name="args"></param> protected void LogWarning(string format, params object[] args) { Interface.Oxide.LogWarning("[{0}] {1}", Title, args.Length > 0 ? string.Format(format, args) : format); } /// <summary> /// Print an error message using the oxide root logger /// </summary> /// <param name="format"></param> /// <param name="args"></param> protected void LogError(string format, params object[] args) { Interface.Oxide.LogError("[{0}] {1}", Title, args.Length > 0 ? string.Format(format, args) : format); } /// <summary> /// Queue a callback to be called in the next server frame /// </summary> /// <param name="callback"></param> protected void NextFrame(Action callback) => Interface.Oxide.NextTick(callback); } }
mit
C#
aff1bb8ba0d0f28c3d5e086952e91e76bbcfb905
Fix private keys config parsing
Romanets/RestImageResize,Romanets/RestImageResize,Romanets/RestImageResize,Romanets/RestImageResize,Romanets/RestImageResize
RestImageResize/Config.cs
RestImageResize/Config.cs
using System.Collections.Generic; using System.Linq; using RestImageResize.Security; using RestImageResize.Utils; namespace RestImageResize { /// <summary> /// Provides configuration options. /// </summary> internal static class Config { private static class AppSettingKeys { private const string Prefix = "RestImageResize."; // ReSharper disable MemberHidesStaticFromOuterClass public const string DefaultTransform = Prefix + "DefautTransform"; public const string PrivateKeys = Prefix + "PrivateKeys"; // ReSharper restore MemberHidesStaticFromOuterClass } /// <summary> /// Gets the default image transformation type. /// </summary> public static ImageTransform DefaultTransform { get { return ConfigUtils.ReadAppSetting(AppSettingKeys.DefaultTransform, ImageTransform.DownFit); } } public static IList<PrivateKey> PrivateKeys { get { var privateKeysString = ConfigUtils.ReadAppSetting<string>(AppSettingKeys.PrivateKeys); if (string.IsNullOrEmpty(privateKeysString)) { return new List<PrivateKey>(); } var privateKeys = privateKeysString.Split('|') .Select(val => new PrivateKey { Name = val.Split(':').First(), Key = val.Split(':').Last() }) .ToList(); return privateKeys; } } } }
using System.Collections.Generic; using System.Linq; using RestImageResize.Security; using RestImageResize.Utils; namespace RestImageResize { /// <summary> /// Provides configuration options. /// </summary> internal static class Config { private static class AppSettingKeys { private const string Prefix = "RestImageResize."; // ReSharper disable MemberHidesStaticFromOuterClass public const string DefaultTransform = Prefix + "DefautTransform"; public const string PrivateKeys = Prefix + "PrivateKeys"; // ReSharper restore MemberHidesStaticFromOuterClass } /// <summary> /// Gets the default image transformation type. /// </summary> public static ImageTransform DefaultTransform { get { return ConfigUtils.ReadAppSetting(AppSettingKeys.DefaultTransform, ImageTransform.DownFit); } } public static IList<PrivateKey> PrivateKeys { get { var privateKeysString = ConfigUtils.ReadAppSetting<string>(AppSettingKeys.PrivateKeys); var privateKeys = privateKeysString.Split('|') .Select(val => new PrivateKey { Name = val.Split(':').First(), Key = val.Split(':').Last() }) .ToList(); return privateKeys; } } } }
mit
C#
94c681261283f79e578641c8c00164385f0dc729
Make everything of LoaderDDS internal.
pratikv/SLSharp,IgniteInteractiveStudio/SLSharp,hach-que/SLSharp,IgniteInteractiveStudio/SLSharp,hach-que/SLSharp,pratikv/SLSharp
IIS.SLSharp/Textures/Externals/LoaderStatics.cs
IIS.SLSharp/Textures/Externals/LoaderStatics.cs
#region --- License --- /* Licensed under the MIT/X11 license. * Copyright (c) 2006-2008 the OpenTK Team. * This notice may not be removed from any source distribution. * See license.txt for licensing details. */ #endregion using OpenTK.Graphics.OpenGL; namespace IIS.SLSharp.Textures.Externals { /// <summary>The parameters in this class have only effect on the following Texture loads.</summary> static class TextureLoaderParameters { /// <summary>(Debug Aid, should be set to false) If set to false only Errors will be printed. If set to true, debug information (Warnings and Queries) will be printed in addition to Errors.</summary> public static bool Verbose = false; /// <summary>Always-valid fallback parameter for GL.BindTexture (Default: 0). This number will be returned if loading the Texture failed. You can set this to a checkerboard texture or similar, which you have already loaded.</summary> public static uint OpenGLDefaultTexture = 0; /// <summary>Compressed formats must have a border of 0, so this is constant.</summary> public const int Border = 0; /// <summary>false==DirectX TexCoords, true==OpenGL TexCoords (Default: true)</summary> public static bool FlipImages = false; /// <summary>When enabled, will use Glu to create MipMaps for images loaded with GDI+ (Default: false)</summary> public static bool BuildMipmapsForUncompressed = false; /// <summary>Selects the Magnification filter for following Textures to be loaded. (Default: Nearest)</summary> public static TextureMagFilter MagnificationFilter = TextureMagFilter.Nearest; /// <summary>Selects the Minification filter for following Textures to be loaded. (Default: Nearest)</summary> public static TextureMinFilter MinificationFilter = TextureMinFilter.Nearest; /// <summary>Selects the S Wrapping for following Textures to be loaded. (Default: Repeat)</summary> public static TextureWrapMode WrapModeS = TextureWrapMode.Repeat; /// <summary>Selects the T Wrapping for following Textures to be loaded. (Default: Repeat)</summary> public static TextureWrapMode WrapModeT = TextureWrapMode.Repeat; /// <summary>Selects the Texture Environment Mode for the following Textures to be loaded. Default: Modulate)</summary> public static TextureEnvMode EnvMode = TextureEnvMode.Modulate; } }
#region --- License --- /* Licensed under the MIT/X11 license. * Copyright (c) 2006-2008 the OpenTK Team. * This notice may not be removed from any source distribution. * See license.txt for licensing details. */ #endregion using OpenTK.Graphics.OpenGL; namespace IIS.SLSharp.Textures.Externals { /// <summary>The parameters in this class have only effect on the following Texture loads.</summary> public static class TextureLoaderParameters { /// <summary>(Debug Aid, should be set to false) If set to false only Errors will be printed. If set to true, debug information (Warnings and Queries) will be printed in addition to Errors.</summary> public static bool Verbose = false; /// <summary>Always-valid fallback parameter for GL.BindTexture (Default: 0). This number will be returned if loading the Texture failed. You can set this to a checkerboard texture or similar, which you have already loaded.</summary> public static uint OpenGLDefaultTexture = 0; /// <summary>Compressed formats must have a border of 0, so this is constant.</summary> public const int Border = 0; /// <summary>false==DirectX TexCoords, true==OpenGL TexCoords (Default: true)</summary> public static bool FlipImages = false; /// <summary>When enabled, will use Glu to create MipMaps for images loaded with GDI+ (Default: false)</summary> public static bool BuildMipmapsForUncompressed = false; /// <summary>Selects the Magnification filter for following Textures to be loaded. (Default: Nearest)</summary> public static TextureMagFilter MagnificationFilter = TextureMagFilter.Nearest; /// <summary>Selects the Minification filter for following Textures to be loaded. (Default: Nearest)</summary> public static TextureMinFilter MinificationFilter = TextureMinFilter.Nearest; /// <summary>Selects the S Wrapping for following Textures to be loaded. (Default: Repeat)</summary> public static TextureWrapMode WrapModeS = TextureWrapMode.Repeat; /// <summary>Selects the T Wrapping for following Textures to be loaded. (Default: Repeat)</summary> public static TextureWrapMode WrapModeT = TextureWrapMode.Repeat; /// <summary>Selects the Texture Environment Mode for the following Textures to be loaded. Default: Modulate)</summary> public static TextureEnvMode EnvMode = TextureEnvMode.Modulate; } }
mit
C#
f03f11c54541cf3a8fc5ef8b2eea4aa89bf42d5e
Edit UrlParser.ReadJson( ... )
tomnolan95/RedditSharp,chuggafan/RedditSharp-1,SirCmpwn/RedditSharp,ekaralar/RedditSharpWindowsStore,IAmAnubhavSaini/RedditSharp,epvanhouten/RedditSharp,CrustyJew/RedditSharp,RobThree/RedditSharp,justcool393/RedditSharp-1,angelotodaro/RedditSharp,theonlylawislove/RedditSharp,Jinivus/RedditSharp,pimanac/RedditSharp,nyanpasudo/RedditSharp
RedditSharp/UrlParser.cs
RedditSharp/UrlParser.cs
using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; namespace RedditSharp { class UrlParser : JsonConverter { public override bool CanConvert(Type objectType) { return objectType == typeof(String) || objectType == typeof(Uri); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var token = JToken.Load(reader); if (token.Type == JTokenType.String) return new Uri(token.Value<string>(), UriKind.RelativeOrAbsolute); else return token.Value<Uri>(); } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { writer.WriteValue(value); } } }
using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; namespace RedditSharp { class UrlParser : JsonConverter { public override bool CanConvert(Type objectType) { return objectType == typeof(String) || objectType == typeof(Uri); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var token = JToken.Load(reader); return new Uri(token.Value<string>(), UriKind.RelativeOrAbsolute); } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { writer.WriteValue(value); } } }
mit
C#
06b1d11027587aa02655d634eb42ffa30c4fa04f
Fix namespace
markmnl/FalconUDP
IPAddress.cs
IPAddress.cs
 namespace FalconUDP { public static class IPAddress { public const string Loopback = "127.0.0.1"; } }
 namespace FalconUDP.RT { public static class IPAddress { public const string Loopback = "127.0.0.1"; } }
mit
C#
0cc0cffcdcb385c708fc6a0934717213a6296a69
fix comment
Captain-Marvel/CSharp-Part2-Teamwork
SpaceGame/Game/Meteor.cs
SpaceGame/Game/Meteor.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SpaceGame { public class Meteor : IPrintable { // private fields private int x; private int y; private char symbol; private ConsoleColor color; // Holds X coordinate for the meteor public int X { get { return this.x; } set { this.x = value; } } // Holds Y coordinate for the meteor public int Y { get { return this.y; } set { this.y = value; } } // Different symbol for each meteor public char Symbol { get { return this.symbol;} set {this.symbol = value; } } // Set color of current meteor public ConsoleColor Color { get { return this.color; } set { this.color = value; } } // Set position of each meteor public void Print() { Console.SetCursorPosition(this.X, this.Y); Console.ForegroundColor = this.Color; Console.Write(this.Symbol); } // Random place generator public void SetRandom(int width) { Random generator = new Random(); // We start from top of the console coordinate system this.Y = 0; // Get random X coordinatie this.X = generator.Next(0, width); this.Color = Game.enemiesColors[generator.Next(0, Game.enemiesColors.Length)]; this.Symbol = Game.enemyIcons[generator.Next(0, Game.enemyIcons.Length)]; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SpaceGame { public class Meteor : IPrintable { // private fields private int x; private int y; private char symbol; private ConsoleColor color; // Holds X coordinate for the rock public int X { get { return this.x; } set { this.x = value; } } // Holds Y coordinate for the rock public int Y { get { return this.y; } set { this.y = value; } } // Different symbol for each meteor public char Symbol { get { return this.symbol;} set {this.symbol = value; } } // Set color of current meteor public ConsoleColor Color { get { return this.color; } set { this.color = value; } } // Set position of each meteor public void Print() { Console.SetCursorPosition(this.X, this.Y); Console.ForegroundColor = this.Color; Console.Write(this.Symbol); } // Random place generator public void SetRandom(int width) { Random generator = new Random(); // We start from top of the console coordinate system this.Y = 0; // Get random X coordinatie this.X = generator.Next(0, width); this.Color = Game.enemiesColors[generator.Next(0, Game.enemiesColors.Length)]; this.Symbol = Game.enemyIcons[generator.Next(0, Game.enemyIcons.Length)]; } } }
mit
C#
2f74f139356d523ad844dafb083f85d018abaf2e
Update LiteDbConnectionProvider.cs
X-OFF/xoff
Framework/XOFF.LiteDB/LiteDbConnectionProvider.cs
Framework/XOFF.LiteDB/LiteDbConnectionProvider.cs
using System; using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using System.Threading; using LiteDB; using LiteDB.Platform; namespace XOFF.LiteDB { public class LiteDbConnectionProvider : ILiteDbConnectionProvider { private LiteDatabase _database; private Semaphore _semaphore; public LiteDbConnectionProvider() { _semaphore = new Semaphore(1, 1); // Database = database; } public LiteDatabase Database { get { if (_database == null) { var libraryPath = Path.Combine("/..", "Library"); var databasePath = "someWidgets.liteDb"; var connStr = $"filename=\"{databasePath}\"; journal =true;";//when this is set to true, file not found exceptions get thrown LitePlatform.Initialize(new LitePlatformiOS()); _database = new LiteDatabase(connStr); } return _database; } } public bool WaitOne([CallerMemberName]string name = "") { Debug.WriteLine(string.Format("###### WAITING SEMAPHORE: {0} ######", name)); return _semaphore.WaitOne(); } public void Release([CallerMemberName] string name = "") { Debug.WriteLine(string.Format("###### RELEASING SEMAPHORE: {0} ######", name)); _semaphore.Release(); } } }
using System; using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using System.Threading; using LiteDB; namespace XOFF.LiteDB { public class LiteDbConnectionProvider : ILiteDbConnectionProvider { private LiteDatabase _database; private Semaphore _semaphore; public LiteDbConnectionProvider() { _semaphore = new Semaphore(1, 1); // Database = database; } public LiteDatabase Database { get { if (_database == null) { var libraryPath = Path.Combine("/..", "Library"); var databasePath = "someWidgets.liteDb"; var connStr = $"filename=\"{databasePath}\"; journal =true;";//when this is set to true, file not found exceptions get thrown _database = new LiteDatabase(connStr); } return _database; } } public bool WaitOne([CallerMemberName]string name = "") { Debug.WriteLine(string.Format("###### WAITING SEMAPHORE: {0} ######", name)); return _semaphore.WaitOne(); } public void Release([CallerMemberName] string name = "") { Debug.WriteLine(string.Format("###### RELEASING SEMAPHORE: {0} ######", name)); _semaphore.Release(); } } }
mit
C#
10a10007567c1e523e6c874b4f07b9ff5cf09b70
Add link to Guava implementation of Cache.
NextMethod/Tamarind
Tamarind/Cache/ICache.cs
Tamarind/Cache/ICache.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; namespace Tamarind.Cache { // Guava Reference: https://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/cache/Cache.java // TODO: NEEDS DOCUMENTATION. public interface ICache<K, V> { V GetIfPresent(K key); V Get(K key, Func<V> valueLoader); ImmutableDictionary<K, V> GetAllPresent(IEnumerator<K> keys); void Put(K key, V value); void PutAll(Dictionary<K, V> xs); void Invalidate(K key); void InvlidateAll(IEnumerator<K> keys); long Count { get; } //CacheStats Stats { get; } ConcurrentDictionary<K, V> ToDictionary(); void CleanUp(); } }
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; namespace Tamarind.Cache { // TODO: NEEDS DOCUMENTATION. public interface ICache<K, V> { V GetIfPresent(K key); V Get(K key, Func<V> valueLoader); ImmutableDictionary<K, V> GetAllPresent(IEnumerator<K> keys); void Put(K key, V value); void PutAll(Dictionary<K, V> xs); void Invalidate(K key); void InvlidateAll(IEnumerator<K> keys); long Count { get; } //CacheStats Stats { get; } ConcurrentDictionary<K, V> ToDictionary(); void CleanUp(); } }
mit
C#
7fe9a36fbc6db1c1399c9b2ece305ab673090783
Fix console project.
haefele/Ynab,haefele/YnabApi
src/Console/Program.cs
src/Console/Program.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Ynab; using Ynab.Desktop; using Ynab.DeviceActions; using Ynab.Dropbox; namespace Console { class Program { public static void Main(string[] args) { Run().Wait(); } private static async Task Run() { var watch = Stopwatch.StartNew(); var dropboxFileSystem = new DropboxFileSystem(""); var desktopFileSystem = new DesktopFileSystem(); YnabApi api = new YnabApi(dropboxFileSystem); var budgets = await api.GetBudgetsAsync(); var testBudget = budgets.First(f => f.BudgetName == "Test-Budget"); var devices = await testBudget.GetRegisteredDevicesAsync(); var registeredDevice = await testBudget.RegisterDevice(Environment.MachineName); var createPayee = new CreatePayeeDeviceAction { Name = "Bücherei" }; var createTransaction = new CreateTransactionDeviceAction { Amount = -20.0m, AccountId = "ACCOUNT-ID-1", CategoryId = "CATEGORY-ID-1", Memo = "#Mittagspause", PayeeId = createPayee.Id }; await registeredDevice.ExecuteActions(createPayee, createTransaction); watch.Stop(); System.Console.WriteLine(watch.Elapsed); System.Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Ynab; using Ynab.Desktop; using Ynab.Dropbox; using Ynab.Items; namespace Console { class Program { public static void Main(string[] args) { Run().Wait(); } private static async Task Run() { var dropboxFileSystem = new DropboxFileSystem(""); var desktopFileSystem = new DesktopFileSystem(); YnabApi api = new YnabApi(dropboxFileSystem); var budgets = await api.GetBudgetsAsync(); var testBudget = budgets.First(f => f.BudgetName == "Test-Budget"); var devices = await testBudget.GetRegisteredDevicesAsync(); var registeredDevice = await testBudget.RegisterDevice(Environment.MachineName); var transaction = new Transaction { Amount = -20.0m, AccountId = "ACCOUNT-ID-1", CategoryId = "CATEGORY-ID-1", Memo = "#Mittagspause", PayeeId = "PAYEE-ID-1" }; await registeredDevice.InsertItems(transaction); } } }
mit
C#
fd922dc680564df456be88bc699991291efa78a5
Remove Runner.consoleRunner references
sharper-library/Sharper.C.Testing
Sharper.C.Testing/Testing/InvariantRunner.cs
Sharper.C.Testing/Testing/InvariantRunner.cs
using System; using System.Collections.Generic; using Microsoft.FSharp.Core; using Microsoft.FSharp.Collections; using FsCheck; namespace Sharper.C.Testing { public struct InvariantRunner : IRunner { private readonly List<InvariantResult> results; private InvariantRunner(List<InvariantResult> results) { this.results = results; } public static InvariantRunner Mk() => new InvariantRunner(new List<InvariantResult>()); public IEnumerable<InvariantResult> Results => results; public void OnArguments ( int ntest , FSharpList<object> args , FSharpFunc<int, FSharpFunc<FSharpList<object>, string>> every ) => Console.Write(every.Invoke(ntest).Invoke(args)); public void OnFinished(string name, TestResult result) => results.Add(InvariantResult.Mk(name, result)); public void OnShrink ( FSharpList<object> args , FSharpFunc<FSharpList<object>, string> everyShrink ) => Console.Write(everyShrink.Invoke(args)); public void OnStartFixture(Type t) => Console.Write(Runner.onStartFixtureToString(t)); } }
using System; using System.Collections.Generic; using Microsoft.FSharp.Core; using Microsoft.FSharp.Collections; using FsCheck; namespace Sharper.C.Testing { public struct InvariantRunner : IRunner { private readonly List<InvariantResult> results; private InvariantRunner(List<InvariantResult> results) { this.results = results; } public static InvariantRunner Mk() => new InvariantRunner(new List<InvariantResult>()); public IEnumerable<InvariantResult> Results => results; public void OnArguments ( int ntest , FSharpList<object> args , FSharpFunc<int, FSharpFunc<FSharpList<object>, string>> every ) => Runner.consoleRunner.OnArguments(ntest, args, every); public void OnFinished(string name, TestResult result) => results.Add(InvariantResult.Mk(name, result)); public void OnShrink ( FSharpList<object> args , FSharpFunc<FSharpList<object>, string> everyShrink ) => Runner.consoleRunner.OnShrink(args, everyShrink); public void OnStartFixture(Type t) => Runner.consoleRunner.OnStartFixture(t); } }
mit
C#
8669114581815386999bdb74eb851cdc1c705cb6
Remove unused using.
shrimpy/kudu,oliver-feng/kudu,badescuga/kudu,sitereactor/kudu,sitereactor/kudu,shrimpy/kudu,badescuga/kudu,chrisrpatterson/kudu,WeAreMammoth/kudu-obsolete,juvchan/kudu,kenegozi/kudu,duncansmart/kudu,WeAreMammoth/kudu-obsolete,barnyp/kudu,bbauya/kudu,kali786516/kudu,projectkudu/kudu,YOTOV-LIMITED/kudu,kali786516/kudu,shibayan/kudu,sitereactor/kudu,YOTOV-LIMITED/kudu,EricSten-MSFT/kudu,sitereactor/kudu,uQr/kudu,oliver-feng/kudu,kali786516/kudu,chrisrpatterson/kudu,kenegozi/kudu,MavenRain/kudu,duncansmart/kudu,juvchan/kudu,juoni/kudu,MavenRain/kudu,shanselman/kudu,EricSten-MSFT/kudu,dev-enthusiast/kudu,MavenRain/kudu,projectkudu/kudu,puneet-gupta/kudu,shibayan/kudu,projectkudu/kudu,puneet-gupta/kudu,dev-enthusiast/kudu,kenegozi/kudu,uQr/kudu,uQr/kudu,mauricionr/kudu,juvchan/kudu,shibayan/kudu,shrimpy/kudu,juoni/kudu,kenegozi/kudu,juvchan/kudu,juoni/kudu,YOTOV-LIMITED/kudu,bbauya/kudu,bbauya/kudu,puneet-gupta/kudu,chrisrpatterson/kudu,oliver-feng/kudu,EricSten-MSFT/kudu,EricSten-MSFT/kudu,bbauya/kudu,MavenRain/kudu,sitereactor/kudu,barnyp/kudu,barnyp/kudu,mauricionr/kudu,kali786516/kudu,badescuga/kudu,puneet-gupta/kudu,dev-enthusiast/kudu,mauricionr/kudu,puneet-gupta/kudu,shanselman/kudu,EricSten-MSFT/kudu,juoni/kudu,WeAreMammoth/kudu-obsolete,badescuga/kudu,oliver-feng/kudu,barnyp/kudu,mauricionr/kudu,shanselman/kudu,chrisrpatterson/kudu,projectkudu/kudu,badescuga/kudu,duncansmart/kudu,YOTOV-LIMITED/kudu,uQr/kudu,duncansmart/kudu,shibayan/kudu,projectkudu/kudu,shibayan/kudu,dev-enthusiast/kudu,juvchan/kudu,shrimpy/kudu
Kudu.Core/Deployment/Generator/NodeSiteBuilder.cs
Kudu.Core/Deployment/Generator/NodeSiteBuilder.cs
using Kudu.Contracts.Settings; using Kudu.Core.SourceControl.Git; using System; using System.Globalization; using System.Threading.Tasks; namespace Kudu.Core.Deployment.Generator { public class NodeSiteBuilder : BaseBasicBuilder { public NodeSiteBuilder(IEnvironment environment, IDeploymentSettingsManager settings, IBuildPropertyProvider propertyProvider, string repositoryPath, string projectPath) : base(environment, settings, propertyProvider, repositoryPath, projectPath, "--node") { } public override Task Build(DeploymentContext context) { try { return base.Build(context); } finally { SafeCleanWebConfig(context); } } private void SafeCleanWebConfig(DeploymentContext context) { try { var git = new GitExecutable(Environment.RepositoryPath, DeploymentSettings.GetCommandIdleTimeout()); if (!String.IsNullOrEmpty(HomePath)) { git.SetHomePath(HomePath); } var args = String.Format(CultureInfo.InvariantCulture, "clean -f {0}\\web.config", this.ProjectPath); git.Execute(args); } catch (Exception ex) { context.Logger.Log(ex); } } } }
using Kudu.Contracts.Settings; using Kudu.Core.SourceControl.Git; using System; using System.Globalization; using System.IO.Abstractions; using System.Threading.Tasks; namespace Kudu.Core.Deployment.Generator { public class NodeSiteBuilder : BaseBasicBuilder { public NodeSiteBuilder(IEnvironment environment, IDeploymentSettingsManager settings, IBuildPropertyProvider propertyProvider, string repositoryPath, string projectPath) : base(environment, settings, propertyProvider, repositoryPath, projectPath, "--node") { } public override Task Build(DeploymentContext context) { try { return base.Build(context); } finally { SafeCleanWebConfig(context); } } private void SafeCleanWebConfig(DeploymentContext context) { try { var git = new GitExecutable(Environment.RepositoryPath, DeploymentSettings.GetCommandIdleTimeout()); if (!String.IsNullOrEmpty(HomePath)) { git.SetHomePath(HomePath); } var args = String.Format(CultureInfo.InvariantCulture, "clean -f {0}\\web.config", this.ProjectPath); git.Execute(args); } catch (Exception ex) { context.Logger.Log(ex); } } } }
apache-2.0
C#
628443596f7a7882f015eefc8d7e11ff6b9039a7
remove redundant field
WojcikMike/docs.particular.net,SzymonPobiega/docs.particular.net,eclaus/docs.particular.net,pedroreys/docs.particular.net,pashute/docs.particular.net,yuxuac/docs.particular.net
Snippets/Snippets_5/Logging/BuiltInConfig.cs
Snippets/Snippets_5/Logging/BuiltInConfig.cs
using NServiceBus.Logging; public class BuiltInConfig { public void ChangingDefaults() { #region OverrideLoggingDefaultsInCode var defaultFactory = LogManager.Use<DefaultFactory>(); defaultFactory.Directory("pathToLoggingDirectory"); defaultFactory.Level(LogLevel.Debug); #endregion } }
using NServiceBus.Logging; public class BuiltInConfig { string pathToLoggingDirectory = ""; public void ChangingDefaults() { #region OverrideLoggingDefaultsInCode var defaultFactory = LogManager.Use<DefaultFactory>(); defaultFactory.Directory(pathToLoggingDirectory); defaultFactory.Level(LogLevel.Debug); #endregion } }
apache-2.0
C#
d7be02f994d5fc952d14dacdccd4c9c1fa21bd8a
Add tests
skonves/Konves.KScript
tests/Konves.KScript.UnitTests/ExpressionTestFixture.cs
tests/Konves.KScript.UnitTests/ExpressionTestFixture.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Konves.KScript.UnitTests { [TestClass] public class ExpressionTestFixture { [TestCategory(nameof(Expression))] [TestMethod] public void EvaluateTest() { string stringValue = "string value"; decimal decimalValue = 5m; DateTime dateValue = DateTime.Parse("2015-1-1"); bool boolValue = true; IDictionary<string, object> state = new Dictionary<string, object> { { nameof(stringValue), stringValue }, { nameof(decimalValue), decimalValue }, { nameof(dateValue), dateValue }, { nameof(boolValue), boolValue } }; DoEvaluateTest($"{{{nameof(stringValue)}}} = '{stringValue}'", state, true); DoEvaluateTest($"TRUE != FALSE", state, true); DoEvaluateTest($"NOW > '2000-1-1'", state, true); DoEvaluateTest($"NULL IS NOT NULL", state, false); DoEvaluateTest($"(5) > (1)", state, true); } private void DoEvaluateTest(string s, IDictionary<string, object> state, bool expected) { // Arrange IExpression expression = new Expression(s); // Act bool result = expression.Evaluate(state); // Assert Assert.AreEqual(expected, result); } [TestCategory(nameof(Expression))] [ExpectedException(typeof(ArgumentException))] [TestMethod] public void EvaluateTest_BadSyntax() { DoEvaluateTest_BadSyntax("not a valid expression", null); } private void DoEvaluateTest_BadSyntax(string s, IDictionary<string, object> state) { // Arrange IExpression expression = new Expression(s); // Act bool result = expression.Evaluate(state); // Assert Assert.Fail(); } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Konves.KScript.UnitTests { [TestClass] public class ExpressionTestFixture { [TestCategory(nameof(Expression))] [TestMethod] public void EvaluateTest() { string stringValue = "string value"; decimal decimalValue = 5m; DateTime dateValue = DateTime.Parse("2015-1-1"); bool boolValue = true; IDictionary<string, object> state = new Dictionary<string, object> { { nameof(stringValue), stringValue }, { nameof(decimalValue), decimalValue }, { nameof(dateValue), dateValue }, { nameof(boolValue), boolValue } }; DoEvaluateTest($"{{{nameof(stringValue)}}} = '{stringValue}'", state, true); DoEvaluateTest($"TRUE != FALSE", state, true); } private void DoEvaluateTest(string s, IDictionary<string, object> state, bool expected) { // Arrange IExpression expression = new Expression(s); // Act bool result = expression.Evaluate(state); // Assert Assert.AreEqual(expected, result); } [TestCategory(nameof(Expression))] [ExpectedException(typeof(ArgumentException))] [TestMethod] public void EvaluateTest_BadSyntax() { DoEvaluateTest_BadSyntax("not a valid expression", null); } private void DoEvaluateTest_BadSyntax(string s, IDictionary<string, object> state) { // Arrange IExpression expression = new Expression(s); // Act bool result = expression.Evaluate(state); // Assert Assert.Fail(); } } }
apache-2.0
C#
a2f90c1a3b9adfa96902bd00871bbaf28fbbd4aa
Apply ReSharper magic.
jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr
test/HelloCoreClrApp.Test/TestserverStartup.cs
test/HelloCoreClrApp.Test/TestserverStartup.cs
using System; using HelloCoreClrApp.Data; using HelloCoreClrApp.Data.Entities; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; namespace HelloCoreClrApp.Test { public class TestserverStartup : Startup { public TestserverStartup(IHostingEnvironment env) : base(env) { } public override DbContextOptionsBuilder<GreetingDbContext> CreateDatabaseOptions() { var builder = new DbContextOptionsBuilder<GreetingDbContext>() .UseInMemoryDatabase("TestserverStartup"); SeedDatabase(builder.Options); return builder; } private static void SeedDatabase(DbContextOptions options) { using (var db = new GreetingDbContext(options)) { db.Greetings.Add(new Greeting{Name = "First Greeting", TimestampUtc = DateTime.Now.ToUniversalTime()}); db.Greetings.Add(new Greeting{Name = "Second Greeting", TimestampUtc = DateTime.Now.ToUniversalTime()}); db.SaveChanges(); } } } }
using System; using HelloCoreClrApp.Data; using HelloCoreClrApp.Data.Entities; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; namespace HelloCoreClrApp.Test { public class TestserverStartup : Startup { public TestserverStartup(IHostingEnvironment env) : base(env) { } public override DbContextOptionsBuilder<GreetingDbContext> CreateDatabaseOptions() { var builder = new DbContextOptionsBuilder<GreetingDbContext>() .UseInMemoryDatabase("TestserverStartup"); SeedDatabase(builder.Options); return builder; } private void SeedDatabase(DbContextOptions<GreetingDbContext> options) { using (var db = new GreetingDbContext(options)) { db.Greetings.Add(new Greeting{Name = "First Greeting", TimestampUtc = DateTime.Now.ToUniversalTime()}); db.Greetings.Add(new Greeting{Name = "Second Greeting", TimestampUtc = DateTime.Now.ToUniversalTime()}); db.SaveChanges(); } } } }
mit
C#
c39f8ec7f0cec218feda8445c390926aa17e659a
make PocketBoolean internal
ceee/PocketSharp
PocketSharp/Models/PocketBoolean.cs
PocketSharp/Models/PocketBoolean.cs
namespace PocketSharp.Models { internal enum PocketBoolean { No = 0, Yes = 1, IsType = 2 } }
namespace PocketSharp.Models { public enum PocketBoolean { No = 0, Yes = 1, IsType = 2 } }
mit
C#
fc1dee29a0d372e3c0ba6a8f152943ce7f881620
Change DragOperationsMask to uint and make Every = UInt32.MaxValue
haozhouxu/CefSharp,rover886/CefSharp,dga711/CefSharp,battewr/CefSharp,dga711/CefSharp,illfang/CefSharp,joshvera/CefSharp,Haraguroicha/CefSharp,twxstar/CefSharp,Livit/CefSharp,dga711/CefSharp,NumbersInternational/CefSharp,haozhouxu/CefSharp,Octopus-ITSM/CefSharp,zhangjingpu/CefSharp,windygu/CefSharp,gregmartinhtc/CefSharp,Haraguroicha/CefSharp,rlmcneary2/CefSharp,jamespearce2006/CefSharp,joshvera/CefSharp,zhangjingpu/CefSharp,windygu/CefSharp,Octopus-ITSM/CefSharp,battewr/CefSharp,ruisebastiao/CefSharp,AJDev77/CefSharp,Livit/CefSharp,Livit/CefSharp,NumbersInternational/CefSharp,twxstar/CefSharp,ruisebastiao/CefSharp,wangzheng888520/CefSharp,wangzheng888520/CefSharp,zhangjingpu/CefSharp,joshvera/CefSharp,haozhouxu/CefSharp,AJDev77/CefSharp,NumbersInternational/CefSharp,ruisebastiao/CefSharp,wangzheng888520/CefSharp,gregmartinhtc/CefSharp,rover886/CefSharp,haozhouxu/CefSharp,windygu/CefSharp,AJDev77/CefSharp,Haraguroicha/CefSharp,jamespearce2006/CefSharp,illfang/CefSharp,ITGlobal/CefSharp,illfang/CefSharp,NumbersInternational/CefSharp,yoder/CefSharp,rover886/CefSharp,twxstar/CefSharp,Livit/CefSharp,rlmcneary2/CefSharp,illfang/CefSharp,gregmartinhtc/CefSharp,jamespearce2006/CefSharp,ruisebastiao/CefSharp,jamespearce2006/CefSharp,VioletLife/CefSharp,yoder/CefSharp,AJDev77/CefSharp,yoder/CefSharp,ITGlobal/CefSharp,yoder/CefSharp,dga711/CefSharp,gregmartinhtc/CefSharp,Octopus-ITSM/CefSharp,ITGlobal/CefSharp,Haraguroicha/CefSharp,zhangjingpu/CefSharp,VioletLife/CefSharp,VioletLife/CefSharp,battewr/CefSharp,battewr/CefSharp,rlmcneary2/CefSharp,Octopus-ITSM/CefSharp,rover886/CefSharp,rlmcneary2/CefSharp,wangzheng888520/CefSharp,jamespearce2006/CefSharp,rover886/CefSharp,VioletLife/CefSharp,windygu/CefSharp,joshvera/CefSharp,twxstar/CefSharp,ITGlobal/CefSharp,Haraguroicha/CefSharp
CefSharp/DragOperationsMask.cs
CefSharp/DragOperationsMask.cs
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; namespace CefSharp { [Flags] public enum DragOperationsMask : uint { None = 0, Copy = 1, Link = 2, Generic = 4, Private = 8, Move = 16, Delete = 32, Every = UInt32.MaxValue } }
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; namespace CefSharp { [Flags] public enum DragOperationsMask { None = 0, Copy = 1, Link = 2, Generic = 4, Private = 8, Move = 16, Delete = 32, Every = None | Copy | Link | Generic | Private | Move | Delete } }
bsd-3-clause
C#
1abe6274db0660127c6b6e0291df52f35c75e2c1
Replace <inheritdoc/> by Hard-Coded Documentation
JKarathiya/Lean,QuantConnect/Lean,StefanoRaggi/Lean,jameschch/Lean,AlexCatarino/Lean,JKarathiya/Lean,StefanoRaggi/Lean,AlexCatarino/Lean,QuantConnect/Lean,StefanoRaggi/Lean,jameschch/Lean,QuantConnect/Lean,AlexCatarino/Lean,jameschch/Lean,jameschch/Lean,StefanoRaggi/Lean,JKarathiya/Lean,AlexCatarino/Lean,jameschch/Lean,QuantConnect/Lean,StefanoRaggi/Lean,JKarathiya/Lean
Common/Data/Custom/NullData.cs
Common/Data/Custom/NullData.cs
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace QuantConnect.Data.Custom { /// <summary> /// Represents a custom data type that works as a heartbeat of data in live mode /// </summary> public class NullData : BaseData { /// <summary> /// The end time of this data. Some data covers spans (trade bars) /// and as such we want to know the entire time span covered /// </summary> public override DateTime EndTime { get; set; } /// <summary> /// Return the URL string source of localhost as placeholder, /// since this custom data class does not use any data. /// </summary> /// <param name="config">Configuration object</param> /// <param name="date">Date of this source file</param> /// <param name="isLiveMode">True if we're in live mode</param> /// <returns>String URL of localhost</returns> public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode) { return new SubscriptionDataSource("http://localhost/", SubscriptionTransportMedium.Rest); } /// <summary> /// Returns a new instance of the <see cref="NullData"/>. Its Value property is always 1 /// and the Time property is the current date/time of the exchange. /// </summary> /// <param name="config">Subscription data config setup object</param> /// <param name="line">Line of the source document.</param> /// <param name="date">Date of the requested data</param> /// <param name="isLiveMode">True if we're in live mode</param> /// <returns>Instance of <see cref="NullData"/></returns> public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) { var nullData = new NullData { Symbol = config.Symbol, Time = DateTime.UtcNow.ConvertFromUtc(config.ExchangeTimeZone), Value = 1 }; nullData.EndTime = nullData.Time + config.Resolution.ToTimeSpan(); return nullData; } } }
/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace QuantConnect.Data.Custom { /// <summary> /// Represents a custom data type that works as a heartbeat of data in live mode /// </summary> public class NullData : BaseData { /// <inheritdoc/> public override DateTime EndTime { get; set; } /// <inheritdoc/> public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode) { return new SubscriptionDataSource("http://localhost/", SubscriptionTransportMedium.Rest); } /// <summary> /// Returns a new instance of the <see cref="NullData"/>. Its Value property is always 1 /// and the Time property is the current date/time of the exchange. /// </summary> /// <param name="config">Subscription data config setup object</param> /// <param name="line">Line of the source document.</param> /// <param name="date">Date of the requested data</param> /// <param name="isLiveMode">True if we're in live mode</param> /// <returns>Instance of <see cref="NullData"/></returns> public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) { var nullData = new NullData { Symbol = config.Symbol, Time = DateTime.UtcNow.ConvertFromUtc(config.ExchangeTimeZone), Value = 1 }; nullData.EndTime = nullData.Time + config.Resolution.ToTimeSpan(); return nullData; } } }
apache-2.0
C#
7e0b214510fa6e3f4b1cd3f0b6d6474145ce5893
Remove account and api key
jnnfrlocke/VendingMachineNew,jnnfrlocke/VendingMachineNew,jnnfrlocke/VendingMachineNew
TwilioAPI.cs
TwilioAPI.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Web; using Twilio; using Twilio.Rest.Api.V2010.Account; using Twilio.Types; namespace VendingMachineNew { public class TwilioAPI { static void Main(string[] args) { SendSms().Wait(); Console.Write("Press any key to continue."); Console.ReadKey(); } static async Task SendSms() { // Your Account SID from twilio.com/console var accountSid = "x"; // Your Auth Token from twilio.com/console var authToken = "x"; TwilioClient.Init(accountSid, authToken); var message = await MessageResource.CreateAsync( to: new PhoneNumber("+14148070975"), from: new PhoneNumber("+14142693915"), body: "The confirmation number will be here"); Console.WriteLine(message.Sid); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Web; using Twilio; using Twilio.Rest.Api.V2010.Account; using Twilio.Types; namespace VendingMachineNew { public class TwilioAPI { static void Main(string[] args) { SendSms().Wait(); Console.Write("Press any key to continue."); Console.ReadKey(); } static async Task SendSms() { // Your Account SID from twilio.com/console var accountSid = "AC745137d20b51ab66c4fd18de86d3831c"; // Your Auth Token from twilio.com/console var authToken = "789153e001d240e55a499bf070e75dfe"; TwilioClient.Init(accountSid, authToken); var message = await MessageResource.CreateAsync( to: new PhoneNumber("+14148070975"), from: new PhoneNumber("+14142693915"), body: "The confirmation number will be here"); Console.WriteLine(message.Sid); } } }
mit
C#
3df96746c6dc8951428d0a674b11faf07fd1d513
Set Configuration.DefaultNameOrConnectionString for unit tests by default.
verdentk/aspnetboilerplate,ilyhacker/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ZhaoRd/aspnetboilerplate,zquans/aspnetboilerplate,ryancyq/aspnetboilerplate,virtualcca/aspnetboilerplate,jaq316/aspnetboilerplate,ShiningRush/aspnetboilerplate,carldai0106/aspnetboilerplate,zquans/aspnetboilerplate,luchaoshuai/aspnetboilerplate,Nongzhsh/aspnetboilerplate,zclmoon/aspnetboilerplate,beratcarsi/aspnetboilerplate,AlexGeller/aspnetboilerplate,virtualcca/aspnetboilerplate,yuzukwok/aspnetboilerplate,verdentk/aspnetboilerplate,ryancyq/aspnetboilerplate,zclmoon/aspnetboilerplate,s-takatsu/aspnetboilerplate,fengyeju/aspnetboilerplate,berdankoca/aspnetboilerplate,Nongzhsh/aspnetboilerplate,verdentk/aspnetboilerplate,jaq316/aspnetboilerplate,jaq316/aspnetboilerplate,beratcarsi/aspnetboilerplate,ryancyq/aspnetboilerplate,virtualcca/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ilyhacker/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,carldai0106/aspnetboilerplate,oceanho/aspnetboilerplate,yuzukwok/aspnetboilerplate,fengyeju/aspnetboilerplate,andmattia/aspnetboilerplate,zquans/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ShiningRush/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ilyhacker/aspnetboilerplate,andmattia/aspnetboilerplate,andmattia/aspnetboilerplate,ShiningRush/aspnetboilerplate,ZhaoRd/aspnetboilerplate,carldai0106/aspnetboilerplate,s-takatsu/aspnetboilerplate,oceanho/aspnetboilerplate,fengyeju/aspnetboilerplate,zclmoon/aspnetboilerplate,ZhaoRd/aspnetboilerplate,ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate,AlexGeller/aspnetboilerplate,yuzukwok/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,s-takatsu/aspnetboilerplate,berdankoca/aspnetboilerplate,oceanho/aspnetboilerplate,Nongzhsh/aspnetboilerplate,AlexGeller/aspnetboilerplate,beratcarsi/aspnetboilerplate,berdankoca/aspnetboilerplate
src/Abp.TestBase/TestBase/AbpTestBaseModule.cs
src/Abp.TestBase/TestBase/AbpTestBaseModule.cs
using System.Reflection; using Abp.Modules; namespace Abp.TestBase { [DependsOn(typeof(AbpKernelModule))] public class AbpTestBaseModule : AbpModule { public override void PreInitialize() { Configuration.EventBus.UseDefaultEventBus = false; Configuration.DefaultNameOrConnectionString = "Default"; } public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); } } }
using System.Reflection; using Abp.Modules; namespace Abp.TestBase { [DependsOn(typeof(AbpKernelModule))] public class AbpTestBaseModule : AbpModule { public override void PreInitialize() { Configuration.EventBus.UseDefaultEventBus = false; } public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); } } }
mit
C#
5769d91d6b780fdb122bc5f5c7fbb5d0e2102138
Update ExtractorService with new path for storing files
jeroen-corsius/smart-meter
SmartMeter.Business/Extractor/ExtractorService.cs
SmartMeter.Business/Extractor/ExtractorService.cs
using System; using System.IO; using SmartMeter.Business.Interface.Extractor; namespace SmartMeter.Business.Extractor { public class ExtractorService { public void Execute() { IReadSmartMeter smartMeterReader = new SmartMeterReader(); IWriteFile fileWriter = new FileWriter(); string fileContents = smartMeterReader.Read(); fileWriter .WithPath(Path.Combine(Path.Combine(Directory.GetDirectoryRoot(AppContext.BaseDirectory), "applicationdata", "smartmeter", "extracted"))) .WithFilename(CreateFilename()) .WithContents(fileContents) .Write(); } public string CreateFilename() { return $"{DateTime.UtcNow:yyyyMMddHHmmss}.smf"; } } }
using System; using System.IO; using SmartMeter.Business.Interface; using SmartMeter.Business.Interface.Extractor; namespace SmartMeter.Business.Extractor { public class ExtractorService { public void Execute() { IReadSmartMeter smartMeterReader = new SmartMeterReader(); IWriteFile fileWriter = new FileWriter(); string fileContents = smartMeterReader.Read(); fileWriter .WithPath(Path.Combine(AppContext.BaseDirectory, "files", "extracted")) .WithFilename(CreateFilename()) .WithContents(fileContents) .Write(); } public string CreateFilename() { return $"{DateTime.UtcNow:yyyyMMddHHmmss}.smf"; } } }
mit
C#
6e4013a7a1aa96e4edfbc819623f2fa1ba8002b5
Update CommandsController - mark fields as readomly
mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX
Modix.WebServer/Controllers/CommandsController.cs
Modix.WebServer/Controllers/CommandsController.cs
using Microsoft.AspNetCore.Mvc; using Modix.Services.CommandHelp; namespace Modix.WebServer.Controllers { [Route("~/api")] public class CommandsController : Controller { private readonly CommandHelpService _commandHelpService; public CommandsController(CommandHelpService commandHelpService) { _commandHelpService = commandHelpService; } [HttpGet("commands")] public IActionResult Commands() { return Ok(_commandHelpService.GetData()); } } }
using Microsoft.AspNetCore.Mvc; using Modix.Services.CommandHelp; namespace Modix.WebServer.Controllers { [Route("~/api")] public class CommandsController : Controller { private CommandHelpService _commandHelpService; public CommandsController(CommandHelpService commandHelpService) { _commandHelpService = commandHelpService; } [HttpGet("commands")] public IActionResult Commands() { return Ok(_commandHelpService.GetData()); } } }
mit
C#
17b483249afab985edbb1f176356957fe8cd14e3
Comment on SquareBoundary
davidaramant/buddhabrot,davidaramant/buddhabrot
src/Buddhabrot.Core/Boundary/SquareBoundary.cs
src/Buddhabrot.Core/Boundary/SquareBoundary.cs
using System.Drawing; namespace Buddhabrot.Core.Boundary; /// <summary> /// A square in screen coordinates (+Y is down) /// </summary> public readonly record struct SquareBoundary( int X, int Y, int Scale) { public bool IsPoint => Scale == 0; public int Length => 1 << Scale; public int QuadrantLength => 1 << (Scale - 1); public Point Center => new(X + QuadrantLength, Y + QuadrantLength); public SquareBoundary OffsetBy(int deltaX, int deltaY) => new(X + deltaX, Y + deltaY, Scale); public SquareBoundary ZoomIn(int x, int y) => new( Scale: Scale + 1, X: X - (x - X), Y: Y - (y - Y)); public SquareBoundary ZoomOut(int width, int height) => new( Scale: Scale - 1, X: X - (X - (width / 2)) / 2, Y: Y - (Y - (height / 2)) / 2); public SquareBoundary GetNWQuadrant() => this with {Scale = Scale - 1}; public SquareBoundary GetNEQuadrant() => new(X + QuadrantLength, Y, Scale - 1); public SquareBoundary GetSEQuadrant() => new(X + QuadrantLength, Y + QuadrantLength, Scale - 1); public SquareBoundary GetSWQuadrant() => new(X, Y + QuadrantLength, Scale - 1); public Rectangle IntersectWith(Rectangle rect) { int length = Length; int x1 = Math.Max(rect.X, X); int x2 = Math.Min(rect.X + rect.Width, X + length); int y1 = Math.Max(rect.Y, Y); int y2 = Math.Min(rect.Y + rect.Height, Y + length); if (x2 >= x1 && y2 >= y1) { return new Rectangle(x1, y1, x2 - x1, y2 - y1); } return Rectangle.Empty; } public override string ToString() => $"({X}, {Y}), SideLength = {1 << Scale}"; public static SquareBoundary GetLargestCenteredSquareInside(int width, int height) { var scale = Utility.GetLargestPowerOfTwoLessThan(Math.Min(width, height)); var length = 1 << scale; var x = (width - length) / 2; var y = (height - length) / 2; return new(x, y, scale); } }
using System.Drawing; namespace Buddhabrot.Core.Boundary; public readonly record struct SquareBoundary( int X, int Y, int Scale) { public bool IsPoint => Scale == 0; public int Length => 1 << Scale; public int QuadrantLength => 1 << (Scale - 1); public Point Center => new(X + QuadrantLength, Y + QuadrantLength); public SquareBoundary OffsetBy(int deltaX, int deltaY) => new(X + deltaX, Y + deltaY, Scale); public SquareBoundary ZoomIn(int x, int y) => new( Scale: Scale + 1, X: X - (x - X), Y: Y - (y - Y)); public SquareBoundary ZoomOut(int width, int height) => new( Scale: Scale - 1, X: X - (X - (width / 2)) / 2, Y: Y - (Y - (height / 2)) / 2); public SquareBoundary GetNWQuadrant() => this with {Scale = Scale - 1}; public SquareBoundary GetNEQuadrant() => new(X + QuadrantLength, Y, Scale - 1); public SquareBoundary GetSEQuadrant() => new(X + QuadrantLength, Y + QuadrantLength, Scale - 1); public SquareBoundary GetSWQuadrant() => new(X, Y + QuadrantLength, Scale - 1); public Rectangle IntersectWith(Rectangle rect) { int length = Length; int x1 = Math.Max(rect.X, X); int x2 = Math.Min(rect.X + rect.Width, X + length); int y1 = Math.Max(rect.Y, Y); int y2 = Math.Min(rect.Y + rect.Height, Y + length); if (x2 >= x1 && y2 >= y1) { return new Rectangle(x1, y1, x2 - x1, y2 - y1); } return Rectangle.Empty; } public override string ToString() => $"({X}, {Y}), SideLength = {1 << Scale}"; public static SquareBoundary GetLargestCenteredSquareInside(int width, int height) { var scale = Utility.GetLargestPowerOfTwoLessThan(Math.Min(width, height)); var length = 1 << scale; var x = (width - length) / 2; var y = (height - length) / 2; return new(x, y, scale); } }
bsd-2-clause
C#
a7fa3b11a2ef001745ab5169b55039abf036df5c
Fix DelayableAction delays persisting DAH serialization
Arkhist/Hacknet-Pathfinder,Arkhist/Hacknet-Pathfinder,Arkhist/Hacknet-Pathfinder,Arkhist/Hacknet-Pathfinder
PathfinderAPI/Action/DelayablePathfinderAction.cs
PathfinderAPI/Action/DelayablePathfinderAction.cs
using System; using System.Xml; using Hacknet; using Pathfinder.Util; using Pathfinder.Util.XML; namespace Pathfinder.Action { public abstract class DelayablePathfinderAction : PathfinderAction { [XMLStorage] public string DelayHost; [XMLStorage] public string Delay; private DelayableActionSystem delayHost; private float delay = 0f; public sealed override void Trigger(object os_obj) { if (delayHost == null && DelayHost != null) { var delayComp = Programs.getComputer(OS.currentInstance, DelayHost); if (delayComp == null) throw new FormatException($"{this.GetType().Name}: DelayHost could not be found"); delayHost = DelayableActionSystem.FindDelayableActionSystemOnComputer(delayComp); } if (delay <= 0f || delayHost == null) { Trigger((OS)os_obj); return; } DelayHost = null; Delay = null; delayHost.AddAction(this, delay); delay = 0f; } public abstract void Trigger(OS os); public override void LoadFromXml(ElementInfo info) { base.LoadFromXml(info); if (Delay != null && !float.TryParse(Delay, out delay)) throw new FormatException($"{this.GetType().Name}: Couldn't parse delay time!"); } } }
using System; using System.Xml; using Hacknet; using Pathfinder.Util; using Pathfinder.Util.XML; namespace Pathfinder.Action { public abstract class DelayablePathfinderAction : PathfinderAction { [XMLStorage] public string DelayHost; [XMLStorage] public string Delay; private DelayableActionSystem delayHost; private float delay = 0f; public sealed override void Trigger(object os_obj) { if (delayHost == null && DelayHost != null) { var delayComp = Programs.getComputer(OS.currentInstance, DelayHost); if (delayComp == null) throw new FormatException($"{this.GetType().Name}: DelayHost could not be found"); delayHost = DelayableActionSystem.FindDelayableActionSystemOnComputer(delayComp); } if (delay <= 0f || delayHost == null) { Trigger((OS)os_obj); return; } delayHost.AddAction(this, delay); delay = 0f; } public abstract void Trigger(OS os); public override void LoadFromXml(ElementInfo info) { base.LoadFromXml(info); if (Delay != null && !float.TryParse(Delay, out delay)) throw new FormatException($"{this.GetType().Name}: Couldn't parse delay time!"); } } }
mit
C#
2f4fa6670b1c88f9040957df90a58a5726fa183e
Update SettingsTable.cs
SE2-BAC/BAC-Tracker
BAC_Tracker/BAC_Tracker/BAC_Tracker.Android/Database/SettingsTable.cs
BAC_Tracker/BAC_Tracker/BAC_Tracker.Android/Database/SettingsTable.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Data; using SQLite; namespace BAC_Tracker.Droid.Fragments { //Had to recreate the Person class in Android to get the SQLite working properly. [Table("Settings")] class Settings { public int ID { get; set; } public int IsMale { get; set; } public double Weight { get; set; } //Will put list of drinks in the Event class. public Settings() { } public Settings(int isMale, double weight) { IsMale = isMale; Weight = weight; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Data; using SQLite; namespace BAC_Tracker.Droid.Fragments { //Had to recreate the Person class in Android to get the SQLite working properly. [Table("Settings")] class Settings { public int ID { get; set; } public bool IsMale { get; set; } public double Weight { get; set; } //Will put list of drinks in the Event class. public Settings() { } public Settings(bool isMale, double weight) { IsMale = isMale; Weight = weight; } } }
apache-2.0
C#
a93c3cc2c4c0da69e5831f2476e222a20b87fbbb
add menu items
jdehlin/Twitta,jdehlin/Twitta
Source/Twitta.Website/Views/Shared/_Layout.cshtml
Source/Twitta.Website/Views/Shared/_Layout.cshtml
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@ViewBag.Title - Twitta</title> @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/jqueryval") @Scripts.Render("~/bundles/bootstrap") @Scripts.Render("~/bundles/knockout") @StackExchange.Profiling.MiniProfiler.RenderIncludes() </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> @Html.ActionLink("Twitta", "Index", "Home", null, new { @class = "navbar-brand" }) @Html.ActionLink("Apps", "Index", "Applications", null, new { @class = "navbar-brand" }) @Html.ActionLink("Searches", "Index", "Search", null, new { @class = "navbar-brand" }) </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li>@Html.ActionLink("Home", "Index", "Home")</li> <li>@Html.ActionLink("View Errors", "Exceptions", "Error")</li> </ul> </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year</p> </footer> </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @RenderSection("scripts", required: false) </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@ViewBag.Title - Twitta</title> @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/jqueryval") @Scripts.Render("~/bundles/bootstrap") @Scripts.Render("~/bundles/knockout") @StackExchange.Profiling.MiniProfiler.RenderIncludes() </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> @Html.ActionLink("Twitta", "Index", "Home", null, new { @class = "navbar-brand" }) </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li>@Html.ActionLink("Home", "Index", "Home")</li> <li>@Html.ActionLink("View Errors", "Exceptions", "Error")</li> </ul> </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year</p> </footer> </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @RenderSection("scripts", required: false) </body> </html>
mit
C#
b2cbb48cc3952d53acea7a677e8407f7e5e30ecb
Fix for shader preview window in material tool appearing and then just disappearing
xlgames-inc/XLE,xlgames-inc/XLE,xlgames-inc/XLE,xlgames-inc/XLE,xlgames-inc/XLE,xlgames-inc/XLE,xlgames-inc/XLE,xlgames-inc/XLE
Tools/ControlsLibrary/BasicControls/TextWindow.cs
Tools/ControlsLibrary/BasicControls/TextWindow.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace ControlsLibrary.BasicControls { public partial class TextWindow : Form { public TextWindow() { InitializeComponent(); } static public void ShowModal(String text) { using (var dlg = new TextWindow()) { dlg.Text = text; dlg.ShowDialog(); } } static public void Show(String text) { new TextWindow() { Text = text }.Show(); } public new string Text { set { _textBox.Text = value; } } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace ControlsLibrary.BasicControls { public partial class TextWindow : Form { public TextWindow() { InitializeComponent(); } static public void ShowModal(String text) { using (var dlg = new TextWindow()) { dlg.Text = text; dlg.ShowDialog(); } } static public void Show(String text) { using (var dlg = new TextWindow()) { dlg.Text = text; dlg.Show(); } } public new string Text { set { _textBox.Text = value; } } } }
mit
C#
a0aa88cc73a3cf540734b4240dfbc92da433b68e
update docs on IPolygon
Voxelgon/Voxelgon,Voxelgon/Voxelgon
Assets/Voxelgon/Geometry/Interfaces/IPolygon.cs
Assets/Voxelgon/Geometry/Interfaces/IPolygon.cs
using System.Collections.Generic; using UnityEngine; namespace Voxelgon.Geometry { public interface IPolygon { //PROPERTIES //access each vertex individually by its index Vector3 this[int index] { get; set; } //the normal of the clockwise polygon // if the polygon is invalid, return Vector3.zero Vector3 Normal { get; } //is the polygon convex? bool IsConvex { get; } //is the polygon valid? // must have >= 3 vertices bool IsValid { get; } //the area of the polygon float Area { get; } //the number of vertices in the polygon int VertexCount { get; } //METHODS //returns the winding order relative to the normal // 1 = clockwise //-1 = counter-clockwise // 0 = all points are colinear int WindingOrder(Vector3 normal); //returns whether or not `point` is on or inside the polygon bool Contains(Vector3 point); //reverses the polygon's winding order void Reverse(); //if the polygon is counter-clockwise, reverse it so it is clockwise void EnsureClockwise(Vector3 normal); //returns an array of triangles that make up the polygon List<Triangle> ToTriangles(); } }
using System.Collections.Generic; using UnityEngine; namespace Voxelgon.Geometry { public interface IPolygon { //PROPERTIES //access each vertex individually by its index Vector3 this[int index] { get; set; } //the normal of the clockwise polygon Vector3 Normal { get; } //is the polygon convex? bool IsConvex { get; } //is the polygon valid? // must have >= 3 vertices bool IsValid { get; } //the area of the polygon float Area { get; } //the number of vertices in the polygon int VertexCount { get; } //METHODS //returns the winding order relative to the normal // 1 = clockwise //-1 = counter-clockwise // 0 = all points are colinear int WindingOrder(Vector3 normal); //returns whether or not `point` is on or inside the polygon bool Contains(Vector3 point); //reverses the polygon's winding order void Reverse(); //if the polygon is counter-clockwise, reverse it so it is clockwise void EnsureClockwise(Vector3 normal); //returns an array of triangles that make up the polygon List<Triangle> ToTriangles(); } }
apache-2.0
C#
43a5991ccf47a4b55c2d23e6acd09223bf3946e2
read model
neuralaxis/carupano
Carupano/Configuration/ReadModelModelBuilder.cs
Carupano/Configuration/ReadModelModelBuilder.cs
using System; using System.Collections.Generic; using System.Text; namespace Carupano.Configuration { public class ReadModelModelBuilder<T> { public ReadModelModelBuilder<T> RespondsTo<TQuery>() { return this; } public ReadModelModelBuilder<T> AutoConfigure() { return this; } } }
using System; using System.Collections.Generic; using System.Text; namespace Carupano.Configuration { public class ReadModelModelBuilder<T> { public ReadModelModelBuilder<T> RespondsTo<TQuery>() { return this; } } }
mit
C#
321c18c8a5233d5ce7447e527bb1eb434407f151
Prueba 2|
ThinkUpStudios/TestGitHub
TestGit/Class1.cs
TestGit/Class1.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TestGit { class Class1 { public string lalala { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TestGit { class Class1 { public Int32 lalala { get; set; } } }
apache-2.0
C#
674100ec36eafc6b19ce268f8e55d8ca06fe206c
Remove test intead of fixing it 👍
TheTree/branch,TheTree/branch,TheTree/branch
dotnet/Tests/Clients/JsonTests/OptionTests.cs
dotnet/Tests/Clients/JsonTests/OptionTests.cs
using System; using Xunit; using Branch.Clients.Json; using System.Threading.Tasks; using Branch.Clients.Http.Models; using System.Collections.Generic; namespace Branch.Tests.Clients.JsonTests { public class OptionTests { [Fact] public void RespectOptions() { var options = new Options { Timeout = TimeSpan.FromMilliseconds(2500), }; var client = new JsonClient("https://example.com", options); Assert.Equal(client.Client.Options.Timeout, options.Timeout); } } }
using System; using Xunit; using Branch.Clients.Json; using System.Threading.Tasks; using Branch.Clients.Http.Models; using System.Collections.Generic; namespace Branch.Tests.Clients.JsonTests { public class OptionTests { [Fact] public void RespectOptions() { var options = new Options { Headers = new Dictionary<string, string> { {"X-Test-Header", "testing"}, {"Content-Type", "application/json"}, }, Timeout = TimeSpan.FromMilliseconds(2500), }; var client = new JsonClient("https://example.com", options); Assert.Equal(client.Client.Options.Timeout, options.Timeout); Assert.Equal(client.Client.Options.Headers, options.Headers); } } }
mit
C#
9b18ab9fb438a88c2be8a54aa3f567a9b1c398da
Fix crash in UWP design mode (#735)
Hitcents/Xamarin.Forms,Hitcents/Xamarin.Forms,Hitcents/Xamarin.Forms
Xamarin.Forms.Platform.WinRT/WindowsBasePage.cs
Xamarin.Forms.Platform.WinRT/WindowsBasePage.cs
using System; using System.ComponentModel; using Windows.ApplicationModel; #if WINDOWS_UWP namespace Xamarin.Forms.Platform.UWP #else namespace Xamarin.Forms.Platform.WinRT #endif { public abstract class WindowsBasePage : Windows.UI.Xaml.Controls.Page { public WindowsBasePage() { if (!DesignMode.DesignModeEnabled) { Windows.UI.Xaml.Application.Current.Suspending += OnApplicationSuspending; Windows.UI.Xaml.Application.Current.Resuming += OnApplicationResuming; } } protected Platform Platform { get; private set; } protected abstract Platform CreatePlatform(); protected void LoadApplication(Application application) { if (application == null) throw new ArgumentNullException("application"); Application.Current = application; Platform = CreatePlatform(); Platform.SetPage(Application.Current.MainPage); application.PropertyChanged += OnApplicationPropertyChanged; Application.Current.SendStart(); } void OnApplicationPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "MainPage") Platform.SetPage(Application.Current.MainPage); } void OnApplicationResuming(object sender, object e) { Application.Current.SendResume(); } async void OnApplicationSuspending(object sender, SuspendingEventArgs e) { SuspendingDeferral deferral = e.SuspendingOperation.GetDeferral(); await Application.Current.SendSleepAsync(); deferral.Complete(); } } }
using System; using System.ComponentModel; using Windows.ApplicationModel; #if WINDOWS_UWP namespace Xamarin.Forms.Platform.UWP #else namespace Xamarin.Forms.Platform.WinRT #endif { public abstract class WindowsBasePage : Windows.UI.Xaml.Controls.Page { public WindowsBasePage() { Windows.UI.Xaml.Application.Current.Suspending += OnApplicationSuspending; Windows.UI.Xaml.Application.Current.Resuming += OnApplicationResuming; } protected Platform Platform { get; private set; } protected abstract Platform CreatePlatform(); protected void LoadApplication(Application application) { if (application == null) throw new ArgumentNullException("application"); Application.Current = application; Platform = CreatePlatform(); Platform.SetPage(Application.Current.MainPage); application.PropertyChanged += OnApplicationPropertyChanged; Application.Current.SendStart(); } void OnApplicationPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "MainPage") Platform.SetPage(Application.Current.MainPage); } void OnApplicationResuming(object sender, object e) { Application.Current.SendResume(); } async void OnApplicationSuspending(object sender, SuspendingEventArgs e) { SuspendingDeferral deferral = e.SuspendingOperation.GetDeferral(); await Application.Current.SendSleepAsync(); deferral.Complete(); } } }
mit
C#
e0223ba9c7de2d2ec6dfc679a44702bb720bc9cf
fix typo
sitofabi/duplicati,mnaiman/duplicati,agrajaghh/duplicati,sitofabi/duplicati,gerco/duplicati,sitofabi/duplicati,klammbueddel/duplicati,gerco/duplicati,agrajaghh/duplicati,duplicati/duplicati,AndersGron/duplicati,klammbueddel/duplicati,AndersGron/duplicati,AndersGron/duplicati,klammbueddel/duplicati,klammbueddel/duplicati,a1ezzz/duplicati,duplicati/duplicati,mnaiman/duplicati,sitofabi/duplicati,AndersGron/duplicati,mnaiman/duplicati,duplicati/duplicati,a1ezzz/duplicati,a1ezzz/duplicati,klammbueddel/duplicati,agrajaghh/duplicati,agrajaghh/duplicati,gerco/duplicati,AndersGron/duplicati,gerco/duplicati,gerco/duplicati,a1ezzz/duplicati,duplicati/duplicati,mnaiman/duplicati,sitofabi/duplicati,agrajaghh/duplicati,mnaiman/duplicati,a1ezzz/duplicati,duplicati/duplicati
Duplicati/Library/Backend/SharePoint/Strings.cs
Duplicati/Library/Backend/SharePoint/Strings.cs
using Duplicati.Library.Localization.Short; namespace Duplicati.Library.Backend.Strings { internal static class SharePoint { public static string DisplayName { get { return LC.L(@"Microsoft SharePoint"); } } public static string Description { get { return LC.L(@"Supports connections to a SharePoint server (including OneDrive for Business). Allowed formats are ""mssp://tennant.sharepoint.com/PathToWeb//BaseDocLibrary/subfolder"" or ""mssp://username:password@tennant.sharepoint.com/PathToWeb//BaseDocLibrary/subfolder"". Use a double slash '//' in the path to denote the web from the documents library."); } } public static string DescriptionAuthPasswordLong { get { return LC.L(@"The password used to connect to the server. This may also be supplied as the environment variable ""AUTH_PASSWORD""."); } } public static string DescriptionAuthPasswordShort { get { return LC.L(@"Supplies the password used to connect to the server"); } } public static string DescriptionAuthUsernameLong { get { return LC.L(@"The username used to connect to the server. This may also be supplied as the environment variable ""AUTH_USERNAME""."); } } public static string DescriptionAuthUsernameShort { get { return LC.L(@"Supplies the username used to connect to the server"); } } public static string DescriptionIntegratedAuthenticationLong { get { return LC.L(@"If the server and client both supports integrated authentication, this option enables that authentication method. This is likely only available with windows servers and clients."); } } public static string DescriptionIntegratedAuthenticationShort { get { return LC.L(@"Use windows integrated authentication to connect to the server"); } } public static string DescriptionUseRecyclerLong { get { return LC.L(@"Use this option to have files moved to the recycle bin folder instead of removing them permanently when compacting or deleting backups."); } } public static string DescriptionUseRecyclerShort { get { return LC.L(@"Move deleted files to the recycle bin"); } } public static string MissingElementError(string serverrelpath, string hosturl) { return LC.L(@"Element with path '{0}' not found on host '{1}'.", serverrelpath, hosturl); } public static string NoSharePointWebFoundError(string url) { return LC.L(@"No SharePoint web could be logged in to at path '{0}'. Maybe wrong credentials. Or try using '//' in path to separate web from folder path.", url); } public static string WebTitleReadFailedError { get { return LC.L(@"Everything seemed alright, but then web title could not be read to test connection. Something's wrong."); } } } internal static class OneDriveForBusiness { public static string DisplayName { get { return LC.L(@"Microsoft OneDrive for Business"); } } public static string Description { get { return LC.L(@"Supports connections to Microsoft OneDrive for Business. Allowed formats are ""od4b://tennant.sharepoint.com/personal/username_domain/Documents/subfolder"" or ""od4b://username:password@tennant.sharepoint.com/personal/username_domain/Documents/folder"". You can use a double slash '//' in the path to denote the base path from the documents folder."); } } } }
using Duplicati.Library.Localization.Short; namespace Duplicati.Library.Backend.Strings { internal static class SharePoint { public static string DisplayName { get { return LC.L(@"Microsoft SharePoint"); } } public static string Description { get { return LC.L(@"Supports connections to a SharePoint server (including OneDrive for Business). Allowed formats are ""mssp://tennant.sharepoint.com/PathToWeb//BaseDocLibrary/subfolder"" or ""mssp://username:password@tennant.sharepoint.com/PathToWeb//BaseDocLibrary/subfolder"". Use a double slash '//' in the path to denote the web from the documents library."); } } public static string DescriptionAuthPasswordLong { get { return LC.L(@"The password used to connect to the server. This may also be supplied as the environment variable ""AUTH_PASSWORD""."); } } public static string DescriptionAuthPasswordShort { get { return LC.L(@"Supplies the password used to connect to the server"); } } public static string DescriptionAuthUsernameLong { get { return LC.L(@"The username used to connect to the server. This may also be supplied as the environment variable ""AUTH_USERNAME""."); } } public static string DescriptionAuthUsernameShort { get { return LC.L(@"Supplies the username used to connect to the server"); } } public static string DescriptionIntegratedAuthenticationLong { get { return LC.L(@"If the server and client both supports integrated authentication, this option enables that authentication method. This is likely only available with windows servers and clients."); } } public static string DescriptionIntegratedAuthenticationShort { get { return LC.L(@"Use windows integrated authentication to connect to the server"); } } public static string DescriptionUseRecyclerLong { get { return LC.L(@"Use this option to have files moved to the recycle bin folder instead of removing them permanently when compacting or deleting backups."); } } public static string DescriptionUseRecyclerShort { get { return LC.L(@"Move deleted files to the recycle bin."); } } public static string MissingElementError(string serverrelpath, string hosturl) { return LC.L(@"Element with path '{0}' not found on host '{1}'.", serverrelpath, hosturl); } public static string NoSharePointWebFoundError(string url) { return LC.L(@"No SharePoint web could be logged in to at path '{0}'. Maybe wrong credentials. Or try using '//' in path to separate web from folder path.", url); } public static string WebTitleReadFailedError { get { return LC.L(@"Everything seemed alright, but then web title could not be read to test connection. Something's wrong."); } } } internal static class OneDriveForBusiness { public static string DisplayName { get { return LC.L(@"Microsoft OneDrive for Business"); } } public static string Description { get { return LC.L(@"Supports connections to Microsoft OneDrive for Business. Allowed formats are ""od4b://tennant.sharepoint.com/personal/username_domain/Documents/subfolder"" or ""od4b://username:password@tennant.sharepoint.com/personal/username_domain/Documents/folder"". You can use a double slash '//' in the path to denote the base path from the documents folder."); } } } }
lgpl-2.1
C#
49cf0275581ae8880a8d6cd0b7e95c3e11e44464
Add test
sakapon/Samples-2015
ExpressionsSample/ExpressionsConsole/Program.cs
ExpressionsSample/ExpressionsConsole/Program.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ExpressionsConsole { class Program { static void Main(string[] args) { EntityTypeTest(); EntityTypeTimeTest(); CsvTest(); } static void EntityTypeTest() { var PersonType = EntityType.Create(new { Id = 0, Name = "", Birthday = DateTime.MinValue }); // Uses a lambda expression. //var PersonType = EntityType.Create(() => new { Id = 0, Name = "", Birthday = DateTime.MinValue }); var person1 = PersonType.CreateEntity(123, "Taro", new DateTime(2001, 1, 1)); var person2 = PersonType.CreateEntity(456, "Jiro", new DateTime(2002, 2, 2)); Console.WriteLine(person1); Console.WriteLine(person2); } static void EntityTypeTimeTest() { var sw = Stopwatch.StartNew(); var PersonType = EntityType.Create(new { Id = 0, Name = "", Birthday = DateTime.MinValue }); Console.WriteLine(sw.Elapsed); for (var i = 0; i < 1000000; i++) PersonType.CreateEntity(i, "Person", DateTime.MaxValue); sw.Stop(); Console.WriteLine(sw.Elapsed); } static void CsvTest() { var TaskItemType = EntityType.Create(new { Id = 0, Name = "", Rotation = DayOfWeek.Sunday, StartTime = TimeSpan.Zero }); var query = CsvFile.ReadEntities("tasks.csv", TaskItemType) .Where(o => o.Rotation == DayOfWeek.Monday) .OrderBy(o => o.StartTime); foreach (var item in query) Console.WriteLine("{0}: {1}", item.StartTime, item.Name); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ExpressionsConsole { class Program { static void Main(string[] args) { EntityTest(); CsvTest(); } static void EntityTest() { var PersonType = EntityType.Create(new { Id = 0, Name = "", Birthday = DateTime.MinValue }); // Uses a lambda expression. //var PersonType = EntityType.Create(() => new { Id = 0, Name = "", Birthday = DateTime.MinValue }); var person1 = PersonType.CreateEntity(123, "Taro", new DateTime(2001, 1, 1)); var person2 = PersonType.CreateEntity(456, "Jiro", new DateTime(2002, 2, 2)); Console.WriteLine(person1); Console.WriteLine(person2); } static void CsvTest() { var TaskItemType = EntityType.Create(new { Id = 0, Name = "", Rotation = DayOfWeek.Sunday, StartTime = TimeSpan.Zero }); var query = CsvFile.ReadEntities("tasks.csv", TaskItemType) .Where(o => o.Rotation == DayOfWeek.Monday) .OrderBy(o => o.StartTime); foreach (var item in query) Console.WriteLine("{0}: {1}", item.StartTime, item.Name); } } }
mit
C#
2e4c5a0c970949d066663fcf4159447584ac8ad1
Update NewSellerListing.cs
viagogo/gogokit.net
src/GogoKit/Models/Request/NewSellerListing.cs
src/GogoKit/Models/Request/NewSellerListing.cs
using System; using GogoKit.Models.Response; using System.Collections.Generic; using System.Runtime.Serialization; namespace GogoKit.Models.Request { [DataContract] public class NewSellerListing { [DataMember(Name = "number_of_tickets")] public int? NumberOfTickets { get; set; } [DataMember(Name = "display_number_of_tickets")] public int? DisplayNumberOfTickets { get; set; } [DataMember(Name = "seating")] public Seating Seating { get; set; } [DataMember(Name = "face_value")] public Money FaceValue { get; set; } [DataMember(Name = "ticket_price")] public Money TicketPrice { get; set; } [DataMember(Name = "ticket_proceeds")] public Money TicketProceeds { get; set; } [DataMember(Name = "ticket_type")] public string TicketType { get; set; } [DataMember(Name = "split_type")] public string SplitType { get; set; } [DataMember(Name = "listing_note_ids")] public IList<int> ListingNoteIds { get; set; } [DataMember(Name = "notes")] public string Notes { get; set; } [DataMember(Name = "ticket_location_address_id")] public int? TicketLocationAddressId { get; set; } [DataMember(Name = "guarantee_payment_method_id")] public int? GuaranteePaymentMethodId { get; set; } [DataMember(Name = "external_id")] public string ExternalId { get; set; } [DataMember(Name = "in_hand_date")] public DateTimeOffset? InHandDate { get; set; } } }
using System; using GogoKit.Models.Response; using System.Collections.Generic; using System.Runtime.Serialization; namespace GogoKit.Models.Request { [DataContract] public class NewSellerListing { [DataMember(Name = "number_of_tickets")] public int? NumberOfTickets { get; set; } [DataMember(Name = "display_number_of_tickets")] public int? DisplayNumberOfTickets { get; set; } [DataMember(Name = "seating")] public Seating Seating { get; set; } [DataMember(Name = "face_value")] public Money FaceValue { get; set; } [DataMember(Name = "ticket_price")] public Money TicketPrice { get; set; } [DataMember(Name = "ticket_proceeds")] public Money TicketProceeds { get; set; } [DataMember(Name = "ticket_type")] public string TicketType { get; set; } [DataMember(Name = "split_type")] public string SplitType { get; set; } [DataMember(Name = "listing_note_ids")] public IList<int> ListingNoteIds { get; set; } [DataMember(Name = "ticket_location_address_id")] public int? TicketLocationAddressId { get; set; } [DataMember(Name = "guarantee_payment_method_id")] public int? GuaranteePaymentMethodId { get; set; } [DataMember(Name = "external_id")] public string ExternalId { get; set; } [DataMember(Name = "in_hand_date")] public DateTimeOffset? InHandDate { get; set; } } }
mit
C#
774b29ff9cdf81eebd76e7fbaec3b2eedd410e34
Bump LatestBreakingChange to 0.28.0
gep13/cake,devlead/cake,gep13/cake,Sam13/cake,robgha01/cake,vlesierse/cake,devlead/cake,robgha01/cake,Sam13/cake,mholo65/cake,cake-build/cake,vlesierse/cake,ferventcoder/cake,cake-build/cake,mholo65/cake,ferventcoder/cake,patriksvensson/cake,patriksvensson/cake
src/Cake.Core/Constants.cs
src/Cake.Core/Constants.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; namespace Cake.Core { internal static class Constants { public static readonly Version LatestBreakingChange = new Version(0, 28, 0); public static class Settings { public const string SkipVerification = "Settings_SkipVerification"; } public static class Paths { public const string Tools = "Paths_Tools"; public const string Addins = "Paths_Addins"; public const string Modules = "Paths_Modules"; } } }
// 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; namespace Cake.Core { internal static class Constants { public static readonly Version LatestBreakingChange = new Version(0, 26, 0); public static class Settings { public const string SkipVerification = "Settings_SkipVerification"; } public static class Paths { public const string Tools = "Paths_Tools"; public const string Addins = "Paths_Addins"; public const string Modules = "Paths_Modules"; } } }
mit
C#