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
3ed0ac75e8d8c7692f1b5b0d92e007d94649ae3e
Resolve matching type in try catch scope
appharbor/appharbor-cli
src/AppHarbor/CommandDispatcher.cs
src/AppHarbor/CommandDispatcher.cs
using System; using System.Linq; using Castle.MicroKernel; namespace AppHarbor { public class CommandDispatcher { private readonly IAliasMatcher _aliasMatcher; private readonly ITypeNameMatcher _typeNameMatcher; private readonly IKernel _kernel; public CommandDispatcher(IAliasMatcher aliasMatcher, ITypeNameMatcher typeNameMatcher, IKernel kernel) { _aliasMatcher = aliasMatcher; _typeNameMatcher = typeNameMatcher; _kernel = kernel; } public void Dispatch(string[] args) { var commandArgument = args.Any() ? string.Concat(args.Skip(1).FirstOrDefault(), args[0]) : "help"; Type matchingType = null; int argsToSkip = 0; if (_typeNameMatcher.IsSatisfiedBy(commandArgument)) { matchingType = _typeNameMatcher.GetMatchedType(commandArgument); argsToSkip = 2; } else if (_aliasMatcher.IsSatisfiedBy(args[0])) { matchingType = _aliasMatcher.GetMatchedType(args[0]); argsToSkip = 1; } else { throw new DispatchException(string.Format("The command \"{0}\" doesn't match a command name or alias", string.Join(" ", args))); } try { var command = (ICommand)_kernel.Resolve(matchingType); command.Execute(args.Skip(argsToSkip).ToArray()); } catch (CommandException exception) { throw new DispatchException(exception.Message); } } } }
using System; using System.Linq; using Castle.MicroKernel; namespace AppHarbor { public class CommandDispatcher { private readonly IAliasMatcher _aliasMatcher; private readonly ITypeNameMatcher _typeNameMatcher; private readonly IKernel _kernel; public CommandDispatcher(IAliasMatcher aliasMatcher, ITypeNameMatcher typeNameMatcher, IKernel kernel) { _aliasMatcher = aliasMatcher; _typeNameMatcher = typeNameMatcher; _kernel = kernel; } public void Dispatch(string[] args) { var commandArgument = args.Any() ? string.Concat(args.Skip(1).FirstOrDefault(), args[0]) : "help"; Type matchingType = null; int argsToSkip = 0; if (_typeNameMatcher.IsSatisfiedBy(commandArgument)) { matchingType = _typeNameMatcher.GetMatchedType(commandArgument); argsToSkip = 2; } else if (_aliasMatcher.IsSatisfiedBy(args[0])) { matchingType = _aliasMatcher.GetMatchedType(args[0]); argsToSkip = 1; } else { throw new DispatchException(string.Format("The command \"{0}\" doesn't match a command name or alias", string.Join(" ", args))); } var command = (ICommand)_kernel.Resolve(matchingType); try { command.Execute(args.Skip(argsToSkip).ToArray()); } catch (CommandException exception) { throw new DispatchException(exception.Message); } } } }
mit
C#
03364877280761784faf679fc4818623326a90ec
Add correct defaults to domain subscriber
volak/Aggregates.NET,volak/Aggregates.NET
src/Aggregates.NET.GetEventStore/Feature.cs
src/Aggregates.NET.GetEventStore/Feature.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Aggregates.Contracts; using Aggregates.Extensions; using EventStore.ClientAPI; using Newtonsoft.Json; using NServiceBus; using NServiceBus.Features; using NServiceBus.Logging; using NServiceBus.MessageInterfaces; using NServiceBus.ObjectBuilder; using NServiceBus.Settings; using Aggregates.Internal; namespace Aggregates.GetEventStore { public class Feature : NServiceBus.Features.Feature { public Feature() { RegisterStartupTask<ConsumerRunner>(); Defaults(s => { s.SetDefault("SetEventStoreMaxDegreeOfParallelism", Environment.ProcessorCount); s.SetDefault("ParallelHandlers", true); s.SetDefault("ReadSize", 500); }); } protected override void Setup(FeatureConfigurationContext context) { context.Container.ConfigureComponent<StoreEvents>(DependencyLifecycle.InstancePerCall); context.Container.ConfigureComponent<StoreSnapshots>(DependencyLifecycle.InstancePerCall); context.Container.ConfigureComponent<NServiceBusDispatcher>(DependencyLifecycle.SingleInstance); context.Container.ConfigureComponent<DomainSubscriber>(DependencyLifecycle.SingleInstance); context.Container.ConfigureComponent(y => { return new JsonSerializerSettings { Binder = new EventSerializationBinder(y.Build<IMessageMapper>()), ContractResolver = new EventContractResolver(y.Build<IMessageMapper>(), y.Build<IMessageCreator>()) }; }, DependencyLifecycle.SingleInstance); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Aggregates.Contracts; using Aggregates.Extensions; using EventStore.ClientAPI; using Newtonsoft.Json; using NServiceBus; using NServiceBus.Features; using NServiceBus.Logging; using NServiceBus.MessageInterfaces; using NServiceBus.ObjectBuilder; using NServiceBus.Settings; using Aggregates.Internal; namespace Aggregates.GetEventStore { public class Feature : NServiceBus.Features.Feature { public Feature() { RegisterStartupTask<ConsumerRunner>(); Defaults(s => { s.SetDefault("SetEventStoreMaxDegreeOfParallelism", Environment.ProcessorCount); s.SetDefault("SetEventStoreCapacity", 10000); }); } protected override void Setup(FeatureConfigurationContext context) { context.Container.ConfigureComponent<StoreEvents>(DependencyLifecycle.InstancePerCall); context.Container.ConfigureComponent<StoreSnapshots>(DependencyLifecycle.InstancePerCall); context.Container.ConfigureComponent<NServiceBusDispatcher>(DependencyLifecycle.SingleInstance); context.Container.ConfigureComponent<DomainSubscriber>(DependencyLifecycle.SingleInstance); context.Container.ConfigureComponent(y => { return new JsonSerializerSettings { Binder = new EventSerializationBinder(y.Build<IMessageMapper>()), ContractResolver = new EventContractResolver(y.Build<IMessageMapper>(), y.Build<IMessageCreator>()) }; }, DependencyLifecycle.SingleInstance); } } }
mit
C#
aea8c3a6920f0a72f29784011e27552aa1383526
Update AccountIndexer.cs
EventDay/dsl,EventDay/dsl
src/Demo/Indexing/Account/AccountIndexer.cs
src/Demo/Indexing/Account/AccountIndexer.cs
// Copyright (C) 2015 EventDay, Inc using Akka.Actor; using Akka.Event; using Demo.Indexing.Account.Entities; using Demo.Indexing.Account.Messages; using Demo.Messages; namespace Demo.Indexing.Account { public class AccountIndexer : ReceiveActor { public AccountIndexer() { IActorRef store = GetStore(); var log = Context.GetLogger(); Receive<AccountCreated>(x => store.Tell(new StoreAccount(new AccountIndexEntry { UserId = x.UserId, Name = x.Name, Email = x.Email }))); Receive<AccountRemoved>(x => store.Tell(new DeleteAccount(x.UserId))); Receive<AccountStored>(x => log.Info($"account '{x.Entry.UserId}' stored in the index")); Receive<AccountStorageFailed>(x => log.Error(x.Reason, $"failed to store account '{x.Entry.UserId}' in the index")); Receive<AccountDeleted>(x => log.Info($"account '{x.Entry.UserId}' deleted from the index")); Receive<AccountDeletionFailed>(x => log.Error(x.Reason, $"failed to delete account '{x.UserId}' from the index")); } private IActorRef GetStore() { //probably use an extension to get configured store; return Context.ActorOf<MemoryStore>(); } protected override void PreStart() { Context.System.EventStream.Subscribe<IIndexAccounts>(Self); base.PreStart(); } protected override void PostStop() { Context.System.EventStream.Unsubscribe<IIndexAccounts>(Self); base.PostStop(); } } }
// Copyright (C) 2015 EventDay, Inc using Akka.Actor; using Akka.Event; using Demo.Indexing.Account.Entities; using Demo.Indexing.Account.Messages; using Demo.Messages; namespace Demo.Indexing.Account { public class AccountIndexer : ReceiveActor { public AccountIndexer() { IActorRef store = GetStore(); var log = Context.GetLogger(); Receive<AccountCreated>(x => store.Tell(new StoreAccount(new AccountIndexEntry { UserId = x.UserId, Name = x.Name, Email = x.Email }))); Receive<AccountRemoved>(x => store.Tell(new DeleteAccount(x.UserId))); Receive<AccountStored>(x => log.Info($"account '{x.Entry.UserId}' stored in the index")); Receive<AccountStorageFailed>(x => log.Error(x.Reason, $"failed to store account '{x.Entry.UserId}' in the index")); Receive<AccountDeleted>(x => log.Info($"account '{x.Entry.UserId}' deleted in the index")); Receive<AccountDeletionFailed>(x => log.Error(x.Reason, $"failed to delete account '{x.UserId}' in the index")); } private IActorRef GetStore() { //probably use an extension to get configured store; return Context.ActorOf<MemoryStore>(); } protected override void PreStart() { Context.System.EventStream.Subscribe<IIndexAccounts>(Self); base.PreStart(); } protected override void PostStop() { Context.System.EventStream.Unsubscribe<IIndexAccounts>(Self); base.PostStop(); } } }
mit
C#
ed32a8234169d4fa1657d26951dfe9239ef09a10
Fix typo in header
arfbtwn/banshee,babycaseny/banshee,lamalex/Banshee,ixfalia/banshee,stsundermann/banshee,allquixotic/banshee-gst-sharp-work,ixfalia/banshee,Dynalon/banshee-osx,ixfalia/banshee,GNOME/banshee,stsundermann/banshee,GNOME/banshee,directhex/banshee-hacks,ixfalia/banshee,Dynalon/banshee-osx,allquixotic/banshee-gst-sharp-work,mono-soc-2011/banshee,mono-soc-2011/banshee,petejohanson/banshee,petejohanson/banshee,arfbtwn/banshee,Carbenium/banshee,GNOME/banshee,Dynalon/banshee-osx,stsundermann/banshee,petejohanson/banshee,mono-soc-2011/banshee,stsundermann/banshee,arfbtwn/banshee,ixfalia/banshee,mono-soc-2011/banshee,babycaseny/banshee,lamalex/Banshee,babycaseny/banshee,directhex/banshee-hacks,Carbenium/banshee,ixfalia/banshee,directhex/banshee-hacks,Dynalon/banshee-osx,Carbenium/banshee,arfbtwn/banshee,allquixotic/banshee-gst-sharp-work,babycaseny/banshee,petejohanson/banshee,arfbtwn/banshee,petejohanson/banshee,stsundermann/banshee,directhex/banshee-hacks,Dynalon/banshee-osx,Carbenium/banshee,allquixotic/banshee-gst-sharp-work,allquixotic/banshee-gst-sharp-work,dufoli/banshee,ixfalia/banshee,ixfalia/banshee,dufoli/banshee,GNOME/banshee,directhex/banshee-hacks,arfbtwn/banshee,arfbtwn/banshee,Dynalon/banshee-osx,babycaseny/banshee,GNOME/banshee,allquixotic/banshee-gst-sharp-work,babycaseny/banshee,GNOME/banshee,dufoli/banshee,dufoli/banshee,directhex/banshee-hacks,babycaseny/banshee,lamalex/Banshee,stsundermann/banshee,petejohanson/banshee,arfbtwn/banshee,dufoli/banshee,Carbenium/banshee,Dynalon/banshee-osx,lamalex/Banshee,lamalex/Banshee,Dynalon/banshee-osx,GNOME/banshee,dufoli/banshee,stsundermann/banshee,mono-soc-2011/banshee,dufoli/banshee,mono-soc-2011/banshee,GNOME/banshee,dufoli/banshee,babycaseny/banshee,lamalex/Banshee,mono-soc-2011/banshee,Carbenium/banshee,stsundermann/banshee
src/Libraries/Hyena/Hyena.Metrics/Sample.cs
src/Libraries/Hyena/Hyena.Metrics/Sample.cs
// // Sample.cs // // Author: // Gabriel Burt <[email protected]> // // Copyright (c) 2010 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Hyena.Data.Sqlite; namespace Hyena.Metrics { public class Sample { [DatabaseColumn (Constraints = DatabaseColumnConstraints.PrimaryKey)] private long Id { get; set; } [DatabaseColumn] public string MetricName { get; protected set; } [DatabaseColumn] public DateTime Stamp { get; protected set; } [DatabaseColumn] public string Value { get; protected set; } // For SqliteModelProvider's use public Sample () {} public Sample (Metric metric, object value) { MetricName = metric.FullName; Stamp = DateTime.Now; Value = value == null ? "" : value.ToString (); } } }
// // Metric.cs // // Author: // Gabriel Burt <[email protected]> // // Copyright (c) 2010 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Hyena.Data.Sqlite; namespace Hyena.Metrics { public class Sample { [DatabaseColumn (Constraints = DatabaseColumnConstraints.PrimaryKey)] private long Id { get; set; } [DatabaseColumn] public string MetricName { get; protected set; } [DatabaseColumn] public DateTime Stamp { get; protected set; } [DatabaseColumn] public string Value { get; protected set; } // For SqliteModelProvider's use public Sample () {} public Sample (Metric metric, object value) { MetricName = metric.FullName; Stamp = DateTime.Now; Value = value == null ? "" : value.ToString (); } } }
mit
C#
a598e88b519e91e44f242d0366daccb60f5ea6ed
Add missing assignment
dbarowy/Depends
Depends/Progress.cs
Depends/Progress.cs
using System; using System.Threading; namespace Depends { public delegate void ProgressBarIncrementer(); public delegate void ProgressBarReset(); public class Progress { private volatile bool _cancelled = false; private long _total = 0; private ProgressBarIncrementer _progBarIncr; private ProgressBarReset _progBarReset; private long _workMultiplier = 1; public static Progress NOPProgress() { ProgressBarIncrementer pbi = () => { return; }; ProgressBarReset pbr = () => { return; }; return new Progress(pbi, pbr, 1L); } public Progress(ProgressBarIncrementer progBarIncrement, ProgressBarReset progBarReset, long workMultiplier) { _progBarIncr = progBarIncrement; _progBarReset = progBarReset; _workMultiplier = workMultiplier; } public long TotalWorkUnits { get { return _total; } set { _total = value; } } public long UpdateEvery { get { return Math.Max(1L, _total / 100L / _workMultiplier); } } public void IncrementCounter() { _progBarIncr(); } public void Cancel() { _cancelled = true; } public bool IsCancelled() { return _cancelled; } public void Reset() { _progBarReset(); } } }
using System; using System.Threading; namespace Depends { public delegate void ProgressBarIncrementer(); public delegate void ProgressBarReset(); public class Progress { private volatile bool _cancelled = false; private long _total = 0; private ProgressBarIncrementer _progBarIncr; private ProgressBarReset _progBarReset; private long _workMultiplier = 1; public static Progress NOPProgress() { ProgressBarIncrementer pbi = () => { return; }; ProgressBarReset pbr = () => { return; }; return new Progress(pbi, pbr, 1L); } public Progress(ProgressBarIncrementer progBarIncrement, ProgressBarReset progBarReset, long workMultiplier) { _progBarIncr = progBarIncrement; _workMultiplier = workMultiplier; } public long TotalWorkUnits { get { return _total; } set { _total = value; } } public long UpdateEvery { get { return Math.Max(1L, _total / 100L / _workMultiplier); } } public void IncrementCounter() { _progBarIncr(); } public void Cancel() { _cancelled = true; } public bool IsCancelled() { return _cancelled; } public void Reset() { _progBarReset(); } } }
bsd-2-clause
C#
1cce99f94233c1b5e914faa669e430e2b4e992c0
Fix player's ship
CalinoursIncorporated/8INF830
Assets/Scripts/PlayerMovement.cs
Assets/Scripts/PlayerMovement.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public float MainThrust = 5.0f; public float AuxThrust = 2.5f; public float Torque = 2.5f; public bool isYawInverted = false; public bool isPitchInverted = true; public bool isRollInverted = true; private Rigidbody rb; // Use this for initialization void Start() { rb = GetComponent<Rigidbody>(); } // Update is called once per frame void Update() { } void FixedUpdate() { Vector3 acceleration = ComputeThrusts(); Vector3 torque = ComputeTorques(); rb.AddRelativeForce(acceleration, ForceMode.Acceleration); rb.AddRelativeTorque(torque, ForceMode.Acceleration); } /// <summary> /// Handle inputs for player's ship orientation /// </summary> /// <returns>The reauested torque</returns> private Vector3 ComputeTorques() { Vector3 torque = Vector3.zero; // TODO: Reverse w/ aux thrust torque += Vector3.forward * Input.GetAxis("Roll") * Torque * (isRollInverted ? -1 : 1); torque += Vector3.up * Input.GetAxis("Yaw") * Torque * (isYawInverted ? -1 : 1); torque += Vector3.right * Input.GetAxis("Pitch") * Torque * (isPitchInverted ? -1 : 1); return torque; } /// <summary> /// Handle inputs for player's ship acceleration /// </summary> /// <returns>The requested acceleration</returns> private Vector3 ComputeThrusts() { Vector3 acceleration = Vector3.zero; acceleration += Vector3.forward * Input.GetAxis("Thrust") * MainThrust; acceleration += Vector3.up * Input.GetAxis("Vertical") * AuxThrust; acceleration += Vector3.right * Input.GetAxis("Horizontal") * AuxThrust; return acceleration; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public float MainThrust = 5.0f; public float AuxThrust = 2.5f; public float Torque = 2.5f; public bool isYawInverted = false; public bool isPitchInverted = true; public bool isRollInverted = true; private Rigidbody rb; // Use this for initialization void Start() { rb = GetComponent<Rigidbody>(); } // Update is called once per frame void Update() { Vector3 acceleration = ComputeThrusts(); Vector3 torque = ComputeTorques(); rb.AddRelativeForce(acceleration, ForceMode.Acceleration); rb.AddRelativeTorque(torque, ForceMode.Acceleration); } /// <summary> /// Handle inputs for player's ship orientation /// </summary> /// <returns>The reauested torque</returns> private Vector3 ComputeTorques() { Vector3 torque = Vector3.zero; // TODO: Reverse w/ aux thrust torque += Vector3.forward * Input.GetAxis("Roll") * Torque * (isRollInverted ? -1 : 1); torque += Vector3.up * Input.GetAxis("Yaw") * Torque * (isYawInverted ? -1 : 1); torque += Vector3.right * Input.GetAxis("Pitch") * Torque * (isPitchInverted ? -1 : 1); return torque; } /// <summary> /// Handle inputs for player's ship acceleration /// </summary> /// <returns>The requested acceleration</returns> private Vector3 ComputeThrusts() { Vector3 acceleration = Vector3.zero; acceleration += Vector3.forward * Input.GetAxis("Thrust") * MainThrust; acceleration += Vector3.up * Input.GetAxis("Vertical") * AuxThrust; acceleration += Vector3.right * Input.GetAxis("Horizontal") * AuxThrust; return acceleration; } }
apache-2.0
C#
7da43f4b834b478eccd5c6d45ac2e87eda3f972f
Remove double quotes from web response
fredatgithub/GetQuote
GetQuote/Program.cs
GetQuote/Program.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using HtmlAgilityPack; namespace GetQuote { internal class Program { private static void Main() { // Create a request for the URL. WebRequest request = WebRequest.Create( "http://www.badnuke.com/"); // If required by the server, set the credentials. request.Credentials = CredentialCache.DefaultCredentials; // Get the response. WebResponse response = request.GetResponse(); // Display the status. //Console.WriteLine(((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. Stream dataStream = response.GetResponseStream(); // Open the stream using a StreamReader for easy access. StreamReader reader = new StreamReader(dataStream); // Read the content. string responseFromServer = reader.ReadToEnd(); // Clean up the streams and the response. reader.Close(); response.Close(); // Display the content. //Console.WriteLine(responseFromServer); // parcours du DOM et recherche de <div class="text-center"> Dictionary<string, string> dicoQuotes = new Dictionary<string, string>(); var source = WebUtility.HtmlDecode(responseFromServer); HtmlDocument resultat = new HtmlDocument(); resultat.LoadHtml(source); List<HtmlNode> quotes = resultat.DocumentNode.Descendants().Where (x => x.Name == "div" && x.Attributes["class"] != null && x.Attributes["class"].Value.Contains("text-center")).ToList(); if (quotes.Count != 0) { string tmpKey = quotes[0].InnerText.Trim(); tmpKey = tmpKey.Replace('"', ' ').Trim(); if (tmpKey.StartsWith('"'.ToString())) { tmpKey = tmpKey.Substring(1, tmpKey.Length - 2); } Console.WriteLine(tmpKey); string tmpValue = quotes[1].InnerText.Trim(); tmpValue = tmpValue.Replace('"', ' ').Trim(); Console.WriteLine(tmpValue); if (!dicoQuotes.ContainsKey(tmpKey)) { dicoQuotes.Add(tmpKey, tmpValue); } } //foreach (HtmlNode htmlNode in quotes) //{ // string tmp = htmlNode.InnerText.Trim().Trim('"'); // Console.WriteLine(tmp); //} Console.WriteLine("Press a key to exit:"); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using HtmlAgilityPack; namespace GetQuote { internal class Program { private static void Main() { // Create a request for the URL. WebRequest request = WebRequest.Create( "http://www.badnuke.com/"); // If required by the server, set the credentials. request.Credentials = CredentialCache.DefaultCredentials; // Get the response. WebResponse response = request.GetResponse(); // Display the status. Console.WriteLine(((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. Stream dataStream = response.GetResponseStream(); // Open the stream using a StreamReader for easy access. StreamReader reader = new StreamReader(dataStream); // Read the content. string responseFromServer = reader.ReadToEnd(); // Clean up the streams and the response. reader.Close(); response.Close(); // Display the content. //Console.WriteLine(responseFromServer); // parcours du DOM et recherche de <div class="text-center"> Dictionary<string, string> dicoQuotes = new Dictionary<string, string>(); var source = WebUtility.HtmlDecode(responseFromServer); HtmlDocument resultat = new HtmlDocument(); resultat.LoadHtml(source); List<HtmlNode> quotes = resultat.DocumentNode.Descendants().Where (x => x.Name == "div" && x.Attributes["class"] != null && x.Attributes["class"].Value.Contains("text-center")).ToList(); if (quotes.Count != 0) { string tmpKey = quotes[0].InnerText.Trim().Trim('"'); Console.WriteLine(tmpKey); string tmpValue = quotes[1].InnerText.Trim().Trim('"'); Console.WriteLine(tmpValue); if (!dicoQuotes.ContainsKey(tmpKey)) { dicoQuotes.Add(tmpKey, tmpValue); } } //foreach (HtmlNode htmlNode in quotes) //{ // string tmp = htmlNode.InnerText.Trim().Trim('"'); // Console.WriteLine(tmp); //} Console.WriteLine("Press a key to exit:"); Console.ReadKey(); } } }
mit
C#
4bed158936a285ff0b2360d1153cbef6f83291ab
update methods
cube-soft/Cube.Core,cube-soft/Cube.Core,cube-soft/Cube.Forms,cube-soft/Cube.Forms
Libraries/Views/IControl.cs
Libraries/Views/IControl.cs
/* ------------------------------------------------------------------------- */ /// /// Copyright (c) 2010 CubeSoft, Inc. /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /* ------------------------------------------------------------------------- */ using System.Drawing; namespace Cube.Forms { /* --------------------------------------------------------------------- */ /// /// IControl /// /// <summary> /// 各種コントロールのインターフェースです。 /// </summary> /// /* --------------------------------------------------------------------- */ public interface IControl { /* ----------------------------------------------------------------- */ /// /// Location /// /// <summary> /// 表示位置を取得または設定します。 /// </summary> /// /* ----------------------------------------------------------------- */ Point Location { get; set; } /* ----------------------------------------------------------------- */ /// /// Size /// /// <summary> /// 表示サイズを取得または設定します。 /// </summary> /// /* ----------------------------------------------------------------- */ Size Size { get; set; } /* ----------------------------------------------------------------- */ /// /// EventAggregator /// /// <summary> /// イベントを集約するためのオブジェクトを取得または設定します。 /// </summary> /// /* ----------------------------------------------------------------- */ IEventAggregator EventAggregator { get; set; } } /* --------------------------------------------------------------------- */ /// /// IForm /// /// <summary> /// 各種フォームのインターフェースです。 /// </summary> /// /* --------------------------------------------------------------------- */ public interface IForm : IControl { /* ----------------------------------------------------------------- */ /// /// Show /// /// <summary> /// 画面を表示します。 /// </summary> /// /* ----------------------------------------------------------------- */ void Show(); /* ----------------------------------------------------------------- */ /// /// Close /// /// <summary> /// 画面を終了させます。 /// </summary> /// /* ----------------------------------------------------------------- */ void Close(); } }
/* ------------------------------------------------------------------------- */ /// /// Copyright (c) 2010 CubeSoft, Inc. /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /* ------------------------------------------------------------------------- */ namespace Cube.Forms { /* --------------------------------------------------------------------- */ /// /// IControl /// /// <summary> /// 各種コントロールのインターフェースです。 /// </summary> /// /* --------------------------------------------------------------------- */ public interface IControl { /* ----------------------------------------------------------------- */ /// /// EventAggregator /// /// <summary> /// イベントを集約するためのオブジェクトを取得または設定します。 /// </summary> /// /* ----------------------------------------------------------------- */ IEventAggregator EventAggregator { get; set; } } /* --------------------------------------------------------------------- */ /// /// IForm /// /// <summary> /// 各種フォームのインターフェースです。 /// </summary> /// /* --------------------------------------------------------------------- */ public interface IForm : IControl { /* ----------------------------------------------------------------- */ /// /// Show /// /// <summary> /// 画面を表示します。 /// </summary> /// /* ----------------------------------------------------------------- */ void Show(); /* ----------------------------------------------------------------- */ /// /// Close /// /// <summary> /// 画面を終了させます。 /// </summary> /// /* ----------------------------------------------------------------- */ void Close(); } }
apache-2.0
C#
94a002500f2e14d14a4856370fb96d047d7cba61
bump version
SimonCropp/NServiceBus.Serilog
NServiceBus.Serilog/AssemblyInfo.cs
NServiceBus.Serilog/AssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("NServiceBus.Serilog")] [assembly: AssemblyProduct("NServiceBus.Serilog")] [assembly: AssemblyVersion("1.3.0")] [assembly: AssemblyFileVersion("1.3.0")]
using System.Reflection; [assembly: AssemblyTitle("NServiceBus.Serilog")] [assembly: AssemblyProduct("NServiceBus.Serilog")] [assembly: AssemblyVersion("1.2.0")] [assembly: AssemblyFileVersion("1.2.0")]
mit
C#
6cb0ac7301ef6058111fc71babbc123636051246
Build fix
DarkWanderer/DW.Lua,DarkWanderer/LuaParser
LuaCodeEditor/EditorForm.cs
LuaCodeEditor/EditorForm.cs
using System; using System.IO; using System.Windows.Forms; using DW.Lua.Editor.Properties; using DW.Lua.Parsers; using DW.Lua.Syntax; namespace DW.Lua.Editor { public partial class EditorForm : Form { public EditorForm() { InitializeComponent(); } private void richTextBox1_TextChanged(object sender, EventArgs e) { var script = codeBox.Text; try { var reader = new StringReader(script); var tokenEnumerator = Tokenizer.Parse(reader); var block = SyntaxParser.Parse(script); UpdateSyntaxTreeView(block); parserStatusLabel.Text = Resources.label_tokens + string.Join(", ",tokenEnumerator); } catch (Exception ex) { parserStatusLabel.Text = ex.Message; } } private void UpdateSyntaxTreeView(Unit unit) { treeView1.BeginUpdate(); treeView1.Nodes.Clear(); InsertSyntaxTreeViewNode(unit,null); treeView1.ExpandAll(); treeView1.EndUpdate(); } private void InsertSyntaxTreeViewNode(Unit unit, TreeNode node) { var newNode = node?.Nodes.Add(unit.GetType().Name) ?? treeView1.Nodes.Add(unit.GetType().Name); foreach (var child in unit.Children) InsertSyntaxTreeViewNode(child,newNode); } private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { } } }
using System; using System.IO; using System.Windows.Forms; using DW.Lua.Parsers; using DW.Lua.Syntax; namespace DW.Lua.Editor { public partial class EditorForm : Form { public EditorForm() { InitializeComponent(); } private void richTextBox1_TextChanged(object sender, EventArgs e) { var script = codeBox.Text; try { var reader = new StringReader(script); var tokenEnumerator = Tokenizer.Parse(reader); var block = SyntaxParser.Parse(script); UpdateSyntaxTreeView(block); parserStatusLabel.Text = Resources.label_tokens + string.Join(", ",tokenEnumerator); } catch (Exception ex) { parserStatusLabel.Text = ex.Message; } } private void UpdateSyntaxTreeView(Unit unit) { treeView1.BeginUpdate(); treeView1.Nodes.Clear(); InsertSyntaxTreeViewNode(unit,null); treeView1.ExpandAll(); treeView1.EndUpdate(); } private void InsertSyntaxTreeViewNode(Unit unit, TreeNode node) { var newNode = node?.Nodes.Add(unit.GetType().Name) ?? treeView1.Nodes.Add(unit.GetType().Name); foreach (var child in unit.Children) InsertSyntaxTreeViewNode(child,newNode); } private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { } } }
mit
C#
df15b4140a5460f5579a1ffcf59d71db77f2fd33
Add watson information.
AmadeusW/roslyn,stephentoub/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,gafter/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,panopticoncentral/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,tmat/roslyn,dotnet/roslyn,jmarolf/roslyn,diryboy/roslyn,weltkante/roslyn,stephentoub/roslyn,ErikSchierboom/roslyn,gafter/roslyn,eriawan/roslyn,KevinRansom/roslyn,physhi/roslyn,tannergooding/roslyn,eriawan/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,tmat/roslyn,KirillOsenkov/roslyn,diryboy/roslyn,KevinRansom/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,ErikSchierboom/roslyn,mavasani/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,heejaechang/roslyn,brettfo/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,sharwell/roslyn,mavasani/roslyn,weltkante/roslyn,AlekseyTs/roslyn,KirillOsenkov/roslyn,aelij/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,KirillOsenkov/roslyn,gafter/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,physhi/roslyn,dotnet/roslyn,mgoertz-msft/roslyn,eriawan/roslyn,wvdd007/roslyn,weltkante/roslyn,brettfo/roslyn,wvdd007/roslyn,panopticoncentral/roslyn,mgoertz-msft/roslyn,heejaechang/roslyn,AlekseyTs/roslyn,jmarolf/roslyn,dotnet/roslyn,heejaechang/roslyn,wvdd007/roslyn,sharwell/roslyn,sharwell/roslyn,aelij/roslyn,genlu/roslyn,tannergooding/roslyn,jmarolf/roslyn,brettfo/roslyn,tmat/roslyn,genlu/roslyn,bartdesmet/roslyn,genlu/roslyn,panopticoncentral/roslyn
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionWithNestedActions.cs
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionWithNestedActions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Text; namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions { /// <summary> /// Lightbulb item that has child items that should be displayed as 'menu items' /// (as opposed to 'flavor items'). /// </summary> internal sealed class SuggestedActionWithNestedActions : SuggestedAction { public readonly ImmutableArray<SuggestedActionSet> NestedActionSets; public SuggestedActionWithNestedActions( IThreadingContext threadingContext, SuggestedActionsSourceProvider sourceProvider, Workspace workspace, ITextBuffer subjectBuffer, object provider, CodeAction codeAction, ImmutableArray<SuggestedActionSet> nestedActionSets) : base(threadingContext, sourceProvider, workspace, subjectBuffer, provider, codeAction) { Debug.Assert(!nestedActionSets.IsDefaultOrEmpty); NestedActionSets = nestedActionSets; } public SuggestedActionWithNestedActions( IThreadingContext threadingContext, SuggestedActionsSourceProvider sourceProvider, Workspace workspace, ITextBuffer subjectBuffer, object provider, CodeAction codeAction, SuggestedActionSet nestedActionSet) : this(threadingContext, sourceProvider, workspace, subjectBuffer, provider, codeAction, ImmutableArray.Create(nestedActionSet)) { } public override bool HasActionSets => true; public sealed override Task<IEnumerable<SuggestedActionSet>> GetActionSetsAsync(CancellationToken cancellationToken) => Task.FromResult<IEnumerable<SuggestedActionSet>>(NestedActionSets); protected override void InnerInvoke(IProgressTracker progressTracker, CancellationToken cancellationToken) { // A code action with nested actions is itself never invokable. So just do nothing if this ever gets asked. // Report a message in debug and log a watson exception so that if this is hit we can try to narrow down how // this happened. Debug.Fail("InnerInvoke should not be called on a SuggestedActionWithNestedActions"); try { throw new InvalidOperationException("Invoke should not be called on a SuggestedActionWithNestedActions"); } catch (Exception e) when (FatalError.ReportWithoutCrash(e)) { } } } }
// 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.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Text; namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions { /// <summary> /// Lightbulb item that has child items that should be displayed as 'menu items' /// (as opposed to 'flavor items'). /// </summary> internal sealed class SuggestedActionWithNestedActions : SuggestedAction { public readonly ImmutableArray<SuggestedActionSet> NestedActionSets; public SuggestedActionWithNestedActions( IThreadingContext threadingContext, SuggestedActionsSourceProvider sourceProvider, Workspace workspace, ITextBuffer subjectBuffer, object provider, CodeAction codeAction, ImmutableArray<SuggestedActionSet> nestedActionSets) : base(threadingContext, sourceProvider, workspace, subjectBuffer, provider, codeAction) { Debug.Assert(!nestedActionSets.IsDefaultOrEmpty); NestedActionSets = nestedActionSets; } public SuggestedActionWithNestedActions( IThreadingContext threadingContext, SuggestedActionsSourceProvider sourceProvider, Workspace workspace, ITextBuffer subjectBuffer, object provider, CodeAction codeAction, SuggestedActionSet nestedActionSet) : this(threadingContext, sourceProvider, workspace, subjectBuffer, provider, codeAction, ImmutableArray.Create(nestedActionSet)) { } public override bool HasActionSets => true; public sealed override Task<IEnumerable<SuggestedActionSet>> GetActionSetsAsync(CancellationToken cancellationToken) => Task.FromResult<IEnumerable<SuggestedActionSet>>(NestedActionSets); protected override void InnerInvoke(IProgressTracker progressTracker, CancellationToken cancellationToken) { // A code action with nested actions is itself never invokable. So just do nothing if this ever gets asked. Debug.Fail("Invoke should not be called on a SuggestedActionWithNestedActions"); } } }
mit
C#
57832543098bb509e7626dccf0c538d09252e640
Fix KugelmatikProxy
henrik1235/Kugelmatik,henrik1235/Kugelmatik,henrik1235/Kugelmatik
KugelmatikProxy/MainForm.cs
KugelmatikProxy/MainForm.cs
using KugelmatikLibrary; using System; using System.ComponentModel; using System.Net; using System.Windows.Forms; namespace KugelmatikProxy { public partial class MainForm : Form { private ClusterProxy cluster; public MainForm() { InitializeComponent(); cluster = new ClusterProxy(); Log.Info("Running"); Log.OnFlushBuffer += Log_OnFlushBuffer; Log.AutomaticFlush = true; Log.FlushBuffer(); Log.BufferCapacity = 1; } private void Log_OnFlushBuffer(object sender, LogFlushEventArgs e) { if (logTextBox.InvokeRequired) logTextBox.BeginInvoke(new EventHandler<LogFlushEventArgs>(Log_OnFlushBuffer), e); else logTextBox.AppendText(e.Buffer); } protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); Log.OnFlushBuffer -= Log_OnFlushBuffer; } private void connectProxyButton_Click(object sender, EventArgs e) { IPAddress ip; if (!IPAddress.TryParse(ipTextBox.Text.Trim(), out ip)) { MessageBox.Show("Invalid ip address!"); return; } cluster.ConnectProxy(ip); } } }
using KugelmatikLibrary; using System; using System.ComponentModel; using System.Net; using System.Windows.Forms; namespace KugelmatikProxy { public partial class MainForm : Form { private ClusterProxy cluster; public MainForm() { InitializeComponent(); cluster = new ClusterProxy(); Log.Info("Running"); Log.OnFlushBuffer += Log_OnFlushBuffer; Log.AutomaticFlush = true; Log.FlushBuffer(); Log.BufferCapacity = 1; } private void Log_OnFlushBuffer(string obj) { if (logTextBox.InvokeRequired) logTextBox.BeginInvoke(new Action<string>(Log_OnFlushBuffer), obj); else logTextBox.AppendText(obj); } protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); Log.OnFlushBuffer -= Log_OnFlushBuffer; } private void connectProxyButton_Click(object sender, EventArgs e) { IPAddress ip; if (!IPAddress.TryParse(ipTextBox.Text.Trim(), out ip)) { MessageBox.Show("Invalid ip address!"); return; } cluster.ConnectProxy(ip); } } }
mit
C#
338d6cfe4ea441857bbf9e79ffa9ab7fb22fe4c0
Add xml-doc to GridTestCase
ppy/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,paparony03/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,default0/osu-framework,paparony03/osu-framework,naoey/osu-framework,ppy/osu-framework,peppy/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,naoey/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,default0/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework
osu.Framework.Testing/GridTestCase.cs
osu.Framework.Testing/GridTestCase.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Linq; namespace osu.Framework.Testing { /// <summary> /// An abstract test case which exposes small cells arranged in a grid. /// Useful for displaying multiple configurations of a tested component at a glance. /// </summary> public abstract class GridTestCase : TestCase { private FillFlowContainer<Container> testContainer; /// <summary> /// The amount of rows of the grid. /// </summary> protected int Rows { get; } /// <summary> /// The amount of columns of the grid. /// </summary> protected int Cols { get; } /// <summary> /// Constructs a grid test case with the given dimensions. /// </summary> /// <param name="rows">The amount of rows of the grid.</param> /// <param name="cols">The amount of columns of the grid.</param> public GridTestCase(int rows, int cols) { Rows = rows; Cols = cols; } private Container createCell() => new Container { RelativeSizeAxes = Axes.Both, Size = new Vector2(1.0f / Cols, 1.0f / Rows), }; public override void Reset() { base.Reset(); testContainer = new FillFlowContainer<Container> { RelativeSizeAxes = Axes.Both }; for (int i = 0; i < Rows * Cols; ++i) testContainer.Add(createCell()); Add(testContainer); } /// <summary> /// Access a cell by its index. Valid indices range from 0 to <see cref="Rows"/> * <see cref="Cols"/> - 1. /// </summary> protected Container Cell(int index) => testContainer.Children.ElementAt(index); /// <summary> /// Access a cell by its row and column. /// </summary> protected Container Cell(int row, int col) => Cell(col + row * Cols); } }
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Linq; namespace osu.Framework.Testing { public abstract class GridTestCase : TestCase { private FillFlowContainer<Container> testContainer; protected int Rows { get; } protected int Cols { get; } public GridTestCase(int rows, int cols) { Rows = rows; Cols = cols; } private Container createCell() => new Container { RelativeSizeAxes = Axes.Both, Size = new Vector2(1.0f / Cols, 1.0f / Rows), }; public override void Reset() { base.Reset(); testContainer = new FillFlowContainer<Container> { RelativeSizeAxes = Axes.Both }; for (int i = 0; i < Rows * Cols; ++i) testContainer.Add(createCell()); Add(testContainer); } protected Container Cell(int index) => testContainer.Children.ElementAt(index); protected Container Cell(int row, int col) => Cell(col + row * Cols); } }
mit
C#
9774d9b317cdb0cd215bafb3aba783bcc0173620
Update Snippets.cs
toddams/RazorLight,toddams/RazorLight
tests/RazorLight.Tests/Snippets/Snippets.cs
tests/RazorLight.Tests/Snippets/Snippets.cs
using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.TestHost; using RazorLight; using Xunit; public class Snippets { public class ViewModel { public string Name { get; set; } } [Fact] public async Task Simple() { #region Simple var engine = new RazorLightEngineBuilder() // required to have a default RazorLightProject type, // but not required to create a template from string. .UseEmbeddedResourcesProject(typeof(Program)) .UseMemoryCachingProvider() .Build(); string template = "Hello, @Model.Name. Welcome to RazorLight repository"; ViewModel model = new ViewModel {Name = "John Doe"}; string result = await engine.CompileRenderStringAsync("templateKey", template, model); #endregion Assert.NotNull(result); } async Task RenderCompiledTemplate(RazorLightEngine engine, object model) { #region RenderCompiledTemplate var cacheResult = engine.Handler.Cache.RetrieveTemplate("templateKey"); if(cacheResult.Success) { var templatePage = cacheResult.Template.TemplatePageFactory(); string result = await engine.RenderTemplateAsync(templatePage, model); } #endregion } async Task FileSource() { #region FileSource var engine = new RazorLightEngineBuilder() .UseFileSystemProject("C:/RootFolder/With/YourTemplates") .UseMemoryCachingProvider() .Build(); var model = new {Name = "John Doe"}; string result = await engine.CompileRenderAsync("Subfolder/View.cshtml", model); #endregion } async Task EmbeddedResourceSource() { #region EmbeddedResourceSource var engine = new RazorLightEngineBuilder() .UseEmbeddedResourcesProject(typeof(Program)) .UseMemoryCachingProvider() .Build(); var model = new SchoolForAnts(); string result = await engine.CompileRenderAsync<object>("Views.Subfolder.SchoolForAnts", model, null); #endregion } public class SchoolForAnts { } }
using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.TestHost; using RazorLight; using Xunit; public class Snippets { public class ViewModel { public string Name { get; set; } } [Fact] public async Task Simple() { #region Simple var engine = new RazorLightEngineBuilder() // required to have a default RazorLightProject type, // but not required to create a template from string. .UseEmbeddedResourcesProject(typeof(Program)) .UseMemoryCachingProvider() .Build(); string template = "Hello, @Model.Name. Welcome to RazorLight repository"; ViewModel model = new ViewModel {Name = "John Doe"}; string result = await engine.CompileRenderStringAsync("templateKey", template, model); #endregion Assert.NotNull(result); } public async Task RenderCompiledTemplate(RazorLightEngine engine, object model) { #region RenderCompiledTemplate var cacheResult = engine.Handler.Cache.RetrieveTemplate("templateKey"); if(cacheResult.Success) { var templatePage = cacheResult.Template.TemplatePageFactory(); string result = await engine.RenderTemplateAsync(templatePage, model); } #endregion } async Task FileSource() { #region FileSource var engine = new RazorLightEngineBuilder() .UseFileSystemProject("C:/RootFolder/With/YourTemplates") .UseMemoryCachingProvider() .Build(); var model = new {Name = "John Doe"}; string result = await engine.CompileRenderAsync("Subfolder/View.cshtml", model); #endregion } async Task EmbeddedResourceSource() { #region EmbeddedResourceSource var engine = new RazorLightEngineBuilder() .UseEmbeddedResourcesProject(typeof(Program)) .UseMemoryCachingProvider() .Build(); var model = new SchoolForAnts(); string result = await engine.CompileRenderAsync<object>("Views.Subfolder.SchoolForAnts", model, null); #endregion } public class SchoolForAnts { } }
apache-2.0
C#
08f187816ab89bccaad0ef3b2ad9afe00b7fe1fa
Update Form1.cs
ARMmaster17/SwatSim
SwatSim/SwatSimGUI/Form1.cs
SwatSim/SwatSimGUI/Form1.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace SwatSimGUI { public partial class Form1 : Form { public Form1() { InitializeComponent(); MessageBox.Show("DISCLAIMER: This program is for demostration purposes only. If you use this program in ANY KIND of real-world application, you do so at your own risk. For the full disclaimer, see DISCLAIMER.md in your application folder."); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace SwatSimGUI { public partial class Form1 : Form { public Form1() { InitializeComponent(); } } }
mit
C#
dc7f32736d6d2c045ff712dc4f004d6c1cf36bfd
Test readback: not implemented yet for the OptimizedTrie. It does show that the trie is faster than the list implementation.
koen-lee/compact-tree-challenge,koen-lee/compact-tree-challenge,koen-lee/compact-tree-challenge
Trie/TrieComparisonTests.cs
Trie/TrieComparisonTests.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using NUnit.Framework; namespace Trie { [TestFixture] public class TrieComparisonTests { private KeyValuePair<string, long>[] _testdata; [TestFixtureSetUp] public void GenerateTestData() { _testdata = GetTestData().Take(32 * 1024 / 8).ToArray(); } [Test] public void TestNoTrie() { TestTrie(new NoTrie(), _testdata); } [Test] public void TestRealTrie() { TestTrie(new RealTrie(), _testdata); } [Test] public void TestOptimizedTrie() { TestTrie(new OptimizedTrie(), _testdata); } private static void TestTrie(ITrie trie, KeyValuePair<string, long>[] testdata) { var items = 0; Console.WriteLine($"Testing {trie.GetType()}"); var stopwatch = Stopwatch.StartNew(); foreach (var kv in testdata) { if (!trie.TryWrite(kv.Key, kv.Value)) break; items++; } Console.WriteLine($"Elapsed: {stopwatch.ElapsedMilliseconds} milliseconds"); Console.WriteLine($"Items in {trie.GetType()}: {items}"); stopwatch.Restart(); foreach (var kv in testdata.Take(items)) { long value; if (!trie.TryRead(kv.Key, out value)) throw new InvalidDataException($"could not read back {kv.Key}: key not found"); if ( value != kv.Value) throw new InvalidDataException($"could not read back {kv.Key}: expected {kv.Value}, got {value}"); } Console.WriteLine($"Readback Elapsed: {stopwatch.ElapsedMilliseconds} milliseconds"); } IEnumerable<KeyValuePair<string, long>> GetTestData() { return EnumerateFilesRecursively(new DirectoryInfo(@"C:\Program Files")) .Select(file => new KeyValuePair<string, long>(file.FullName, file.Length)); } private IEnumerable<FileInfo> EnumerateFilesRecursively(DirectoryInfo directoryInfo) { return directoryInfo.EnumerateFiles() .Concat(directoryInfo.EnumerateDirectories() .SelectMany(EnumerateFilesRecursively)); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using NUnit.Framework; namespace Trie { [TestFixture] public class TrieComparisonTests { [Test] public void CompareTries() { var testdata = GetTestData().Take(32 * 1024 / 8).ToArray(); TestTrie(new NoTrie(), testdata); TestTrie(new RealTrie(), testdata); TestTrie(new OptimizedTrie(), testdata); } private static void TestTrie(ITrie trie, KeyValuePair<string, long>[] testdata) { var items = 0; Console.WriteLine($"Testing {trie.GetType()}"); var stopwatch = Stopwatch.StartNew(); foreach (var kv in testdata) { if (!trie.TryWrite(kv.Key, kv.Value)) break; items++; } Console.WriteLine($"Elapsed: {stopwatch.ElapsedMilliseconds} milliseconds"); Console.WriteLine($"Items in {trie.GetType()}: {items}"); } IEnumerable<KeyValuePair<string, long>> GetTestData() { return EnumerateFilesRecursively(new DirectoryInfo(@"C:\Program Files")) .Select(file => new KeyValuePair<string, long>(file.FullName, file.Length)); } private IEnumerable<FileInfo> EnumerateFilesRecursively(DirectoryInfo directoryInfo) { return directoryInfo.EnumerateFiles() .Concat(directoryInfo.EnumerateDirectories() .SelectMany(EnumerateFilesRecursively)); } } }
mit
C#
fb91289432f70d6a26f7a3c1fe77041ce3c5549a
Improve Logging
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Program.cs
WalletWasabi.Gui/Program.cs
using Avalonia; using Avalonia.Threading; using System; using AvalonStudio.Extensibility.Theme; using AvalonStudio.Shell; using WalletWasabi.Logging; using System.IO; namespace WalletWasabi.Gui { internal class Program { private static void Main(string[] args) { try { Logger.SetFilePath(Path.Combine(Global.DataDir, "Logs.txt")); #if RELEASE Logger.SetMinimumLevel(LogLevel.Info); Logger.SetModes(LogMode.File); #else Logger.SetMinimumLevel(LogLevel.Debug); Logger.SetModes(LogMode.Debug, LogMode.Console, LogMode.File); #endif BuildAvaloniaApp().AfterSetup(async builder => { var configFilePath = Path.Combine(Global.DataDir, "Config.json"); var config = new Config(configFilePath); await config.LoadOrCreateDefaultFileAsync(); Logger.LogInfo<Config>("Config is successfully initialized."); await Global.InitializeAsync(config); }).StartShellApp("Wasabi Wallet"); } catch (Exception ex) { Logger.LogCritical<Program>(ex); } } private static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>().UsePlatformDetect().UseReactiveUI(); } }
using Avalonia; using Avalonia.Threading; using System; using AvalonStudio.Extensibility.Theme; using AvalonStudio.Shell; using WalletWasabi.Logging; using System.IO; namespace WalletWasabi.Gui { internal class Program { private static void Main(string[] args) { Logger.SetFilePath(Path.Combine(Global.DataDir, "Logs.txt")); #if RELEASE Logger.SetMinimumLevel(LogLevel.Info); Logger.SetModes(LogMode.File); #else Logger.SetMinimumLevel(LogLevel.Debug); Logger.SetModes(LogMode.Debug, LogMode.Console, LogMode.File); #endif BuildAvaloniaApp().AfterSetup(async builder => { var configFilePath = Path.Combine(Global.DataDir, "Config.json"); var config = new Config(configFilePath); await config.LoadOrCreateDefaultFileAsync(); Logger.LogInfo<Config>("Config is successfully initialized."); await Global.InitializeAsync(config); }).StartShellApp("Wasabi Wallet"); } private static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>().UsePlatformDetect().UseReactiveUI(); } }
mit
C#
ae666d1753c604ea25ec31aa259dbbd354f7ce9b
Fix warning due to unused variable
mrward/monodevelop-nuget-extensions,mrward/monodevelop-nuget-extensions
src/MonoDevelop.PackageManagement.Extensions/MonoDevelop.PackageManagement/MonoPclCommandLine.cs
src/MonoDevelop.PackageManagement.Extensions/MonoDevelop.PackageManagement/MonoPclCommandLine.cs
// // MonoPclCommandLine.cs // // Author: // Matt Ward <[email protected]> // // Copyright (c) 2014 Xamarin Inc. (http://xamarin.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // using System; using MonoDevelop.Core; using MonoDevelop.Core.Assemblies; using System.IO; namespace MonoDevelop.PackageManagement { public class MonoPclCommandLine { MonoTargetRuntime monoRuntime; public MonoPclCommandLine () : this ( Runtime.SystemAssemblyService.DefaultMonoRuntime as MonoTargetRuntime) { } public MonoPclCommandLine (MonoTargetRuntime monoRuntime) { this.monoRuntime = monoRuntime; List = true; } public string Command { get; set; } public string Arguments { get; private set; } public string WorkingDirectory { get; private set; } public bool List { get; set; } public void BuildCommandLine () { GenerateMonoCommandLine (); } void GenerateMonoCommandLine () { Arguments = String.Format ( "--runtime=v4.0 \"{0}\" {1}", MonoPclExe.GetPath (), GetOptions ()); Command = Path.Combine (monoRuntime.Prefix, "bin", "mono"); } string GetOptions () { if (List) return "list"; return String.Empty; } public override string ToString () { return String.Format ("{0} {1}", GetQuotedCommand (), Arguments); } string GetQuotedCommand () { if (Command.Contains (" ")) { return String.Format ("\"{0}\"", Command); } return Command; } } }
// // MonoPclCommandLine.cs // // Author: // Matt Ward <[email protected]> // // Copyright (c) 2014 Xamarin Inc. (http://xamarin.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // using System; using MonoDevelop.Core; using MonoDevelop.Core.Assemblies; using System.IO; namespace MonoDevelop.PackageManagement { public class MonoPclCommandLine { MonoTargetRuntime monoRuntime; bool isMonoRuntime; public MonoPclCommandLine () : this ( Runtime.SystemAssemblyService.DefaultMonoRuntime as MonoTargetRuntime) { } public MonoPclCommandLine (MonoTargetRuntime monoRuntime) { this.monoRuntime = monoRuntime; List = true; } public string Command { get; set; } public string Arguments { get; private set; } public string WorkingDirectory { get; private set; } public bool List { get; set; } public void BuildCommandLine () { GenerateMonoCommandLine (); } void GenerateMonoCommandLine () { Arguments = String.Format ( "--runtime=v4.0 \"{0}\" {1}", MonoPclExe.GetPath (), GetOptions ()); Command = Path.Combine (monoRuntime.Prefix, "bin", "mono"); } string GetOptions () { if (List) return "list"; return String.Empty; } public override string ToString () { return String.Format ("{0} {1}", GetQuotedCommand (), Arguments); } string GetQuotedCommand () { if (Command.Contains (" ")) { return String.Format ("\"{0}\"", Command); } return Command; } } }
mit
C#
ab2152889c326e11fb9d9925f30e7c53d7b553ca
Fix rendering of workflow modal dialogs. (#10025)
stevetayloruk/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2
src/OrchardCore.Modules/OrchardCore.Forms/Views/Items/BindModelStateTask.Fields.Thumbnail.cshtml
src/OrchardCore.Modules/OrchardCore.Forms/Views/Items/BindModelStateTask.Fields.Thumbnail.cshtml
<h4 class="card-title"><i class="fa fa-clone" aria-hidden="true"></i>@T["Bind Form to Model State"]</h4> <p>@T["Binds submitted form fields to the model state."]</p>
<h4 class="card-title"><i class="fa fa-clone aria-hidden="true"i>@T["Bind Form to Model State"]</h4> <p>@T["Binds submitted form fields to the model state."]</p>
bsd-3-clause
C#
769a548b8f216a312e1571320681c98475d93dd3
Allow to set an inner exception in a DomainException
biarne-a/Zebus,Abc-Arbitrage/Zebus
src/Abc.Zebus/DomainException.cs
src/Abc.Zebus/DomainException.cs
using System; using System.ComponentModel; using System.Linq; using System.Linq.Expressions; using System.Reflection; using Abc.Zebus.Util.Extensions; namespace Abc.Zebus { public class DomainException : Exception { public int ErrorCode { get; private set; } public DomainException(Exception innerException, int errorCode, string message) : base(message, innerException) { ErrorCode = errorCode; } public DomainException(int errorCode, string message) : this(null, errorCode, message) { } public DomainException(int errorCode, string message, params object[] values) : this(errorCode, string.Format(message, values)) { } public DomainException(Enum enumVal, params object[] values) : this(Convert.ToInt32(enumVal), enumVal.GetAttributeDescription(), values) { } public DomainException(Expression<Func<int>> errorCodeExpression, params object[] values) : this(errorCodeExpression.Compile()(), ReadDescriptionFromAttribute(errorCodeExpression), values) { } private static string ReadDescriptionFromAttribute(Expression<Func<int>> errorCodeExpression) { var memberExpr = errorCodeExpression.Body as MemberExpression; if (memberExpr == null) return string.Empty; var attr = (DescriptionAttribute)memberExpr.Member.GetCustomAttributes(typeof(DescriptionAttribute)).FirstOrDefault(); return attr != null ? attr.Description : string.Empty; } } }
using System; using System.ComponentModel; using System.Linq; using System.Linq.Expressions; using System.Reflection; using Abc.Zebus.Util.Extensions; namespace Abc.Zebus { public class DomainException : Exception { public int ErrorCode { get; private set; } public DomainException(int errorCode, string message, params object[] values) : base(string.Format(message, values)) { ErrorCode = errorCode; } public DomainException(Enum enumVal, params object[] values) : this (Convert.ToInt32(enumVal), enumVal.GetAttributeDescription(), values) { } public DomainException(Expression<Func<int>> errorCodeExpression, params object[] values) : this (errorCodeExpression.Compile()(), ReadDescriptionFromAttribute(errorCodeExpression), values) { } static string ReadDescriptionFromAttribute(Expression<Func<int>> errorCodeExpression) { var memberExpr = errorCodeExpression.Body as MemberExpression; if (memberExpr == null) return string.Empty; var attr = (DescriptionAttribute)memberExpr.Member.GetCustomAttributes(typeof(DescriptionAttribute)).FirstOrDefault(); return attr != null ? attr.Description : string.Empty; } } }
mit
C#
54b669fb65a84f6db5e851b174c592632a22fcc3
Make GetAndIncrement more threadsafety.
maxim-s/NBench,maxim-s/NBench,petabridge/NBench,petabridge/NBench
src/NBench/Util/AtomicCounter.cs
src/NBench/Util/AtomicCounter.cs
// Copyright (c) Petabridge <https://petabridge.com/>. All rights reserved. // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. using System.Threading; namespace NBench.Util { /// <summary> /// Atomic counter class used for incrementing and decrementing <c>long</c> integer values. /// </summary> public class AtomicCounter { protected long Value; public AtomicCounter(long seed = 0) { Value = seed; } public void Increment() { Interlocked.Increment(ref Value); } public void Decrement() { Interlocked.Decrement(ref Value); } public long Current => Interlocked.Read(ref Value); public long GetAndIncrement() { return Interlocked.Increment(ref Value) - 1; } } }
// Copyright (c) Petabridge <https://petabridge.com/>. All rights reserved. // Licensed under the Apache 2.0 license. See LICENSE file in the project root for full license information. using System.Threading; namespace NBench.Util { /// <summary> /// Atomic counter class used for incrementing and decrementing <c>long</c> integer values. /// </summary> public class AtomicCounter { protected long Value; public AtomicCounter(long seed = 0) { Value = seed; } public void Increment() { Interlocked.Increment(ref Value); } public void Decrement() { Interlocked.Decrement(ref Value); } public long Current => Interlocked.Read(ref Value); public long GetAndIncrement() { long current = Current; Increment(); return current; } } }
apache-2.0
C#
01cd976975819280214ca7578e0d2157ca31959f
Remove property from ProductTestObjetBuilder that is left over from move of building with constructor feature to TestObjectBuilder class.
tdpreece/TestObjectBuilderCsharp
TestObjectBuilderTests/ConcreteTestObjectBuilders/ProductTestObjectBuilder.cs
TestObjectBuilderTests/ConcreteTestObjectBuilders/ProductTestObjectBuilder.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using TestObjectBuilder; namespace TestObjectBuilderTests { public class ProductTestObjectBuilder : TestObjBuilder<Product> { public ProductTestObjectBuilder() { this.FirstDependency = new DummyDependency1(); this.SecondDependency = new DummyDependency2(); this.PropertiesUsedByProductConstructor = new List<string>() { "FirstDependency" }; } public IDependency1 FirstDependency { get; set; } public IDependency2 SecondDependency { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using TestObjectBuilder; namespace TestObjectBuilderTests { public class ProductTestObjectBuilder : TestObjBuilder<Product> { public ProductTestObjectBuilder() { this.FirstDependency = new DummyDependency1(); this.SecondDependency = new DummyDependency2(); this.ConstructorArgumentPropertyNames = new List<string>() { "FirstDependency" }; } public List<string> ConstructorArgumentPropertyNames { get; set; } public IDependency1 FirstDependency { get; set; } public IDependency2 SecondDependency { get; set; } } }
mit
C#
1fd16088d2085715b46064b6d84e802210ade1a8
Add ToString to StringifiedExpression to simplify debugging.
asd-and-Rizzo/ExpressionToCode,EamonNerbonne/ExpressionToCode
ExpressionToCodeLib/StringifiedExpression.cs
ExpressionToCodeLib/StringifiedExpression.cs
using System; using System.Linq.Expressions; namespace ExpressionToCodeLib { struct StringifiedExpression { //a node cannot have children and text. If it has neither, it is considered empty. public readonly string Text; readonly StringifiedExpression[] children; static readonly StringifiedExpression[] empty = new StringifiedExpression[0]; public StringifiedExpression[] Children => children ?? empty; //can only have a value it it has text. public readonly Expression OptionalValue; StringifiedExpression(string text, StringifiedExpression[] children, Expression optionalValue) { Text = text; this.children = children; OptionalValue = optionalValue; } public static StringifiedExpression TextOnly(string text) => new StringifiedExpression(text, null, null); public static StringifiedExpression TextAndExpr(string text, Expression expr) { if (expr == null) { throw new ArgumentNullException(nameof(expr)); } return new StringifiedExpression(text, null, expr); } public static StringifiedExpression WithChildren(StringifiedExpression[] children) => new StringifiedExpression(null, children, null); public override string ToString() => Text ?? string.Join("", children); } }
using System; using System.Linq.Expressions; namespace ExpressionToCodeLib { struct StringifiedExpression { //a node cannot have children and text. If it has neither, it is considered empty. public readonly string Text; readonly StringifiedExpression[] children; static readonly StringifiedExpression[] empty = new StringifiedExpression[0]; public StringifiedExpression[] Children => children ?? empty; //can only have a value it it has text. public readonly Expression OptionalValue; StringifiedExpression(string text, StringifiedExpression[] children, Expression optionalValue) { Text = text; this.children = children; OptionalValue = optionalValue; } public static StringifiedExpression TextOnly(string text) => new StringifiedExpression(text, null, null); public static StringifiedExpression TextAndExpr(string text, Expression expr) { if (expr == null) { throw new ArgumentNullException(nameof(expr)); } return new StringifiedExpression(text, null, expr); } public static StringifiedExpression WithChildren(StringifiedExpression[] children) => new StringifiedExpression(null, children, null); } }
apache-2.0
C#
a64cf34d861bc166f38c3580c8c4de0c4c2c9c15
Fix system web detection logic.
meebey/JabbR,mzdv/JabbR,yadyn/JabbR,lukehoban/JabbR,e10/JabbR,M-Zuber/JabbR,yadyn/JabbR,fuzeman/vox,JabbR/JabbR,yadyn/JabbR,AAPT/jean0226case1322,SonOfSam/JabbR,lukehoban/JabbR,JabbR/JabbR,LookLikeAPro/JabbR,18098924759/JabbR,meebey/JabbR,ajayanandgit/JabbR,18098924759/JabbR,huanglitest/JabbRTest2,borisyankov/JabbR,LookLikeAPro/JabbR,AAPT/jean0226case1322,CrankyTRex/JabbRMirror,borisyankov/JabbR,fuzeman/vox,mzdv/JabbR,CrankyTRex/JabbRMirror,M-Zuber/JabbR,LookLikeAPro/JabbR,fuzeman/vox,lukehoban/JabbR,e10/JabbR,ajayanandgit/JabbR,timgranstrom/JabbR,borisyankov/JabbR,huanglitest/JabbRTest2,CrankyTRex/JabbRMirror,huanglitest/JabbRTest2,meebey/JabbR,timgranstrom/JabbR,SonOfSam/JabbR
JabbR/Infrastructure/AppBuilderExtensions.cs
JabbR/Infrastructure/AppBuilderExtensions.cs
using System; using System.Collections.Generic; using Owin; namespace JabbR.Infrastructure { public static class AppBuilderExtensions { private static readonly string SystemWebHostName = "System.Web 4.5, Microsoft.Owin.Host.SystemWeb 1.0.0.0"; public static bool IsRunningUnderSystemWeb(this IAppBuilder app) { var capabilities = (IDictionary<string, object>)app.Properties["server.Capabilities"]; // Not hosing on system web host? Bail out. object serverName; if (capabilities.TryGetValue("server.Name", out serverName) && SystemWebHostName.Equals((string)serverName, StringComparison.Ordinal)) { return true; } return false; } } }
using System; using System.Collections.Generic; using Owin; namespace JabbR.Infrastructure { public static class AppBuilderExtensions { private static readonly string SystemWebHostName = "System.Web 4.5, Microsoft.Owin.Host.SystemWeb 1.0.0.0"; public static bool IsRunningUnderSystemWeb(this IAppBuilder app) { var capabilities = (IDictionary<string, object>)app.Properties["server.Capabilities"]; // Not hosing on system web host? Bail out. object serverName; if (capabilities.TryGetValue("server.Name", out serverName) && !SystemWebHostName.Equals((string)serverName, StringComparison.Ordinal)) { return false; } return true; } } }
mit
C#
69b1a0e39e1c680f09ee9364893b5ab68757e3e7
fix toasts when running .net4.0 or higher
mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient,mindthegab/SFE-Minuet-DesktopClient
minuet/symphony/Paragon.Plugins.Notifications/WindowInteropHelperUtilities.cs
minuet/symphony/Paragon.Plugins.Notifications/WindowInteropHelperUtilities.cs
using System; using System.Reflection; using System.Windows; using System.Windows.Interop; namespace Paragon.Plugins.Notifications { public static class WindowInteropHelperUtilities { public static IntPtr EnsureHandle(this WindowInteropHelper helper) { if (helper == null) { throw new ArgumentNullException("helper"); } if (helper.Handle == IntPtr.Zero) { var window = (Window) typeof (WindowInteropHelper).InvokeMember( "_window", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic, null, helper, null); try { // SafeCreateWindow only exists in the .NET 2.0 runtime. If we try to // invoke this method on the .NET 4.0 runtime it will result in a // MissingMethodException, see below. typeof(Window).InvokeMember( "SafeCreateWindow", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, null, window, null); } catch (MissingMethodException) { // If we ended up here it means we are running on the .NET 4.0 runtime, // where the method we need to call for the handle was renamed/replaced // with CreateSourceWindow. typeof(Window).InvokeMember( "CreateSourceWindow", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, null, window, new object[] { false }); } } return helper.Handle; } } }
using System; using System.Reflection; using System.Windows; using System.Windows.Interop; namespace Paragon.Plugins.Notifications { public static class WindowInteropHelperUtilities { public static IntPtr EnsureHandle(this WindowInteropHelper helper) { if (helper == null) { throw new ArgumentNullException("helper"); } if (helper.Handle == IntPtr.Zero) { var window = (Window) typeof (WindowInteropHelper).InvokeMember( "_window", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic, null, helper, null); typeof (Window).InvokeMember( "SafeCreateWindow", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, null, window, null); } return helper.Handle; } } }
apache-2.0
C#
dbd04c81a67758871f9dd40d138229e0c173e0b7
Tweak to test
taylorjg/Monads
MonadLibTests/MonadAgnosticFunctionsTests.cs
MonadLibTests/MonadAgnosticFunctionsTests.cs
using System; using MonadLib; using NUnit.Framework; namespace MonadLibTests { [TestFixture] internal class MonadAgnosticFunctionsTests { private enum Context { Home, Mobile, Business } private Tuple<Context, string>[] _phoneBook; [SetUp] public void SetUp() { _phoneBook = new[] { Tuple.Create(Context.Mobile, "456"), Tuple.Create(Context.Home, "123-1"), Tuple.Create(Context.Home, "123-2"), Tuple.Create(Context.Business, "789"), }; } [Test] public void LookupMTest() { var homeNumber = MonadPlusAgnosticFunctions.LookupM<Maybe<string>, Context, string>(Context.Home, _phoneBook); Assert.That(homeNumber.FromJust, Is.EqualTo("123-1")); } } }
using System; using MonadLib; using NUnit.Framework; namespace MonadLibTests { [TestFixture] class MonadAgnosticFunctionsTests { private Tuple<Context, string>[] _phoneBook; private enum Context { Home, Mobile, Business } [SetUp] public void SetUp() { _phoneBook = new[] { Tuple.Create(Context.Mobile, "456"), Tuple.Create(Context.Home, "123-1"), Tuple.Create(Context.Home, "123-2"), Tuple.Create(Context.Business, "789"), }; } [Test] public void LookupMTest() { var homeNumber = MonadPlusAgnosticFunctions.LookupM<Maybe<string>, Context, string>(Context.Home, _phoneBook); Assert.That(homeNumber.FromJust, Is.EqualTo("123-1")); } } }
mit
C#
5f122dc54582cd78d8fb0df665c25cd41f058220
Update GameTree.cs
yishn/GTPWrapper
GTPWrapper/Sgf/GameTree.cs
GTPWrapper/Sgf/GameTree.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Drawing; using System.Diagnostics; using GTPWrapper.DataTypes; namespace GTPWrapper.Sgf { /// <summary> /// Represents a SGF game tree. /// </summary> public class GameTree : ListTree<Node> { /// <summary> /// Initializes a new instance of the GameTree class. /// </summary> public GameTree() : base() { } /// <summary> /// Initializes a new instance of the GameTree class with the given node list. /// </summary> /// <param name="list">The list.</param> public GameTree(List<Node> list) : base(list) { } /// <summary> /// Returns a string which represents the object. /// </summary> public override string ToString() { return string.Join("\n", this.Elements) + (this.Elements.Count == 0 || this.SubTrees.Count == 0 ? "" : "\n") + (this.SubTrees.Count == 0 ? "" : "(" + string.Join(")\n(", this.SubTrees) + ")"); } /// <summary> /// Creates a GameTree from the given string. /// </summary> /// <param name="input">The input string.</param> public static GameTree FromString(string input) { var tokens = SgfParser.Tokenize(input).ToList(); return SgfParser.Parse(tokens); } /// <summary> /// Creates a GameTree from the specified file. /// </summary> /// <param name="path">The path of the file.</param> public static GameTree FromFile(string path) { string input = File.ReadAllText(path); return GameTree.FromString(input); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Drawing; using System.Diagnostics; using GTPWrapper.DataTypes; namespace GTPWrapper.Sgf { /// <summary> /// Represents a SGF game tree. /// </summary> public class GameTree : ListTree<Node> { /// <summary> /// Initializes a new instance of the GameTree class. /// </summary> public GameTree() : base() { } /// <summary> /// Initializes a new instance of the GameTree class with the given node list. /// </summary> /// <param name="list"></param> public GameTree(List<Node> list) : base(list) { } /// <summary> /// Returns a string which represents the object. /// </summary> public override string ToString() { return string.Join("\n", this.Elements) + (this.Elements.Count == 0 || this.SubTrees.Count == 0 ? "" : "\n") + (this.SubTrees.Count == 0 ? "" : "(" + string.Join(")\n(", this.SubTrees) + ")"); } /// <summary> /// Creates a GameTree from the given string. /// </summary> /// <param name="input">The input string.</param> public static GameTree FromString(string input) { var tokens = SgfParser.Tokenize(input).ToList(); return SgfParser.Parse(tokens); } /// <summary> /// Creates a GameTree from the specified file. /// </summary> /// <param name="path">The path of the file.</param> public static GameTree FromFile(string path) { string input = File.ReadAllText(path); return GameTree.FromString(input); } } }
mit
C#
a2d6c64029a51efd2702febdd58e2010cf2c1641
Load jQuery-ui after bootstrap to get dialog close icon rendered
jeremycook/PickupMailViewer,jeremycook/PickupMailViewer
PickupMailViewer/Views/Shared/_Layout.cshtml
PickupMailViewer/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</title> <script type="text/javascript"> var baseUrl = "@Url.Content("~")"; </script> @Styles.Render("~/Content/css") @Styles.Render("~/Content/themes/base/css") @Scripts.Render("~/bundles/modernizr") <meta name="description" content="Mail viewer" /> </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("Mail Viewer", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li>@Html.ActionLink("Home", "Index", "Home")</li> </ul> </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - Albin Sunnanbo</p> <p><a href="https://github.com/albinsunnanbo/PickupMailViewer">https://github.com/albinsunnanbo/PickupMailViewer</a></p> </footer> </div> @Scripts.Render("~/bundles/bootstrap") @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/app") @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</title> <script type="text/javascript"> var baseUrl = "@Url.Content("~")"; </script> @Styles.Render("~/Content/css") @Styles.Render("~/Content/themes/base/css") @Scripts.Render("~/bundles/modernizr") <meta name="description" content="Mail viewer" /> </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("Mail Viewer", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li>@Html.ActionLink("Home", "Index", "Home")</li> </ul> </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - Albin Sunnanbo</p> <p><a href="https://github.com/albinsunnanbo/PickupMailViewer">https://github.com/albinsunnanbo/PickupMailViewer</a></p> </footer> </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @Scripts.Render("~/bundles/app") @RenderSection("scripts", required: false) </body> </html>
mit
C#
d848b810da8fbc39ad234465d83907711946e8f5
Fix VisualTests crashing on first startup due to incorrect configuration
EVAST9919/osu-framework,EVAST9919/osu-framework,default0/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,Nabile-Rahmani/osu-framework,ppy/osu-framework,Tom94/osu-framework,ZLima12/osu-framework,peppy/osu-framework,default0/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,Nabile-Rahmani/osu-framework,ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,Tom94/osu-framework
osu.Framework/Testing/TestBrowserConfig.cs
osu.Framework/Testing/TestBrowserConfig.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using osu.Framework.Configuration; using osu.Framework.Platform; namespace osu.Framework.Testing { internal class TestBrowserConfig : IniConfigManager<TestBrowserSetting> { protected override string Filename => @"visualtests.cfg"; public TestBrowserConfig(Storage storage) : base(storage) { } protected override void InitialiseDefaults() { base.InitialiseDefaults(); Set(TestBrowserSetting.LastTest, string.Empty); } } internal enum TestBrowserSetting { LastTest, } }
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using osu.Framework.Configuration; using osu.Framework.Platform; namespace osu.Framework.Testing { internal class TestBrowserConfig : IniConfigManager<TestBrowserSetting> { protected override string Filename => @"visualtests.cfg"; public TestBrowserConfig(Storage storage) : base(storage) { } } internal enum TestBrowserSetting { LastTest, } }
mit
C#
16feadbd7aa289e46d2c70a5e3a659bd32cb197d
fix crash in WillMoveToWindow
florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho,florin-chelaru/urho
bindings/iOS/UrhoSurface.cs
bindings/iOS/UrhoSurface.cs
using System; using System.Runtime.InteropServices; using CoreGraphics; using UIKit; namespace Urho.iOS { public class UrhoSurface : UIView { [DllImport("mono-urho", CallingConvention = CallingConvention.Cdecl)] static extern void SDL_SetExternalViewPlaceholder(IntPtr viewPtr, IntPtr windowPtr); public UrhoSurface() { BackgroundColor = UIColor.Black; } public UrhoSurface(CGRect frame) : base(frame) { BackgroundColor = UIColor.Black; } public override void WillMoveToWindow(UIWindow window) { SDL_SetExternalViewPlaceholder(Handle, window?.Handle ?? IntPtr.Zero); base.WillMoveToWindow(window); } } }
using System; using System.Runtime.InteropServices; using UIKit; namespace Urho.iOS { public class UrhoSurface : UIView { [DllImport("mono-urho", CallingConvention = CallingConvention.Cdecl)] static extern void SDL_SetExternalViewPlaceholder(IntPtr viewPtr, IntPtr windowPtr); public override void WillMoveToWindow(UIWindow window) { SDL_SetExternalViewPlaceholder(this.Handle, window.Handle); base.WillMoveToWindow(window); } } }
mit
C#
54a2de85ca31442c5435b72638e5122aac51c8d4
Update ConvertingToXPS.cs
aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET
Examples/CSharp/Files/Utility/ConvertingToXPS.cs
Examples/CSharp/Files/Utility/ConvertingToXPS.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Files.Utility { public class ConvertingToXPS { public static void Main(string[] args) { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Open an Excel file Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(dataDir + "Book1.xls"); //Get the first worksheet Aspose.Cells.Worksheet sheet = workbook.Worksheets[0]; //Apply different Image and Print options Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions(); //Set the Format options.SaveFormat = SaveFormat.XPS; //Render the sheet with respect to specified printing options Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, options); // Save sr.ToImage(0, dataDir + "out_printingxps.out.xps"); //Export the whole workbook to XPS Aspose.Cells.Rendering.WorkbookRender wr = new Aspose.Cells.Rendering.WorkbookRender(workbook, options); wr.ToImage(dataDir + "out_whole_printingxps.out.xps"); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Files.Utility { public class ConvertingToXPS { public static void Main(string[] args) { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Open an Excel file Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(dataDir + "Book1.xls"); //Get the first worksheet Aspose.Cells.Worksheet sheet = workbook.Worksheets[0]; //Apply different Image and Print options Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions(); //Set the Format options.SaveFormat = SaveFormat.XPS; //Render the sheet with respect to specified printing options Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, options); // Save sr.ToImage(0, dataDir + "out_printingxps.out.xps"); //Export the whole workbook to XPS Aspose.Cells.Rendering.WorkbookRender wr = new Aspose.Cells.Rendering.WorkbookRender(workbook, options); wr.ToImage(dataDir + "out_whole_printingxps.out.xps"); } } }
mit
C#
3f24624845f5e157b5d8ed0f801c89b76bdf4900
Edit in Home/Index
CloversInc/ProductManager,CloversInc/Restaurant,CloversInc/Restaurant,CloversInc/ProductManager,CloversInc/ProductManager,CloversInc/Restaurant
ProductManager.Web/Controllers/HomeController.cs
ProductManager.Web/Controllers/HomeController.cs
namespace ProductManager.Web.Controllers { using System.Collections.Generic; using System.Web.Mvc; using ProductManager.ViewModels; using Services.Interfaces; public class HomeController : Controller { private IProductService productService; public HomeController(IProductService productService) { this.productService = productService; } public ActionResult Index() { IEnumerable<ProductViewModel> models = this.productService.GetAll(); return View(); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { ViewBag.Message = "Your contact page."; return View(); } } }
using System.Web.Mvc; namespace ProductManager.Web.Controllers { using Services.Interfaces; public class HomeController : Controller { private IProductService productService; public HomeController(IProductService productService) { this.productService = productService; } public ActionResult Index() { this.productService.GetAll(); return View(); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { ViewBag.Message = "Your contact page."; return View(); } } }
mit
C#
b6594058519fe2b6ac41f11b3802fac36abc8792
Add constructor to Queue that consumes an IEnumerable
x335/WootzJs,x335/WootzJs,kswoll/WootzJs,kswoll/WootzJs,kswoll/WootzJs,x335/WootzJs
WootzJs.Runtime/Collections/Generic/Queue.cs
WootzJs.Runtime/Collections/Generic/Queue.cs
using System.Runtime.WootzJs; namespace System.Collections.Generic { public class Queue<T> : IEnumerable<T>, ICollection { private JsArray storage = new JsArray(); public Queue() { } /// <summary> /// Initializes a new instance of the <see cref="T:System.Collections.Generic.Queue`1"/> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied. /// </summary> /// <param name="collection">The collection whose elements are copied to the new <see cref="T:System.Collections.Generic.Queue`1"/>.</param><exception cref="T:System.ArgumentNullException"><paramref name="collection"/> is null.</exception> public Queue(IEnumerable<T> collection) { if (collection == null) throw new ArgumentNullException("collection"); foreach (T obj in collection) Enqueue(obj); } public void Enqueue(T item) { storage.push(item.As<JsObject>()); } public T Dequeue() { return storage.shift().As<T>(); } public T Peek() { if (storage.length == 0) throw new InvalidOperationException(); return storage[0].As<T>(); } public int Count { get { return storage.length; } } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public IEnumerator<T> GetEnumerator() { return GetEnumerable().GetEnumerator(); } private IEnumerable<T> GetEnumerable() { for (var i = 0; i < storage.length; i++) { yield return storage[i].As<T>(); } } public object SyncRoot { get { return this; } } public bool IsSynchronized { get { return true; } } public void CopyTo(Array array, int index) { for (int i = 0, j = index; index < array.Length && i < storage.length; i++, j++) { array[index] = storage[i]; } } } }
using System.Runtime.WootzJs; namespace System.Collections.Generic { public class Queue<T> : IEnumerable<T>, ICollection { private JsArray storage = new JsArray(); public void Enqueue(T item) { storage.push(item.As<JsObject>()); } public T Dequeue() { return storage.shift().As<T>(); } public T Peek() { if (storage.length == 0) throw new InvalidOperationException(); return storage[0].As<T>(); } public int Count { get { return storage.length; } } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public IEnumerator<T> GetEnumerator() { return GetEnumerable().GetEnumerator(); } private IEnumerable<T> GetEnumerable() { for (var i = 0; i < storage.length; i++) { yield return storage[i].As<T>(); } } public object SyncRoot { get { return this; } } public bool IsSynchronized { get { return true; } } public void CopyTo(Array array, int index) { for (int i = 0, j = index; index < array.Length && i < storage.length; i++, j++) { array[index] = storage[i]; } } } }
mit
C#
9a7e314aebe1c6f4fd0f36925f838acf58df0a04
Increase version number.
Roland-Schneider/TfsZipShelveset
TfZip/Properties/AssemblyInfo.cs
TfZip/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("TfZip")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TfZip")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM //[assembly: Guid("c39b9aca-a822-4653-9428-3b83bbcd567f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5")] //[assembly: AssemblyFileVersion("1.2")]
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("TfZip")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TfZip")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM //[assembly: Guid("c39b9aca-a822-4653-9428-3b83bbcd567f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4")] //[assembly: AssemblyFileVersion("1.2")]
bsd-3-clause
C#
3ce0450d7b4c9a69f983c27efd333de119a02e36
Make sure we test across more than two lines.
jmptrader/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,jacksonh/manos,jacksonh/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,jmptrader/manos,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,jacksonh/manos,jacksonh/manos
src/Mango/Mango.Tests/Mango.Server/HttpHeadersTest.cs
src/Mango/Mango.Tests/Mango.Server/HttpHeadersTest.cs
using System; using System.IO; using NUnit.Framework; namespace Mango.Server.Tests { [TestFixture()] public class HttpHeadersTest { [Test()] public void TestMultilineParse () { // // multiline values are acceptable if the next // line starts with spaces // string header = @"HeaderName: Some multiline value"; HttpHeaders headers = new HttpHeaders (); headers.Parse (new StringReader (header)); Assert.AreEqual ("some multiline value", headers ["HeaderName"], "a1"); header = @"HeaderName: Some multiline value that spans a bunch of lines"; headers = new HttpHeaders (); headers.Parse (new StringReader (header)); Assert.AreEqual ("Some multiline value that spans a bunch of lines", headers ["HeaderName"], "a2"); } } }
using System; using System.IO; using NUnit.Framework; namespace Mango.Server.Tests { [TestFixture()] public class HttpHeadersTest { [Test()] public void TestMultilineParse () { // // multiline values are acceptable if the next // line starts with spaces // string header = @"HeaderName: Some multiline value"; HttpHeaders headers = new HttpHeaders (); headers.Parse (new StringReader (header)); Assert.AreEqual ("some multiline value", headers ["HeaderName"], "a1"); } } }
mit
C#
386633a5a5caccfb1cb8660a82fbb697510b083c
add PlayerPrefs.Save after DeleteAll()
NDark/ndinfrastructure,NDark/ndinfrastructure
Unity/EditorTools/EditorTools.cs
Unity/EditorTools/EditorTools.cs
/** MIT License Copyright (c) 2017 NDark 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. */ /** @file EditorTools.cs @author NDark @date 20170509 . file started. */ using UnityEngine; public static partial class EditorTools { public static void CachingCleanCache() { if( Caching.CleanCache () ) { Debug.Log("EditorTools::CachingCleanCache() succeed."); } else { Debug.LogWarning("EditorTools::CachingCleanCache() failed."); } } public static void PlayerPrefsDeleteAll() { Debug.LogWarning("EditorTools::PlayerPrefsDeleteAll() remember this just remove PlayerPrefs of editor platform."); PlayerPrefs.DeleteAll() ; PlayerPrefs.Save(); } }
/** MIT License Copyright (c) 2017 NDark 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. */ /** @file EditorTools.cs @author NDark @date 20170509 . file started. */ using UnityEngine; public static partial class EditorTools { public static void CachingCleanCache() { if( Caching.CleanCache () ) { Debug.Log("EditorTools::CachingCleanCache() succeed."); } else { Debug.LogWarning("EditorTools::CachingCleanCache() failed."); } } public static void PlayerPrefsDeleteAll() { Debug.LogWarning("EditorTools::PlayerPrefsDeleteAll() remember this just remove PlayerPrefs of editor platform."); PlayerPrefs.DeleteAll() ; } }
mit
C#
4adc693cb52c3b70175721ed9c474cde46409f96
Add an UseRouter that takes Action<IRouteBuilder>
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNetCore.Routing/BuilderExtensions.cs
src/Microsoft.AspNetCore.Routing/BuilderExtensions.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing.Internal; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.AspNetCore.Builder { /// <summary> /// Extension methods for adding the <see cref="RouterMiddleware"/> middleware to an <see cref="IApplicationBuilder"/>. /// </summary> public static class RoutingBuilderExtensions { /// <summary> /// Adds a <see cref="RouterMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/> with the specified <see cref="IRouter"/>. /// </summary> /// <param name="builder">The <see cref="IApplicationBuilder"/> to add the middleware to.</param> /// <param name="router">The <see cref="IRouter"/> to use for routing requests.</param> /// <returns>A reference to this instance after the operation has completed.</returns> public static IApplicationBuilder UseRouter(this IApplicationBuilder builder, IRouter router) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (router == null) { throw new ArgumentNullException(nameof(router)); } if (builder.ApplicationServices.GetService(typeof(RoutingMarkerService)) == null) { throw new InvalidOperationException(Resources.FormatUnableToFindServices( nameof(IServiceCollection), nameof(RoutingServiceCollectionExtensions.AddRouting), "ConfigureServices(...)")); } return builder.UseMiddleware<RouterMiddleware>(router); } /// <summary> /// Adds a <see cref="RouterMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/> /// with the <see cref="IRouter"/> built from configured <see cref="IRouteBuilder"/>. /// </summary> /// <param name="builder">The <see cref="IApplicationBuilder"/> to add the middleware to.</param> /// <param name="action">An <see cref="Action{IRouteBuilder}"/> to configure the provided <see cref="IRouteBuilder"/>.</param> /// <returns>A reference to this instance after the operation has completed.</returns> public static IApplicationBuilder UseRouter(this IApplicationBuilder builder, Action<IRouteBuilder> action) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (action == null) { throw new ArgumentNullException(nameof(action)); } var routeBuilder = new RouteBuilder(builder); action(routeBuilder); return builder.UseRouter(routeBuilder.Build()); } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing.Internal; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.AspNetCore.Builder { /// <summary> /// Extension methods for adding the <see cref="RouterMiddleware"/> middleware to an <see cref="IApplicationBuilder"/>. /// </summary> public static class RoutingBuilderExtensions { /// <summary> /// Adds a <see cref="RouterMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/> with the specified <see cref="IRouter"/>. /// </summary> /// <param name="builder">The <see cref="IApplicationBuilder"/> to add the middleware to.</param> /// <param name="router">The <see cref="IRouter"/> to use for routing requests.</param> /// <returns>A reference to this instance after the operation has completed.</returns> public static IApplicationBuilder UseRouter(this IApplicationBuilder builder, IRouter router) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (router == null) { throw new ArgumentNullException(nameof(router)); } if (builder.ApplicationServices.GetService(typeof(RoutingMarkerService)) == null) { throw new InvalidOperationException(Resources.FormatUnableToFindServices( nameof(IServiceCollection), nameof(RoutingServiceCollectionExtensions.AddRouting), "ConfigureServices(...)")); } return builder.UseMiddleware<RouterMiddleware>(router); } } }
apache-2.0
C#
28c8598fd86e53f437dd012a025d82d8bcf1c0a0
Determine upper limit
martincostello/project-euler
src/ProjectEuler/Puzzles/Puzzle041.cs
src/ProjectEuler/Puzzles/Puzzle041.cs
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.ProjectEuler.Puzzles { using System.Linq; /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=41</c>. This class cannot be inherited. /// </summary> internal sealed class Puzzle041 : Puzzle { /// <inheritdoc /> public override string Question => "What is the largest n-digit pandigital prime that exists?"; /// <inheritdoc /> protected override int SolveCore(string[] args) { // 1..n is divisble by 3 (and hence not prime) // if the sum of the digits is divisble by 3. // Determine the maximum number of digits for // a pandigital that is not divisible by 3. int maxDigits = Enumerable.Range(2, 9 - 2) .Select((p) => Enumerable.Range(1, p)) .Where((p) => p.Sum() % 3 != 0) .SelectMany((p) => p) .Max(); int upperLimit = (int)Maths.FromDigits(Enumerable.Repeat(9, maxDigits).ToArray()); int current = 0; foreach (int value in Maths.Primes(upperLimit)) { if (value > current && Maths.IsPandigital(value)) { current = value; } } Answer = current; return 0; } } }
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.ProjectEuler.Puzzles { /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=41</c>. This class cannot be inherited. /// </summary> internal sealed class Puzzle041 : Puzzle { /// <inheritdoc /> public override string Question => "What is the largest n-digit pandigital prime that exists?"; /// <inheritdoc /> protected override int SolveCore(string[] args) { int current = 0; foreach (int value in Maths.Primes(999999999)) { if (value > current && Maths.IsPandigital(value)) { current = value; } } Answer = current; return 0; } } }
apache-2.0
C#
48daced835c5538f45149809cf62dbb4c737fefa
Fix failing GetFieldMapping api tests
RossLieberman/NEST,RossLieberman/NEST,UdiBen/elasticsearch-net,cstlaurent/elasticsearch-net,RossLieberman/NEST,UdiBen/elasticsearch-net,adam-mccoy/elasticsearch-net,TheFireCookie/elasticsearch-net,adam-mccoy/elasticsearch-net,UdiBen/elasticsearch-net,CSGOpenSource/elasticsearch-net,azubanov/elasticsearch-net,CSGOpenSource/elasticsearch-net,elastic/elasticsearch-net,cstlaurent/elasticsearch-net,elastic/elasticsearch-net,CSGOpenSource/elasticsearch-net,TheFireCookie/elasticsearch-net,azubanov/elasticsearch-net,TheFireCookie/elasticsearch-net,adam-mccoy/elasticsearch-net,cstlaurent/elasticsearch-net,azubanov/elasticsearch-net
src/Tests/Indices/MappingManagement/GetFieldMapping/GetFieldMappingApiTests.cs
src/Tests/Indices/MappingManagement/GetFieldMapping/GetFieldMappingApiTests.cs
using Elasticsearch.Net; using FluentAssertions; using Nest; using Tests.Framework; using Tests.Framework.Integration; using Tests.Framework.MockData; using Xunit; namespace Tests.Indices.MappingManagement.GetFieldMapping { [Collection(IntegrationContext.ReadOnly)] public class GetFieldMappingApiTests : ApiIntegrationTestBase<IGetFieldMappingResponse, IGetFieldMappingRequest, GetFieldMappingDescriptor<Project>, GetFieldMappingRequest> { private static readonly Fields Fields = Infer.Fields<Project>(p => p.Name, p => p.Tags); public GetFieldMappingApiTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { } protected override LazyResponses ClientUsage() => Calls( fluent: (client, f) => client.GetFieldMapping<Project>(Fields), fluentAsync: (client, f) => client.GetFieldMappingAsync<Project>(Fields), request: (client, r) => client.GetFieldMapping(r), requestAsync: (client, r) => client.GetFieldMappingAsync(r) ); protected override bool ExpectIsValid => true; protected override int ExpectStatusCode => 200; protected override HttpMethod HttpMethod => HttpMethod.GET; protected override string UrlPath => $"/_mapping/field/name,tags"; protected override GetFieldMappingDescriptor<Project> NewDescriptor() => new GetFieldMappingDescriptor<Project>(Fields); protected override GetFieldMappingRequest Initializer => new GetFieldMappingRequest(Fields); protected override void ExpectResponse(IGetFieldMappingResponse response) { var fieldMapping = response.MappingFor<Project>("name"); fieldMapping.Should().NotBeNull(); } } }
using Elasticsearch.Net; using FluentAssertions; using Nest; using Tests.Framework; using Tests.Framework.Integration; using Tests.Framework.MockData; using Xunit; namespace Tests.Indices.MappingManagement.GetFieldMapping { [Collection(IntegrationContext.Indexing)] public class GetFieldMappingApiTests : ApiIntegrationTestBase<IGetFieldMappingResponse, IGetFieldMappingRequest, GetFieldMappingDescriptor<Project>, GetFieldMappingRequest> { private static readonly Fields Fields = Infer.Fields<Project>(p => p.Name, p => p.Tags); public GetFieldMappingApiTests(IndexingCluster cluster, EndpointUsage usage) : base(cluster, usage) { } protected override LazyResponses ClientUsage() => Calls( fluent: (client, f) => client.GetFieldMapping<Project>(Fields), fluentAsync: (client, f) => client.GetFieldMappingAsync<Project>(Fields), request: (client, r) => client.GetFieldMapping(r), requestAsync: (client, r) => client.GetFieldMappingAsync(r) ); protected override bool ExpectIsValid => true; protected override int ExpectStatusCode => 200; protected override HttpMethod HttpMethod => HttpMethod.GET; protected override string UrlPath => $"/_mapping/field/name,tags"; protected override GetFieldMappingDescriptor<Project> NewDescriptor() => new GetFieldMappingDescriptor<Project>(Fields); protected override GetFieldMappingRequest Initializer => new GetFieldMappingRequest(Fields); protected override void ExpectResponse(IGetFieldMappingResponse response) { var fieldMapping = response.MappingFor<Project>("name"); fieldMapping.Should().NotBeNull(); } } }
apache-2.0
C#
d2f232a3d677b59fcd23b2ebdf4b8d5cf6908f9f
Update version number.
Damnae/storybrew
editor/Properties/AssemblyInfo.cs
editor/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © Damnae 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.84.*")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © Damnae 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.83.*")]
mit
C#
9058f8a66bbadbfcad93893733e5e4eef3da992a
Update version number.
Damnae/storybrew
editor/Properties/AssemblyInfo.cs
editor/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © Damnae 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.52.*")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © Damnae 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.51.*")]
mit
C#
73faf294e1899394963f1b22dfc1a58c3be06f66
Change URL of initialization in integration tests
mikehancock/CypherNetCore
src/CypherTwo.Tests/IntegrationTests.cs
src/CypherTwo.Tests/IntegrationTests.cs
namespace CypherTwo.Tests { using System; using System.Net.Http; using CypherTwo.Core; using NUnit.Framework; [TestFixture] public class IntegrationTests { private INeoClient neoClient; private ISendRestCommandsToNeo neoApi; private IJsonHttpClientWrapper httpClientWrapper; [SetUp] public void SetupBeforeEachTest() { this.httpClientWrapper = new JsonHttpClientWrapper(new HttpClient()); this.neoApi = new NeoRestApiClient(this.httpClientWrapper, "http://localhost:7474/db/data"); this.neoClient = new NeoClient(this.neoApi); this.neoClient.Initialise(); } [Test] public void InitialiseThrowsExecptionWithInvalidUrl() { this.neoApi = new NeoRestApiClient(this.httpClientWrapper, "http://localhost:1111/"); this.neoClient = new NeoClient(this.neoApi); Assert.Throws<InvalidOperationException>(() => this.neoClient.Initialise()); } [Test] public async void CreateAndSelectNode() { var reader = await this.neoClient.QueryAsync("CREATE (n:Person { name : 'Andres', title : 'Developer' }) RETURN Id(n)"); Assert.That(reader.Read(), Is.EqualTo(true)); Assert.That(reader.Get<int>(0), Is.EqualTo(1)); } } }
namespace CypherTwo.Tests { using System; using System.Net.Http; using CypherTwo.Core; using NUnit.Framework; [TestFixture] public class IntegrationTests { private INeoClient neoClient; private ISendRestCommandsToNeo neoApi; private IJsonHttpClientWrapper httpClientWrapper; [SetUp] public void SetupBeforeEachTest() { this.httpClientWrapper = new JsonHttpClientWrapper(new HttpClient()); this.neoApi = new NeoRestApiClient(this.httpClientWrapper, "http://localhost:7474/"); this.neoClient = new NeoClient(this.neoApi); this.neoClient.Initialise(); } [Test] public void InitialiseThrowsExecptionWithInvalidUrl() { this.neoApi = new NeoRestApiClient(this.httpClientWrapper, "http://localhost:1111/"); this.neoClient = new NeoClient(this.neoApi); Assert.Throws<InvalidOperationException>(() => this.neoClient.Initialise()); } [Test] public async void CreateAndSelectNode() { var reader = await this.neoClient.QueryAsync("CREATE (n:Person { name : 'Andres', title : 'Developer' }) RETURN Id(n)"); Assert.That(reader.Read(), Is.EqualTo(true)); Assert.That(reader.Get<int>(0), Is.EqualTo(1)); } } }
mit
C#
0e2c743f99d1d21b63e4883eecd4c98a00f0d9d3
Update version
valdisiljuconoks/EPiBootstrapArea,valdisiljuconoks/EPiBootstrapArea,valdisiljuconoks/EPiBootstrapArea
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("EPiBootstrapArea")] [assembly: AssemblyDescription("Bootstrap aware EPiServer Content Area renderer")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Valdis Iljuconoks (Tech Fellow Consulting)")] [assembly: AssemblyProduct("EPiBootstrapArea")] [assembly: AssemblyCopyright("Copyright © 2016 http://blog.tech-fellow.net")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("0b623313-e88f-4f24-8240-66934f8e6b02")] [assembly: AssemblyVersion("3.3.1.0")] [assembly: AssemblyFileVersion("3.3.1.0")] [assembly: AssemblyInformationalVersion("3.3.1")] [assembly: InternalsVisibleTo("EPiBootstrapArea.Tests")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("EPiBootstrapArea")] [assembly: AssemblyDescription("Bootstrap aware EPiServer Content Area renderer")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Valdis Iljuconoks (Tech Fellow Consulting)")] [assembly: AssemblyProduct("EPiBootstrapArea")] [assembly: AssemblyCopyright("Copyright © 2016 http://blog.tech-fellow.net")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("0b623313-e88f-4f24-8240-66934f8e6b02")] [assembly: AssemblyVersion("3.3.0.0")] [assembly: AssemblyFileVersion("3.3.0.0")] [assembly: AssemblyInformationalVersion("3.3.0")] [assembly: InternalsVisibleTo("EPiBootstrapArea.Tests")]
mit
C#
1ca83740285907192002dca79b29ea7a90a367d8
Fix UseAzureAppServices_RegisterLogger test
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/AppServicesWebHostBuilderExtensionsTest.cs
test/Microsoft.AspNetCore.AzureAppServicesIntegration.Tests/AppServicesWebHostBuilderExtensionsTest.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.Extensions.Logging; using Moq; using Xunit; namespace Microsoft.AspNetCore.Hosting.Azure.AppServices.Tests { public class AppServicesWebHostBuilderExtensionsTest { [Fact] public void UseAzureAppServices_RegisterLogger() { var mock = new Mock<IWebHostBuilder>(); mock.Object.UseAzureAppServices(); mock.Verify(builder => builder.ConfigureLogging(It.IsNotNull<Action<WebHostBuilderContext, LoggerFactory>>()), Times.Once); } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.Extensions.Logging; using Moq; using Xunit; namespace Microsoft.AspNetCore.Hosting.Azure.AppServices.Tests { public class AppServicesWebHostBuilderExtensionsTest { [Fact] public void UseAzureAppServices_RegisterLogger() { var mock = new Mock<IWebHostBuilder>(); mock.Object.UseAzureAppServices(); mock.Verify(builder => builder.ConfigureLogging(It.IsNotNull<Action<LoggerFactory>>()), Times.Once); } } }
apache-2.0
C#
0b7d4d58a0a3d91005e8a358d458b306de993707
increment minor version,
jwChung/Experimentalism,jwChung/Experimentalism
build/CommonAssemblyInfo.cs
build/CommonAssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Jin-Wook Chung")] [assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyProduct("")] [assembly: AssemblyVersion("0.8.0")] [assembly: AssemblyInformationalVersion("0.8.0")] /* * Version 0.8.0 * * - Implemented the feature of First class tests, which is * varataion of parameterized tests. * * Closes https://github.com/jwChung/Experimentalism/pull/19 * * Related to pull requests: * https://github.com/jwChung/Experimentalism/pull/20 * https://github.com/jwChung/Experimentalism/pull/21 * https://github.com/jwChung/Experimentalism/pull/22 */
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Jin-Wook Chung")] [assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyProduct("")] [assembly: AssemblyVersion("0.7.0")] [assembly: AssemblyInformationalVersion("0.7.0")] /* * Version 0.7.0 * * - Experiment.AutoFixture에서 AutoFixture.Xunit의 CustomizeAttribute 지원. * 이로써, 테스트 메소드 파라메타의 어트리뷰트를 통해 dependency injection을 * 이용할 수 있음. */
mit
C#
9af5ad54972c1286381ebac128038535b60570a8
Prepare for 0.2 release.
neitsa/PrepareLanding,neitsa/PrepareLanding
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PrepareLanding")] [assembly: AssemblyDescription("A RimWorld Alpha 17 mod")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PrepareLanding")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("417e7144-1b89-42b4-ae98-7b3bbd6303da")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.2.0.0")] [assembly: AssemblyFileVersion("0.2.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PrepareLanding")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PrepareLanding")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("417e7144-1b89-42b4-ae98-7b3bbd6303da")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
6a8ed3b2bcdb16772cf59bea7449625d152990ee
Bump version
TETYYS/VCTRNR
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("VCTRNTR")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("VCTRNTR")] [assembly: AssemblyCopyright("TETYYS")] [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("689398a0-3462-42e3-a9b4-83786ceeb6a3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.3.*")]
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("VCTRNTR")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("VCTRNTR")] [assembly: AssemblyCopyright("TETYYS")] [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("689398a0-3462-42e3-a9b4-83786ceeb6a3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.2.*")]
mit
C#
c0dde9674c132c546b3ad9de3c630ac597d1bbdd
Update FileVersion number
TechieGuy12/PlexServerAutoUpdater
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
#region Using directives using System; using System.Reflection; using System.Runtime.InteropServices; #endregion // 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 ("PlexServerAutoUpdater")] [assembly: AssemblyDescription("Updates the Plex Server when it is run as a service.")] [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("")] [assembly: AssemblyProduct ("PlexServerAutoUpdater")] [assembly: AssemblyCopyright("Copyright 2017-2018")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. [assembly: ComVisible (false)] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all the values or you can use the default the Revision and // Build Numbers by using the '*' as shown below: [assembly: AssemblyVersion("0.1.8.3")] [assembly: AssemblyFileVersion("0.1.8.3")]
#region Using directives using System; using System.Reflection; using System.Runtime.InteropServices; #endregion // 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 ("PlexServerAutoUpdater")] [assembly: AssemblyDescription("Updates the Plex Server when it is run as a service.")] [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("")] [assembly: AssemblyProduct ("PlexServerAutoUpdater")] [assembly: AssemblyCopyright("Copyright 2017-2018")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. [assembly: ComVisible (false)] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all the values or you can use the default the Revision and // Build Numbers by using the '*' as shown below: [assembly: AssemblyVersion("0.1.8.3")] [assembly: AssemblyFileVersion("0.1.8.1")]
mit
C#
9d0aefcc43fde8ea303f8b3e370f076b8bb2a3db
Fix Object reference not set to an instance of an object.
pekspro/Template10,pekspro/Template10,callummoffat/Template10,SimoneBWS/Template10,liptonbeer/Template10,GFlisch/Template10,AparnaChinya/Template10,teamneusta/Template10,artfuldev/Template10,Viachaslau-Zinkevich/Template10,Windows-XAML/Template10,SimoneBWS/Template10,MichaelPetrinolis/Template10,kenshinthebattosai/Template10,kenshinthebattosai/Template10,liptonbeer/Template10,dkackman/Template10,dkackman/Template10,callummoffat/Template10,devinfluencer/Template10,artfuldev/Template10,mvermef/Template10,teamneusta/Template10,AparnaChinya/Template10,dg2k/Template10,MichaelPetrinolis/Template10,GFlisch/Template10,devinfluencer/Template10,Viachaslau-Zinkevich/Template10
Samples/Search/App.xaml.cs
Samples/Search/App.xaml.cs
using System.Threading.Tasks; using Windows.ApplicationModel.Activation; using Windows.UI.Xaml; namespace Template10.Samples.SearchSample { sealed partial class App : Template10.Common.BootStrapper { public App() { InitializeComponent(); } public override Task OnInitializeAsync(IActivatedEventArgs args) { var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include); Window.Current.Content = new Views.Shell(nav); return Task.CompletedTask; } public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args) { NavigationService.Navigate(typeof(Views.MainPage)); return Task.CompletedTask; } } }
using System.Threading.Tasks; using Windows.ApplicationModel.Activation; using Windows.UI.Xaml; namespace Template10.Samples.SearchSample { sealed partial class App : Template10.Common.BootStrapper { public App() { InitializeComponent(); } public override Task OnInitializeAsync(IActivatedEventArgs args) { var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include, null); Window.Current.Content = new Views.Shell(nav); return Task.CompletedTask; } public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args) { NavigationService.Navigate(typeof(Views.MainPage)); return Task.CompletedTask; } } }
apache-2.0
C#
b5e1ecbda6f5181abca69fb143ad2b2480d11f20
fix potential error when parsing, if value is not recognized, keep the current value
Elders/VSE-FormatDocumentOnSave
src/Elders.VSE-FormatDocumentOnSave/Configurations/EditorConfigConfiguration.cs
src/Elders.VSE-FormatDocumentOnSave/Configurations/EditorConfigConfiguration.cs
using EditorConfig.Core; using System.Collections.Generic; using System.Linq; namespace Elders.VSE_FormatDocumentOnSave.Configurations { public sealed class EditorConfigConfiguration : IConfiguration { private readonly bool enable = true; private readonly string allowed = ".*"; private readonly string denied = ""; private readonly string command = "Edit.FormatDocument"; private readonly bool enableInDebug = false; public EditorConfigConfiguration(string formatConfigFile) { var parser = new EditorConfigParser(formatConfigFile); FileConfiguration configFile = parser.Parse(formatConfigFile).First(); if (configFile.Properties.TryGetValue("enable", out string enableAsString) && bool.TryParse(enableAsString, out bool enableParsed)) enable = enableParsed; if (configFile.Properties.ContainsKey("allowed_extensions")) configFile.Properties.TryGetValue("allowed_extensions", out allowed); if (configFile.Properties.ContainsKey("denied_extensions")) configFile.Properties.TryGetValue("denied_extensions", out denied); if (configFile.Properties.ContainsKey("command")) configFile.Properties.TryGetValue("command", out command); if (configFile.Properties.TryGetValue("enable_in_debug", out string enableInDebugAsString) && bool.TryParse(enableInDebugAsString, out bool enableInDebugParsed)) enableInDebug = enableInDebugParsed; } public bool IsEnable => enable; IEnumerable<string> IConfiguration.Allowed => allowed.Split(' '); IEnumerable<string> IConfiguration.Denied => denied.Split(' '); public string Commands => command; public bool EnableInDebug => enableInDebug; } }
using EditorConfig.Core; using System.Collections.Generic; using System.Linq; namespace Elders.VSE_FormatDocumentOnSave.Configurations { public sealed class EditorConfigConfiguration : IConfiguration { private readonly bool enable = true; private readonly string allowed = ".*"; private readonly string denied = ""; private readonly string command = "Edit.FormatDocument"; private readonly bool enableInDebug = false; public EditorConfigConfiguration(string formatConfigFile) { var parser = new EditorConfig.Core.EditorConfigParser(formatConfigFile); FileConfiguration configFile = parser.Parse(formatConfigFile).First(); if (configFile.Properties.ContainsKey("enable")) { configFile.Properties.TryGetValue("enable", out string enableAsString); bool.TryParse(enableAsString, out enable); } if (configFile.Properties.ContainsKey("allowed_extensions")) configFile.Properties.TryGetValue("allowed_extensions", out allowed); if (configFile.Properties.ContainsKey("denied_extensions")) configFile.Properties.TryGetValue("denied_extensions", out denied); if (configFile.Properties.ContainsKey("command")) configFile.Properties.TryGetValue("command", out command); if (configFile.Properties.ContainsKey("enable_in_debug")) { configFile.Properties.TryGetValue("enable_in_debug", out string enableInDebugAsString); bool.TryParse(enableInDebugAsString, out enableInDebug); } } public bool IsEnable => enable; IEnumerable<string> IConfiguration.Allowed => allowed.Split(' '); IEnumerable<string> IConfiguration.Denied => denied.Split(' '); public string Commands => command; public bool EnableInDebug => enableInDebug; } }
apache-2.0
C#
77cdfe9cb1832f1349db82f0684001c409860366
fix tabbing
Pondidum/NuCache,Pondidum/NuCache,Pondidum/NuCache
NuCache/Infrastructure/Spark/SparkResponseFactory.cs
NuCache/Infrastructure/Spark/SparkResponseFactory.cs
using System.IO; using System.Net; using System.Net.Http; using System.Net.Http.Headers; namespace NuCache.Infrastructure.Spark { public class SparkResponseFactory { private readonly SparkEngine _engine; public SparkResponseFactory(SparkEngine engine) { _engine = engine; } public HttpResponseMessage From<TModel>(TModel model) where TModel : class { var view = _engine.CreateView(model); var content = new PushStreamContent((responseStream, cont, context) => { using (var writer = new StreamWriter(responseStream)) { view.RenderView(writer); } responseStream.Close(); }); content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); return new HttpResponseMessage(HttpStatusCode.OK) { Content = content }; } } }
using System.IO; using System.Net; using System.Net.Http; using System.Net.Http.Headers; namespace NuCache.Infrastructure.Spark { public class SparkResponseFactory { private readonly SparkEngine _engine; public SparkResponseFactory(SparkEngine engine) { _engine = engine; } public HttpResponseMessage From<TModel>(TModel model) where TModel : class { var view = _engine.CreateView(model); var content = new PushStreamContent((responseStream, cont, context) => { using (var writer = new StreamWriter(responseStream)) { view.RenderView(writer); } responseStream.Close(); }); content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); return new HttpResponseMessage(HttpStatusCode.OK) { Content = content }; } } }
lgpl-2.1
C#
29def0150a514ac1e49c7c155b904dc675a19ac4
Update NUnitSettings of Atata.Bootstrap.Tests project
atata-framework/atata-bootstrap,atata-framework/atata-bootstrap
src/Atata.Bootstrap.Tests/NUnitSettings.cs
src/Atata.Bootstrap.Tests/NUnitSettings.cs
using NUnit.Framework; [assembly: LevelOfParallelism(4)] [assembly: Parallelizable(ParallelScope.Children)]
using NUnit.Framework; [assembly: LevelOfParallelism(4)] [assembly: Parallelizable(ParallelScope.Fixtures)]
apache-2.0
C#
5968f2166d16d1c755190c8a1cbf6675264c89b5
Fix Trigger_VerifyH1_6 test
YevgeniyShunevych/Atata,YevgeniyShunevych/Atata,atata-framework/atata,atata-framework/atata
src/Atata.Tests/VerifyHeadingTests.cs
src/Atata.Tests/VerifyHeadingTests.cs
using System.Linq; using NUnit.Framework; namespace Atata.Tests { public class VerifyHeadingTests : UITestFixture { [TestCase(TestName = "Trigger_VerifyH1-6")] public void Trigger_VerifyH1_6() { Go.To<HeadingPage>(); string[] logMessages = LogEntries.Select(x => x.Message).ToArray(); string[] expectedLogMessageTexts = { "Heading 1_2", "Heading 2.1.2.1.1.1", "Heading 2.2", "Assert: \"4th\" <h2> heading content should equal \"Heading 2.2\"", "Assert: \"Heading_2/Heading 2\" <h1> heading should exist" }; foreach (var text in expectedLogMessageTexts) Assert.That(logMessages, Has.Some.Contains(text)); } } }
using System.Linq; using NUnit.Framework; namespace Atata.Tests { public class VerifyHeadingTests : UITestFixture { [TestCase(TestName = "Trigger_VerifyH1-6")] public void Trigger_VerifyH1_6() { Go.To<HeadingPage>(); string[] logMessages = LogEntries.Select(x => x.Message).ToArray(); string[] expectedLogMessageTexts = { "Heading 1_2", "Heading 2.1.2.1.1.1", "Heading 2.2", "Verify \"4th\" <h2> heading content should equal \"Heading 2.2\"", "Verify \"Heading_2/Heading 2\" <h1> heading should exist" }; foreach (var text in expectedLogMessageTexts) Assert.That(logMessages, Has.Some.Contains(text)); } } }
apache-2.0
C#
6e3b342f282b3b5f0fe9a2f05619a83f185edfc2
Switch over agent to using Agent bus
zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype
src/Glimpse.Agent.Web/AgentRuntime.cs
src/Glimpse.Agent.Web/AgentRuntime.cs
using Glimpse.Web; using System; namespace Glimpse.Agent.Web { public class AgentRuntime : IRequestRuntime { private readonly IMessageAgentBus _messageBus; public AgentRuntime(IMessageAgentBus messageBus) { _messageBus = messageBus; } public void Begin(IContext newContext) { var message = new BeginRequestMessage(); // TODO: Full out message more _messageBus.SendMessage(message); } public void End(IContext newContext) { var message = new EndRequestMessage(); // TODO: Full out message more _messageBus.SendMessage(message); } } }
using Glimpse.Web; using System; namespace Glimpse.Agent.Web { public class AgentRuntime : IRequestRuntime { private readonly IMessagePublisher _messagePublisher; public AgentRuntime(IMessagePublisher messagePublisher) { _messagePublisher = messagePublisher; } public void Begin(IContext newContext) { var message = new BeginRequestMessage(); // TODO: Full out message more _messagePublisher.PublishMessage(message); } public void End(IContext newContext) { var message = new EndRequestMessage(); // TODO: Full out message more _messagePublisher.PublishMessage(message); } } }
mit
C#
9d7da0a3311275375d3dd5da20478f8fd4f0814c
fix benchmark which was misleading (poor x86 Jit NaN performance)
mathnet/mathnet-numerics,shaia/mathnet-numerics,shaia/mathnet-numerics,shaia/mathnet-numerics,mathnet/mathnet-numerics,mathnet/mathnet-numerics,mathnet/mathnet-numerics,shaia/mathnet-numerics,mathnet/mathnet-numerics,shaia/mathnet-numerics
src/Benchmark/Transforms/FFT.cs
src/Benchmark/Transforms/FFT.cs
using System.Numerics; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; using BenchmarkDotNet.Environments; using BenchmarkDotNet.Jobs; using MathNet.Numerics; using MathNet.Numerics.IntegralTransforms; namespace Benchmark.Transforms { [Config(typeof(Config))] public class FFT { class Config : ManualConfig { public Config() { Add( new Job("CLR x64", RunMode.Default, EnvMode.RyuJitX64) { Env = { Runtime = Runtime.Clr, Platform = Platform.X64 } }, new Job("CLR x86", RunMode.Default, EnvMode.LegacyJitX86) { Env = { Runtime = Runtime.Clr, Platform = Platform.X86 } }); #if !NET461 Add(new Job("Core RyuJit x64", RunMode.Default, EnvMode.RyuJitX64) { Env = { Runtime = Runtime.Core, Platform = Platform.X64 } }); #endif } } [Params(32, 128, 1024)] // 32, 64, 128, 1024, 8192, 65536 public int N { get; set; } [Params(Provider.Managed, Provider.NativeMKLAutoHigh)] public Provider Provider { get; set; } Complex[] _data; [GlobalSetup] public void GlobalSetup() { Providers.ForceProvider(Provider); var realSinusoidal = Generate.Sinusoidal(N, 32, -2.0, 2.0); var imagSawtooth = Generate.Sawtooth(N, 32, -20.0, 20.0); _data = Generate.Map2(realSinusoidal, imagSawtooth, (r, i) => new Complex(r, i)); } [Benchmark(OperationsPerInvoke = 2)] public void Transform() { Fourier.Forward(_data, FourierOptions.Default); Fourier.Inverse(_data, FourierOptions.Default); } } }
using System.Numerics; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; using BenchmarkDotNet.Environments; using BenchmarkDotNet.Jobs; using MathNet.Numerics; using MathNet.Numerics.IntegralTransforms; namespace Benchmark.Transforms { [Config(typeof(Config))] public class FFT { class Config : ManualConfig { public Config() { Add( new Job("CLR x64", RunMode.Default, EnvMode.RyuJitX64) { Env = { Runtime = Runtime.Clr, Platform = Platform.X64 } }, new Job("CLR x86", RunMode.Default, EnvMode.LegacyJitX86) { Env = { Runtime = Runtime.Clr, Platform = Platform.X86 } }); #if !NET461 Add(new Job("Core RyuJit x64", RunMode.Default, EnvMode.RyuJitX64) { Env = { Runtime = Runtime.Core, Platform = Platform.X64 } }); #endif } } [Params(32, 128, 1024)] // 32, 64, 128, 1024, 8192, 65536 public int N { get; set; } [Params(Provider.Managed, Provider.NativeMKLAutoHigh)] public Provider Provider { get; set; } Complex[] _data; [GlobalSetup] public void Setup() { Providers.ForceProvider(Provider); var realSinusoidal = Generate.Sinusoidal(N, 32, -2.0, 2.0); var imagSawtooth = Generate.Sawtooth(N, 32, -20.0, 20.0); _data = Generate.Map2(realSinusoidal, imagSawtooth, (r, i) => new Complex(r, i)); } [Benchmark(OperationsPerInvoke = 2)] public void Transform() { Fourier.Forward(_data, FourierOptions.NoScaling); Fourier.Inverse(_data, FourierOptions.NoScaling); } } }
mit
C#
f15135851246804d7de829865aa59fa3f4532dab
Use positive statement and let it return as soon as possible
wangkanai/Detection
src/TagHelpers/PreferenceTagHelper.cs
src/TagHelpers/PreferenceTagHelper.cs
using System; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using Wangkanai.Detection.Models; using Wangkanai.Detection.Services; namespace Microsoft.AspNetCore.Mvc.TagHelpers { [HtmlTargetElement(ElementName, Attributes = OnlyAttributeName, TagStructure = TagStructure.NormalOrSelfClosing)] public class PreferenceTagHelper : TagHelper { private const string ElementName = "preference"; private const string OnlyAttributeName = "only"; protected IHtmlGenerator Generator { get; } private readonly IResponsiveService _responsive; private readonly IDeviceService _device; [HtmlAttributeName(OnlyAttributeName)] public string? Only { get; set; } public PreferenceTagHelper(IHtmlGenerator generator, IResponsiveService responsive, IDeviceService device) { Generator = generator ?? throw new ArgumentNullException(nameof(generator)); _responsive = responsive ?? throw new ArgumentNullException(nameof(responsive)); _device = device ?? throw new ArgumentNullException(nameof(device)); } public override void Process(TagHelperContext context, TagHelperOutput output) { if (context == null) throw new ArgumentNullException(nameof(context)); if (output == null) throw new ArgumentNullException(nameof(output)); output.TagName = null; if (string.IsNullOrWhiteSpace(Only)) return; if (_responsive.HasPreferred()) return; if (DisplayOnlyDevice) return; output.SuppressOutput(); } private bool DisplayOnlyDevice => _device.Type == OnlyDevice; private Device OnlyDevice => Enum.Parse<Device>(Only, true); } }
using System; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using Wangkanai.Detection.Models; using Wangkanai.Detection.Services; namespace Microsoft.AspNetCore.Mvc.TagHelpers { [HtmlTargetElement(ElementName, Attributes = OnlyAttributeName, TagStructure = TagStructure.NormalOrSelfClosing)] public class PreferenceTagHelper : TagHelper { private const string ElementName = "preference"; private const string OnlyAttributeName = "only"; protected IHtmlGenerator Generator { get; } private readonly IResponsiveService _responsive; private readonly IDeviceService _device; [HtmlAttributeName(OnlyAttributeName)] public string? Only { get; set; } public PreferenceTagHelper(IHtmlGenerator generator, IResponsiveService responsive, IDeviceService device) { Generator = generator ?? throw new ArgumentNullException(nameof(generator)); _responsive = responsive ?? throw new ArgumentNullException(nameof(responsive)); _device = device ?? throw new ArgumentNullException(nameof(device)); } public override void Process(TagHelperContext context, TagHelperOutput output) { if (context == null) throw new ArgumentNullException(nameof(context)); if (output == null) throw new ArgumentNullException(nameof(output)); output.TagName = null; if (string.IsNullOrWhiteSpace(Only)) return; if (!_responsive.HasPreferred() && !DisplayOnlyDevice) output.SuppressOutput(); } private bool DisplayOnlyDevice => _device.Type == OnlyDevice; private Device OnlyDevice => Enum.Parse<Device>(Only, true); } }
apache-2.0
C#
cdf862613270f973b7702ff28de9702149c0ea61
Fix version
Fredi/NetIRC
src/NetIRC/Ctcp/CtcpCommands.cs
src/NetIRC/Ctcp/CtcpCommands.cs
using NetIRC.Messages; using System; using System.Reflection; using System.Threading.Tasks; namespace NetIRC.Ctcp { public static class CtcpCommands { internal const string CtcpDelimiter = "\x01"; public const string ACTION = nameof(ACTION); public const string CLIENTINFO = nameof(CLIENTINFO); public const string ERRMSG = nameof(ERRMSG); public const string PING = nameof(PING); public const string TIME = nameof(TIME); public const string VERSION = nameof(VERSION); internal static Task HandleCtcp(Client client, CtcpEventArgs ctcp) { switch (ctcp.CtcpCommand.ToUpper()) { case ACTION: case ERRMSG: break; case CLIENTINFO: return ClientInfoReply(client, ctcp.From); case PING: return PingReply(client, ctcp.From, ctcp.CtcpMessage); case TIME: return TimeReply(client, ctcp.From); case VERSION: return VersionReply(client, ctcp.From); } return Task.CompletedTask; } private static Task ClientInfoReply(Client client, string target) { return client.SendAsync(new CtcpReplyMessage(target, ($"{CLIENTINFO} {ACTION} {CLIENTINFO} {PING} {TIME} {VERSION}"))); } private static Task PingReply(Client client, string target, string message) { return client.SendAsync(new CtcpReplyMessage(target, $"{PING} {message}")); } private static Task TimeReply(Client client, string target) { return client.SendAsync(new CtcpReplyMessage(target, $"{TIME} {DateTime.Now.ToString("F")}")); } private static Task VersionReply(Client client, string target) { var version = typeof(Client).Assembly .GetCustomAttribute<AssemblyFileVersionAttribute>() .Version; return client.SendAsync(new CtcpReplyMessage(target, $"{VERSION} NetIRC v{version} - Simple cross-platform IRC Client Library (https://github.com/fredimachado/NetIRC)")); } } }
using NetIRC.Messages; using System; using System.Threading.Tasks; namespace NetIRC.Ctcp { public static class CtcpCommands { internal const string CtcpDelimiter = "\x01"; public const string ACTION = nameof(ACTION); public const string CLIENTINFO = nameof(CLIENTINFO); public const string ERRMSG = nameof(ERRMSG); public const string PING = nameof(PING); public const string TIME = nameof(TIME); public const string VERSION = nameof(VERSION); internal static Task HandleCtcp(Client client, CtcpEventArgs ctcp) { switch (ctcp.CtcpCommand.ToUpper()) { case ACTION: case ERRMSG: break; case CLIENTINFO: return ClientInfoReply(client, ctcp.From); case PING: return PingReply(client, ctcp.From, ctcp.CtcpMessage); case TIME: return TimeReply(client, ctcp.From); case VERSION: return VersionReply(client, ctcp.From); } return Task.CompletedTask; } private static Task ClientInfoReply(Client client, string target) { return client.SendAsync(new CtcpReplyMessage(target, ($"{CLIENTINFO} {ACTION} {CLIENTINFO} {PING} {TIME} {VERSION}"))); } private static Task PingReply(Client client, string target, string message) { return client.SendAsync(new CtcpReplyMessage(target, $"{PING} {message}")); } private static Task TimeReply(Client client, string target) { return client.SendAsync(new CtcpReplyMessage(target, $"{TIME} {DateTime.Now.ToString("F")}")); } private static Task VersionReply(Client client, string target) { return client.SendAsync(new CtcpReplyMessage(target, $"{VERSION} NetIRC v{typeof(Client).Assembly.GetName().Version} - Open source IRC Client Library (https://github.com/fredimachado/NetIRC)")); } } }
mit
C#
a47b6526a2b7810d51adb2cc2f6d035b8e6d5cad
Fix CI issues.
smoogipoo/osu,peppy/osu,johnneijzen/osu,peppy/osu,EVAST9919/osu,ZLima12/osu,Nabile-Rahmani/osu,smoogipoo/osu,DrabWeb/osu,peppy/osu-new,ppy/osu,NeoAdonis/osu,smoogipooo/osu,DrabWeb/osu,EVAST9919/osu,2yangk23/osu,UselessToucan/osu,NeoAdonis/osu,2yangk23/osu,naoey/osu,naoey/osu,naoey/osu,Damnae/osu,UselessToucan/osu,ppy/osu,peppy/osu,NeoAdonis/osu,Drezi126/osu,smoogipoo/osu,johnneijzen/osu,Frontear/osuKyzer,ZLima12/osu,DrabWeb/osu,ppy/osu,UselessToucan/osu
osu.Game/Rulesets/RulesetInfo.cs
osu.Game/Rulesets/RulesetInfo.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using SQLite.Net.Attributes; namespace osu.Game.Rulesets { public class RulesetInfo : IEquatable<RulesetInfo> { [PrimaryKey, AutoIncrement] public int? ID { get; set; } [Indexed(Unique = true)] public string Name { get; set; } [Indexed(Unique = true)] public string InstantiationInfo { get; set; } [Indexed] public bool Available { get; set; } public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this); public bool Equals(RulesetInfo other) { return ID == other?.ID && Available == other?.Available && Name == other?.Name && InstantiationInfo == other?.InstantiationInfo; } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using SQLite.Net.Attributes; namespace osu.Game.Rulesets { public class RulesetInfo : IEquatable<RulesetInfo> { [PrimaryKey, AutoIncrement] public int? ID { get; set; } [Indexed(Unique = true)] public string Name { get; set; } [Indexed(Unique = true)] public string InstantiationInfo { get; set; } [Indexed] public bool Available { get; set; } public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this); public bool Equals(RulesetInfo other) { return this.ID == other.ID && this.Available == other.Available && this.Name == other.Name && this.InstantiationInfo == other.InstantiationInfo; } } }
mit
C#
15a9044ed834970e05629fcf62063a0baa5682c8
Add key and value variant types to VariantSeries
Spreads/Spreads
src/Spreads/Series/VariantSeries.cs
src/Spreads/Series/VariantSeries.cs
using Spreads.DataTypes; // ReSharper disable once CheckNamespace namespace Spreads { public class VariantSeries<TKey, TValue> : ConvertSeries<TKey, TValue, Variant, Variant, VariantSeries<TKey, TValue>> { public VariantSeries() { } public VariantSeries(IReadOnlySeries<TKey, TValue> inner) : base(inner) { } public override Variant ToKey2(TKey key) { return Variant.Create(key); } public override Variant ToValue2(TValue value) { return Variant.Create(value); } public override TKey ToKey(Variant key) { return key.Get<TKey>(); } public override TValue ToValue(Variant value) { return value.Get<TValue>(); } public TypeEnum KeyType { get; } = VariantHelper<TKey>.TypeEnum; public TypeEnum ValueType { get; } = VariantHelper<TValue>.TypeEnum; } public class VariantMutableSeries<TKey, TValue> : ConvertMutableSeries<TKey, TValue, Variant, Variant, VariantMutableSeries<TKey, TValue>> { public VariantMutableSeries() { } public VariantMutableSeries(IMutableSeries<TKey, TValue> innerSeries) : base(innerSeries) { } public override Variant ToKey2(TKey key) { return Variant.Create(key); } public override Variant ToValue2(TValue value) { return Variant.Create(value); } public override TKey ToKey(Variant key) { return key.Get<TKey>(); } public override TValue ToValue(Variant value) { return value.Get<TValue>(); } public TypeEnum KeyType { get; } = VariantHelper<TKey>.TypeEnum; public TypeEnum ValueType { get; } = VariantHelper<TValue>.TypeEnum; } }
using Spreads.DataTypes; // ReSharper disable once CheckNamespace namespace Spreads { public class VariantSeries<TKey, TValue> : ConvertSeries<TKey, TValue, Variant, Variant, VariantSeries<TKey, TValue>> { public VariantSeries() { } public VariantSeries(IReadOnlySeries<TKey, TValue> inner) : base(inner) { } public override Variant ToKey2(TKey key) { return Variant.Create(key); } public override Variant ToValue2(TValue value) { return Variant.Create(value); } public override TKey ToKey(Variant key) { return key.Get<TKey>(); } public override TValue ToValue(Variant value) { return value.Get<TValue>(); } } public class VariantMutableSeries<TKey, TValue> : ConvertMutableSeries<TKey, TValue, Variant, Variant, VariantMutableSeries<TKey, TValue>> { public VariantMutableSeries() { } public VariantMutableSeries(IMutableSeries<TKey, TValue> innerSeries) : base(innerSeries) { } public override Variant ToKey2(TKey key) { return Variant.Create(key); } public override Variant ToValue2(TValue value) { return Variant.Create(value); } public override TKey ToKey(Variant key) { return key.Get<TKey>(); } public override TValue ToValue(Variant value) { return value.Get<TValue>(); } } }
mpl-2.0
C#
d78a2c8eb53558928eac79f1876d5ce772296636
Put auto focus on search too
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Mvc/Views/Lab/Search.cshtml
Anlab.Mvc/Views/Lab/Search.cshtml
@{ ViewBag.Title = "Search"; } <div class="col"> <form asp-controller="Lab" asp-action="Search"> <div> <div class="form-group"> <label class="control-label">Search By Id, Request Num, or Share Identifier</label> <div> <input id="term" class="form-control" name="term" autofocus /> </div> </div> <button type="submit" class="btn btn-danger"><i class="fa fa-search" aria-hidden="true"></i> Search</button> </div> </form> </div>
@{ ViewBag.Title = "Search"; } <div class="col"> <form asp-controller="Lab" asp-action="Search"> <div> <div class="form-group"> <label class="control-label">Search By Id, Request Num, or Share Identifier</label> <div> <input id="term" class="form-control" name="term" /> </div> </div> <button type="submit" class="btn btn-danger"><i class="fa fa-search" aria-hidden="true"></i> Search</button> </div> </form> </div>
mit
C#
37bf904b95ca983c64805b4613ffab187aa2c264
Fix android host incorrectly accepting exit requests
ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework
osu.Framework.Android/AndroidGameHost.cs
osu.Framework.Android/AndroidGameHost.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using osu.Framework.Android.Graphics.Textures; using osu.Framework.Android.Input; using osu.Framework.Graphics.Textures; using osu.Framework.Input; using osu.Framework.Input.Handlers; using osu.Framework.IO.Stores; using osu.Framework.Platform; namespace osu.Framework.Android { public class AndroidGameHost : GameHost { private readonly AndroidGameView gameView; public AndroidGameHost(AndroidGameView gameView) { this.gameView = gameView; } protected override void SetupForRun() { base.SetupForRun(); AndroidGameWindow.View = gameView; Window = new AndroidGameWindow(); } protected override bool LimitedMemoryEnvironment => true; public override bool CanExit => false; public override bool OnScreenKeyboardOverlapsGameWindow => true; public override ITextInputSource GetTextInput() => new AndroidTextInput(gameView); protected override IEnumerable<InputHandler> CreateAvailableInputHandlers() => new InputHandler[] { new AndroidKeyboardHandler(gameView), new AndroidTouchHandler(gameView) }; protected override Storage GetStorage(string baseName) => new AndroidStorage(baseName, this); public override void OpenFileExternally(string filename) => throw new NotImplementedException(); public override void OpenUrlExternally(string url) => throw new NotImplementedException(); public override IResourceStore<TextureUpload> CreateTextureLoaderStore(IResourceStore<byte[]> underlyingStore) => new AndroidTextureLoaderStore(underlyingStore); protected override void PerformExit(bool immediately) { // Do not exit on Android, Window.Run() does not block } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using osu.Framework.Android.Graphics.Textures; using osu.Framework.Android.Input; using osu.Framework.Graphics.Textures; using osu.Framework.Input; using osu.Framework.Input.Handlers; using osu.Framework.IO.Stores; using osu.Framework.Platform; namespace osu.Framework.Android { public class AndroidGameHost : GameHost { private readonly AndroidGameView gameView; public AndroidGameHost(AndroidGameView gameView) { this.gameView = gameView; } protected override void SetupForRun() { base.SetupForRun(); AndroidGameWindow.View = gameView; Window = new AndroidGameWindow(); } protected override bool LimitedMemoryEnvironment => true; public override bool OnScreenKeyboardOverlapsGameWindow => true; public override ITextInputSource GetTextInput() => new AndroidTextInput(gameView); protected override IEnumerable<InputHandler> CreateAvailableInputHandlers() => new InputHandler[] { new AndroidKeyboardHandler(gameView), new AndroidTouchHandler(gameView) }; protected override Storage GetStorage(string baseName) => new AndroidStorage(baseName, this); public override void OpenFileExternally(string filename) => throw new NotImplementedException(); public override void OpenUrlExternally(string url) => throw new NotImplementedException(); public override IResourceStore<TextureUpload> CreateTextureLoaderStore(IResourceStore<byte[]> underlyingStore) => new AndroidTextureLoaderStore(underlyingStore); protected override void PerformExit(bool immediately) { // Do not exit on Android, Window.Run() does not block } } }
mit
C#
b1db3dd834eedf8852c67f71ef6512b84a44050d
Add assert and simplify assignment
ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework
osu.Framework/Input/TouchEventManager.cs
osu.Framework/Input/TouchEventManager.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Framework.Input.States; using osuTK; namespace osu.Framework.Input { /// <summary> /// A manager that manages states and events for a single touch. /// </summary> public class TouchEventManager : ButtonEventManager<TouchSource> { protected Vector2? TouchDownPosition; /// <summary> /// The drawable from the input queue that handled a <see cref="TouchEvent"/> corresponding to this touch source. /// Null when no drawable has handled a touch event or the touch is not yet active / has been deactivated. /// </summary> public Drawable HeldDrawable { get; protected set; } public TouchEventManager(TouchSource source) : base(source) { } public void HandlePositionChange(InputState state, Vector2 lastPosition) { handleTouchMove(state, state.Touch.TouchPositions[(int)Button], lastPosition); } private void handleTouchMove(InputState state, Vector2 position, Vector2 lastPosition) { PropagateButtonEvent(ButtonDownInputQueue, new TouchMoveEvent(state, new Touch(Button, position), TouchDownPosition, lastPosition)); } protected override Drawable HandleButtonDown(InputState state, List<Drawable> targets) { Debug.Assert(HeldDrawable == null); Debug.Assert(TouchDownPosition == null); TouchDownPosition = state.Touch.GetTouchPosition(Button); Debug.Assert(TouchDownPosition != null); return HeldDrawable = PropagateButtonEvent(targets, new TouchDownEvent(state, new Touch(Button, (Vector2)TouchDownPosition))); } protected override void HandleButtonUp(InputState state, List<Drawable> targets) { var currentPosition = state.Touch.TouchPositions[(int)Button]; PropagateButtonEvent(targets, new TouchUpEvent(state, new Touch(Button, currentPosition), TouchDownPosition)); HeldDrawable = null; TouchDownPosition = null; } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Framework.Input.States; using osuTK; namespace osu.Framework.Input { /// <summary> /// A manager that manages states and events for a single touch. /// </summary> public class TouchEventManager : ButtonEventManager<TouchSource> { protected Vector2? TouchDownPosition; /// <summary> /// The drawable from the input queue that handled a <see cref="TouchEvent"/> corresponding to this touch source. /// Null when no drawable has handled a touch event or the touch is not yet active / has been deactivated. /// </summary> public Drawable HeldDrawable { get; protected set; } public TouchEventManager(TouchSource source) : base(source) { } public void HandlePositionChange(InputState state, Vector2 lastPosition) { handleTouchMove(state, state.Touch.TouchPositions[(int)Button], lastPosition); } private void handleTouchMove(InputState state, Vector2 position, Vector2 lastPosition) { PropagateButtonEvent(ButtonDownInputQueue, new TouchMoveEvent(state, new Touch(Button, position), TouchDownPosition, lastPosition)); } protected override Drawable HandleButtonDown(InputState state, List<Drawable> targets) { TouchDownPosition = state.Touch.GetTouchPosition(Button); Debug.Assert(TouchDownPosition != null); var handled = PropagateButtonEvent(targets, new TouchDownEvent(state, new Touch(Button, (Vector2)TouchDownPosition))); HeldDrawable = handled; return handled; } protected override void HandleButtonUp(InputState state, List<Drawable> targets) { var currentPosition = state.Touch.TouchPositions[(int)Button]; PropagateButtonEvent(targets, new TouchUpEvent(state, new Touch(Button, currentPosition), TouchDownPosition)); HeldDrawable = null; TouchDownPosition = null; } } }
mit
C#
91980f5a1991f3bda4da9d86059606286a0f1005
Initialize dictionary in RelabelingFunction
lou1306/CIV,lou1306/CIV
CIV/Helpers/RelabelingFunction.cs
CIV/Helpers/RelabelingFunction.cs
using System; using System.Collections; using System.Collections.Generic; namespace CIV.Helpers { public class RelabelingFunction : ICollection<KeyValuePair<string, string>> { IDictionary<string, string> dict = new Dictionary<string, string>(); public int Count => dict.Count; public bool IsReadOnly => dict.IsReadOnly; /// <summary> /// Allows square-bracket indexing, i.e. relabeling[key]. /// </summary> /// <param name="key">The key to access or set.</param> public string this[string key] => dict[key]; internal bool ContainsKey(string label) => dict.ContainsKey(label); public IEnumerator<KeyValuePair<string, string>> GetEnumerator() => dict.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => dict.GetEnumerator(); public void Add(string action, string relabeled) { if (action == "tau") { throw new ArgumentException("Cannot relabel tau"); } if (action.IsOutput()) { action = action.Coaction(); relabeled = action.Coaction(); } dict.Add(action, relabeled); } public void Add(KeyValuePair<string, string> item) => Add(item.Key, item.Value); public void Clear() => dict.Clear(); public bool Contains(KeyValuePair<string, string> item) => dict.Contains(item); public void CopyTo(KeyValuePair<string, string>[] array, int arrayIndex) => dict.CopyTo(array, arrayIndex); public bool Remove(KeyValuePair<string, string> item) => dict.Remove(item); } }
using System; using System.Collections; using System.Collections.Generic; namespace CIV.Helpers { public class RelabelingFunction : ICollection<KeyValuePair<string, string>> { IDictionary<string, string> dict; public int Count => dict.Count; public bool IsReadOnly => dict.IsReadOnly; /// <summary> /// Allows square-bracket indexing, i.e. relabeling[key]. /// </summary> /// <param name="key">The key to access or set.</param> public string this[string key] => dict[key]; internal bool ContainsKey(string label) => dict.ContainsKey(label); public IEnumerator<KeyValuePair<string, string>> GetEnumerator() => dict.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => dict.GetEnumerator(); public void Add(string action, string relabeled) { if (action == "tau") { throw new ArgumentException("Cannot relabel tau"); } if (action.IsOutput()) { action = action.Coaction(); relabeled = action.Coaction(); } dict.Add(action, relabeled); } public void Add(KeyValuePair<string, string> item) => Add(item.Key, item.Value); public void Clear() => dict.Clear(); public bool Contains(KeyValuePair<string, string> item) => dict.Contains(item); public void CopyTo(KeyValuePair<string, string>[] array, int arrayIndex) => dict.CopyTo(array, arrayIndex); public bool Remove(KeyValuePair<string, string> item) => dict.Remove(item); } }
mit
C#
c1c19243cd28af8ec11664af84dcfdb69bea4799
Change FirstOrDefault back to First
ZLima12/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,2yangk23/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,EVAST9919/osu,peppy/osu,johnneijzen/osu,ZLima12/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,EVAST9919/osu,johnneijzen/osu,ppy/osu,UselessToucan/osu,ppy/osu,2yangk23/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,UselessToucan/osu
osu.Game/Scoring/ScoreManager.cs
osu.Game/Scoring/ScoreManager.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using Microsoft.EntityFrameworkCore; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.IO.Archives; using osu.Game.Rulesets; using osu.Game.Scoring.Legacy; namespace osu.Game.Scoring { public class ScoreManager : ArchiveModelManager<ScoreInfo, ScoreFileInfo> { public override string[] HandledExtensions => new[] { ".osr" }; protected override string[] HashableFileTypes => new[] { ".osr" }; protected override string ImportFromStablePath => @"Data\r"; protected override bool StableDirectoryBased => false; private readonly RulesetStore rulesets; private readonly Func<BeatmapManager> beatmaps; public ScoreManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, IDatabaseContextFactory contextFactory, IIpcHost importHost = null) : base(storage, contextFactory, new ScoreStore(contextFactory, storage), importHost) { this.rulesets = rulesets; this.beatmaps = beatmaps; } protected override ScoreInfo CreateModel(ArchiveReader archive) { if (archive == null) return null; using (var stream = archive.GetStream(archive.Filenames.First(f => f.EndsWith(".osr")))) { try { return new DatabasedLegacyScoreParser(rulesets, beatmaps()).Parse(stream).ScoreInfo; } catch (LegacyScoreParser.BeatmapNotFoundException e) { Logger.Log(e.Message, LoggingTarget.Information, LogLevel.Error); return null; } } } public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps(), Files.Store); public List<ScoreInfo> GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending).ToList(); public IEnumerable<ScoreInfo> QueryScores(Expression<Func<ScoreInfo, bool>> query) => ModelStore.ConsumableItems.AsNoTracking().Where(query); public ScoreInfo Query(Expression<Func<ScoreInfo, bool>> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query); } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using Microsoft.EntityFrameworkCore; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.IO.Archives; using osu.Game.Rulesets; using osu.Game.Scoring.Legacy; namespace osu.Game.Scoring { public class ScoreManager : ArchiveModelManager<ScoreInfo, ScoreFileInfo> { public override string[] HandledExtensions => new[] { ".osr" }; protected override string[] HashableFileTypes => new[] { ".osr" }; protected override string ImportFromStablePath => @"Data\r"; protected override bool StableDirectoryBased => false; private readonly RulesetStore rulesets; private readonly Func<BeatmapManager> beatmaps; public ScoreManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, IDatabaseContextFactory contextFactory, IIpcHost importHost = null) : base(storage, contextFactory, new ScoreStore(contextFactory, storage), importHost) { this.rulesets = rulesets; this.beatmaps = beatmaps; } protected override ScoreInfo CreateModel(ArchiveReader archive) { if (archive == null) return null; using (var stream = archive.GetStream(archive.Filenames.FirstOrDefault(f => f.EndsWith(".osr")))) { try { return new DatabasedLegacyScoreParser(rulesets, beatmaps()).Parse(stream).ScoreInfo; } catch (LegacyScoreParser.BeatmapNotFoundException e) { Logger.Log(e.Message, LoggingTarget.Information, LogLevel.Error); return null; } } } public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps(), Files.Store); public List<ScoreInfo> GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending).ToList(); public IEnumerable<ScoreInfo> QueryScores(Expression<Func<ScoreInfo, bool>> query) => ModelStore.ConsumableItems.AsNoTracking().Where(query); public ScoreInfo Query(Expression<Func<ScoreInfo, bool>> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query); } }
mit
C#
d9920d3d087f244d109f01ae410faa4c0b42f6f6
make the ComboBox more versatile
NattyNarwhal/Colours
Colours/Controls/ColorComboBox.cs
Colours/Controls/ColorComboBox.cs
using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Colours { public class ColorComboBox : ComboBox { public ColorComboBox() { DropDownStyle = ComboBoxStyle.DropDownList; DrawMode = DrawMode.OwnerDrawFixed; ItemHeight = 21; // seems reasonable DrawItem += ColorComboBox_DrawItem; } private void ColorComboBox_DrawItem(object sender, DrawItemEventArgs e) { // Draw the background of the item. e.DrawBackground(); var rectangle = new Rectangle(3, e.Bounds.Top + 2, e.Bounds.Height > 16 ? 16 : e.Bounds.Height, e.Bounds.Height > 16 ? 16 : e.Bounds.Height); //e.Graphics.FillRectangle(new SolidBrush(color), rectangle); //e.Graphics.DrawRectangle(Pens.Black, rectangle); // Draw each string in the array, using a different size, color, // and font for each item. if (e.Index > -1 && Items[e.Index] is PaletteColor) { var pc = (PaletteColor)Items[e.Index]; e.Graphics.DrawImage(RenderColorIcon.RenderIcon(pc.Color.ToRgb()), rectangle); e.Graphics.DrawString(pc.Name, e.Font, new SolidBrush(e.ForeColor), new RectangleF(e.Bounds.X + rectangle.Width + 4, e.Bounds.Y + 4, e.Bounds.Width, e.Font.Height)); } else if (e.Index > -1 && Items[e.Index] is IColor) { var c = (IColor)Items[e.Index]; e.Graphics.DrawImage(RenderColorIcon.RenderIcon(c.ToRgb()), rectangle); e.Graphics.DrawString(c.ToString(), e.Font, new SolidBrush(e.ForeColor), new RectangleF(e.Bounds.X + rectangle.Width + 4, e.Bounds.Y + 4, e.Bounds.Width, e.Font.Height)); } // Draw the focus rectangle if the mouse hovers over an item. e.DrawFocusRectangle(); } } }
using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Colours { public class ColorComboBox : ComboBox { public ColorComboBox() { DrawMode = DrawMode.OwnerDrawFixed; ItemHeight = 21; // seems reasonable DrawItem += ColorComboBox_DrawItem; } private void ColorComboBox_DrawItem(object sender, DrawItemEventArgs e) { // Draw the background of the item. e.DrawBackground(); var rectangle = new Rectangle(3, e.Bounds.Top + 2, e.Bounds.Height > 16 ? 16 : e.Bounds.Height, e.Bounds.Height > 16 ? 16 : e.Bounds.Height); //e.Graphics.FillRectangle(new SolidBrush(color), rectangle); //e.Graphics.DrawRectangle(Pens.Black, rectangle); // Draw each string in the array, using a different size, color, // and font for each item. if (e.Index > -1 && Items[e.Index] is PaletteColor) { var pc = (PaletteColor)Items[e.Index]; e.Graphics.DrawImage(RenderColorIcon.RenderIcon(pc.Color.ToRgb()), rectangle); e.Graphics.DrawString(pc.Name, e.Font, new SolidBrush(e.ForeColor), new RectangleF(e.Bounds.X + rectangle.Width + 4, e.Bounds.Y + 4, e.Bounds.Width, e.Font.Height)); } // Draw the focus rectangle if the mouse hovers over an item. e.DrawFocusRectangle(); } } }
mit
C#
73a27fc1671545504c7e5af61ad3b7ccc2378740
add database migration
D4N3-777/Din_Website,D4N3-777/Din_Website,D4N3-777/Din_Website
src/Din.Data/DbInitializer.cs
src/Din.Data/DbInitializer.cs
 using Microsoft.EntityFrameworkCore; namespace Din.Data { public static class DbInitializer { public static void Initialize(DinContext context) { context.Database.Migrate(); context.Database.EnsureCreated(); context.SaveChanges(); } } }
 namespace Din.Data { public static class DbInitializer { public static void Initialize(DinContext context) { context.Database.EnsureCreated(); context.SaveChanges(); } } }
apache-2.0
C#
b58884271cb0df9260a93f4f046353a041db0d54
Update AssemblyInfo for NuGet builds
logankp/Deliverance
Deliverance/Properties/AssemblyInfo.cs
Deliverance/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("Deliverance")] [assembly: AssemblyDescription("A fully managed library for reading Outlook .MSG files")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Logan Paschke")] [assembly: AssemblyProduct("Deliverance")] [assembly: AssemblyCopyright("Copyright © Logan Paschke 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("eefcfa45-edeb-45cf-b489-202eb81ec36f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0-alpha")] [assembly:InternalsVisibleTo("Deliverance.Test")]
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("Deliverance")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Deliverance")] [assembly: AssemblyCopyright("Copyright © Logan Paschke 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("eefcfa45-edeb-45cf-b489-202eb81ec36f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly:InternalsVisibleTo("Deliverance.Test")]
mit
C#
de413418c7404f7c34fcb75ef16a6fac942ae5ee
Remove redundant prefix
peppy/osu,peppy/osu-new,EVAST9919/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,smoogipooo/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,EVAST9919/osu,UselessToucan/osu,peppy/osu,johnneijzen/osu,smoogipoo/osu,johnneijzen/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu
osu.Game/Online/API/Requests/GetUserRankingsRequest.cs
osu.Game/Online/API/Requests/GetUserRankingsRequest.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.IO.Network; using osu.Game.Rulesets; namespace osu.Game.Online.API.Requests { public class GetUserRankingsRequest : GetRankingsRequest<GetUsersResponse> { public readonly UserRankingsType Type; private readonly string country; public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, string country = null) : base(ruleset, page) { Type = type; this.country = country; } protected override WebRequest CreateWebRequest() { var req = base.CreateWebRequest(); if (country != null) req.AddParameter("country", country); return req; } protected override string TargetPostfix() => Type.ToString().ToLowerInvariant(); } public enum UserRankingsType { Performance, Score } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.IO.Network; using osu.Game.Rulesets; namespace osu.Game.Online.API.Requests { public class GetUserRankingsRequest : GetRankingsRequest<GetUsersResponse> { public readonly UserRankingsType Type; private readonly string country; public GetUserRankingsRequest(RulesetInfo ruleset, UserRankingsType type = UserRankingsType.Performance, int page = 1, string country = null) : base(ruleset, page) { this.Type = type; this.country = country; } protected override WebRequest CreateWebRequest() { var req = base.CreateWebRequest(); if (country != null) req.AddParameter("country", country); return req; } protected override string TargetPostfix() => Type.ToString().ToLowerInvariant(); } public enum UserRankingsType { Performance, Score } }
mit
C#
dbefc0c860caff2cdb1b95c0ae76e7769382436d
Add unit test for reading a project definition.
Timboski/solution-edit
SolutionParserTest/ProjectTest.cs
SolutionParserTest/ProjectTest.cs
using System; using Xunit; using SolutionEdit; using System.IO; namespace SolutionParserTest { public class ProjectTest { [Fact] public void CreateNewDirectoryProject() { // Arrange. var directoryName = "Test"; // Act. var directoryProject = Project.NewDirectoryProject(directoryName); // Assert. Assert.Equal(directoryName, directoryProject.Name); Assert.Equal(directoryName, directoryProject.Location); Assert.Equal(ProjectType.Directory, directoryProject.Type); } [Fact] public void ReadProjectFromStream() { // Project is of the form: //Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SolutionParser", "SolutionParser\SolutionParser.csproj", "{AE17D442-B29B-4F55-9801-7151BCD0D9CA}" //EndProject // Arrange. var guid = new Guid("1DC4FA2D-16D1-459D-9C35-D49208F753C5"); var projectName = "TestProject"; var projectLocation = @"This\is\a\test\TestProject.csproj"; var projectDefinition = $"Project(\"{{9A19103F-16F7-4668-BE54-9A1E7A4F7556}}\") = \"{projectName}\", \"{projectLocation}\", \"{guid.ToString("B").ToUpper()}\"\nEndProject"; using (TextReader inStream = new StringReader(projectDefinition)) { // Act. var project = new Project(inStream); // Assert. Assert.Equal(projectName, project.Name); Assert.Equal(projectLocation, project.Location); Assert.Equal(ProjectType.Project, project.Type); } } } }
using System; using Xunit; using SolutionEdit; namespace SolutionParserTest { public class ProjectTest { [Fact] public void CreateNewDirectoryProject() { // Arrange. var directoryName = "Test"; // Act. var directoryProject = Project.NewDirectoryProject(directoryName); // Assert. Assert.Equal(directoryName, directoryProject.Name); Assert.Equal(directoryName, directoryProject.Location); Assert.Equal(ProjectType.Directory, directoryProject.Type); } } }
mit
C#
cdbed2492c636191845db36bc8c86d3f7c6c71f8
Update product name in Assembly
nagyistoce/TinCan.NET,RusticiSoftware/TinCan.NET,limey98/TinCan.NET,brianjmiller/TinCan.NET
TinCan/Properties/AssemblyInfo.cs
TinCan/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("TinCan")] [assembly: AssemblyDescription("Library for implementing Tin Can API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rustici Software")] [assembly: AssemblyProduct("TinCan.NET")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("6b7c12d3-32ea-4cb2-9399-3004963d2340")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.1.0")] [assembly: AssemblyFileVersion("0.0.1.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("TinCan")] [assembly: AssemblyDescription("Library for implementing Tin Can API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rustici Software")] [assembly: AssemblyProduct("TinCan")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("6b7c12d3-32ea-4cb2-9399-3004963d2340")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.1.0")] [assembly: AssemblyFileVersion("0.0.1.0")]
apache-2.0
C#
9ec1102f79e2510e2690c6a6e038baf2366be675
make access
Appleseed/base,Appleseed/base
Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/Constants.cs
Applications/Appleseed.Base.Alerts.Console/Appleseed.Base.Alerts/Model/Constants.cs
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Appleseed.Base.Alerts.Model { class Constants { #region App Config Values // Test Settings public static string Mode = System.Configuration.ConfigurationManager.AppSettings["Mode"]; public static string TestEmail = System.Configuration.ConfigurationManager.AppSettings["TestEmail"]; public static string TestSearchQuery = System.Configuration.ConfigurationManager.AppSettings["TestSearchQuery"]; public static string TestSearchLink = System.Configuration.ConfigurationManager.AppSettings["TestSearchLink"]; //SendGridAPI Key static string APIKey = System.Configuration.ConfigurationManager.AppSettings["SendGridAPIKey"]; //Mail Settings static string MailFrom = System.Configuration.ConfigurationManager.AppSettings["MailFrom"]; static string MailFromName = System.Configuration.ConfigurationManager.AppSettings["MailFromName"]; static string MailSubject = System.Configuration.ConfigurationManager.AppSettings["MailSubject"]; static string MailHeaderText = System.Configuration.ConfigurationManager.AppSettings["MailHeaderText"]; static string MailSchedule = System.Configuration.ConfigurationManager.AppSettings["MailSchedule"]; //Search Settings static string SiteSearchLink = System.Configuration.ConfigurationManager.AppSettings["SiteSearchLink"]; static string SolrURL = System.Configuration.ConfigurationManager.AppSettings["SolrURL"]; static string RefreshQuery = System.Configuration.ConfigurationManager.AppSettings["RefreshQuery"]; //Data Settings static IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); #endregion } }
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Appleseed.Base.Alerts.Model { class Constants { #region App Config Values // Test Settings static string Mode = System.Configuration.ConfigurationManager.AppSettings["Mode"]; static string TestEmail = System.Configuration.ConfigurationManager.AppSettings["TestEmail"]; static string TestSearchQuery = System.Configuration.ConfigurationManager.AppSettings["TestSearchQuery"]; static string TestSearchLink = System.Configuration.ConfigurationManager.AppSettings["TestSearchLink"]; //SendGridAPI Key static string APIKey = System.Configuration.ConfigurationManager.AppSettings["SendGridAPIKey"]; //Mail Settings static string MailFrom = System.Configuration.ConfigurationManager.AppSettings["MailFrom"]; static string MailFromName = System.Configuration.ConfigurationManager.AppSettings["MailFromName"]; static string MailSubject = System.Configuration.ConfigurationManager.AppSettings["MailSubject"]; static string MailHeaderText = System.Configuration.ConfigurationManager.AppSettings["MailHeaderText"]; static string MailSchedule = System.Configuration.ConfigurationManager.AppSettings["MailSchedule"]; //Search Settings static string SiteSearchLink = System.Configuration.ConfigurationManager.AppSettings["SiteSearchLink"]; static string SolrURL = System.Configuration.ConfigurationManager.AppSettings["SolrURL"]; static string RefreshQuery = System.Configuration.ConfigurationManager.AppSettings["RefreshQuery"]; //Data Settings static IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); #endregion } }
apache-2.0
C#
8546f690a3a0198e3574f4e23caa5b80715097c6
Update IShapeRendererState.cs
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D,wieslawsoltes/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 value indicating whether to draw decorators. /// </summary> bool DrawDecorators { get; set; } /// <summary> /// Gets or sets value indicating whether to draw points. /// </summary> bool DrawPoints { get; set; } /// <summary> /// Gets or sets style used to draw points. /// </summary> IShapeStyle PointStyle { get; set; } /// <summary> /// Gets or sets style used to draw selected points. /// </summary> IShapeStyle SelectedPointStyle { get; set; } /// <summary> /// Gets or sets size used to draw points. /// </summary> double PointSize { 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; } /// <summary> /// Gets or sets shapes decorator. /// </summary> IDecorator Decorator { 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 value indicating whether to draw decorators. /// </summary> bool DrawDecorators { get; set; } /// <summary> /// Gets or sets value indicating whether to draw points. /// </summary> bool DrawPoints { get; set; } /// <summary> /// Gets or sets style used to draw points. /// </summary> IShapeStyle PointStyle { get; set; } /// <summary> /// Gets or sets size used to draw points. /// </summary> double PointSize { 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; } /// <summary> /// Gets or sets shapes decorator. /// </summary> IDecorator Decorator { get; set; } } }
mit
C#
6eb09e728f8e84d129ba8ce9360684b542114d56
Update RoboCopyExitCodes.cs
tjscience/RoboSharp,tjscience/RoboSharp
RoboSharp/Results/RoboCopyExitCodes.cs
RoboSharp/Results/RoboCopyExitCodes.cs
using System; namespace RoboSharp.Results { /// <summary> /// RoboCopy Exit Codes /// </summary> /// <remarks><see href="https://ss64.com/nt/robocopy-exit.html"/></remarks> [Flags] public enum RoboCopyExitCodes { /// <summary>No Files Copied, No Errors Occured</summary> NoErrorNoCopy = 0x0, /// <summary>One or more files were copied successfully</summary> FilesCopiedSuccessful = 0x1, /// <summary> /// Some Extra files or directories were detected.<br/> /// Examine the output log for details. /// </summary> ExtraFilesOrDirectoriesDetected = 0x2, /// <summary> /// Some Mismatched files or directories were detected.<br/> /// Examine the output log. Housekeeping might be required. /// </summary> MismatchedDirectoriesDetected = 0x4, /// <summary> /// Some files or directories could not be copied <br/> /// (copy errors occurred and the retry limit was exceeded). /// Check these errors further. /// </summary> SomeFilesOrDirectoriesCouldNotBeCopied = 0x8, /// <summary> /// Serious error. Robocopy did not copy any files.<br/> /// Either a usage error or an error due to insufficient access privileges on the source or destination directories. /// </summary> SeriousErrorOccurred = 0x10, /// <summary>The Robocopy process exited prior to completion</summary> Cancelled = -1, } }
using System; namespace RoboSharp.Results { /// <summary> /// RoboCopy Exit Codes /// </summary> /// <remarks><see href="https://ss64.com/nt/robocopy-exit.html"/></remarks> [Flags] public enum RoboCopyExitCodes { /// <summary>No Files Copied, No Errors Occured</summary> NoErrorNoCopy = 0x0, /// <summary>One or more files were copied successfully</summary> FilesCopiedSuccessful = 0x1, /// <summary> /// Some Extra files or directories were detected.<br/> /// Examine the output log for details. /// </summary> ExtraFilesOrDirectoriesDetected = 0x2, /// <summary> /// Some Mismatched files or directories were detected.<br/> /// Examine the output log. Housekeeping might be required. /// </summary> MismatchedDirectoriesDetected = 0x4, /// <summary> /// Some files or directories could not be copied <br/> /// (copy errors occurred and the retry limit was exceeded). /// Check these errors further. /// </summary> SomeFilesOrDirectoriesCouldNotBeCopied = 0x8, /// <summary> /// Serious error. Robocopy did not copy any files.<br/> /// Either a usage error or an error due to insufficient access privileges on the source or destination directories. /// </summary> SeriousErrorOccoured = 0x10, /// <summary>The Robocopy process exited prior to completion</summary> Cancelled = -1, } }
mit
C#
c658480331e87a4cbb3a68fbe8d485063915aa7c
Initialize SettingSchema with a set of properties.
PenguinF/sandra-three
Sandra.UI.WF/Settings/SettingSchema.cs
Sandra.UI.WF/Settings/SettingSchema.cs
/********************************************************************************* * SettingSchema.cs * * Copyright (c) 2004-2018 Henk Nicolai * * 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.Collections.Generic; using System.Linq; namespace Sandra.UI.WF { public class SettingSchema { // Prevent repeated allocations of empty dictionaries. private static readonly Dictionary<string, SettingProperty> emptyProperties = new Dictionary<string, SettingProperty>(); /// <summary> /// Represents the empty <see cref="SettingSchema"/>, which contains no properties. /// </summary> public static readonly SettingSchema Empty = new SettingSchema(null); private readonly Dictionary<string, SettingProperty> properties; /// <summary> /// Initializes a new instance of a <see cref="SettingSchema"/>. /// </summary> /// <param name="properties"> /// The set of properties with unique keys to support. /// </param> /// <exception cref="System.ArgumentException"> /// Two or more properties have the same key. /// </exception> public SettingSchema(IEnumerable<SettingProperty> properties) { this.properties = properties != null && properties.Any() ? new Dictionary<string, SettingProperty>() : emptyProperties; if (properties != null) { foreach (var property in properties) { this.properties.Add(property.Name.Key, property); } } } } }
/********************************************************************************* * SettingSchema.cs * * Copyright (c) 2004-2018 Henk Nicolai * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *********************************************************************************/ namespace Sandra.UI.WF { }
apache-2.0
C#
85769f41da35c00b275e8dc6aedc7ee63064778a
change version number
takenet/lime-csharp
src/Lime.Client.TestConsole/Properties/AssemblyInfo.cs
src/Lime.Client.TestConsole/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Lime.Client.TestConsole")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Lime.Client.TestConsole")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.10.0.0")] [assembly: AssemblyFileVersion("0.10.0.0")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Lime.Client.TestConsole")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Lime.Client.TestConsole")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
709b4691ee1dfb85f093d08bf8d2d5312f5f7804
Add newlines to ToString of MetadataGenerationError
cityindex-attic/RESTful-Webservice-Schema,cityindex-attic/RESTful-Webservice-Schema,cityindex-attic/RESTful-Webservice-Schema
src/MetadataGeneration.Core/MetadataGenerationError.cs
src/MetadataGeneration.Core/MetadataGenerationError.cs
using System; using MetadataGeneration.Core.JsonSchemaDTO; namespace MetadataGeneration.Core { public enum MetadataType { JsonSchema, SMD } ; public class MetadataGenerationError { public MetadataGenerationError(MetadataType metadataType, Type type, string errorReason, string sugestionedSolution) { MetadataType = metadataType; Type = type; ErrorReason = errorReason; SuggestedSolution = sugestionedSolution; } public MetadataGenerationError(MetadataType metadataType, Type type, MetadataValidationException metadataValidationException): this(metadataType, type, metadataValidationException.Message, metadataValidationException.SuggestedSolution) { } public MetadataType MetadataType { get; private set; } public Type Type { get; private set; } public string ErrorReason { get; private set; } public string SuggestedSolution { get; private set; } public override string ToString() { return string.Format("MetadataGenerationError: MetadataType={0}, Type={1},\r\n\tErrorReason={2},\r\n\tSuggestedSolution={3}", MetadataType, Type, ErrorReason, SuggestedSolution); } } }
using System; using MetadataGeneration.Core.JsonSchemaDTO; namespace MetadataGeneration.Core { public enum MetadataType { JsonSchema, SMD } ; public class MetadataGenerationError { public MetadataGenerationError(MetadataType metadataType, Type type, string errorReason, string sugestionedSolution) { MetadataType = metadataType; Type = type; ErrorReason = errorReason; SuggestedSolution = sugestionedSolution; } public MetadataGenerationError(MetadataType metadataType, Type type, MetadataValidationException metadataValidationException): this(metadataType, type, metadataValidationException.Message, metadataValidationException.SuggestedSolution) { } public MetadataType MetadataType { get; private set; } public Type Type { get; private set; } public string ErrorReason { get; private set; } public string SuggestedSolution { get; private set; } public override string ToString() { return string.Format("MetadataGenerationError: MetadataType={0}, Type={1}, ErrorReason={2}, SuggestedSolution={3}", MetadataType, Type, ErrorReason, SuggestedSolution); } } }
apache-2.0
C#
2283075459c1c07820f497a109c78db00968ff7e
Change the feature define to be more uniform.
FloodProject/flood,FloodProject/flood,FloodProject/flood
src/ServerManaged/Server.cs
src/ServerManaged/Server.cs
using Flood.RPC.Server; using Flood.RPC.Transport; namespace Flood.Server { public abstract class Server { public IDatabaseManager Database { get; set; } public TSimpleServer RPCServer { get; set; } public TServerSocket Socket { get; set; } protected Server() { #if USE_RAVENDB Database = new RavenDatabaseManager(); #else Database = new NullDatabaseManager(); #endif } public void Shutdown() { } public void Update() { } } }
using Flood.RPC.Server; using Flood.RPC.Transport; namespace Flood.Server { public abstract class Server { public IDatabaseManager Database { get; set; } public TSimpleServer RPCServer { get; set; } public TServerSocket Socket { get; set; } protected Server() { #if RAVENDBSET Database = new RavenDatabaseManager(); #else Database = new NullDatabaseManager(); #endif } public void Shutdown() { } public void Update() { } } }
bsd-2-clause
C#
7a44ddb36baeafdab1fae0637571fab793ad145a
Update incorrect xmldoc
ppy/osu,NeoAdonis/osu,ppy/osu,peppy/osu,peppy/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,smoogipoo/osu,UselessToucan/osu
osu.Game/Extensions/TimeDisplayExtensions.cs
osu.Game/Extensions/TimeDisplayExtensions.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Localisation; namespace osu.Game.Extensions { public static class TimeDisplayExtensions { /// <summary> /// Get an editor formatted string (mm:ss:mss) /// </summary> /// <param name="milliseconds">A time value in milliseconds.</param> /// <returns>An editor formatted display string.</returns> public static string ToEditorFormattedString(this double milliseconds) => ToEditorFormattedString(TimeSpan.FromMilliseconds(milliseconds)); /// <summary> /// Get an editor formatted string (mm:ss:mss) /// </summary> /// <param name="timeSpan">A time value.</param> /// <returns>An editor formatted display string.</returns> public static string ToEditorFormattedString(this TimeSpan timeSpan) => $"{(timeSpan < TimeSpan.Zero ? "-" : string.Empty)}{(int)timeSpan.TotalMinutes:00}:{timeSpan:ss\\:fff}"; /// <summary> /// Get a formatted duration (dd:hh:mm:ss with days/hours omitted if zero). /// </summary> /// <param name="milliseconds">A duration in milliseconds.</param> /// <returns>A formatted duration string.</returns> public static LocalisableString ToFormattedDuration(this double milliseconds) => ToFormattedDuration(TimeSpan.FromMilliseconds(milliseconds)); /// <summary> /// Get a formatted duration (dd:hh:mm:ss with days/hours omitted if zero). /// </summary> /// <param name="timeSpan">A duration value.</param> /// <returns>A formatted duration string.</returns> public static LocalisableString ToFormattedDuration(this TimeSpan timeSpan) { if (timeSpan.TotalDays >= 1) return new LocalisableFormattableString(timeSpan, @"dd\:hh\:mm\:ss"); if (timeSpan.TotalHours >= 1) return new LocalisableFormattableString(timeSpan, @"hh\:mm\:ss"); return new LocalisableFormattableString(timeSpan, @"mm\:ss"); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Localisation; namespace osu.Game.Extensions { public static class TimeDisplayExtensions { /// <summary> /// Get an editor formatted string (mm:ss:mss) /// </summary> /// <param name="milliseconds">A time value in milliseconds.</param> /// <returns>An editor formatted display string.</returns> public static string ToEditorFormattedString(this double milliseconds) => ToEditorFormattedString(TimeSpan.FromMilliseconds(milliseconds)); /// <summary> /// Get an editor formatted string (mm:ss:mss) /// </summary> /// <param name="timeSpan">A time value.</param> /// <returns>An editor formatted display string.</returns> public static string ToEditorFormattedString(this TimeSpan timeSpan) => $"{(timeSpan < TimeSpan.Zero ? "-" : string.Empty)}{(int)timeSpan.TotalMinutes:00}:{timeSpan:ss\\:fff}"; /// <summary> /// Get a formatted duration (mm:ss or HH:mm:ss if more than an hour). /// </summary> /// <param name="milliseconds">A duration in milliseconds.</param> /// <returns>A formatted duration string.</returns> public static LocalisableString ToFormattedDuration(this double milliseconds) => ToFormattedDuration(TimeSpan.FromMilliseconds(milliseconds)); /// <summary> /// Get a formatted duration (dd:hh:mm:ss with days/hours omitted if zero). /// </summary> /// <param name="timeSpan">A duration value.</param> /// <returns>A formatted duration string.</returns> public static LocalisableString ToFormattedDuration(this TimeSpan timeSpan) { if (timeSpan.TotalDays >= 1) return new LocalisableFormattableString(timeSpan, @"dd\:hh\:mm\:ss"); if (timeSpan.TotalHours >= 1) return new LocalisableFormattableString(timeSpan, @"hh\:mm\:ss"); return new LocalisableFormattableString(timeSpan, @"mm\:ss"); } } }
mit
C#
d6112fe0fb2e0c2cfe18ce5f64ee1f33ac0edcce
Update Bs4SideNav
joeaudette/cloudscribe.Web.Navigation,joeaudette/cloudscribe.Web.Navigation
src/cloudscribe.Web.Navigation/Views/Shared/Components/Navigation/Bs4SideNav.cshtml
src/cloudscribe.Web.Navigation/Views/Shared/Components/Navigation/Bs4SideNav.cshtml
@using cloudscribe.Web.Navigation @using System.Text @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @model NavigationViewModel @if (Model.HasVisibleChildren(Model.StartingNode)) { <ul class="nav nav-pills flex-column" id="side-menu"> @foreach (var node in Model.StartingNode.Children) { if (!Model.ShouldAllowView(node)) { continue; } if (!Model.HasVisibleChildren(node)) { if (node.EqualsNode(Model.CurrentNode)) { <li class="nav-item"><a class="nav-link active" href="@Url.Content(Model.AdjustUrl(node))">@Html.Raw(Model.GetIcon(node.Value))@Model.AdjustText(node)</a></li> } else { <li class="nav-item"><a class="nav-link" href="@Url.Content(Model.AdjustUrl(node))">@Html.Raw(Model.GetIcon(node.Value))@Model.AdjustText(node)</a></li> } } else { <li class="nav-item"> <a class="nav-link @(node.EqualsNode(Model.CurrentNode) ? "active" : "")" href="@Url.Content(Model.AdjustUrl(node))">@Html.Raw(Model.GetIcon(node.Value))@Model.AdjustText(node)</a> @Model.UpdateTempNode(node) <partial name="Bs4SideNavPartial" model="@Model" /> </li> } } </ul> }
@using cloudscribe.Web.Navigation @using System.Text @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @model NavigationViewModel @if (Model.HasVisibleChildren(Model.StartingNode)) { <ul class="nav nav-pills flex-column" id="side-menu"> @foreach (var node in Model.StartingNode.Children) { if (!Model.ShouldAllowView(node)) { continue; } if (!Model.HasVisibleChildren(node)) { if (node.EqualsNode(Model.CurrentNode)) { <li class="nav-item"><a class="nav-link active" href="@Url.Content(Model.AdjustUrl(node))">@Html.Raw(Model.GetIcon(node.Value))@Model.AdjustText(node)</a></li> } else { <li class="nav-item"><a class="nav-link" href="@Url.Content(Model.AdjustUrl(node))">@Html.Raw(Model.GetIcon(node.Value))@Model.AdjustText(node)</a></li> } } else { if (node.EqualsNode(Model.CurrentNode)) { <li class="nav-item"> <a class="nav-link active" href="@Url.Content(Model.AdjustUrl(node))">@Html.Raw(Model.GetIcon(node.Value))@Model.AdjustText(node)</a> @Model.UpdateTempNode(node) <partial name="Bs4SideNavPartial" model="@Model" /> </li> } else { <li class="nav-item"> <a class="nav-link" href="@Url.Content(Model.AdjustUrl(node))">@Html.Raw(Model.GetIcon(node.Value))@Model.AdjustText(node)</a> @Model.UpdateTempNode(node) <partial name="Bs4SideNavPartial" model="@Model" /> </li> } } } </ul> }
apache-2.0
C#
0fd47d533f0558c4ce6d2e8cd80acc659bfcc060
Add BucketId to IEventStream
jamiegaines/NEventStore,deltatre-webplu/NEventStore,D3-LucaPiombino/NEventStore,adamfur/NEventStore,AGiorgetti/NEventStore,marcoaoteixeira/NEventStore,paritoshmmmec/NEventStore,NEventStore/NEventStore,nerdamigo/NEventStore
src/NEventStore/IEventStream.cs
src/NEventStore/IEventStream.cs
namespace NEventStore { using System; using System.Collections.Generic; using NEventStore.Persistence; /// <summary> /// Indicates the ability to track a series of events and commit them to durable storage. /// </summary> /// <remarks> /// Instances of this class are single threaded and should not be shared between threads. /// </remarks> public interface IEventStream : IDisposable { /// <summary> /// Gets the value which identifies bucket to which the the stream belongs. /// </summary> string BucketId { get; } /// <summary> /// Gets the value which uniquely identifies the stream to which the stream belongs. /// </summary> string StreamId { get; } /// <summary> /// Gets the value which indiciates the most recent committed revision of event stream. /// </summary> int StreamRevision { get; } /// <summary> /// Gets the value which indicates the most recent committed sequence identifier of the event stream. /// </summary> int CommitSequence { get; } /// <summary> /// Gets the collection of events which have been successfully persisted to durable storage. /// </summary> ICollection<EventMessage> CommittedEvents { get; } /// <summary> /// Gets the collection of committed headers associated with the stream. /// </summary> IDictionary<string, object> CommittedHeaders { get; } /// <summary> /// Gets the collection of yet-to-be-committed events that have not yet been persisted to durable storage. /// </summary> ICollection<EventMessage> UncommittedEvents { get; } /// <summary> /// Gets the collection of yet-to-be-committed headers associated with the uncommitted events. /// </summary> IDictionary<string, object> UncommittedHeaders { get; } /// <summary> /// Adds the event messages provided to the session to be tracked. /// </summary> /// <param name="uncommittedEvent">The event to be tracked.</param> void Add(EventMessage uncommittedEvent); /// <summary> /// Commits the changes to durable storage. /// </summary> /// <param name="commitId">The value which uniquely identifies the commit.</param> /// <exception cref="DuplicateCommitException" /> /// <exception cref="ConcurrencyException" /> /// <exception cref="StorageException" /> /// <exception cref="StorageUnavailableException" /> void CommitChanges(Guid commitId); /// <summary> /// Clears the uncommitted changes. /// </summary> void ClearChanges(); } }
namespace NEventStore { using System; using System.Collections.Generic; using NEventStore.Persistence; /// <summary> /// Indicates the ability to track a series of events and commit them to durable storage. /// </summary> /// <remarks> /// Instances of this class are single threaded and should not be shared between threads. /// </remarks> public interface IEventStream : IDisposable { /// <summary> /// Gets the value which uniquely identifies the stream to which the stream belongs. /// </summary> string StreamId { get; } /// <summary> /// Gets the value which indiciates the most recent committed revision of event stream. /// </summary> int StreamRevision { get; } /// <summary> /// Gets the value which indicates the most recent committed sequence identifier of the event stream. /// </summary> int CommitSequence { get; } /// <summary> /// Gets the collection of events which have been successfully persisted to durable storage. /// </summary> ICollection<EventMessage> CommittedEvents { get; } /// <summary> /// Gets the collection of committed headers associated with the stream. /// </summary> IDictionary<string, object> CommittedHeaders { get; } /// <summary> /// Gets the collection of yet-to-be-committed events that have not yet been persisted to durable storage. /// </summary> ICollection<EventMessage> UncommittedEvents { get; } /// <summary> /// Gets the collection of yet-to-be-committed headers associated with the uncommitted events. /// </summary> IDictionary<string, object> UncommittedHeaders { get; } /// <summary> /// Adds the event messages provided to the session to be tracked. /// </summary> /// <param name="uncommittedEvent">The event to be tracked.</param> void Add(EventMessage uncommittedEvent); /// <summary> /// Commits the changes to durable storage. /// </summary> /// <param name="commitId">The value which uniquely identifies the commit.</param> /// <exception cref="DuplicateCommitException" /> /// <exception cref="ConcurrencyException" /> /// <exception cref="StorageException" /> /// <exception cref="StorageUnavailableException" /> void CommitChanges(Guid commitId); /// <summary> /// Clears the uncommitted changes. /// </summary> void ClearChanges(); } }
mit
C#
ede185a73d0ea45fa8478c872ee3019189a8b97d
Update src/Nest/Enums/TextQueryType.cs
KodrAus/elasticsearch-net,junlapong/elasticsearch-net,gayancc/elasticsearch-net,Grastveit/NEST,junlapong/elasticsearch-net,robrich/elasticsearch-net,tkirill/elasticsearch-net,TheFireCookie/elasticsearch-net,SeanKilleen/elasticsearch-net,gayancc/elasticsearch-net,tkirill/elasticsearch-net,junlapong/elasticsearch-net,adam-mccoy/elasticsearch-net,NickCraver/NEST,alanprot/elasticsearch-net,azubanov/elasticsearch-net,UdiBen/elasticsearch-net,jonyadamit/elasticsearch-net,mac2000/elasticsearch-net,robrich/elasticsearch-net,robertlyson/elasticsearch-net,jonyadamit/elasticsearch-net,cstlaurent/elasticsearch-net,Grastveit/NEST,LeoYao/elasticsearch-net,amyzheng424/elasticsearch-net,geofeedia/elasticsearch-net,DavidSSL/elasticsearch-net,CSGOpenSource/elasticsearch-net,amyzheng424/elasticsearch-net,faisal00813/elasticsearch-net,joehmchan/elasticsearch-net,gayancc/elasticsearch-net,wawrzyn/elasticsearch-net,faisal00813/elasticsearch-net,robertlyson/elasticsearch-net,DavidSSL/elasticsearch-net,geofeedia/elasticsearch-net,DavidSSL/elasticsearch-net,joehmchan/elasticsearch-net,alanprot/elasticsearch-net,TheFireCookie/elasticsearch-net,starckgates/elasticsearch-net,LeoYao/elasticsearch-net,joehmchan/elasticsearch-net,NickCraver/NEST,adam-mccoy/elasticsearch-net,amyzheng424/elasticsearch-net,RossLieberman/NEST,starckgates/elasticsearch-net,UdiBen/elasticsearch-net,jonyadamit/elasticsearch-net,azubanov/elasticsearch-net,cstlaurent/elasticsearch-net,Grastveit/NEST,LeoYao/elasticsearch-net,ststeiger/elasticsearch-net,KodrAus/elasticsearch-net,wawrzyn/elasticsearch-net,wawrzyn/elasticsearch-net,ststeiger/elasticsearch-net,CSGOpenSource/elasticsearch-net,tkirill/elasticsearch-net,azubanov/elasticsearch-net,SeanKilleen/elasticsearch-net,CSGOpenSource/elasticsearch-net,TheFireCookie/elasticsearch-net,KodrAus/elasticsearch-net,RossLieberman/NEST,abibell/elasticsearch-net,robrich/elasticsearch-net,ststeiger/elasticsearch-net,NickCraver/NEST,robertlyson/elasticsearch-net,SeanKilleen/elasticsearch-net,cstlaurent/elasticsearch-net,mac2000/elasticsearch-net,geofeedia/elasticsearch-net,alanprot/elasticsearch-net,faisal00813/elasticsearch-net,alanprot/elasticsearch-net,adam-mccoy/elasticsearch-net,elastic/elasticsearch-net,abibell/elasticsearch-net,UdiBen/elasticsearch-net,RossLieberman/NEST,mac2000/elasticsearch-net,abibell/elasticsearch-net,starckgates/elasticsearch-net,elastic/elasticsearch-net
src/Nest/Enums/TextQueryType.cs
src/Nest/Enums/TextQueryType.cs
// ReSharper disable InconsistentNaming // ReSharper disable CheckNamespace namespace Nest { public enum TextQueryType { BOOLEAN, PHRASE, PHRASE_PREFIX } } // ReSharper restore CheckNamespace // ReSharper restore InconsistentNaming
// ReSharper disable InconsistentNaming // ReSharper disable CheckNamespace namespace Nest { public enum TextQueryType { BOOLEAN, PHASE, PHASE_PREFIX } } // ReSharper restore CheckNamespace // ReSharper restore InconsistentNaming
apache-2.0
C#
b2f6159ecb65360bc07348729e65d1affd81b832
drop analytics implementation
RadicalFx/radical
src/Radical/AnalyticsService.cs
src/Radical/AnalyticsService.cs
using System; using System.Collections.Generic; namespace Radical { namespace ComponentModel { public interface IAnalyticsServices { Boolean IsEnabled { get; set; } void TrackUserActionAsync(Analytics.AnalyticsEvent action); } } namespace Analytics { /// <summary> /// TODO /// </summary> public class AnalyticsEvent { /// <summary> /// Initializes a new instance of the <see cref="AnalyticsEvent" /> class. /// </summary> public AnalyticsEvent() { this.ExecutedOn = DateTimeOffset.Now; } public DateTimeOffset ExecutedOn { get; set; } public String Name { get; set; } public IDictionary<string, object> Data { get; set; } } } }
using System; using System.Security.Principal; using System.Threading; namespace Radical { namespace ComponentModel { public interface IAnalyticsServices { Boolean IsEnabled { get; set; } void TrackUserActionAsync(Analytics.AnalyticsEvent action); } } namespace Services { class AnalyticsServices : ComponentModel.IAnalyticsServices { public void TrackUserActionAsync(Analytics.AnalyticsEvent action) { Analytics.AnalyticsServices.TrackUserActionAsync(action); } public bool IsEnabled { get { return Analytics.AnalyticsServices.IsEnabled; } set { Analytics.AnalyticsServices.IsEnabled = value; } } } } namespace Analytics { public static class AnalyticsServices { public static Boolean IsEnabled { get; set; } public static void TrackUserActionAsync(AnalyticsEvent action) { if (IsEnabled && UserActionTrackingHandler != null) { System.Threading.Tasks.Task.Factory.StartNew(() => { UserActionTrackingHandler(action); }); } } public static Action<AnalyticsEvent> UserActionTrackingHandler { get; set; } } /// <summary> /// TODO /// </summary> public class AnalyticsEvent { /// <summary> /// Initializes a new instance of the <see cref="AnalyticsEvent" /> class. /// </summary> public AnalyticsEvent() { this.ExecutedOn = DateTimeOffset.Now; } public DateTimeOffset ExecutedOn { get; set; } public String Name { get; set; } public Object Data { get; set; } } } }
mit
C#
69e6d365c4730c4a31b1a4c6940b7e650fd6a245
Remove condition from approvaltestconfig
Simution/NServiceBus.Recoverability.RetrySuccessNotification
src/Tests/ApprovalTestConfig.cs
src/Tests/ApprovalTestConfig.cs
using ApprovalTests.Reporters; [assembly: UseReporter(typeof(DiffReporter), typeof(AllFailingTestsClipboardReporter))]
using ApprovalTests.Reporters; #if(DEBUG) [assembly: UseReporter(typeof(DiffReporter), typeof(AllFailingTestsClipboardReporter))] #else [assembly: UseReporter(typeof(DiffReporter))] #endif
mit
C#
14b04c640ba1fd37ec62556b5d76041eff2aa074
Decrease execution time for large iterations. Issue: #448
rexm/Handlebars.Net,rexm/Handlebars.Net
source/Handlebars/Runtime/BoxedValues.cs
source/Handlebars/Runtime/BoxedValues.cs
using System.Collections.Generic; using System.Runtime.CompilerServices; using HandlebarsDotNet.Collections; namespace HandlebarsDotNet.Runtime { /// <summary> /// Provides cache for frequently used struct values to avoid unnecessary boxing. /// <para>Overuse may lead to memory leaks! Do not store one-time values here!</para> /// <para>Usage example: indexes in iterators</para> /// </summary> public static class BoxedValues { private const int BoxedIntegersCount = 20; private static readonly object[] BoxedIntegers = new object[BoxedIntegersCount]; static BoxedValues() { for (var index = 0; index < BoxedIntegers.Length; index++) { BoxedIntegers[index] = index; } } public static readonly object True = true; public static readonly object False = false; public static readonly object Zero = 0; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static object Int(int value) { if (value >= 0 && value < BoxedIntegersCount) { return BoxedIntegers[value]; } return value; } } }
using System.Collections.Generic; using System.Runtime.CompilerServices; using HandlebarsDotNet.Collections; namespace HandlebarsDotNet.Runtime { /// <summary> /// Provides cache for frequently used struct values to avoid unnecessary boxing. /// <para>Overuse may lead to memory leaks! Do not store one-time values here!</para> /// <para>Usage example: indexes in iterators</para> /// </summary> public static class BoxedValues { private const int BoxedIntegersCount = 20; private static readonly object[] BoxedIntegers = new object[BoxedIntegersCount]; static BoxedValues() { for (var index = 0; index < BoxedIntegers.Length; index++) { BoxedIntegers[index] = index; } } public static readonly object True = true; public static readonly object False = false; public static readonly object Zero = 0; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static object Int(int value) { if (value >= 0 && value < BoxedIntegersCount) { return BoxedIntegers[value]; } return Value(value); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static object Value<T>(T value) where T: struct => BoxedContainer<T>.Boxed.GetOrAdd(value, v => (object) v); private static class BoxedContainer<T> { public static readonly LookupSlim<T, object, IEqualityComparer<T>> Boxed = new LookupSlim<T, object, IEqualityComparer<T>>(EqualityComparer<T>.Default); } } }
mit
C#
f88c510ee4f4914f84b97a023c26f10496f4dfd7
Update comments
meutley/ISTS
src/Api/Controllers/StudiosController.cs
src/Api/Controllers/StudiosController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using ISTS.Api.Model; using ISTS.Application.Studios; namespace ISTS.Api.Controllers { [Route("api/[controller]")] public class StudiosController : Controller { private readonly IStudioService _studioService; public StudiosController( IStudioService studioService) { _studioService = studioService; } // GET api/studios/1 [HttpGet("{id}")] public ApiModelResult<StudioDto> Get(Guid id) { var studio = _studioService.Get(id); return studio != null ? ApiModelResult<StudioDto>.Ok(studio) : ApiModelResult<StudioDto>.NotFound(null); } // POST api/studios [HttpPost] public ApiModelResult<StudioDto> Post([FromBody]StudioDto model) { var studio = _studioService.Create(model); return ApiModelResult<StudioDto>.Ok(studio); } // PUT api/studios/1 [HttpPut("{id}")] public ApiModelResult<StudioDto> Put([FromBody]StudioDto model) { var studio = _studioService.Update(model); return ApiModelResult<StudioDto>.Ok(studio); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using ISTS.Api.Model; using ISTS.Application.Studios; namespace ISTS.Api.Controllers { [Route("api/[controller]")] public class StudiosController : Controller { private readonly IStudioService _studioService; public StudioController( IStudioService studioService) { _studioService = studioService; } // GET api/studio/1 [HttpGet("{id}")] public ApiModelResult<StudioDto> Get(Guid id) { var studio = _studioService.Get(id); return studio != null ? ApiModelResult<StudioDto>.Ok(studio) : ApiModelResult<StudioDto>.NotFound(null); } // POST api/studio [HttpPost] public ApiModelResult<StudioDto> Post([FromBody]StudioDto model) { var studio = _studioService.Create(model); return ApiModelResult<StudioDto>.Ok(studio); } // PUT api/studio/1 [HttpPut("{id}")] public ApiModelResult<StudioDto> Put([FromBody]StudioDto model) { var studio = _studioService.Update(model); return ApiModelResult<StudioDto>.Ok(studio); } } }
mit
C#
aaf03139a3e835aa3ca2b4e9c5bd0bfbeefea412
set Chloe.PostgreSQL.DatabaseType="PostgreSQL".
shuxinqin/Chloe
src/Chloe.PostgreSQL/DatabaseProvider.cs
src/Chloe.PostgreSQL/DatabaseProvider.cs
using Chloe.Core.Visitors; using Chloe.Infrastructure; using Chloe.Query; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; namespace Chloe.PostgreSQL { class DatabaseProvider : IDatabaseProvider { IDbConnectionFactory _dbConnectionFactory; PostgreSQLContext _postgreSQLContext; public string DatabaseType { get { return "PostgreSQL"; } } public DatabaseProvider(IDbConnectionFactory dbConnectionFactory, PostgreSQLContext postgreSQLContext) { this._dbConnectionFactory = dbConnectionFactory; this._postgreSQLContext = postgreSQLContext; } public IDbConnection CreateConnection() { return this._dbConnectionFactory.CreateConnection(); } public IDbExpressionTranslator CreateDbExpressionTranslator() { if (this._postgreSQLContext.ConvertToLowercase == true) { return DbExpressionTranslator_ConvertToLowercase.Instance; } else { return DbExpressionTranslator.Instance; } } public string CreateParameterName(string name) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); if (name[0] == UtilConstants.ParameterNamePlaceholer[0]) { return name; } return UtilConstants.ParameterNamePlaceholer + name; } } }
using Chloe.Core.Visitors; using Chloe.Infrastructure; using Chloe.Query; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; namespace Chloe.PostgreSQL { class DatabaseProvider : IDatabaseProvider { IDbConnectionFactory _dbConnectionFactory; PostgreSQLContext _postgreSQLContext; public string DatabaseType { get { return "SqlServer"; } } public DatabaseProvider(IDbConnectionFactory dbConnectionFactory, PostgreSQLContext postgreSQLContext) { this._dbConnectionFactory = dbConnectionFactory; this._postgreSQLContext = postgreSQLContext; } public IDbConnection CreateConnection() { return this._dbConnectionFactory.CreateConnection(); } public IDbExpressionTranslator CreateDbExpressionTranslator() { if (this._postgreSQLContext.ConvertToLowercase == true) { return DbExpressionTranslator_ConvertToLowercase.Instance; } else { return DbExpressionTranslator.Instance; } } public string CreateParameterName(string name) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); if (name[0] == UtilConstants.ParameterNamePlaceholer[0]) { return name; } return UtilConstants.ParameterNamePlaceholer + name; } } }
mit
C#
deaaf26ddbc4c33d9a938982566f5f6dad97834f
Bump version to 0.12
jamesfoster/DeepEqual
src/DeepEqual/Properties/AssemblyInfo.cs
src/DeepEqual/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("DeepEqual")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DeepEqual")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2db8921a-dc9f-4b4a-b651-cd71eac66b39")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.12.0.0")] [assembly: AssemblyFileVersion("0.12.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("DeepEqual")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DeepEqual")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2db8921a-dc9f-4b4a-b651-cd71eac66b39")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.11.0.0")] [assembly: AssemblyFileVersion("0.11.0.0")]
mit
C#
c5c3d8e4e0e5180c1a00974e911de77858c3d779
Update assembly
PiezPiedPy/Kerbalism,PiezPiedPy/Kerbalism,PiezPiedPy/Kerbalism
src/Kerbalism/Properties/AssemblyInfo.cs
src/Kerbalism/Properties/AssemblyInfo.cs
#region Using directives using System.Reflection; using System.Runtime.InteropServices; #endregion // 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( "Kerbalism" )] [assembly: AssemblyDescription( "Hundreds of Kerbals were killed in the making of this mod." )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "" )] [assembly: AssemblyProduct( "Kerbalism" )] [assembly: AssemblyCopyright( "" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. [assembly: ComVisible( false )] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all the values or you can use the default the Revision and // Build Numbers by using the '*' as shown below: [assembly: AssemblyVersion( "2.0.0.0" )] [assembly: AssemblyFileVersion( "2.0.0.0" )]
#region Using directives using System; using System.Reflection; using System.Runtime.InteropServices; #endregion // 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("Kerbalism")] [assembly: AssemblyDescription("Hundreds of Kerbals were killed in the making of this mod.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Kerbalism")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. [assembly: ComVisible(false)] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all the values or you can use the default the Revision and // Build Numbers by using the '*' as shown below: [assembly: AssemblyVersion("1.9.1.0")] [assembly: AssemblyFileVersion("1.9.1.0")]
unlicense
C#
fbd04d181f47a7822767e4166cd2facf8e1fb8b2
Add null check
mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard
src/Okanshi.Dashboard/GetHealthChecks.cs
src/Okanshi.Dashboard/GetHealthChecks.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Okanshi.Dashboard.Models; namespace Okanshi.Dashboard { public interface IGetHealthChecks { IEnumerable<HealthCheck> Execute(string instanceName); } public class GetHealthChecks : IGetHealthChecks { private readonly IStorage _storage; public GetHealthChecks(IStorage storage) { _storage = storage; } public IEnumerable<HealthCheck> Execute(string instanceName) { var webClient = new WebClient(); var url = _storage.GetAll().Single(x => x.Name.Equals(instanceName, StringComparison.OrdinalIgnoreCase)).Url; var response = webClient.DownloadString(string.Format("{0}/healthchecks", url)); var jObject = JObject.Parse(response); JToken versionToken; jObject.TryGetValue("version", out versionToken); var version = versionToken != null ? versionToken.Value<string>() ?? "0" : "0"; if (version.Equals("0", StringComparison.OrdinalIgnoreCase)) { var deserializeObject = JsonConvert.DeserializeObject<IDictionary<string, bool>>(response); return deserializeObject .Select(x => new HealthCheck { Name = x.Key, Success = x.Value, }); } return Enumerable.Empty<HealthCheck>(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Okanshi.Dashboard.Models; namespace Okanshi.Dashboard { public interface IGetHealthChecks { IEnumerable<HealthCheck> Execute(string instanceName); } public class GetHealthChecks : IGetHealthChecks { private readonly IStorage _storage; public GetHealthChecks(IStorage storage) { _storage = storage; } public IEnumerable<HealthCheck> Execute(string instanceName) { var webClient = new WebClient(); var url = _storage.GetAll().Single(x => x.Name.Equals(instanceName, StringComparison.OrdinalIgnoreCase)).Url; var response = webClient.DownloadString(string.Format("{0}/healthchecks", url)); var jObject = JObject.Parse(response); JToken versionToken; jObject.TryGetValue("version", out versionToken); var version = versionToken.Value<string>() ?? "0"; if (version.Equals("0", StringComparison.OrdinalIgnoreCase)) { var deserializeObject = JsonConvert.DeserializeObject<IDictionary<string, bool>>(response); return deserializeObject .Select(x => new HealthCheck { Name = x.Key, Success = x.Value, }); } return Enumerable.Empty<HealthCheck>(); } } }
mit
C#
cd97a7ffcb948d5a6e21f3c3fc6ef0d4737b0424
Fix attribute values for MSAL extension config of gnome keyring (#15944)
AsrOneSdk/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,markcowl/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net
sdk/identity/Azure.Identity/src/Constants.cs
sdk/identity/Azure.Identity/src/Constants.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.IO; namespace Azure.Identity { internal class Constants { public const string OrganizationsTenantId = "organizations"; public const string AdfsTenantId = "adfs"; // TODO: Currently this is piggybacking off the Azure CLI client ID, but needs to be switched once the Developer Sign On application is available public const string DeveloperSignOnClientId = "04b07795-8ddb-461a-bbee-02f9e1bf7b46"; public static string SharedTokenCacheFilePath { get { return Path.Combine(DefaultMsalTokenCacheDirectory, DefaultMsalTokenCacheName); } } public const int SharedTokenCacheAccessRetryCount = 100; public static readonly TimeSpan SharedTokenCacheAccessRetryDelay = TimeSpan.FromMilliseconds(600); public const string DefaultRedirectUrl = "http://localhost"; public static readonly string DefaultMsalTokenCacheDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ".IdentityService"); public const string DefaultMsalTokenCacheKeychainService = "Microsoft.Developer.IdentityService"; public const string DefaultMsalTokenCacheKeychainAccount = "MSALCache"; public const string DefaultMsalTokenCacheKeyringLabel = "MSALCache"; public const string DefaultMsalTokenCacheKeyringSchema = "msal.cache"; public const string DefaultMsalTokenCacheKeyringCollection = "default"; public static readonly KeyValuePair<string, string> DefaultMsaltokenCacheKeyringAttribute1 = new KeyValuePair<string, string>("MsalClientID", "Microsoft.Developer.IdentityService"); public static readonly KeyValuePair<string, string> DefaultMsaltokenCacheKeyringAttribute2 = new KeyValuePair<string, string>("Microsoft.Developer.IdentityService", "1.0.0.0"); public const string DefaultMsalTokenCacheName = "msal.cache"; } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.IO; namespace Azure.Identity { internal class Constants { public const string OrganizationsTenantId = "organizations"; public const string AdfsTenantId = "adfs"; // TODO: Currently this is piggybacking off the Azure CLI client ID, but needs to be switched once the Developer Sign On application is available public const string DeveloperSignOnClientId = "04b07795-8ddb-461a-bbee-02f9e1bf7b46"; public static string SharedTokenCacheFilePath { get { return Path.Combine(DefaultMsalTokenCacheDirectory, DefaultMsalTokenCacheName); } } public const int SharedTokenCacheAccessRetryCount = 100; public static readonly TimeSpan SharedTokenCacheAccessRetryDelay = TimeSpan.FromMilliseconds(600); public const string DefaultRedirectUrl = "http://localhost"; public static readonly string DefaultMsalTokenCacheDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ".IdentityService"); public const string DefaultMsalTokenCacheKeychainService = "Microsoft.Developer.IdentityService"; public const string DefaultMsalTokenCacheKeychainAccount = "MSALCache"; public const string DefaultMsalTokenCacheKeyringLabel = "MSALCache"; public const string DefaultMsalTokenCacheKeyringSchema = "msal.cache"; public const string DefaultMsalTokenCacheKeyringCollection = "default"; public static readonly KeyValuePair<string, string> DefaultMsaltokenCacheKeyringAttribute1 = new KeyValuePair<string, string>("MsalClientID", null); public static readonly KeyValuePair<string, string> DefaultMsaltokenCacheKeyringAttribute2 = new KeyValuePair<string, string>("Microsoft.Developer.IdentityService", null); public const string DefaultMsalTokenCacheName = "msal.cache"; } }
mit
C#
fb26eec66597ba1639401b3045db7ae7c9812a8b
Change Record.Data to byte[]
carbon/Amazon
src/Amazon.Kinesis.Firehose/Models/Record.cs
src/Amazon.Kinesis.Firehose/Models/Record.cs
using System; namespace Amazon.Kinesis.Firehose { public readonly struct Record { public const int MaxSize = 1_000_000; // 1,000 KB public Record(byte[] data) { if (data is null) { throw new ArgumentNullException(nameof(data)); } if (data.Length == 0) { throw new ArgumentException("Must not be empty", nameof(data)); } if (data.Length > MaxSize) { throw new ArgumentException(nameof(data), "Must be less than 1MB"); } Data = data; } public byte[] Data { get; } } } // The data blob, which is base64-encoded when the blob is serialized. // The maximum size of the data blob, before base64-encoding, is 1,000 KB.
using System; namespace Amazon.Kinesis.Firehose { public readonly struct Record { public const int MaxSize = 1_000_000; // 1,000 KB public Record(byte[] data) { if (data == null) { throw new ArgumentNullException(nameof(data)); } if (data.Length == 0) { throw new ArgumentException("Must not be empty", nameof(data)); } if (data.Length > MaxSize) { throw new ArgumentException(nameof(data), "Must be less than 1MB"); } Data = Convert.ToBase64String(data); } public readonly string Data; } } // The data blob, which is base64-encoded when the blob is serialized. // The maximum size of the data blob, before base64-encoding, is 1,000 KB.
mit
C#
8457c05b9a19dcc7e23cb94b8390c9c5b26d4ce2
Fix the new diff tool configurations to account for the "approved" file not existing.
JoeMighty/shouldly
src/Shouldly/Configuration/KnownDiffTools.cs
src/Shouldly/Configuration/KnownDiffTools.cs
#if ShouldMatchApproved using System.IO; using JetBrains.Annotations; namespace Shouldly.Configuration { public class KnownDiffTools { [UsedImplicitly] public readonly DiffTool KDiff3 = new DiffTool("KDiff3", @"KDiff3\kdiff3.exe", KDiffArgs); [UsedImplicitly] public readonly DiffTool BeyondCompare3 = new DiffTool("Beyond Compare 3", @"Beyond Compare 3\BCompare.exe", BeyondCompareArgs); [UsedImplicitly] public readonly DiffTool BeyondCompare4 = new DiffTool("Beyond Compare 4", @"Beyond Compare 4\BCompare.exe", BeyondCompareArgs); [UsedImplicitly] public readonly DiffTool CodeCompare = new DiffTool("Code Compare", @"Devart\Code Compare\CodeMerge.exe", CodeCompareArgs); [UsedImplicitly] public readonly DiffTool P4Merge = new DiffTool("P4Merge", @"Perforce\p4merge.exe", P4MergeArgs); public static KnownDiffTools Instance { get; } = new KnownDiffTools(); static string BeyondCompareArgs(string received, string approved, bool approvedExists) { return approvedExists ? $"\"{received}\" \"{approved}\" /mergeoutput=\"{approved}\"" : $"\"{received}\" /mergeoutput=\"{approved}\""; } static string KDiffArgs(string received, string approved, bool approvedExists) { return approvedExists ? $"\"{received}\" \"{approved}\" -o \"{approved}\"" : $"\"{received}\" -o \"{approved}\""; } static string CodeCompareArgs(string received, string approved, bool approvedExists) { return $"/BF=\"{approved}\" /TF=\"{approved}\" /MF=\"{received}\" /RF=\"{approved}\""; } static string P4MergeArgs(string received, string approved, bool approvedExists) { if (!approvedExists) using (var file = File.Create(approved)) { } return $"\"{approved}\" \"{approved}\" \"{received}\" \"{approved}\""; } } } #endif
#if ShouldMatchApproved using JetBrains.Annotations; namespace Shouldly.Configuration { public class KnownDiffTools { [UsedImplicitly] public readonly DiffTool KDiff3 = new DiffTool("KDiff3", @"KDiff3\kdiff3.exe", KDiffArgs); [UsedImplicitly] public readonly DiffTool BeyondCompare3 = new DiffTool("Beyond Compare 3", @"Beyond Compare 3\BCompare.exe", BeyondCompareArgs); [UsedImplicitly] public readonly DiffTool BeyondCompare4 = new DiffTool("Beyond Compare 4", @"Beyond Compare 4\BCompare.exe", BeyondCompareArgs); [UsedImplicitly] public readonly DiffTool CodeCompare = new DiffTool("Code Compare", @"Devart\Code Compare\CodeMerge.exe", CodeCompareArgs); [UsedImplicitly] public readonly DiffTool P4Merge = new DiffTool("P4Merge", @"Perforce\p4merge.exe", P4MergeArgs); public static KnownDiffTools Instance { get; } = new KnownDiffTools(); static string BeyondCompareArgs(string received, string approved, bool approvedExists) { return approvedExists ? $"\"{received}\" \"{approved}\" /mergeoutput=\"{approved}\"" : $"\"{received}\" /mergeoutput=\"{approved}\""; } static string KDiffArgs(string received, string approved, bool approvedExists) { return approvedExists ? $"\"{received}\" \"{approved}\" -o \"{approved}\"" : $"\"{received}\" -o \"{approved}\""; } static string CodeCompareArgs(string received, string approved, bool approvedExists) { return approvedExists ? $"/MF=\"{received}\" /TF=\"{approved}\" /RF=\"{approved}\"" : $"/MF=\"{received}\" /TF=\"\" /RF=\"{approved}\""; } static string P4MergeArgs(string received, string approved, bool approvedExists) { return approvedExists ? $"\"{approved}\" \"{approved}\" \"{received}\" \"{approved}\"" : $"\"\" \"\" \"{received}\" \"{approved}\""; } } } #endif
bsd-3-clause
C#
5e689722fa7e7191e7a2aabe9008ffd15f7abd1b
Add the standard copyright header into UTF8Marshaler.cs
shutej/tapcfg,shutej/tapcfg,shutej/tapcfg,shutej/tapcfg,shutej/tapcfg,shutej/tapcfg,shutej/tapcfg
trunk/src/bindings/UTF8Marshaler.cs
trunk/src/bindings/UTF8Marshaler.cs
/** * tapcfg - A cross-platform configuration utility for TAP driver * Copyright (C) 2008 Juho Vähä-Herttua * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ using System; using System.Text; using System.Collections; using System.Runtime.InteropServices; namespace TAP { public class UTF8Marshaler : ICustomMarshaler { static UTF8Marshaler marshaler = new UTF8Marshaler(); private Hashtable allocated = new Hashtable(); public static ICustomMarshaler GetInstance(string cookie) { return marshaler; } public void CleanUpManagedData(object ManagedObj) { } public void CleanUpNativeData(IntPtr pNativeData) { /* This is a hack not to crash on mono!!! */ if (allocated.Contains(pNativeData)) { Marshal.FreeHGlobal(pNativeData); allocated.Remove(pNativeData); } else { Console.WriteLine("WARNING: Trying to free an unallocated pointer!"); Console.WriteLine(" This is most likely a bug in mono"); } } public int GetNativeDataSize() { return -1; } public IntPtr MarshalManagedToNative(object ManagedObj) { if (ManagedObj == null) return IntPtr.Zero; if (ManagedObj.GetType() != typeof(string)) throw new ArgumentException("ManagedObj", "Can only marshal type of System.string"); byte[] array = Encoding.UTF8.GetBytes((string) ManagedObj); int size = Marshal.SizeOf(typeof(byte)) * (array.Length + 1); IntPtr ptr = Marshal.AllocHGlobal(size); /* This is a hack not to crash on mono!!! */ allocated.Add(ptr, null); Marshal.Copy(array, 0, ptr, array.Length); Marshal.WriteByte(ptr, array.Length, 0); return ptr; } public object MarshalNativeToManaged(IntPtr pNativeData) { if (pNativeData == IntPtr.Zero) return null; int size = 0; while (Marshal.ReadByte(pNativeData, size) > 0) size++; byte[] array = new byte[size]; Marshal.Copy(pNativeData, array, 0, size); return Encoding.UTF8.GetString(array); } } }
using System; using System.Text; using System.Collections; using System.Runtime.InteropServices; namespace TAP { public class UTF8Marshaler : ICustomMarshaler { static UTF8Marshaler marshaler = new UTF8Marshaler(); private Hashtable allocated = new Hashtable(); public static ICustomMarshaler GetInstance(string cookie) { return marshaler; } public void CleanUpManagedData(object ManagedObj) { } public void CleanUpNativeData(IntPtr pNativeData) { /* This is a hack not to crash on mono!!! */ if (allocated.Contains(pNativeData)) { Marshal.FreeHGlobal(pNativeData); allocated.Remove(pNativeData); } else { Console.WriteLine("WARNING: Trying to free an unallocated pointer!"); Console.WriteLine(" This is most likely a bug in mono"); } } public int GetNativeDataSize() { return -1; } public IntPtr MarshalManagedToNative(object ManagedObj) { if (ManagedObj == null) return IntPtr.Zero; if (ManagedObj.GetType() != typeof(string)) throw new ArgumentException("ManagedObj", "Can only marshal type of System.string"); byte[] array = Encoding.UTF8.GetBytes((string) ManagedObj); int size = Marshal.SizeOf(typeof(byte)) * (array.Length + 1); IntPtr ptr = Marshal.AllocHGlobal(size); /* This is a hack not to crash on mono!!! */ allocated.Add(ptr, null); Marshal.Copy(array, 0, ptr, array.Length); Marshal.WriteByte(ptr, array.Length, 0); return ptr; } public object MarshalNativeToManaged(IntPtr pNativeData) { if (pNativeData == IntPtr.Zero) return null; int size = 0; while (Marshal.ReadByte(pNativeData, size) > 0) size++; byte[] array = new byte[size]; Marshal.Copy(pNativeData, array, 0, size); return Encoding.UTF8.GetString(array); } } }
lgpl-2.1
C#
8009b99fc55137accbb7bce0e7c848628c7dd58b
add experimental codes to edit file
hakomikan/CommandUtility
CommandInterfaceTest/Utility/ProjectConstructorTests.cs
CommandInterfaceTest/Utility/ProjectConstructorTests.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using CommandInterface.Utility; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using CommandInterface; using System.IO; using TestUtility; using System.Diagnostics; using CommandInterfaceTest; namespace CommandInterface.Utility.Tests { [TestClass()] public class ProjectConstructorTests : CommandInterfaceTestBase { [TestMethod()] public void ProjectConstructorTest() { using (var holder = new TemporaryFileHolder(TestContext)) { var script1 = new FileInfo(CommandManager.GetScriptPath("test-script")); var script2 = new FileInfo(CommandManager.GetScriptPath("test-script2")); var constructor = new ProjectConstructor() { CommandInterfaceProject = this.CommandInterfaceProject }; constructor.CreateProject( "TestProject", holder.WorkSpaceDirectory, new List<FileInfo>() { script1, script2 }); Assert.IsTrue(File.Exists(constructor.ProjectPath.FullName)); TestUtility.FileUtility.OpenDirectory(holder.WorkSpaceDirectory); //TestUtility.FileUtility.OpenFile(constructor.SolutionPath); Process.Start("devenv.exe", $"/Command \"Edit.Goto 9\" \"{script1.FullName}\""); } } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using CommandInterface.Utility; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using CommandInterface; using System.IO; using TestUtility; using System.Diagnostics; using CommandInterfaceTest; namespace CommandInterface.Utility.Tests { [TestClass()] public class ProjectConstructorTests : CommandInterfaceTestBase { [TestMethod()] public void ProjectConstructorTest() { using (var holder = new TemporaryFileHolder(TestContext)) { var script1 = new FileInfo(CommandManager.GetScriptPath("test-script")); var script2 = new FileInfo(CommandManager.GetScriptPath("test-script2")); var constructor = new ProjectConstructor() { CommandInterfaceProject = this.CommandInterfaceProject }; constructor.CreateProject( "TestProject", holder.WorkSpaceDirectory, new List<FileInfo>() { script1, script2 }); Assert.IsTrue(File.Exists(constructor.ProjectPath.FullName)); TestUtility.FileUtility.OpenDirectory(holder.WorkSpaceDirectory); //TestUtility.FileUtility.OpenFile(constructor.SolutionPath); } throw new NotImplementedException(); } } }
bsd-2-clause
C#
bd5270a4c7f6198c91e43277656840ade94c9716
Include regular console reporting even when running under TeamCity, so that users see appropriate test details whether looking at the captured build output or the test report.
fixie/fixie
src/Fixie/Internal/EntryPoint.cs
src/Fixie/Internal/EntryPoint.cs
namespace Fixie.Internal { using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading.Tasks; using Reports; using static System.Console; using static System.Environment; using static Maybe; public class EntryPoint { enum ExitCode { Success = 0, Failure = 1, FatalError = -1 } public static async Task<int> Main(Assembly assembly, string[] customArguments) { try { return (int) await RunAssemblyAsync(assembly, customArguments); } catch (Exception exception) { using (Foreground.Red) WriteLine($"Fatal Error: {exception}"); return (int)ExitCode.FatalError; } } static async Task<ExitCode> RunAssemblyAsync(Assembly assembly, string[] customArguments) { var reports = DefaultReports().ToArray(); var runner = new Runner(assembly, customArguments, reports); var pattern = GetEnvironmentVariable("FIXIE:TESTS"); var summary = pattern == null ? await runner.RunAsync() : await runner.RunAsync(new TestPattern(pattern)); if (summary.Total == 0) return ExitCode.FatalError; if (summary.Failed > 0) return ExitCode.Failure; return ExitCode.Success; } static IEnumerable<Report> DefaultReports() { if (Try(AzureReport.Create, out var azure)) yield return azure; if (Try(AppVeyorReport.Create, out var appVeyor)) yield return appVeyor; if (Try(XmlReport.Create, out var xml)) yield return xml; if (Try(TeamCityReport.Create, out var teamCity)) yield return teamCity; yield return ConsoleReport.Create(); } } }
namespace Fixie.Internal { using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading.Tasks; using Reports; using static System.Console; using static System.Environment; using static Maybe; public class EntryPoint { enum ExitCode { Success = 0, Failure = 1, FatalError = -1 } public static async Task<int> Main(Assembly assembly, string[] customArguments) { try { return (int) await RunAssemblyAsync(assembly, customArguments); } catch (Exception exception) { using (Foreground.Red) WriteLine($"Fatal Error: {exception}"); return (int)ExitCode.FatalError; } } static async Task<ExitCode> RunAssemblyAsync(Assembly assembly, string[] customArguments) { var reports = DefaultReports().ToArray(); var runner = new Runner(assembly, customArguments, reports); var pattern = GetEnvironmentVariable("FIXIE:TESTS"); var summary = pattern == null ? await runner.RunAsync() : await runner.RunAsync(new TestPattern(pattern)); if (summary.Total == 0) return ExitCode.FatalError; if (summary.Failed > 0) return ExitCode.Failure; return ExitCode.Success; } static IEnumerable<Report> DefaultReports() { if (Try(AzureReport.Create, out var azure)) yield return azure; if (Try(AppVeyorReport.Create, out var appVeyor)) yield return appVeyor; if (Try(XmlReport.Create, out var xml)) yield return xml; if (Try(TeamCityReport.Create, out var teamCity)) yield return teamCity; else yield return ConsoleReport.Create(); } } }
mit
C#
18cd981490699d7b54111d245130a0bfce1b38d4
Enable CORS
Wabyon/MarkN
src/MarkN.Server/Bootstrapper.cs
src/MarkN.Server/Bootstrapper.cs
using Nancy; using Nancy.Bootstrapper; using Nancy.TinyIoc; namespace MarkN { public class Bootstrapper : DefaultNancyBootstrapper { protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context) { //CORS Enable pipelines.AfterRequest.AddItemToEndOfPipeline( (ctx) => ctx.Response.WithHeader("Access-Control-Allow-Origin", "*") .WithHeader("Access-Control-Allow-Methods", "POST,GET") .WithHeader("Access-Control-Allow-Headers", "Accept, Origin, Content-type")); } } }
using Nancy; namespace MarkN { public class Bootstrapper : DefaultNancyBootstrapper { } }
mit
C#
30a9e353dc7f492adb096d2ad8d790f896c9cb88
Add missing character in namespace
appharbor/appharbor-cli
src/AppHarbor/TypeNameMatcher.cs
src/AppHarbor/TypeNameMatcher.cs
namespace AppHarbor { public class TypeNameMatcher { } }
amespace AppHarbor { public class TypeNameMatcher { } }
mit
C#
f12053f5fb3c67274463407dbff41b1a3602ed40
Add call to Evolve and change log msg
lecaillon/Evolve
src/Evolve/MsBuild/EvolveBoot.cs
src/Evolve/MsBuild/EvolveBoot.cs
#if NET using System; using System.IO; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace Evolve.MsBuild { [LoadInSeparateAppDomain] [Serializable] public class EvolveBoot : AppDomainIsolatedTask { public string TargetPath { get; set; } public string TargetDir => Path.GetDirectoryName(TargetPath); public string EvolveConfigurationFile => TargetPath + ".config"; public override bool Execute() { string originalCurrentDirectory = Directory.GetCurrentDirectory(); try { LogInfo("Sql migration begins"); Directory.SetCurrentDirectory(TargetDir); var evolve = new Evolve(EvolveConfigurationFile); evolve.Migrate(); return true; } catch (Exception ex) { LogError(ex); return false; } finally { Directory.SetCurrentDirectory(originalCurrentDirectory); WriteFooter(); } } private void LogError(Exception ex) { Log.LogErrorFromException(ex, true, false, "Evolve"); } private void LogInfo(string msg) { Log.LogMessage(MessageImportance.High, msg); } private void WriteHeader() { Log.LogMessage(MessageImportance.High, @" _____ _ "); Log.LogMessage(MessageImportance.High, @" | ____|__ __ ___ | |__ __ ___ "); Log.LogMessage(MessageImportance.High, @" | _| \ \ / // _ \ | |\ \ / // _ \"); Log.LogMessage(MessageImportance.High, @" | |___ \ V /| (_) || | \ V /| __/"); Log.LogMessage(MessageImportance.High, @" |_____| \_/ \___/ |_| \_/ \___|"); //" _ _ _ _ _ _ " //" / \ / \ / \ / \ / \ / \ " //" ( E ) ( v ) ( o ) ( l ) ( v ) ( e )" //" \_/ \_/ \_/ \_/ \_/ \_/ " //" ____ ____ ____ ____ ____ ____ " //"||E ||||v ||||o ||||l ||||v ||||e ||" //"||__||||__||||__||||__||||__||||__||" //"|/__\||/__\||/__\||/__\||/__\||/__\|" //"__________ ______ " //"___ ____/__ __________ /__ ______ " //"__ __/ __ | / / __ \_ /__ | / / _ \" //"_ /___ __ |/ // /_/ / / __ |/ // __/" //"/_____/ _____/ \____//_/ _____/ \___/ " } private void WriteFooter() { } private void WriteNewLine() { Log.LogMessage(MessageImportance.High, string.Empty); } } } #endif
#if NET using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace Evolve.MsBuild { public class EvolveBoot : Task { public string TargetPath { get; set; } public override bool Execute() { Log.LogMessage(MessageImportance.High, ""); Log.LogMessage(MessageImportance.High, "Start EvolveBoot task"); Log.LogMessage(MessageImportance.High, TargetPath); Log.LogMessage(MessageImportance.High, "End EvolveBoot task"); Log.LogMessage(MessageImportance.High, ""); return true; } } } #endif //<UsingTask TaskName = "Evolve.MsBuild.EvolveBoot" AssemblyFile="..\..\src\Evolve\bin\Debug\netstandard1.3\Evolve.dll" /> //<Target Name = "AfterBuild" > // < EvolveBoot TargetPath="$(TargetPath)" /> //</Target> // Sql_Scripts // Use Directory.SetCurrentDirectory($TargetDir); to mimic the comportment of the default // FileMigrationLoader new DirectoryInfo(@"c:\test").FullName wheen launching from MsBuild
mit
C#
5ba266ba2e8451bdd3976affae4817a65a1716be
Extend the available constructors on ParseException to avoid a binary-breaking change
datalust/superpower,datalust/superpower
src/Superpower/ParseException.cs
src/Superpower/ParseException.cs
// Copyright 2016 Datalust, Superpower Contributors, Sprache Contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using Superpower.Model; namespace Superpower { /// <summary> /// Represents an error that occurs during parsing. /// </summary> public class ParseException : Exception { /// <summary> /// Initializes a new instance of the <see cref="ParseException" /> class with a default error message. /// </summary> public ParseException() : this("Parsing failed.", Position.Empty, null) { } /// <summary> /// Initializes a new instance of the <see cref="ParseException" /> class with a specified error message. /// </summary> /// <param name="message">The message that describes the error.</param> public ParseException(string message) : this(message, Position.Empty, null) { } /// <summary> /// Initializes a new instance of the <see cref="ParseException" /> class with a specified error message. /// </summary> /// <param name="message">The message that describes the error.</param> /// <param name="innerException">The exception that is the cause of the current exception.</param> public ParseException(string message, Exception innerException) : this(message, Position.Empty, innerException) { } /// <summary> /// Initializes a new instance of the <see cref="ParseException" /> class with a specified error message. /// </summary> /// <param name="message">The message that describes the error.</param> /// <param name="errorPosition">The position of the error in the input text.</param> public ParseException(string message, Position errorPosition) : this(message, errorPosition, null) { } /// <summary> /// Initializes a new instance of the <see cref="ParseException" /> class with a specified error message. /// </summary> /// <param name="message">The message that describes the error.</param> /// <param name="errorPosition">The position of the error in the input text.</param> /// <param name="innerException">The exception that is the cause of the current exception.</param> public ParseException(string message, Position errorPosition, Exception innerException) : base(message, innerException) { ErrorPosition = errorPosition; } /// <summary> /// The position of the error in the input text, or <see cref="Position.Empty"/> if no position is specified. /// </summary> public Position ErrorPosition { get; } } }
// Copyright 2016 Datalust, Superpower Contributors, Sprache Contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using Superpower.Model; namespace Superpower { /// <summary> /// Represents an error that occurs during parsing. /// </summary> public class ParseException : Exception { /// <summary> /// Initializes a new instance of the <see cref="ParseException" /> class with a specified error message. /// </summary> /// <param name="message">The message that describes the error.</param> /// <param name="errorPosition"> position that the recorded error occurred at.</param> public ParseException(string message, Position errorPosition) : this(message, errorPosition, null) { } /// <summary> /// Initializes a new instance of the <see cref="ParseException" /> class with a specified error message. /// </summary> /// <param name="message">The message that describes the error.</param> /// <param name="errorPosition"> position that the recorded error occurred at.</param> /// <param name="innerException">The exception that is the cause of the current exception, /// or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param> public ParseException(string message, Position errorPosition, Exception innerException = null) : base(message, innerException) { ErrorPosition = errorPosition; } /// <summary> /// The position that the recorded error occurred at /// </summary> public Position ErrorPosition { get; } } }
apache-2.0
C#
3b29583a43da76ee6b0952ed0483c569cc180d2d
Update TestBase.cs
SimonCropp/NServiceBus.Serilog
src/Tests/TestConfig/TestBase.cs
src/Tests/TestConfig/TestBase.cs
using Xunit.Abstractions; using ObjectApproval; public class TestBase: XunitApprovalBase { public TestBase(ITestOutputHelper output, [CallerFilePath] string sourceFilePath = "") : base(output, sourceFilePath) { } static TestBase() { SerializerBuilder.ExtraSettings = settings => { settings.Converters.Add(new LogEventPropertyConverter()); settings.Converters.Add(new LogEventConverter()); settings.Converters.Add(new ScalarValueConverter()); }; StringScrubber.AddExtraDatetimeFormat("yyyy-MM-dd HH:mm:ss:ffffff Z"); } }
using Xunit.Abstractions; using ObjectApproval; public class TestBase: XunitApprovalBase { public TestBase(ITestOutputHelper output) : base(output) { } static TestBase() { SerializerBuilder.ExtraSettings = settings => { settings.Converters.Add(new LogEventPropertyConverter()); settings.Converters.Add(new LogEventConverter()); settings.Converters.Add(new ScalarValueConverter()); }; StringScrubber.AddExtraDatetimeFormat("yyyy-MM-dd HH:mm:ss:ffffff Z"); } }
mit
C#