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
898fc0c669b840df753922494c6726c3a1237f73
add look ahead cancel test
ArsenShnurkov/BitSharp
BitSharp.Common.Test/LookAheadTest.cs
BitSharp.Common.Test/LookAheadTest.cs
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace BitSharp.Common.Test { [TestClass] public class LookAheadTest { [TestMethod] public void TestReadException() { var expectedException = new Exception(); try { foreach (var value in this.ThrowsEnumerable(expectedException).LookAhead(1)) { } Assert.Fail("Expected exeption."); } catch (Exception actualException) { Assert.AreSame(expectedException, actualException); } } [TestMethod] [ExpectedException(typeof(OperationCanceledException))] public void TestCancelToken() { using (var cancelToken = new CancellationTokenSource()) using (var waitEvent = new ManualResetEventSlim()) { foreach (var value in this.WaitsEnumerable(waitEvent.WaitHandle).LookAhead(1, cancelToken.Token)) { cancelToken.Cancel(); waitEvent.Set(); } } } private IEnumerable<object> ThrowsEnumerable(Exception e) { yield return new Object(); yield return new Object(); yield return new Object(); yield return new Object(); throw e; } private IEnumerable<object> WaitsEnumerable(WaitHandle waitHandle) { yield return new Object(); yield return new Object(); waitHandle.WaitOne(); yield return new Object(); yield return new Object(); yield return new Object(); yield return new Object(); yield return new Object(); } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace BitSharp.Common.Test { [TestClass] public class LookAheadTest { [TestMethod] public void TestReadException() { var expectedException = new Exception(); try { foreach (var value in this.BadEnumerable(expectedException).LookAhead(1)) { } Assert.Fail("Expected exeption."); } catch (Exception actualException) { Assert.AreSame(expectedException, actualException); } } private IEnumerable<object> BadEnumerable(Exception e) { yield return new Object(); yield return new Object(); yield return new Object(); yield return new Object(); throw e; } } }
unlicense
C#
58faf7ccac1e401983734afe4052e4211e135f9a
Update VBlock to use AVBlock as a parent
BenVlodgi/VMFParser
VMFParser/VBlock.cs
VMFParser/VBlock.cs
using System.Collections.Generic; using System.Linq; namespace VMFParser { /// <summary>Represents a block containing other IVNodes in a VMF</summary> public class VBlock : AVBlock, IVNode, IDeepCloneable<VBlock> { public string Name { get; private set; } //public IList<IVNode> Body { get; protected set; } /// <summary>Initializes a new instance of the <see cref="VBlock"/> class from its name and a list of IVNodes.</summary> public VBlock(string name, IList<IVNode> body = null) { Name = name; if (body == null) body = new List<IVNode>(); Body = body; } /// <summary>Initializes a new instance of the <see cref="VBlock"/> class from VMF text.</summary> public VBlock(string[] text) { Name = text[0].Trim(); Body = Utils.ParseToBody(text.SubArray(2, text.Length - 3)); } /// <summary>Generates the VMF text representation of this block.</summary> /// <param name="useTabs">if set to <c>true</c> the text will be tabbed accordingly.</param> public string[] ToVMFStrings(bool useTabs = true) { var text = Utils.BodyToString(Body); if (useTabs) text = text.Select(t => t.Insert(0, "\t")).ToList(); text.Insert(0, Name); text.Insert(1, "{"); text.Add("}"); return text.ToArray(); } public override string ToString() { return base.ToString() + " (" + Name + ")"; } IVNode IDeepCloneable<IVNode>.DeepClone() => DeepClone(); public VBlock DeepClone() { return new VBlock(Name, Body == null ? null : Body.Select(node => node.DeepClone()).ToList()); } } }
using System.Collections.Generic; using System.Linq; namespace VMFParser { /// <summary>Represents a block containing other IVNodes in a VMF</summary> public class VBlock : IVNode, IDeepCloneable<VBlock> { public string Name { get; private set; } public IList<IVNode> Body { get; protected set; } /// <summary>Initializes a new instance of the <see cref="VBlock"/> class from its name and a list of IVNodes.</summary> public VBlock(string name, IList<IVNode> body = null) { Name = name; if (body == null) body = new List<IVNode>(); Body = body; } /// <summary>Initializes a new instance of the <see cref="VBlock"/> class from VMF text.</summary> public VBlock(string[] text) { Name = text[0].Trim(); Body = Utils.ParseToBody(text.SubArray(2, text.Length - 3)); } /// <summary>Generates the VMF text representation of this block.</summary> /// <param name="useTabs">if set to <c>true</c> the text will be tabbed accordingly.</param> public string[] ToVMFStrings(bool useTabs = true) { var text = Utils.BodyToString(Body); if (useTabs) text = text.Select(t => t.Insert(0, "\t")).ToList(); text.Insert(0, Name); text.Insert(1, "{"); text.Add("}"); return text.ToArray(); } public override string ToString() { return base.ToString() + " (" + Name + ")"; } IVNode IDeepCloneable<IVNode>.DeepClone() => DeepClone(); public VBlock DeepClone() { return new VBlock(Name, Body == null ? null : Body.Select(node => node.DeepClone()).ToList()); } } }
mit
C#
388d75e0c492f780f873f976e241948162617856
remove ET handling for unimplemented expressions
maul-esel/CobaltAHK,maul-esel/CobaltAHK
CobaltAHK/ExpressionTree/Generator.cs
CobaltAHK/ExpressionTree/Generator.cs
using System; using System.Collections.Generic; using DLR = System.Linq.Expressions; using CobaltAHK.Expressions; namespace CobaltAHK.ExpressionTree { public static class Generator { public static DLR.Expression Generate(Expression expr, Scope scope, ScriptSettings settings) { if (expr is FunctionCallExpression) { return GenerateFunctionCall((FunctionCallExpression)expr, scope, settings); } else if (expr is FunctionDefinitionExpression) { return GenerateFunctionDefinition((FunctionDefinitionExpression)expr, scope, settings); } else if (expr is StringLiteralExpression) { return DLR.Expression.Constant(((StringLiteralExpression)expr).String); } throw new NotImplementedException(); } private static DLR.Expression GenerateFunctionCall(FunctionCallExpression func, Scope scope, ScriptSettings settings) { var lambda = scope.ResolveFunction(func.Name); var prms = new List<DLR.Expression>(); foreach (var p in func.Parameters) { prms.Add(Generate(p, scope, settings)); } return DLR.Expression.Invoke(lambda, prms); } private static DLR.Expression GenerateFunctionDefinition(FunctionDefinitionExpression func, Scope scope, ScriptSettings settings) { var funcScope = new Scope(); var prms = new List<DLR.ParameterExpression>(); var types = new List<Type>(prms.Count + 1); foreach (var p in func.Parameters) { // todo: default values var param = DLR.Expression.Parameter(typeof(object), p.Name); prms.Add(param); funcScope.AddVariable(p.Name, param); var type = typeof(object); if (p.Modifier.HasFlag(Syntax.ParameterModifier.ByRef)) { type = type.MakeByRefType(); } types.Add(type); } types.Add(typeof(void)); // return value var funcBody = new List<DLR.Expression>(); foreach (var e in func.Body) { funcBody.Add(Generate(e, funcScope, settings)); } var funcType = DLR.Expression.GetFuncType(types.ToArray()); var function = DLR.Expression.Lambda(funcType, DLR.Expression.Block(funcBody), func.Name, prms); // todo: use Label instead of Block? (see dlr-overview p. 35) scope.AddFunction(func.Name, function); // todo: can't call itself, because body is generated before function is complete return function; } } }
using System; using System.Collections.Generic; using DLR = System.Linq.Expressions; using CobaltAHK.Expressions; namespace CobaltAHK.ExpressionTree { public static class Generator { public static DLR.Expression Generate(Expression expr, Scope scope, ScriptSettings settings) { if (expr is DirectiveExpression) { // todo } else if (expr is CommandCallExpression) { // todo } else if (expr is FunctionCallExpression) { return GenerateFunctionCall((FunctionCallExpression)expr, scope, settings); } else if (expr is FunctionDefinitionExpression) { return GenerateFunctionDefinition((FunctionDefinitionExpression)expr, scope, settings); } else if (expr is ClassDefinitionExpression) { // todo } else if (expr is StringLiteralExpression) { return DLR.Expression.Constant(((StringLiteralExpression)expr).String); } throw new NotImplementedException(); } private static DLR.Expression GenerateFunctionCall(FunctionCallExpression func, Scope scope, ScriptSettings settings) { var lambda = scope.ResolveFunction(func.Name); var prms = new List<DLR.Expression>(); foreach (var p in func.Parameters) { prms.Add(Generate(p, scope, settings)); } return DLR.Expression.Invoke(lambda, prms); } private static DLR.Expression GenerateFunctionDefinition(FunctionDefinitionExpression func, Scope scope, ScriptSettings settings) { var funcScope = new Scope(); var prms = new List<DLR.ParameterExpression>(); var types = new List<Type>(prms.Count + 1); foreach (var p in func.Parameters) { // todo: default values var param = DLR.Expression.Parameter(typeof(object), p.Name); prms.Add(param); funcScope.AddVariable(p.Name, param); var type = typeof(object); if (p.Modifier.HasFlag(Syntax.ParameterModifier.ByRef)) { type = type.MakeByRefType(); } types.Add(type); } types.Add(typeof(void)); // return value var funcBody = new List<DLR.Expression>(); foreach (var e in func.Body) { funcBody.Add(Generate(e, funcScope, settings)); } var funcType = DLR.Expression.GetFuncType(types.ToArray()); var function = DLR.Expression.Lambda(funcType, DLR.Expression.Block(funcBody), func.Name, prms); // todo: use Label instead of Block? (see dlr-overview p. 35) scope.AddFunction(func.Name, function); // todo: can't call itself, because body is generated before function is complete return function; } } }
mit
C#
5feeb9ecdebb2dc82f64d6fa416701ee39f49f82
Bump prefetch count to 1000
bording/Angora
samples/Consumer/Program.cs
samples/Consumer/Program.cs
using System; using System.Threading.Tasks; using Angora; namespace Consumer { class Program { static void Main(string[] args) { MainAsync().GetAwaiter().GetResult(); } static async Task MainAsync() { var factory = new ConnectionFactory { HostName = "rabbit" }; var connection = await factory.CreateConnection("Consumer"); var channel = await connection.CreateChannel(); await channel.Queue.Declare("test", false, true, false, false, null); await channel.Basic.Qos(0, 1000, false); var consumer = new MesssageConsumer(channel.Basic); var consumerTag = await channel.Basic.Consume("test", "Consumer", false, false, null, consumer.HandleIncomingMessage); Console.WriteLine("Consumer started. Press any key to quit."); Console.ReadKey(); await channel.Basic.Cancel(consumerTag); await channel.Close(); await connection.Close(); } } class MesssageConsumer { Basic basic; public MesssageConsumer(Basic basic) { this.basic = basic; } public async Task HandleIncomingMessage(Basic.DeliverState messageState) { await basic.Ack(messageState.DeliveryTag, false); } } }
using System; using System.Threading.Tasks; using Angora; namespace Consumer { class Program { static void Main(string[] args) { MainAsync().GetAwaiter().GetResult(); } static async Task MainAsync() { var factory = new ConnectionFactory { HostName = "rabbit" }; var connection = await factory.CreateConnection("Consumer"); var channel = await connection.CreateChannel(); await channel.Queue.Declare("test", false, true, false, false, null); await channel.Basic.Qos(0, 1, false); var consumer = new MesssageConsumer(channel.Basic); var consumerTag = await channel.Basic.Consume("test", "Consumer", false, false, null, consumer.HandleIncomingMessage); Console.WriteLine("Consumer started. Press any key to quit."); Console.ReadKey(); await channel.Basic.Cancel(consumerTag); await channel.Close(); await connection.Close(); } } class MesssageConsumer { Basic basic; public MesssageConsumer(Basic basic) { this.basic = basic; } public async Task HandleIncomingMessage(Basic.DeliverState messageState) { await basic.Ack(messageState.DeliveryTag, false); } } }
mit
C#
f9f611598f3f51ce094e188d35714c1db567a96b
Update code
sakapon/Samples-2016,sakapon/Samples-2016
BindingSample/DynamicBindingWpf/AppModel.cs
BindingSample/DynamicBindingWpf/AppModel.cs
using System; namespace DynamicBindingWpf { public class AppModel { public dynamic TextModel { get; } = new TextModel().ToDynamicNotifiable(300); } public class TextModel { string _Input; public string Input { get { return _Input; } set { _Input = value; Output = _Input?.ToUpper(); } } public string Output { get; private set; } } }
using System; namespace DynamicBindingWpf { public class AppModel { public dynamic TextModel { get; } = new TextModel().ToDynamicNotifiable(); } public class TextModel { string input; public string Input { get { return input; } set { input = value; Output = input?.ToUpper(); } } public string Output { get; private set; } } }
mit
C#
3061e634e5d328b14b4fea9c4a66b90bf81f7233
Add XML doc comments.
WSDOT-GIS/GTFS-Service,WSDOT-GIS/GTFS-Service
GtfsService/Feed.cs
GtfsService/Feed.cs
using ServiceStack.ServiceHost; using ServiceStack.ServiceInterface; using System; using System.Configuration; using System.Net; using Wsdot.Gtfs.Contract; using Wsdot.Gtfs.IO; namespace GtfsService { /// <summary> /// Request for an agencies GTFS feed. /// </summary> [Route("/feed/{agency}")] public class Feed { public string agency { get; set; } } /// <summary> /// Retrieves a GTFS ZIP file and converts the CSV files to objects. /// </summary> public class FeedService : Service { public GtfsFeed Any(Feed request) { // Test to make sure that an agency was specified. if (string.IsNullOrWhiteSpace(request.agency)) { throw new ArgumentNullException("Agency ID not provided."); } // Construct the gtfs-data-exchange URL for the specified agency. // E.g., http://www.gtfs-data-exchange.com/agency/intercity-transit/latest.zip string url = string.Format("{0}/agency/{1}/latest.zip", ConfigurationManager.AppSettings["gtfs-url"].TrimEnd('/'), request.agency); HttpWebRequest zipRequest = WebRequest.CreateHttp(url); GtfsFeed gtfs; using (var response = (HttpWebResponse)zipRequest.GetResponse()) { using (var stream = response.GetResponseStream()) { gtfs = stream.ReadGtfs(); } } return gtfs; } } }
using ServiceStack.ServiceHost; using ServiceStack.ServiceInterface; using System; using System.Configuration; using System.Net; using Wsdot.Gtfs.Contract; using Wsdot.Gtfs.IO; namespace GtfsService { [Route("/feed/{agency}")] public class Feed { public string agency { get; set; } } public class FeedService : Service { public GtfsFeed Any(Feed request) { // Test to make sure that an agency was specified. if (string.IsNullOrWhiteSpace(request.agency)) { throw new ArgumentNullException("Agency ID not provided."); } // Construct the gtfs-data-exchange URL for the specified agency. // E.g., http://www.gtfs-data-exchange.com/agency/intercity-transit/latest.zip string url = string.Format("{0}/agency/{1}/latest.zip", ConfigurationManager.AppSettings["gtfs-url"].TrimEnd('/'), request.agency); HttpWebRequest zipRequest = WebRequest.CreateHttp(url); GtfsFeed gtfs; using (var response = (HttpWebResponse)zipRequest.GetResponse()) { using (var stream = response.GetResponseStream()) { gtfs = stream.ReadGtfs(); } } return gtfs; } } }
unlicense
C#
8e4e41740440c97b28a183fdb8d0f54c377c6ddd
change the role of oauth manager’s
CloudBreadProject/CloudBread-Unity-SDK
Assets/CloudBread/API/OAuth/OAuthManager.cs
Assets/CloudBread/API/OAuth/OAuthManager.cs
using UnityEngine; using System.Collections; namespace CloudBread.OAuth { public class OAuthManager { public static BaseOAuth2Services OAuthService; public enum OAuthServices { facebook, google } public static BaseOAuth2Services GetServices(OAuthServices services){ switch (services) { case OAuthServices.facebook: if (OAuth2Setting.UseFacebook) { return new FaceBookServices (); } else { Debug.LogError ("You have to check 'use facebook' checkbox. It's in CloudBread-CBAuthentication, Facebook Tab"); return null; } case OAuthServices.google: if (OAuth2Setting.UseGooglePlay) { return new GooglePlayServices (); } else { Debug.LogError ("You have to check 'use google play' checkbox. It's in CloudBread-CBAuthentication, Google Tab"); return null; } default: return null; } } public OAuthManager() { } } }
using UnityEngine; using System.Collections; namespace CloudBread.OAuth { public class OAuthManager { public BaseConnector Connector; private bool isUseOAuth = true; public OAuthManager() { } public OAuthManager(BaseConnector _connector) { Connector = _connector; } public void Clear() { } public void ReGet() { } } }
mit
C#
664e16bd928efe3faefffec91e141e03b709282f
clean up
taka-oyama/UniHttp
Assets/UniHttp/Support/File/IFileHandler.cs
Assets/UniHttp/Support/File/IFileHandler.cs
using System.IO; namespace UniHttp { public interface IFileHandler { bool Exists(string path); void Write(string path, byte[] data); byte[] Read(string path); FileStream OpenWriteStream(string path); FileStream OpenReadStream(string path); void WriteObject<T>(string path, T obj) where T : class; T ReadObject<T>(string path) where T : class; } }
using System.IO; namespace UniHttp { public interface IFileHandler { bool Exists(string path); void Write(string path, byte[] data); void WriteObject<T>(string path, T obj) where T : class; FileStream OpenWriteStream(string path); byte[] Read(string path); FileStream OpenReadStream(string path); T ReadObject<T>(string path) where T : class; } }
mit
C#
84609972d7589865750b90dc2c562d3f8f61755b
Improve reporting of a scenario (problem with false-failures)
csf-dev/CSF.Screenplay,csf-dev/CSF.Screenplay,csf-dev/CSF.Screenplay
CSF.Screenplay.Reporting/Models/Scenario.cs
CSF.Screenplay.Reporting/Models/Scenario.cs
using System; using System.Collections.Generic; using System.Linq; namespace CSF.Screenplay.Reporting.Models { /// <summary> /// Represents a single scenrio within a report (equivalent to a single test case, if not using Cucumber terminology). /// </summary> public class Scenario { readonly string name; readonly IList<Reportable> children; /// <summary> /// Gets the name of the scenario. /// </summary> /// <value>The name.</value> public virtual string Name => name; /// <summary> /// Gets the contained reportables. /// </summary> /// <value>The reportables.</value> public virtual IList<Reportable> Reportables => children; /// <summary> /// Gets or sets a value indicating whether this <see cref="T:CSF.Screenplay.Reporting.Models.Scenario"/> /// is a failure. /// </summary> /// <value><c>true</c> if this scenario is a failure; otherwise, <c>false</c>.</value> public virtual bool IsFailure { get; set; } /// <summary> /// Gets a value indicating whether this <see cref="T:CSF.Screenplay.Reporting.Models.Scenario"/> is a success. /// </summary> /// <value><c>true</c> if is success; otherwise, <c>false</c>.</value> public virtual bool IsSuccess => !IsFailure; IEnumerable<Reportable> FindReportables() { return children.ToArray() .Union(children.SelectMany(x => FindReportables(x))) .ToArray(); } IEnumerable<Reportable> FindReportables(Reportable current) { var performance = current as Performance; if(performance == null) return Enumerable.Empty<Reportable>(); return performance.Reportables.ToArray() .Union(performance.Reportables.SelectMany(x => FindReportables(x))) .ToArray(); } /// <summary> /// Initializes a new instance of the <see cref="Scenario"/> class. /// </summary> /// <param name="name">Name.</param> public Scenario(string name) { if(name == null) throw new ArgumentNullException(nameof(name)); this.name = name; children = new List<Reportable>(); } } }
using System; using System.Collections.Generic; using System.Linq; namespace CSF.Screenplay.Reporting.Models { /// <summary> /// Represents a single scenrio within a report (equivalent to a single test case, if not using Cucumber terminology). /// </summary> public class Scenario { readonly static Outcome[] SuccessOutcomes = new [] { Outcome.Success, Outcome.SuccessWithResult, }; readonly string name; readonly IList<Reportable> children; /// <summary> /// Gets the name of the scenario. /// </summary> /// <value>The name.</value> public virtual string Name => name; /// <summary> /// Gets the contained reportables. /// </summary> /// <value>The reportables.</value> public virtual IList<Reportable> Reportables => children; /// <summary> /// Gets or sets a value indicating whether this <see cref="T:CSF.Screenplay.Reporting.Models.Scenario"/> /// is a failure. /// </summary> /// <value><c>true</c> if this scenario is a failure; otherwise, <c>false</c>.</value> public virtual bool IsFailure { get; set; } /// <summary> /// Gets a value indicating whether this <see cref="T:CSF.Screenplay.Reporting.Models.Scenario"/> is a success. /// </summary> /// <value><c>true</c> if is success; otherwise, <c>false</c>.</value> public virtual bool IsSuccess { get { if(IsFailure) return false; var reportables = FindReportables(); return reportables.All(x => SuccessOutcomes.Contains(x.Outcome)); } } IEnumerable<Reportable> FindReportables() { return children.ToArray() .Union(children.SelectMany(x => FindReportables(x))) .ToArray(); } IEnumerable<Reportable> FindReportables(Reportable current) { var performance = current as Performance; if(performance == null) return Enumerable.Empty<Reportable>(); return performance.Reportables.ToArray() .Union(performance.Reportables.SelectMany(x => FindReportables(x))) .ToArray(); } /// <summary> /// Initializes a new instance of the <see cref="Scenario"/> class. /// </summary> /// <param name="name">Name.</param> public Scenario(string name) { if(name == null) throw new ArgumentNullException(nameof(name)); this.name = name; children = new List<Reportable>(); } } }
mit
C#
6521e46bcc04aa9fbd512a432ed0f21aa6304cb7
fix check
Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek
core/Engine/Engine.Core/Engine.cs
core/Engine/Engine.Core/Engine.cs
using System.Collections.Generic; using System.Linq; using Engine.Core.Context; using Engine.Core.Rules; using LanguageExt; using Engine.Core.Utils; using Engine.DataTypes; using FSharpUtils.Newtonsoft; namespace Engine.Core { public delegate Option<IRule> RulesRepository(ConfigurationPath path); public static class EngineCore { public delegate Option<ConfigurationValue> GetRuleValue(ConfigurationPath path); public static GetRuleValue GetRulesEvaluator(HashSet<Identity> identities, GetLoadedContextByIdentityType contextByIdentity, RulesRepository rules) { var identityTypes = identities.Select(x => x.Type).ToArray(); var flattenContext = ContextHelpers.FlattenLoadedContext(contextByIdentity); GetRuleValue getRuleValue = null; GetContextValue recursiveContext = key => { if (key.StartsWith("@@key:")){ key = key.Replace("@@key:", "keys."); } if (!key.StartsWith("keys.")) return Option<JsonValue>.None; var path = new ConfigurationPath(key.Split('.')[1]); return getRuleValue(path).Map(x => x.Value); }; var context = ContextHelpers.Merge(flattenContext, recursiveContext); getRuleValue = Memoize(path => { foreach (var identity in identityTypes) { var fixedResult = ContextHelpers.GetFixedConfigurationContext(context, identity)(path); if (fixedResult.IsSome) return fixedResult; } return rules(path).Bind(x => x.GetValue(context)); }); return getRuleValue; } private static GetRuleValue Memoize(GetRuleValue getRuleValue) { var dict = new Dictionary<ConfigurationPath, Option<ConfigurationValue>>(); return (path) => { if (!dict.ContainsKey(path)) { dict[path] = getRuleValue(path); } return dict[path]; }; } } }
using System.Collections.Generic; using System.Linq; using Engine.Core.Context; using Engine.Core.Rules; using LanguageExt; using Engine.Core.Utils; using Engine.DataTypes; using FSharpUtils.Newtonsoft; namespace Engine.Core { public delegate Option<IRule> RulesRepository(ConfigurationPath path); public static class EngineCore { public delegate Option<ConfigurationValue> GetRuleValue(ConfigurationPath path); public static GetRuleValue GetRulesEvaluator(HashSet<Identity> identities, GetLoadedContextByIdentityType contextByIdentity, RulesRepository rules) { var identityTypes = identities.Select(x => x.Type).ToArray(); var flattenContext = ContextHelpers.FlattenLoadedContext(contextByIdentity); GetRuleValue getRuleValue = null; GetContextValue recursiveContext = key => { if (key.StartsWith("@@key")){ key = key.Replace("@@key", "keys."); } if (!key.StartsWith("keys.")) return Option<JsonValue>.None; var path = new ConfigurationPath(key.Split('.')[1]); return getRuleValue(path).Map(x => x.Value); }; var context = ContextHelpers.Merge(flattenContext, recursiveContext); getRuleValue = Memoize(path => { foreach (var identity in identityTypes) { var fixedResult = ContextHelpers.GetFixedConfigurationContext(context, identity)(path); if (fixedResult.IsSome) return fixedResult; } return rules(path).Bind(x => x.GetValue(context)); }); return getRuleValue; } private static GetRuleValue Memoize(GetRuleValue getRuleValue) { var dict = new Dictionary<ConfigurationPath, Option<ConfigurationValue>>(); return (path) => { if (!dict.ContainsKey(path)) { dict[path] = getRuleValue(path); } return dict[path]; }; } } }
mit
C#
9349ef218bfd4a67a64d3d0f350018662b8ac6d5
Add Trim() call
tigrouind/LifeDISA,tigrouind/LifeDISA
Shared/VarParser.cs
Shared/VarParser.cs
using System; using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; namespace Shared { public class VarParser { readonly Dictionary<string, Dictionary<int, string>> sections = new Dictionary<string, Dictionary<int, string>>(); public virtual string GetText(string sectionName, int value) { Dictionary<int, string> section; if (sections.TryGetValue(sectionName, out section)) { string text; if(section.TryGetValue(value, out text)) { return text; } } return string.Empty; } public void Load(string filePath, params string[] sectionsToParse) { var allLines = ReadLines(filePath); Dictionary<int, string> currentSection = null; Regex regex = new Regex("^(?<from>[0-9]+)(-(?<to>[0-9]+))? (?<text>.*)"); foreach (string line in allLines) { //check if new section if (line.Length > 0 && line[0] >= 'A' && line[0] <= 'Z') { currentSection = CreateNewSection(line, sectionsToParse); } else if (currentSection != null) { //parse line if inside section Match match = regex.Match(line); if (match.Success) { string from = match.Groups["from"].Value; string to = match.Groups["to"].Value; string text = match.Groups["text"].Value.Trim(); AddEntry(currentSection, from, to, text); } } } } Dictionary<int, string> CreateNewSection(string name, string[] sectionsToParse) { Dictionary<int, string> section; if (sectionsToParse.Length == 0 || Array.IndexOf(sectionsToParse, name) >= 0) { section = new Dictionary<int, string>(); sections.Add(name.Trim(), section); } else { section = null; } return section; } void AddEntry(Dictionary<int, string> section, string fromString, string toString, string text) { if (!(string.IsNullOrEmpty(text) || text.Trim() == string.Empty)) { int from = int.Parse(fromString); int to = string.IsNullOrEmpty(toString) ? from : int.Parse(toString); for(int i = from; i <= to ; i++) { section[i] = text; } } } IEnumerable<string> ReadLines(string filePath) { using (StreamReader reader = new StreamReader(filePath)) { string line; while ((line = reader.ReadLine()) != null) { yield return line; } } } } }
using System; using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; namespace Shared { public class VarParser { readonly Dictionary<string, Dictionary<int, string>> sections = new Dictionary<string, Dictionary<int, string>>(); public virtual string GetText(string sectionName, int value) { Dictionary<int, string> section; if (sections.TryGetValue(sectionName, out section)) { string text; if(section.TryGetValue(value, out text)) { return text; } } return string.Empty; } public void Load(string filePath, params string[] sectionsToParse) { var allLines = ReadLines(filePath); Dictionary<int, string> currentSection = null; Regex regex = new Regex("^(?<from>[0-9]+)(-(?<to>[0-9]+))? (?<text>.*)"); foreach (string line in allLines) { //check if new section if (line.Length > 0 && line[0] >= 'A' && line[0] <= 'Z') { currentSection = CreateNewSection(line, sectionsToParse); } else if (currentSection != null) { //parse line if inside section Match match = regex.Match(line); if (match.Success) { string from = match.Groups["from"].Value; string to = match.Groups["to"].Value; string text = match.Groups["text"].Value; AddEntry(currentSection, from, to, text); } } } } Dictionary<int, string> CreateNewSection(string name, string[] sectionsToParse) { Dictionary<int, string> section; if (sectionsToParse.Length == 0 || Array.IndexOf(sectionsToParse, name) >= 0) { section = new Dictionary<int, string>(); sections.Add(name.Trim(), section); } else { section = null; } return section; } void AddEntry(Dictionary<int, string> section, string fromString, string toString, string text) { if (!(string.IsNullOrEmpty(text) || text.Trim() == string.Empty)) { int from = int.Parse(fromString); int to = string.IsNullOrEmpty(toString) ? from : int.Parse(toString); for(int i = from; i <= to ; i++) { section[i] = text; } } } IEnumerable<string> ReadLines(string filePath) { using (StreamReader reader = new StreamReader(filePath)) { string line; while ((line = reader.ReadLine()) != null) { yield return line; } } } } }
mit
C#
052772cce7423d3b67bbcd7ebb2e0ef6cd8ae842
add test case
EVAST9919/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,peppy/osu,johnneijzen/osu,EVAST9919/osu,peppy/osu-new,ppy/osu,2yangk23/osu,NeoAdonis/osu,2yangk23/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,johnneijzen/osu,peppy/osu
osu.Game.Tests/Visual/UserInterface/TestSceneModButton.cs
osu.Game.Tests/Visual/UserInterface/TestSceneModButton.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Mods; using osu.Game.Rulesets.Mods; namespace osu.Game.Tests.Visual.UserInterface { public class TestSceneModButton : OsuTestScene { private ModButton modButton; [SetUp] public void SetUp() => Schedule(() => { Children = new Drawable[] { modButton = new ModButton(new MultiMod(new TestMod1(), new TestMod2(), new TestMod3(), new TestMod4())) { Anchor = Anchor.Centre, Origin = Anchor.Centre } }; }); private class TestMod1 : TestMod { public override string Name => "Test mod 1"; public override string Acronym => "M1"; } private class TestMod2 : TestMod { public override string Name => "Test mod 2"; public override string Acronym => "M2"; public override IconUsage? Icon => FontAwesome.Solid.Exclamation; } private class TestMod3 : TestMod { public override string Name => "Test mod 3"; public override string Acronym => "M3"; public override IconUsage? Icon => FontAwesome.Solid.ArrowRight; } private class TestMod4 : TestMod { public override string Name => "Test mod 4"; public override string Acronym => "M4"; } private abstract class TestMod : Mod, IApplicableMod { public override double ScoreMultiplier => 1.0; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Testing; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; using osu.Game.Overlays.Mods.Sections; using osu.Game.Rulesets; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mania.Mods; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.UI; using osu.Game.Screens.Play.HUD; using osuTK; using osuTK.Graphics; namespace osu.Game.Tests.Visual.UserInterface { public class TestSceneModButton : OsuTestScene { private ModButton modButton; [SetUp] public void SetUp() => Schedule(() => { Children = new Drawable[] { modButton = new ModButton(new MultiMod(new TestMod1(), new TestMod2(), new TestMod3(), new TestMod4())) { Anchor = Anchor.Centre, Origin = Anchor.Centre } }; }); private class TestMod1 : TestMod { public override string Name => "Test mod 1"; public override string Acronym => "M1"; } private class TestMod2 : TestMod { public override string Name => "Test mod 2"; public override string Acronym => "M2"; public override IconUsage? Icon => FontAwesome.Solid.Exclamation; } private class TestMod3 : TestMod { public override string Name => "Test mod 3"; public override string Acronym => "M3"; public override IconUsage? Icon => FontAwesome.Solid.ArrowRight; } private class TestMod4 : TestMod { public override string Name => "Test mod 4"; public override string Acronym => "M4"; } private abstract class TestMod : Mod, IApplicableMod { public override double ScoreMultiplier => 1.0; } } }
mit
C#
d1fd14e287eb7ff00e36d87e3b76f53df2207912
Add missing `nullable`
ppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,NeoAdonis/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu
osu.Game/Overlays/Chat/ChannelControl/ControlItemClose.cs
osu.Game/Overlays/Chat/ChannelControl/ControlItemClose.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osuTK; namespace osu.Game.Overlays.Chat.ChannelControl { public class ControlItemClose : OsuClickableContainer { private readonly SpriteIcon icon; [Resolved] private OsuColour osuColour { get; set; } = null!; public ControlItemClose() { Alpha = 0f; Size = new Vector2(20); Child = icon = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, Scale = new Vector2(0.75f), Icon = FontAwesome.Solid.TimesCircle, RelativeSizeAxes = Axes.Both, }; } protected override bool OnMouseDown(MouseDownEvent e) { icon.ScaleTo(0.5f, 1000, Easing.OutQuint); return base.OnMouseDown(e); } protected override void OnMouseUp(MouseUpEvent e) { icon.ScaleTo(0.75f, 1000, Easing.OutElastic); base.OnMouseUp(e); } protected override bool OnHover(HoverEvent e) { icon.FadeColour(osuColour.Red1, 200, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { icon.FadeColour(Colour4.White, 200, Easing.OutQuint); base.OnHoverLost(e); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osuTK; namespace osu.Game.Overlays.Chat.ChannelControl { public class ControlItemClose : OsuClickableContainer { private readonly SpriteIcon icon; [Resolved] private OsuColour osuColour { get; set; } = null!; public ControlItemClose() { Alpha = 0f; Size = new Vector2(20); Child = icon = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, Scale = new Vector2(0.75f), Icon = FontAwesome.Solid.TimesCircle, RelativeSizeAxes = Axes.Both, }; } protected override bool OnMouseDown(MouseDownEvent e) { icon.ScaleTo(0.5f, 1000, Easing.OutQuint); return base.OnMouseDown(e); } protected override void OnMouseUp(MouseUpEvent e) { icon.ScaleTo(0.75f, 1000, Easing.OutElastic); base.OnMouseUp(e); } protected override bool OnHover(HoverEvent e) { icon.FadeColour(osuColour.Red1, 200, Easing.OutQuint); return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { icon.FadeColour(Colour4.White, 200, Easing.OutQuint); base.OnHoverLost(e); } } }
mit
C#
d2650fc1a05e012a58a2283a59ce4dfdc6e634e3
Add count to deletion dialog
NeoAdonis/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,peppy/osu-new,smoogipoo/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,peppy/osu
osu.Game/Collections/DeleteCollectionDialog.cs
osu.Game/Collections/DeleteCollectionDialog.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using Humanizer; using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; namespace osu.Game.Collections { public class DeleteCollectionDialog : PopupDialog { public DeleteCollectionDialog(BeatmapCollection collection, Action deleteAction) { HeaderText = "Confirm deletion of"; BodyText = $"{collection.Name.Value} ({"beatmap".ToQuantity(collection.Beatmaps.Count)})"; Icon = FontAwesome.Regular.TrashAlt; Buttons = new PopupDialogButton[] { new PopupDialogOkButton { Text = @"Yes. Go for it.", Action = deleteAction }, new PopupDialogCancelButton { Text = @"No! Abort mission!", }, }; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; namespace osu.Game.Collections { public class DeleteCollectionDialog : PopupDialog { public DeleteCollectionDialog(BeatmapCollection collection, Action deleteAction) { HeaderText = "Confirm deletion of"; BodyText = collection.Name.Value; Icon = FontAwesome.Regular.TrashAlt; Buttons = new PopupDialogButton[] { new PopupDialogOkButton { Text = @"Yes. Go for it.", Action = deleteAction }, new PopupDialogCancelButton { Text = @"No! Abort mission!", }, }; } } }
mit
C#
ccf3323c78b1c9b789b5f3695f3f1b514113f473
Update XFileImporterWindow.cs
mmd-for-unity-proj/mmd-for-unity
Editor/XFileImporter/XFileImporterWindow.cs
Editor/XFileImporter/XFileImporterWindow.cs
using UnityEngine; using UnityEditor; using System.Collections; public class XFileImporterWindow : EditorWindow { Object xFile = null; [MenuItem ("MMD for Unity/XFile Importer")] static void Init() { var window = (XFileImporterWindow)EditorWindow.GetWindow<XFileImporterWindow>(true, "XFile Importer"); window.Show(); } void OnGUI() { const int height = 20; xFile = EditorGUI.ObjectField( new Rect(0, 0, position.width-16, height), "XFile" ,xFile, typeof(Object), true); if (xFile != null) { if (GUI.Button(new Rect(0, height+2, position.width/2, height), "Convert")) { XFileImporter.Import(xFile); xFile = null; // 読み終わったので空にする } } else { EditorGUI.LabelField(new Rect(0, height+2, position.width, height), "Missing", "Select XFile"); } } }
using UnityEngine; using UnityEditor; using System.Collections; public class XFileImporterWindow : EditorWindow { Object xFile = null; [MenuItem ("Plugins/XFile Importer")] static void Init() { var window = (XFileImporterWindow)EditorWindow.GetWindow<XFileImporterWindow>(true, "XFile Importer"); window.Show(); } void OnGUI() { const int height = 20; xFile = EditorGUI.ObjectField( new Rect(0, 0, position.width-16, height), "XFile" ,xFile, typeof(Object), true); if (xFile != null) { if (GUI.Button(new Rect(0, height+2, position.width/2, height), "Convert")) { XFileImporter.Import(xFile); xFile = null; // 読み終わったので空にする } } else { EditorGUI.LabelField(new Rect(0, height+2, position.width, height), "Missing", "Select XFile"); } } }
bsd-3-clause
C#
df6175124240ed6d9d7f277462d4d704ef2b9dcb
Update AssemblyInfo.cs
NimaAra/Easy.Compression
Easy.Compression/Properties/AssemblyInfo.cs
Easy.Compression/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Easy.Compression")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: InternalsVisibleTo("Easy.Compression.Tests.Unit")]
using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyTitle("Easy.Compression")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("Easy.Compression.Tests.Unit")]
mit
C#
dfee2a663d58a4202c9c77e2497f5a5f06f8af79
update test data
Stelmashenko-A/GameOfLife,Stelmashenko-A/GameOfLife,Stelmashenko-A/GameOfLife
GameOfLife.Services.Tests/GameOfLifeTest.cs
GameOfLife.Services.Tests/GameOfLifeTest.cs
using System; using LifeHost.Controllers; using LifeHost.Storage; using NUnit.Framework; namespace GameOfLife.Services.Tests { public class GameOfLifeTest { [Test] public void TestGame() { LifeHost.Controllers.GameOfLife gol = new LifeHost.Controllers.GameOfLife(); gol.StateCalculator = new StateCalculator(); gol.Converter = new Converter(); gol.GameStorage=new GameStorage(); gol.Process(new RequestForProcessing {Field = "0000000100000100111000000",Id = Guid.NewGuid(),Pats = 10,Steps = 100}); } } }
using System; using LifeHost.Controllers; using LifeHost.Storage; using NUnit.Framework; namespace GameOfLife.Services.Tests { public class GameOfLifeTest { [Test] public void TestGame() { LifeHost.Controllers.GameOfLife gol = new LifeHost.Controllers.GameOfLife(); gol.StateCalculator = new StateCalculator(); gol.Converter = new Converter(); gol.GameStorage=new GameStorage(); gol.Process(new RequestForProcessing() {Field = "101010101",Id = Guid.NewGuid(),Pats = 10,Steps = 100}); } } }
mit
C#
871a1a213c62a987898adaf40b86465e0afe3685
Bump version to 1.0.0-alpha2
andyshao/Hangfire.Ninject,HangfireIO/Hangfire.Ninject
HangFire.Ninject/Properties/AssemblyInfo.cs
HangFire.Ninject/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("HangFire.Ninject")] [assembly: AssemblyDescription("Ninject IoC Container support for HangFire (background job system for ASP.NET applications).")] [assembly: AssemblyProduct("HangFire")] [assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")] // 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("91f25a4e-65e7-4d9c-886e-33a6c82b14c4")] [assembly: AssemblyInformationalVersion("1.0.0-alpha2")] [assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("HangFire.Ninject")] [assembly: AssemblyDescription("Ninject IoC Container support for HangFire (background job system for ASP.NET applications).")] [assembly: AssemblyProduct("HangFire")] [assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")] // 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("91f25a4e-65e7-4d9c-886e-33a6c82b14c4")] [assembly: AssemblyInformationalVersion("1.0.0-alpha1")] [assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
38aa65e2f8a822ee1fb7c40754a8b2a33bdbf6bb
add input field for task
jgraber/ForgetTheMilk,jgraber/ForgetTheMilk,jgraber/ForgetTheMilk
ForgetTheMilk/ForgetTheMilk/Views/Task/Index.cshtml
ForgetTheMilk/ForgetTheMilk/Views/Task/Index.cshtml
@{ ViewBag.Title = "Home Page"; } <div class="jumbotron"> <p>Add a task:</p> <form> <input type="text" class="input-lg" name="task"/> </form> </div>
@{ ViewBag.Title = "Home Page"; } <div class="jumbotron"> <h1>ASP.NET</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> <p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p> </div> <div class="row"> <div class="col-md-4"> <h2>Getting started</h2> <p> ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and gives you full control over markup for enjoyable, agile development. </p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Get more libraries</h2> <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Web Hosting</h2> <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p> </div> </div>
apache-2.0
C#
43c650a9430280ea48266333614b79754a5e8d2d
Change orbit angles to degree
dirty-casuals/LD38-A-Small-World
Assets/Scripts/Planet.cs
Assets/Scripts/Planet.cs
using UnityEngine; public class Planet : MonoBehaviour { [SerializeField] private float _radius; public float Radius { get { return _radius; } set { _radius = value; } } public float Permieter { get { return 2 * Mathf.PI * Radius; } } public void SampleOrbit2D( float angle, float distance, out Vector3 position, out Vector3 normal ) { angle = angle * Mathf.Deg2Rad; // Polar to cartesian coordinates float x = Mathf.Cos( angle ) * distance; float y = Mathf.Sin( angle ) * distance; Vector3 dispalcement = new Vector3( x, 0, y ); Vector3 center = transform.position; position = center + dispalcement; normal = dispalcement.normalized; } }
using UnityEngine; public class Planet : MonoBehaviour { [SerializeField] private float _radius; public float Radius { get { return _radius; } set { _radius = value; } } public float Permieter { get { return 2 * Mathf.PI * Radius; } } public void SampleOrbit2D( float angle, float distance, out Vector3 position, out Vector3 normal ) { // Polar to cartesian coordinates float x = Mathf.Cos( angle ) * distance; float y = Mathf.Sin( angle ) * distance; Vector3 dispalcement = new Vector3( x, 0, y ); Vector3 center = transform.position; position = center + dispalcement; normal = dispalcement.normalized; } }
mit
C#
e856a9efaea19fdb92c96469da7fc8502c524714
Update SingleDatabaseFixture.cs
unosquare/tenantcore
Unosquare.TenantCore.Tests/SingleDatabaseFixture.cs
Unosquare.TenantCore.Tests/SingleDatabaseFixture.cs
using Effort; using Microsoft.Owin.Testing; using NUnit.Framework; using Owin; using System.Threading.Tasks; using System.Collections.Generic; using System.Linq; using Unosquare.TenantCore.SampleDatabase; namespace Unosquare.TenantCore.Tests { [TestFixture] public class SingleDatabaseFixture { private ApplicationDbContext _context; private TestServer _server; private ITenantResolver _resolver; [SetUp] public void Setup() { Effort.Provider.EffortProviderConfiguration.RegisterProvider(); var connection = DbConnectionFactory.CreateTransient(); _context = new ApplicationDbContext(connection); _context.GenerateRandomData(); _resolver = new HostNameTenantResolver(new List<ITenant> { new Tenant(1, "local", "localhost"), new Tenant(2, "sample", "sample.local") }, "TenantId"); _server = TestServer.Create(app => { app.UseTenantCore(_resolver); app.Run(context => { var tenant = context.GetCurrentTenant(); return context.Response.WriteAsync(tenant.Name); }); }); } [Test] public async Task GetTenant() { var response = await _server.HttpClient.GetAsync("/"); Assert.IsTrue(response.IsSuccessStatusCode); var content = await response.Content.ReadAsStringAsync(); Assert.IsNotNull(content); Assert.AreEqual(content, _resolver.GetTenants().First().Name); } } }
using Effort; using Microsoft.Owin.Testing; using NUnit.Framework; using Owin; using System.Collections.Generic; using System.Linq; using Unosquare.TenantCore.SampleDatabase; namespace Unosquare.TenantCore.Tests { [TestFixture] public class SingleDatabaseFixture { private ApplicationDbContext _context; private TestServer _server; private ITenantResolver _resolver; [SetUp] public void Setup() { Effort.Provider.EffortProviderConfiguration.RegisterProvider(); var connection = DbConnectionFactory.CreateTransient(); _context = new ApplicationDbContext(connection); _context.GenerateRandomData(); _resolver = new HostNameTenantResolver(new List<ITenant> { new Tenant(1, "local", "localhost"), new Tenant(2, "sample", "sample.local") }, "TenantId"); _server = TestServer.Create(app => { app.UseTenantCore(_resolver); app.Run(context => { var tenant = context.GetCurrentTenant(); return context.Response.WriteAsync(tenant.Name); }); }); } [Test] public async Task GetTenant() { var response = await _server.HttpClient.GetAsync("/"); Assert.IsTrue(response.IsSuccessStatusCode); var content = await response.Content.ReadAsStringAsync(); Assert.IsNotNull(content); Assert.AreEqual(content, _resolver.GetTenants().First().Name); } } }
mit
C#
3c439c66c6ce21bf6b1a6bd7f6a85314163a019c
Fix CodeFactor issue
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
using ReactiveUI; using System.Collections.ObjectModel; using System.Reactive.Linq; using DynamicData; using DynamicData.Binding; using System.Reactive; using System.IO; namespace WalletWasabi.Fluent.ViewModels { public class HomePageViewModel : NavBarItemViewModel { private readonly ReadOnlyObservableCollection<NavBarItemViewModel> _items; public HomePageViewModel(IScreen screen, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage) : base(screen) { Title = "Home"; var list = new SourceList<NavBarItemViewModel>(); list.Add(addWalletPage); walletManager.Items.ToObservableChangeSet() .Cast(x => x as NavBarItemViewModel) .Sort(SortExpressionComparer<NavBarItemViewModel>.Ascending(i => i.Title)) .Merge(list.Connect()) .ObserveOn(RxApp.MainThreadScheduler) .Bind(out _items) .AsObservableList(); OpenWalletsFolderCommand = ReactiveCommand.Create(() => IoHelpers.OpenFolderInFileExplorer(walletManager.Model.WalletDirectories.WalletsDir)); } public override string IconName => "home_regular"; public ReadOnlyObservableCollection<NavBarItemViewModel> Items => _items; public ReactiveCommand<Unit, Unit> OpenWalletsFolderCommand { get; } } }
using ReactiveUI; using System.Collections.ObjectModel; using System.Reactive.Linq; using DynamicData; using DynamicData.Binding; using System.Reactive; using System.IO; namespace WalletWasabi.Fluent.ViewModels { public class HomePageViewModel : NavBarItemViewModel { private readonly ReadOnlyObservableCollection<NavBarItemViewModel> _items; public HomePageViewModel(IScreen screen, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage) : base(screen) { Title = "Home"; var list = new SourceList<NavBarItemViewModel>(); list.Add(addWalletPage); walletManager.Items.ToObservableChangeSet() .Cast(x => x as NavBarItemViewModel) .Sort(SortExpressionComparer<NavBarItemViewModel>.Ascending(i=>i.Title)) .Merge(list.Connect()) .ObserveOn(RxApp.MainThreadScheduler) .Bind(out _items) .AsObservableList(); OpenWalletsFolderCommand = ReactiveCommand.Create(() => IoHelpers.OpenFolderInFileExplorer(walletManager.Model.WalletDirectories.WalletsDir)); } public override string IconName => "home_regular"; public ReadOnlyObservableCollection<NavBarItemViewModel> Items => _items; public ReactiveCommand<Unit, Unit> OpenWalletsFolderCommand { get; } } }
mit
C#
fde47de2a44c9becfc6ef45b56f475b0d77930b0
Add the defaults for GeneratorOptions
mrahhal/ExternalTemplates
src/ExternalTemplates.AspNet/IGeneratorOptions.Default.cs
src/ExternalTemplates.AspNet/IGeneratorOptions.Default.cs
using System; namespace ExternalTemplates { /// <summary> /// Default generator options. /// </summary> public class GeneratorOptions : IGeneratorOptions { /// <summary> /// Gets the path relative to the web root where the templates are stored. /// Default is "/Content/templates". /// </summary> public string VirtualPath { get; set; } = "/Content/templates"; /// <summary> /// Gets the extension of the templates. /// Default is ".tmpl.html". /// </summary> public string Extension { get; set; } = ".tmpl.html"; /// <summary> /// Gets the post string to add to the end of the script tag's id following its name. /// Default is "-tmpl". /// </summary> public string PostString { get; set; } = "-tmpl"; } }
using System; namespace ExternalTemplates { /// <summary> /// Default generator options. /// </summary> public class GeneratorOptions : IGeneratorOptions { /// <summary> /// Gets the path relative to the web root where the templates are stored. /// Default is "/Content/templates". /// </summary> public string VirtualPath { get; set; } /// <summary> /// Gets the extension of the templates. /// Default is ".tmpl.html". /// </summary> public string Extension { get; set; } /// <summary> /// Gets the post string to add to the end of the script tag's id following its name. /// Default is "-tmpl". /// </summary> public string PostString { get; set; } } }
mit
C#
7515dfefa45a889d7a6626cdae3ac3123b19c300
Fix MySql do not support Milliseconds
barser/fluentmigrator,schambers/fluentmigrator,lcharlebois/fluentmigrator,amroel/fluentmigrator,mstancombe/fluentmig,mstancombe/fluentmigrator,tommarien/fluentmigrator,alphamc/fluentmigrator,amroel/fluentmigrator,KaraokeStu/fluentmigrator,bluefalcon/fluentmigrator,istaheev/fluentmigrator,lcharlebois/fluentmigrator,IRlyDontKnow/fluentmigrator,drmohundro/fluentmigrator,jogibear9988/fluentmigrator,vgrigoriu/fluentmigrator,wolfascu/fluentmigrator,drmohundro/fluentmigrator,itn3000/fluentmigrator,IRlyDontKnow/fluentmigrator,daniellee/fluentmigrator,barser/fluentmigrator,daniellee/fluentmigrator,alphamc/fluentmigrator,akema-fr/fluentmigrator,daniellee/fluentmigrator,eloekset/fluentmigrator,spaccabit/fluentmigrator,eloekset/fluentmigrator,igitur/fluentmigrator,igitur/fluentmigrator,KaraokeStu/fluentmigrator,mstancombe/fluentmig,bluefalcon/fluentmigrator,vgrigoriu/fluentmigrator,mstancombe/fluentmigrator,spaccabit/fluentmigrator,wolfascu/fluentmigrator,istaheev/fluentmigrator,MetSystem/fluentmigrator,stsrki/fluentmigrator,MetSystem/fluentmigrator,fluentmigrator/fluentmigrator,FabioNascimento/fluentmigrator,dealproc/fluentmigrator,istaheev/fluentmigrator,mstancombe/fluentmig,jogibear9988/fluentmigrator,modulexcite/fluentmigrator,akema-fr/fluentmigrator,fluentmigrator/fluentmigrator,schambers/fluentmigrator,FabioNascimento/fluentmigrator,stsrki/fluentmigrator,modulexcite/fluentmigrator,tommarien/fluentmigrator,dealproc/fluentmigrator,itn3000/fluentmigrator
src/FluentMigrator.Runner/Generators/MySql/MySqlQuoter.cs
src/FluentMigrator.Runner/Generators/MySql/MySqlQuoter.cs
using FluentMigrator.Runner.Generators.Generic; namespace FluentMigrator.Runner.Generators.MySql { public class MySqlQuoter : GenericQuoter { public override string OpenQuote { get { return "`"; } } public override string CloseQuote { get { return "`"; } } public override string QuoteValue(object value) { return base.QuoteValue(value).Replace(@"\", @"\\"); } public override string FromTimeSpan(System.TimeSpan value) { return System.String.Format("{0}{1:00}:{2:00}:{3:00}{0}" , ValueQuote , value.Hours + (value.Days * 24) , value.Minutes , value.Seconds); } } }
using FluentMigrator.Runner.Generators.Generic; namespace FluentMigrator.Runner.Generators.MySql { public class MySqlQuoter : GenericQuoter { public override string OpenQuote { get { return "`"; } } public override string CloseQuote { get { return "`"; } } public override string QuoteValue(object value) { return base.QuoteValue(value).Replace(@"\", @"\\"); } public override string FromTimeSpan(System.TimeSpan value) { return System.String.Format("{0}{1}:{2}:{3}.{4}{0}" , ValueQuote , value.Hours + (value.Days * 24) , value.Minutes , value.Seconds , value.Milliseconds); } } }
apache-2.0
C#
553cd985d093eacb4fc335074683ad715b459e17
Fix namespace mistake.
dolkensp/node.net,oliver-feng/nuget,xoofx/NuGet,pratikkagda/nuget,mrward/nuget,mrward/NuGet.V2,indsoft/NuGet2,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,antiufo/NuGet2,ctaggart/nuget,ctaggart/nuget,indsoft/NuGet2,antiufo/NuGet2,RichiCoder1/nuget-chocolatey,dolkensp/node.net,GearedToWar/NuGet2,zskullz/nuget,oliver-feng/nuget,xoofx/NuGet,mrward/nuget,alluran/node.net,indsoft/NuGet2,xoofx/NuGet,jholovacs/NuGet,jmezach/NuGet2,GearedToWar/NuGet2,mono/nuget,oliver-feng/nuget,alluran/node.net,dolkensp/node.net,zskullz/nuget,RichiCoder1/nuget-chocolatey,xoofx/NuGet,rikoe/nuget,xoofx/NuGet,mono/nuget,rikoe/nuget,pratikkagda/nuget,GearedToWar/NuGet2,OneGet/nuget,mrward/nuget,mrward/NuGet.V2,xoofx/NuGet,jmezach/NuGet2,ctaggart/nuget,akrisiun/NuGet,dolkensp/node.net,antiufo/NuGet2,jholovacs/NuGet,jmezach/NuGet2,RichiCoder1/nuget-chocolatey,jholovacs/NuGet,zskullz/nuget,jmezach/NuGet2,zskullz/nuget,chocolatey/nuget-chocolatey,indsoft/NuGet2,pratikkagda/nuget,mrward/NuGet.V2,pratikkagda/nuget,pratikkagda/nuget,OneGet/nuget,oliver-feng/nuget,antiufo/NuGet2,jholovacs/NuGet,pratikkagda/nuget,oliver-feng/nuget,GearedToWar/NuGet2,OneGet/nuget,jmezach/NuGet2,RichiCoder1/nuget-chocolatey,mrward/nuget,jholovacs/NuGet,mrward/nuget,chocolatey/nuget-chocolatey,akrisiun/NuGet,chocolatey/nuget-chocolatey,chocolatey/nuget-chocolatey,alluran/node.net,oliver-feng/nuget,rikoe/nuget,OneGet/nuget,chocolatey/nuget-chocolatey,jmezach/NuGet2,mrward/nuget,RichiCoder1/nuget-chocolatey,mrward/NuGet.V2,mrward/NuGet.V2,chocolatey/nuget-chocolatey,jholovacs/NuGet,antiufo/NuGet2,antiufo/NuGet2,mono/nuget,indsoft/NuGet2,rikoe/nuget,GearedToWar/NuGet2,ctaggart/nuget,mono/nuget,GearedToWar/NuGet2,alluran/node.net,indsoft/NuGet2
src/VisualStudio/ProductUpdate/VsProductUpdateSettings.cs
src/VisualStudio/ProductUpdate/VsProductUpdateSettings.cs
using System; using System.ComponentModel.Composition; namespace NuGet.VisualStudio { [Export(typeof(IProductUpdateSettings))] public class VsProductUpdateSettings : SettingsManagerBase, IProductUpdateSettings { private const string SettingsRoot = "NuGet"; private const string CheckUpdatePropertyName = "ShouldCheckForUpdate"; public VsProductUpdateSettings() : this(ServiceLocator.GetInstance<IServiceProvider>()) { } public VsProductUpdateSettings(IServiceProvider serviceProvider) : base(serviceProvider) { } public bool ShouldCheckForUpdate { get { return ReadInt32(SettingsRoot, CheckUpdatePropertyName, defaultValue: 1) == 1; } set { WriteInt32(SettingsRoot, CheckUpdatePropertyName, value ? 1 : 0); } } } }
using System; using System.ComponentModel.Composition; namespace NuGet.VisualStudio.ProductUpdate { [Export(typeof(IProductUpdateSettings))] public class VsProductUpdateSettings : SettingsManagerBase, IProductUpdateSettings { private const string SettingsRoot = "NuGet"; private const string CheckUpdatePropertyName = "ShouldCheckForUpdate"; public VsProductUpdateSettings() : this(ServiceLocator.GetInstance<IServiceProvider>()) { } public VsProductUpdateSettings(IServiceProvider serviceProvider) : base(serviceProvider) { } public bool ShouldCheckForUpdate { get { return ReadInt32(SettingsRoot, CheckUpdatePropertyName, defaultValue: 1) == 1; } set { WriteInt32(SettingsRoot, CheckUpdatePropertyName, value ? 1 : 0); } } } }
apache-2.0
C#
a2839acd1680be52f57587aea524976fc74d9088
Stop chancellor from prompting the player when they have no cards in their deck.
paulbatum/Dominion,paulbatum/Dominion
Dominion.Cards/Actions/Chancellor.cs
Dominion.Cards/Actions/Chancellor.cs
using System; using Dominion.Rules; using Dominion.Rules.Activities; using Dominion.Rules.CardTypes; namespace Dominion.Cards.Actions { public class Chancellor : Card, IActionCard { public Chancellor() : base(3) { } public void Play(TurnContext context) { context.MoneyToSpend += 2; context.AddEffect(new ChancellorEffect()); } public class ChancellorEffect : CardEffectBase { public override void Resolve(TurnContext context) { if(context.ActivePlayer.Deck.CardCount > 0) _activities.Add(new ChancellorActivity(context.Game.Log, context.ActivePlayer, "Do you wish to put your deck into your discard pile?")); } public class ChancellorActivity : YesNoChoiceActivity { public ChancellorActivity(IGameLog log, Player player, string message) : base(log, player, message) { } public override void Execute(bool choice) { if (choice) { Log.LogMessage("{0} put his deck in his discard pile", Player.Name); this.Player.Deck.MoveAll(this.Player.Discards); } } } } } }
using System; using Dominion.Rules; using Dominion.Rules.Activities; using Dominion.Rules.CardTypes; namespace Dominion.Cards.Actions { public class Chancellor : Card, IActionCard { public Chancellor() : base(3) { } public void Play(TurnContext context) { context.MoneyToSpend += 2; context.AddEffect(new ChancellorEffect()); } public class ChancellorEffect : CardEffectBase { public override void Resolve(TurnContext context) { _activities.Add(new ChancellorActivity(context.Game.Log, context.ActivePlayer, "Do you wish to put your deck into your discard pile?")); } public class ChancellorActivity : YesNoChoiceActivity { public ChancellorActivity(IGameLog log, Player player, string message) : base(log, player, message) { } public override void Execute(bool choice) { if (choice) { Log.LogMessage("{0} put his deck in his discard pile", Player.Name); this.Player.Deck.MoveAll(this.Player.Discards); } } } } } }
mit
C#
befc9c595172262ec6a809ebbfcc032d3340cd9c
Update ClientSerializationTest.cs
fortesinformatica/IuguClient
src/IuguClient.Tests/Serealization/ClientSerializationTest.cs
src/IuguClient.Tests/Serealization/ClientSerializationTest.cs
using IuguClientAPI.Models; using Newtonsoft.Json; using NUnit.Framework; namespace IuguClientAPI.Tests.Serealization { [TestFixture] public class ClientSerializationTest { [Test] public void SerializeClient() { var iuguClient = new IuguClient("email@email.com", "Cliente", "03318802379", null); var json = JsonConvert.SerializeObject(iuguClient); Assert.IsNotEmpty(json); } [Test] public void DeserializeClient() { var deserializeObject = JsonConvert.DeserializeObject<IuguClient>(JSON); Assert.IsNotNull(deserializeObject); } #region json private const string JSON = @"{ ""id"": ""77C2565F6F064A26ABED4255894224F0"", ""email"": ""email@email.com"", ""name"": ""Nome do Cliente"", ""notes"": ""Anotações Gerais"", ""created_at"": ""2013-11-18T14:58:30-02:00"", ""updated_at"": ""2013-11-18T14:58:30-02:00"", ""custom_variables"":[] }"; #endregion } }
using IuguClientAPI.Models; using Newtonsoft.Json; using NUnit.Framework; namespace IuguClientAPI.Tests.Serealization { [TestFixture] public class ClientSerializationTest { [Test] public void IuguSubitemSerialization() { var iuguClient = new IuguClient("email@email.com", "Cliente", "03318802379", null); var json = JsonConvert.SerializeObject(iuguClient); Assert.IsNotEmpty(json); } [Test] public void DeserializeClient() { var deserializeObject = JsonConvert.DeserializeObject<IuguClient>(JSON); Assert.IsNotNull(deserializeObject); } #region json private const string JSON = @"{ ""id"": ""77C2565F6F064A26ABED4255894224F0"", ""email"": ""email@email.com"", ""name"": ""Nome do Cliente"", ""notes"": ""Anotações Gerais"", ""created_at"": ""2013-11-18T14:58:30-02:00"", ""updated_at"": ""2013-11-18T14:58:30-02:00"", ""custom_variables"":[] }"; #endregion } }
mit
C#
b1704a4c06c581a5b18126740dbe92bb018b35f2
Add support for custom key delimiter
gusztavvargadr/aspnet-Configuration.Contrib
tests/Core.UnitTests/AppSettingsConfigurationProviderTests.cs
tests/Core.UnitTests/AppSettingsConfigurationProviderTests.cs
using System; using System.Collections.Specialized; using Microsoft.Extensions.Configuration; using Xunit; namespace GV.AspNet.Configuration.ConfigurationManager.UnitTests { public class AppSettingsConfigurationProviderTests { public class Load { [Theory] [InlineData("", "Value")] [InlineData("Key", "Value")] public void AddsAppSettings(string key, string value) { var appSettings = new NameValueCollection { { key, value } }; var keyDelimiter = Constants.KeyDelimiter; var keyPrefix = string.Empty; var source = new AppSettingsConfigurationProvider(appSettings, keyDelimiter, keyPrefix); source.Load(); string configurationValue; Assert.True(source.TryGet(key, out configurationValue)); Assert.Equal(value, configurationValue); } [Theory] [InlineData("Parent.Key", "", "Parent.Key", "Value")] [InlineData("Parent.Key", ".", "Parent:Key", "Value")] public void ReplacesKeyDelimiter(string appSettingsKey, string keyDelimiter, string configurationKey, string value) { var appSettings = new NameValueCollection { { appSettingsKey, value } }; var keyPrefix = string.Empty; var source = new AppSettingsConfigurationProvider(appSettings, keyDelimiter, keyPrefix); source.Load(); string configurationValue; Assert.True(source.TryGet(configurationKey, out configurationValue)); Assert.Equal(value, configurationValue); } } } }
using System; using System.Collections.Specialized; using Xunit; namespace GV.AspNet.Configuration.ConfigurationManager.UnitTests { public class AppSettingsConfigurationProviderTests { [Theory] [InlineData("Key1", "Value1")] [InlineData("Key2", "Value2")] public void LoadsKeyValuePairsFromAppSettings(string key, string value) { var appSettings = new NameValueCollection { { key, value } }; var source = new AppSettingsConfigurationProvider(appSettings, ":", string.Empty); source.Load(); string outValue; Assert.True(source.TryGet(key, out outValue)); Assert.Equal(value, outValue); } } }
mit
C#
82b1710b1c2d3f39153303f9f3ef4f582b88abd6
Fix addTemplate reference
andrewdavey/reference-application,andrewdavey/reference-application
App/Infrastructure/Cassette/ConvertAllHtmlTemplatesToScript.cs
App/Infrastructure/Cassette/ConvertAllHtmlTemplatesToScript.cs
using Cassette.BundleProcessing; using Cassette.Scripts; namespace App.Infrastructure.Cassette { class ConvertAllHtmlTemplatesToScript : IBundleProcessor<ScriptBundle> { public void Process(ScriptBundle bundle) { foreach (var asset in bundle.Assets) { if (asset.Path.EndsWith(".htm") || asset.Path.EndsWith(".html")) { asset.AddReference("~/Infrastructure/Scripts/App/addTemplate.js", 0); asset.AddAssetTransformer(new ConvertHtmlTemplateToScript()); } } } } }
using Cassette.BundleProcessing; using Cassette.Scripts; namespace App.Infrastructure.Cassette { class ConvertAllHtmlTemplatesToScript : IBundleProcessor<ScriptBundle> { public void Process(ScriptBundle bundle) { bundle.AddReference("~/Infrastructure/Scripts/App"); foreach (var asset in bundle.Assets) { if (asset.Path.EndsWith(".htm") || asset.Path.EndsWith(".html")) { asset.AddAssetTransformer(new ConvertHtmlTemplateToScript()); } } } } }
apache-2.0
C#
821402b14d3eb62a6394d58a3a32227e0a314da6
Update home page with helpful links
alsafonov/gitresources,alsafonov/gitresources,ethomson/gitresources,ethomson/gitresources
GitResources/Views/Home/_Home.cshtml
GitResources/Views/Home/_Home.cshtml
<!-- ko with: home --> <div class="jumbotron"> <h1>Git Resources</h1> <p class="lead"> Git is a powerful distributed version control system that provides fast, lightweight source control management including offline editing support, lightweight branching and merging and amazing support for distributed teams. </p> <p><a href="http://git-scm.com/" class="btn btn-primary btn-lg">Learn more &raquo;</a></p> </div> <div class="row"> <div class="col-md-4"> <h2>Getting started</h2> <p> The Git documentation provides a wealth of knowledge about the fundamentals of Git repositories as well as the manual for the Git command-line interface. </p> <p><a class="btn btn-default" href="http://git-scm.com/">Browse the Documentation &raquo;</a></p> </div> <div class="col-md-4"> <h2>Git for Windows</h2> <p> The Git for Windows project provides the Git command-line interface, a simple GUI and optional Windows Explorer integration. </p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=273732">Install Git for Windows &raquo;</a></p> </div> <div class="col-md-4"> <h2>Git in Visual Studio</h2> <p> Visual Studio provides Git repository management directly in the IDE and Visual Studio Online hosts repositories in the cloud. </p> <p><a class="btn btn-default" href="https://www.visualstudio.com/en-us/features/version-control-vs.aspx">Learn more &raquo;</a></p> </div> </div> <!-- /ko -->
<!-- ko with: home --> <div class="jumbotron"> <h1>ASP.NET</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.</p> <p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p> </div> <div class="row"> <div class="col-md-4"> <h2>Your information</h2> <p>This section shows how you can call ASP.NET Web API to get the user details.</p> <p data-bind="text: myHometown"></p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=273732">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Getting started</h2> <p> ASP.NET Single Page Application (SPA) helps you build applications that include significant client-side interactions using HTML, CSS, and JavaScript. It's now easier than ever before to getting started writing highly interactive web applications. </p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=273732">Learn more &raquo;</a></p> </div> <div class="col-md-4"> <h2>Web Hosting</h2> <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p> </div> </div> <!-- /ko -->
mit
C#
c8d64d8e007d2af189ab3e148b1d2699ab2510d3
add UnityLogHandler
yb199478/catlib,CatLib/Framework
CatLib.VS/CatLib/Debugger/LogHandler/UnityConsoleLogHandler.cs
CatLib.VS/CatLib/Debugger/LogHandler/UnityConsoleLogHandler.cs
/* * This file is part of the CatLib package. * * (c) Yu Bin <support@catlib.io> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * Document: http://catlib.io/ */ using System; using System.Collections.Generic; using CatLib.API.Debugger; using UnityEngine; namespace CatLib.Debugger.LogHandler { /// <summary> /// Unity控制台日志处理器 /// </summary> class UnityConsoleLogHandler : ILogHandler { /// <summary> /// 实际处理方法 /// </summary> private Dictionary<LogLevels, Action<object>> mapping; /// <summary> /// Unity控制台日志处理器 /// </summary> public UnityConsoleLogHandler() { mapping = new Dictionary<LogLevels, Action<object>>() { { LogLevels.Emergency , Debug.LogError }, { LogLevels.Alert , Debug.LogError }, { LogLevels.Critical , Debug.LogError }, { LogLevels.Error, Debug.LogError }, { LogLevels.Warning, Debug.LogWarning }, { LogLevels.Notice, Debug.Log }, { LogLevels.Informational, Debug.Log }, { LogLevels.Debug , Debug.Log } }; } /// <summary> /// 日志处理器 /// </summary> /// <param name="level">日志等级</param> /// <param name="message">日志内容</param> /// <param name="context">上下文,用于替换占位符</param> public void Handler(LogLevels level, object message, params object[] context) { var result = string.Format(message.ToString(), context); Action<object> handler; if (mapping.TryGetValue(level, out handler)) { handler.Invoke(result); } } } }
/* * This file is part of the CatLib package. * * (c) Yu Bin <support@catlib.io> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * Document: http://catlib.io/ */ using CatLib.API.Debugger; namespace CatLib.Debugger.LogHandler { /// <summary> /// Unity控制台日志处理器 /// </summary> class UnityConsoleLogHandler : ILogHandler { /// <summary> /// 日志处理器 /// </summary> /// <param name="level">日志等级</param> /// <param name="message">日志内容</param> /// <param name="context">上下文,用于替换占位符</param> public void Handler(LogLevels level, object message, params object[] context) { } //private void } }
unknown
C#
386e7ff0c9106537be5696acba206351f09c5943
add to collection customers
camiloandresok/SubwayNFCT,camiloandresok/SubwayNFCT,camiloandresok/SubwayNFCT
SubWay/SubWay/Controllers/HomeController.cs
SubWay/SubWay/Controllers/HomeController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using SubWay.DAL; namespace SubWay.Controllers { public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { try { demosubwaydbEntities dbContext = new demosubwaydbEntities(); Customer newCustomer = new Customer(); newCustomer.Nombres = "Andrea Reyes"; newCustomer.Telefono = "3112110445"; newCustomer.Email = "yurypecas@hotmail.com"; newCustomer.TwilioCode = "XZZXCERT"; dbContext.Customers.Add(newCustomer); dbContext.SaveChanges(); ViewBag.Message = "Salvado Ok ..."; } catch (Exception ex) { ViewBag.Message = ex.Message; } return View(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using SubWay.DAL; namespace SubWay.Controllers { public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { try { demosubwaydbEntities dbContext = new demosubwaydbEntities(); Customer newCustomer = new Customer(); newCustomer.Nombres = "Andrea Reyes"; newCustomer.Telefono = "3112110445"; newCustomer.Email = "yurypecas@hotmail.com"; newCustomer.TwilioCode = "XZZXCERT"; dbContext.SaveChanges(); ViewBag.Message = "Salvado Ok ..."; } catch (Exception ex) { ViewBag.Message = ex.Message; } return View(); } } }
mit
C#
ae4cce6a13e9ef377c9d0cf5441626377a85aab2
Update to version 1.3.2.0
Ulterius/server
RemoteTaskServer/Properties/AssemblyInfo.cs
RemoteTaskServer/Properties/AssemblyInfo.cs
#region 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("Ulterius™ Server")] [assembly: AssemblyDescription("Ulterius is currently in beta, follow updates at blog.ulterius.io")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ulterius")] [assembly: AssemblyProduct("Ulterius Server")] [assembly: AssemblyCopyright("Copyright © Octopodal Solutions 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("8faa6465-7d15-4c77-9b5f-d9495293a794")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.2.0")] [assembly: AssemblyFileVersion("1.3.2.0")]
#region 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("Ulterius™ Server")] [assembly: AssemblyDescription("Ulterius is currently in beta, follow updates at blog.ulterius.io")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ulterius")] [assembly: AssemblyProduct("Ulterius Server")] [assembly: AssemblyCopyright("Copyright © Octopodal Solutions 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("8faa6465-7d15-4c77-9b5f-d9495293a794")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.1.0")] [assembly: AssemblyFileVersion("1.3.1.0")]
mpl-2.0
C#
cfc8873ff4adf209dc26b5927561e633c229613c
Test for aggregate exception handling
bugsnag/bugsnag-dotnet,bugsnag/bugsnag-dotnet
tests/Bugsnag.Tests/Payload/ExceptionTests.cs
tests/Bugsnag.Tests/Payload/ExceptionTests.cs
using System.Linq; using System.Threading.Tasks; using Bugsnag.Payload; using Xunit; namespace Bugsnag.Tests.Payload { public class ExceptionTests { [Fact] public void CorrectNumberOfExceptions() { var exception = new System.Exception("oh noes!"); var exceptions = new Exceptions(exception, 5); Assert.Single(exceptions); } [Fact] public void IncludeInnerExceptions() { var innerException = new System.Exception(); var exception = new System.Exception("oh noes!", innerException); var exceptions = new Exceptions(exception, 5); Assert.Equal(2, exceptions.Count()); } [Fact] public void HandleAggregateExceptions() { Exceptions exceptions = null; var exceptionsToThrow = new[] { new System.Exception(), new System.DllNotFoundException() }; var tasks = exceptionsToThrow.Select(e => Task.Run(() => { throw e; })).ToArray(); try { Task.WaitAll(tasks); } catch (System.Exception exception) { exceptions = new Exceptions(exception, 0); } var results = exceptions.ToArray(); Assert.Contains(results, exception => exception.ErrorClass == "System.DllNotFoundException"); Assert.Contains(results, exception => exception.ErrorClass == "System.Exception"); Assert.Contains(results, exception => exception.ErrorClass == "System.AggregateException"); } } }
using System.Linq; using Bugsnag.Payload; using Xunit; namespace Bugsnag.Tests.Payload { public class ExceptionTests { [Fact] public void CorrectNumberOfExceptions() { var exception = new System.Exception("oh noes!"); var exceptions = new Exceptions(exception, 5); Assert.Single(exceptions); } [Fact] public void IncludeInnerExceptions() { var innerException = new System.Exception(); var exception = new System.Exception("oh noes!", innerException); var exceptions = new Exceptions(exception, 5); Assert.Equal(2, exceptions.Count()); } } }
mit
C#
be881ba9ca7261d9a4a85a95338406025f5682e5
Fix the redirect tracking composer
hfloyd/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,leekelleher/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,leekelleher/Umbraco-CMS,umbraco/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,madsoulswe/Umbraco-CMS,marcemarc/Umbraco-CMS,tcmorris/Umbraco-CMS,NikRimington/Umbraco-CMS,rasmuseeg/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,madsoulswe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,rasmuseeg/Umbraco-CMS,robertjf/Umbraco-CMS,bjarnef/Umbraco-CMS,NikRimington/Umbraco-CMS,hfloyd/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,madsoulswe/Umbraco-CMS,leekelleher/Umbraco-CMS,rasmuseeg/Umbraco-CMS,KevinJump/Umbraco-CMS,hfloyd/Umbraco-CMS,arknu/Umbraco-CMS,bjarnef/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,arknu/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,NikRimington/Umbraco-CMS,marcemarc/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,bjarnef/Umbraco-CMS,mattbrailsford/Umbraco-CMS,hfloyd/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS
src/Umbraco.Web/Routing/RedirectTrackingComposer.cs
src/Umbraco.Web/Routing/RedirectTrackingComposer.cs
using Umbraco.Core; using Umbraco.Core.Components; namespace Umbraco.Web.Routing { /// <summary> /// Implements an Application Event Handler for managing redirect urls tracking. /// </summary> /// <remarks> /// <para>when content is renamed or moved, we want to create a permanent 301 redirect from it's old url</para> /// <para>not managing domains because we don't know how to do it - changing domains => must create a higher level strategy using rewriting rules probably</para> /// <para>recycle bin = moving to and from does nothing: to = the node is gone, where would we redirect? from = same</para> /// </remarks> [RuntimeLevel(MinLevel = RuntimeLevel.Run)] public class RedirectTrackingComposer : ComponentComposer<RedirectTrackingComponent>, ICoreComposer { } }
using Umbraco.Core; using Umbraco.Core.Components; namespace Umbraco.Web.Routing { /// <summary> /// Implements an Application Event Handler for managing redirect urls tracking. /// </summary> /// <remarks> /// <para>when content is renamed or moved, we want to create a permanent 301 redirect from it's old url</para> /// <para>not managing domains because we don't know how to do it - changing domains => must create a higher level strategy using rewriting rules probably</para> /// <para>recycle bin = moving to and from does nothing: to = the node is gone, where would we redirect? from = same</para> /// </remarks> [RuntimeLevel(MinLevel = RuntimeLevel.Run)] public class RedirectTrackingComposer : ComponentComposer<RelateOnCopyComponent>, ICoreComposer { } }
mit
C#
755d941851e5e7b40ad087738b3bde61d06c8ef2
Fix - Added Tag's albums.
Kratos-TA/pSher,Kratos-TA/pSher,Kratos-TA/pSher
Data/pSher.Models/Tag.cs
Data/pSher.Models/Tag.cs
namespace PSher.Models { using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using PSher.Common.Constants; public class Tag { private ICollection<Image> images; private ICollection<Album> albums; public Tag() { this.images = new HashSet<Image>(); this.albums = new HashSet<Album>(); } [Key] public int Id { get; set; } [Required] [MinLength(ValidationConstants.MinTagName)] [MaxLength(ValidationConstants.MaxTagName)] public string Name { get; set; } public virtual ICollection<Image> Images { get { return this.images; } set { this.images = value; } } public virtual ICollection<Album> Albums { get { return this.albums; } set { this.albums = value; } } } }
namespace PSher.Models { using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using PSher.Common.Constants; public class Tag { private ICollection<Image> images; public Tag() { this.images = new HashSet<Image>(); } [Key] public int Id { get; set; } [Required] [MinLength(ValidationConstants.MinTagName)] [MaxLength(ValidationConstants.MaxTagName)] public string Name { get; set; } public virtual ICollection<Image> Images { get { return this.images; } set { this.images = value; } } } }
mit
C#
047a2b289fcedd5cb481f1583be7ddafa5c9bc97
Use var declaration. Fix ArgumentNullException parameter name.
gheeres/PDFSharp.Extensions
Pdf/PdfPageExtensions.cs
Pdf/PdfPageExtensions.cs
using System; using System.Collections.Generic; using System.Drawing; using PdfSharp.Pdf.Advanced; // ReSharper disable once CheckNamespace namespace PdfSharp.Pdf { /// <summary> /// Extension methods for the PdfSharp library PdfItem object. /// </summary> public static class PdfPageExtensions { /// <summary> /// Get's all of the images from the specified page. /// </summary> /// <param name="page">The page to extract or retrieve images from.</param> /// <param name="filter">An optional filter to perform additional modifications or actions on the image.</param> /// <returns>An enumeration of images contained on the page.</returns> public static IEnumerable<Image> GetImages(this PdfPage page, Func<PdfPage, int, Image, Image> filter = null) { if (page == null) throw new ArgumentNullException("page", "The provided PDF page was null."); if (filter == null) filter = (pg, idx, img) => img; int index = 0; var resources = page.Elements.GetDictionary("/Resources"); if (resources != null) { var xObjects = resources.Elements.GetDictionary("/XObject"); if (xObjects != null) { var items = xObjects.Elements.Values; foreach (PdfItem item in items) { var reference = item as PdfReference; if (reference != null) { var xObject = reference.Value as PdfDictionary; if (xObject.IsImage()) { yield return filter.Invoke(page, index++, xObject.ToImage()); } } } } } } } }
using System; using System.Collections.Generic; using System.Drawing; using PdfSharp.Pdf.Advanced; // ReSharper disable once CheckNamespace namespace PdfSharp.Pdf { /// <summary> /// Extension methods for the PdfSharp library PdfItem object. /// </summary> public static class PdfPageExtensions { /// <summary> /// Get's all of the images from the specified page. /// </summary> /// <param name="page">The page to extract or retrieve images from.</param> /// <param name="filter">An optional filter to perform additional modifications or actions on the image.</param> /// <returns>An enumeration of images contained on the page.</returns> public static IEnumerable<Image> GetImages(this PdfPage page, Func<PdfPage, int, Image, Image> filter = null) { if (page == null) throw new ArgumentNullException("item", "The provided PDF page was null."); if (filter == null) filter = (pg, idx, img) => img; int index = 0; PdfDictionary resources = page.Elements.GetDictionary("/Resources"); if (resources != null) { PdfDictionary xObjects = resources.Elements.GetDictionary("/XObject"); if (xObjects != null) { ICollection<PdfItem> items = xObjects.Elements.Values; foreach (PdfItem item in items) { PdfReference reference = item as PdfReference; if (reference != null) { PdfDictionary xObject = reference.Value as PdfDictionary; if (xObject.IsImage()) { yield return filter.Invoke(page, index++, xObject.ToImage()); } } } } } } } }
mit
C#
c94db0af6b58712c6deb2f9f1249e8345b60688b
Bring Attention to the Quick Access Panel On Page Load
tommcclean/PortalCMS,tommcclean/PortalCMS,tommcclean/PortalCMS
Portal.CMS.Web/Areas/Admin/Views/Dashboard/_QuickAccess.cshtml
Portal.CMS.Web/Areas/Admin/Views/Dashboard/_QuickAccess.cshtml
@model Portal.CMS.Web.Areas.Admin.ViewModels.Dashboard.QuickAccessViewModel <div class="page-admin-wrapper admin-wrapper animated zoomInUp"> @foreach (var category in Model.Categories) { <a href="@category.Link" class="button @category.CssClass @(category.LaunchModal ? "launch-modal" : "")" data-toggle="popover" data-placement="top" data-trigger="click" data-title="@(!string.IsNullOrWhiteSpace(category.Link) ? category.DesktopText : "")" data-container="body"><span class="click-through"><span class="@category.Icon" style="float: left;"></span><span class="hidden-xs visible-sm visible-md visible-lg" style="float: left;">@category.DesktopText</span><span class="visible-xs hidden-sm hidden-md hidden-lg" style="float: left;">@category.MobileText</span></span></a> } @foreach (var category in Model.Categories) { <div id="popover-@category.CssClass" class="list-group" style="display: none;"> <div class="popover-menu"> @foreach (var action in category.Actions) { <a class="list-group-item @(action.LaunchModal ? "launch-modal" : "")" onclick="@action.JavaScript" href="@action.Link" data-title="@action.Text"><span class="@action.Icon"></span>@action.Text</a> } </div> </div> } </div>
@model Portal.CMS.Web.Areas.Admin.ViewModels.Dashboard.QuickAccessViewModel <div class="page-admin-wrapper admin-wrapper"> @foreach (var category in Model.Categories) { <a href="@category.Link" class="button @category.CssClass @(category.LaunchModal ? "launch-modal" : "")" data-toggle="popover" data-placement="top" data-trigger="click" data-title="@(!string.IsNullOrWhiteSpace(category.Link) ? category.DesktopText : "")" data-container="body"><span class="click-through"><span class="@category.Icon" style="float: left;"></span><span class="hidden-xs visible-sm visible-md visible-lg" style="float: left;">@category.DesktopText</span><span class="visible-xs hidden-sm hidden-md hidden-lg" style="float: left;">@category.MobileText</span></span></a> } @foreach (var category in Model.Categories) { <div id="popover-@category.CssClass" class="list-group" style="display: none;"> <div class="popover-menu"> @foreach (var action in category.Actions) { <a class="list-group-item @(action.LaunchModal ? "launch-modal" : "")" onclick="@action.JavaScript" href="@action.Link" data-title="@action.Text"><span class="@action.Icon"></span>@action.Text</a> } </div> </div> } </div>
mit
C#
45ff0924a71287acb5860084e4ffd578d9759641
Make sure we order by sequence
Azure-Samples/MyDriving,Azure-Samples/MyDriving,Azure-Samples/MyDriving
XamarinApp/MyTrips/MyTrips.DataStore.Azure/Stores/TripStore.cs
XamarinApp/MyTrips/MyTrips.DataStore.Azure/Stores/TripStore.cs
using System; using MyTrips.DataObjects; using MyTrips.DataStore.Abstractions; using System.Threading.Tasks; using MyTrips.Utils; using System.Collections.Generic; using System.Linq; namespace MyTrips.DataStore.Azure.Stores { public class TripStore : BaseStore<Trip>, ITripStore { IPhotoStore photoStore; public TripStore() { photoStore = ServiceLocator.Instance.Resolve<IPhotoStore>(); } public override async Task<IEnumerable<Trip>> GetItemsAsync(int skip = 0, int take = 100, bool forceRefresh = false) { var items = await base.GetItemsAsync(skip, take, forceRefresh); foreach (var item in items) { item.Photos = new List<Photo>(); var photos = await photoStore.GetTripPhotos(item.Id); foreach(var photo in photos) item.Photos.Add(photo); } return items; } public override async Task<Trip> GetItemAsync(string id) { var item = await base.GetItemAsync(id); if (item.Photos == null) item.Photos = new List<Photo>(); else item.Photos.Clear(); var photos = await photoStore.GetTripPhotos(item.Id); foreach(var photo in photos) item.Photos.Add(photo); item.Points = item.Points.OrderBy(p => p.Sequence).ToArray(); return item; } } }
using System; using MyTrips.DataObjects; using MyTrips.DataStore.Abstractions; using System.Threading.Tasks; using MyTrips.Utils; using System.Collections.Generic; namespace MyTrips.DataStore.Azure.Stores { public class TripStore : BaseStore<Trip>, ITripStore { IPhotoStore photoStore; public TripStore() { photoStore = ServiceLocator.Instance.Resolve<IPhotoStore>(); } public override async Task<IEnumerable<Trip>> GetItemsAsync(int skip = 0, int take = 100, bool forceRefresh = false) { var items = await base.GetItemsAsync(skip, take, forceRefresh); foreach (var item in items) { item.Photos = new List<Photo>(); var photos = await photoStore.GetTripPhotos(item.Id); foreach(var photo in photos) item.Photos.Add(photo); } return items; } public override async Task<Trip> GetItemAsync(string id) { var item = await base.GetItemAsync(id); if (item.Photos == null) item.Photos = new List<Photo>(); else item.Photos.Clear(); var photos = await photoStore.GetTripPhotos(item.Id); foreach(var photo in photos) item.Photos.Add(photo); return item; } } }
mit
C#
6ad8a9a0b6a39be5986fe5abe41e93dae50bcf4a
Disable transparent sync during a reserialize so it's not a tautology
PetersonDave/Unicorn,MacDennis76/Unicorn,MacDennis76/Unicorn,bllue78/Unicorn,PetersonDave/Unicorn,rmwatson5/Unicorn,kamsar/Unicorn,rmwatson5/Unicorn,kamsar/Unicorn,GuitarRich/Unicorn,bllue78/Unicorn,GuitarRich/Unicorn
src/Unicorn/ControlPanel/ReserializeConsole.cs
src/Unicorn/ControlPanel/ReserializeConsole.cs
using System; using System.Linq; using System.Web; using Kamsar.WebConsole; using Unicorn.Configuration; using Unicorn.ControlPanel.Headings; using Unicorn.Logging; using Unicorn.Predicates; namespace Unicorn.ControlPanel { /// <summary> /// Renders a WebConsole that handles reserialize - or initial serialize - for Unicorn configurations /// </summary> public class ReserializeConsole : ControlPanelConsole { private readonly IConfiguration[] _configurations; public ReserializeConsole(bool isAutomatedTool, IConfiguration[] configurations) : base(isAutomatedTool, new HeadingService()) { _configurations = configurations; } protected override string Title { get { return "Reserialize Unicorn"; } } protected override void Process(IProgressStatus progress) { foreach (var configuration in ResolveConfigurations()) { var logger = configuration.Resolve<ILogger>(); using (new LoggingContext(new WebConsoleLogger(progress), configuration)) { try { logger.Info("Control Panel Reserialize: Processing Unicorn configuration " + configuration.Name); using (new TransparentSyncDisabler()) { var helper = configuration.Resolve<SerializationHelper>(); var roots = configuration.Resolve<PredicateRootPathResolver>().GetRootSourceItems(); int index = 1; foreach (var root in roots) { helper.DumpTree(root); progress.Report((int) ((index/(double) roots.Length)*100)); index++; } } logger.Info("Control Panel Reserialize: Finished reserializing Unicorn configuration " + configuration.Name); } catch (Exception ex) { logger.Error(ex); break; } } } } protected virtual IConfiguration[] ResolveConfigurations() { var config = HttpContext.Current.Request.QueryString["configuration"]; if (string.IsNullOrWhiteSpace(config)) return _configurations; var targetConfiguration = _configurations.FirstOrDefault(x => x.Name == config); if (targetConfiguration == null) throw new ArgumentException("Configuration requested was not defined."); return new[] { targetConfiguration }; } } }
using System; using System.Linq; using System.Web; using Kamsar.WebConsole; using Unicorn.Configuration; using Unicorn.ControlPanel.Headings; using Unicorn.Logging; using Unicorn.Predicates; namespace Unicorn.ControlPanel { /// <summary> /// Renders a WebConsole that handles reserialize - or initial serialize - for Unicorn configurations /// </summary> public class ReserializeConsole : ControlPanelConsole { private readonly IConfiguration[] _configurations; public ReserializeConsole(bool isAutomatedTool, IConfiguration[] configurations) : base(isAutomatedTool, new HeadingService()) { _configurations = configurations; } protected override string Title { get { return "Reserialize Unicorn"; } } protected override void Process(IProgressStatus progress) { foreach (var configuration in ResolveConfigurations()) { var logger = configuration.Resolve<ILogger>(); using (new LoggingContext(new WebConsoleLogger(progress), configuration)) { try { logger.Info("Control Panel Reserialize: Processing Unicorn configuration " + configuration.Name); var helper = configuration.Resolve<SerializationHelper>(); var roots = configuration.Resolve<PredicateRootPathResolver>().GetRootSourceItems(); int index = 1; foreach (var root in roots) { helper.DumpTree(root); progress.Report((int) ((index/(double) roots.Length)*100)); index++; } logger.Info("Control Panel Reserialize: Finished reserializing Unicorn configuration " + configuration.Name); } catch (Exception ex) { logger.Error(ex); break; } } } } protected virtual IConfiguration[] ResolveConfigurations() { var config = HttpContext.Current.Request.QueryString["configuration"]; if (string.IsNullOrWhiteSpace(config)) return _configurations; var targetConfiguration = _configurations.FirstOrDefault(x => x.Name == config); if (targetConfiguration == null) throw new ArgumentException("Configuration requested was not defined."); return new[] { targetConfiguration }; } } }
mit
C#
d6bde992130f29046bc7688022808a30a7044727
Fix handling of inter-assembly reference
jbeshir/ConfuserEx,arpitpanwar/ConfuserEx,engdata/ConfuserEx,yeaicc/ConfuserEx,Immortal-/ConfuserEx,modulexcite/ConfuserEx,AgileJoshua/ConfuserEx,KKKas/ConfuserEx,Desolath/ConfuserEx3,fretelweb/ConfuserEx,manojdjoshi/ConfuserEx,Desolath/Confuserex,farmaair/ConfuserEx,timnboys/ConfuserEx,apexrichard/ConfuserEx
Confuser.Renamer/Analyzers/InterReferenceAnalyzer.cs
Confuser.Renamer/Analyzers/InterReferenceAnalyzer.cs
using System; using Confuser.Core; using Confuser.Renamer.References; using dnlib.DotNet; using dnlib.DotNet.MD; namespace Confuser.Renamer.Analyzers { internal class InterReferenceAnalyzer : IRenamer { // i.e. Inter-Assembly References, e.g. InternalVisibleToAttributes public void Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) { var module = def as ModuleDefMD; if (module == null) return; MDTable table; uint len; // MemberRef/MethodSpec table = module.TablesStream.Get(Table.Method); len = table.Rows; for (uint i = 1; i <= len; i++) { MethodDef methodDef = module.ResolveMethod(i); foreach (var ov in methodDef.Overrides) { ProcessMemberRef(context, service, module, ov.MethodBody); ProcessMemberRef(context, service, module, ov.MethodDeclaration); } if (!methodDef.HasBody) continue; foreach (var instr in methodDef.Body.Instructions) { if (instr.Operand is MemberRef || instr.Operand is MethodSpec) ProcessMemberRef(context, service, module, (IMemberRef)instr.Operand); } } // TypeRef table = module.TablesStream.Get(Table.TypeRef); len = table.Rows; for (uint i = 1; i <= len; i++) { TypeRef typeRef = module.ResolveTypeRef(i); TypeDef typeDef = typeRef.ResolveTypeDefThrow(); if (typeDef.Module != module && context.Modules.Contains((ModuleDefMD)typeDef.Module)) { service.AddReference(typeDef, new TypeRefReference(typeRef, typeDef)); } } } void ProcessMemberRef(ConfuserContext context, INameService service, ModuleDefMD module, IMemberRef r) { var memberRef = r as MemberRef; if (r is MethodSpec) memberRef = ((MethodSpec)r).Method as MemberRef; if (memberRef != null) { if (memberRef.DeclaringType.TryGetArraySig() != null) return; TypeDef declType = memberRef.DeclaringType.ResolveTypeDefThrow(); if (declType.Module != module && context.Modules.Contains((ModuleDefMD)declType.Module)) { var memberDef = (IDnlibDef)declType.ResolveThrow(memberRef); service.AddReference(memberDef, new MemberRefReference(memberRef, memberDef)); } } } public void PreRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) { // } public void PostRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) { // } } }
using System; using Confuser.Core; using Confuser.Renamer.References; using dnlib.DotNet; using dnlib.DotNet.MD; namespace Confuser.Renamer.Analyzers { internal class InterReferenceAnalyzer : IRenamer { // i.e. Inter-Assembly References, e.g. InternalVisibleToAttributes public void Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) { var module = def as ModuleDefMD; if (module == null) return; MDTable table; uint len; // MemberRef table = module.TablesStream.Get(Table.MemberRef); len = table.Rows; for (uint i = 1; i <= len; i++) { MemberRef memberRef = module.ResolveMemberRef(i); if (memberRef.DeclaringType.TryGetArraySig() != null) continue; TypeDef declType = memberRef.DeclaringType.ResolveTypeDefThrow(); if (declType.Module != module && context.Modules.Contains((ModuleDefMD)declType.Module)) { var memberDef = (IDnlibDef)declType.ResolveThrow(memberRef); service.AddReference(memberDef, new MemberRefReference(memberRef, memberDef)); } } // TypeRef table = module.TablesStream.Get(Table.TypeRef); len = table.Rows; for (uint i = 1; i <= len; i++) { TypeRef typeRef = module.ResolveTypeRef(i); TypeDef typeDef = typeRef.ResolveTypeDefThrow(); if (typeDef.Module != module && context.Modules.Contains((ModuleDefMD)typeDef.Module)) { service.AddReference(typeDef, new TypeRefReference(typeRef, typeDef)); } } } public void PreRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) { // } public void PostRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) { // } } }
mit
C#
8bc1c46163ce8a3ad8a1e1ff043fac072280ae95
fix keypath to internal
dgarage/NBXplorer,dgarage/NBXplorer
NBXplorer.Client/NBXplorerNetworkProvider.Althash.cs
NBXplorer.Client/NBXplorerNetworkProvider.Althash.cs
using NBitcoin; using System; using System.Collections.Generic; using System.Text; namespace NBXplorer { public partial class NBXplorerNetworkProvider { private void InitAlthash(ChainName networkType) { Add(new NBXplorerNetwork(NBitcoin.Altcoins.Althash.Instance, networkType) { MinRPCVersion = 169900, CoinType = networkType == ChainName.Mainnet ? new KeyPath("88'") : new KeyPath("1'") }); } public NBXplorerNetwork GetALTHASH() { return GetFromCryptoCode(NBitcoin.Altcoins.Althash.Instance.CryptoCode); } } }
using NBitcoin; using System; using System.Collections.Generic; using System.Text; namespace NBXplorer { public partial class NBXplorerNetworkProvider { private void InitAlthash(ChainName networkType) { Add(new NBXplorerNetwork(NBitcoin.Altcoins.Althash.Instance, networkType) { MinRPCVersion = 169900, CoinType = networkType == ChainName.Mainnet ? new KeyPath("88'") : new KeyPath("0'") }); } public NBXplorerNetwork GetALTHASH() { return GetFromCryptoCode(NBitcoin.Altcoins.Althash.Instance.CryptoCode); } } }
mit
C#
c1f1aad1daae09325037b09d4fd821fbaa919bf6
Update Program.cs
MartinChavez/CSharp
SchoolOfCSharp/ValueTypes/Program.cs
SchoolOfCSharp/ValueTypes/Program.cs
 using System; namespace ValueTypes { class Program { static void Main(string[] args) { /*Value Types*/ //No pointers or references //No object allocated on the heap int valueTypeInt = 4; //No need to use the 'new' keyword int valueTypeIntTwo = new int(); //but you could valueTypeIntTwo = 5; valueTypeInt = valueTypeIntTwo; //This is a copy and paste from memory, not a reference { //Result should be 10 int result = valueTypeInt + valueTypeIntTwo; //this is short lived, it dissapears after the context Console.WriteLine(result); } Console.ReadLine(); } } }
 using System; namespace ValueTypes { class Program { static void Main(string[] args) { /*Value Types*/ //No pointers or references //No object allocated on the heap int valueTypeInt = 4; //No need to use the 'new' keyboard int valueTypeIntTwo = new int(); //but you could valueTypeIntTwo = 5; valueTypeInt = valueTypeIntTwo; //This is a copy and paste from memory, not a reference { //Result should be 10 int result = valueTypeInt + valueTypeIntTwo; //this is short lived, it dissapears after the context Console.WriteLine(result); } Console.ReadLine(); } } }
mit
C#
7f569f737c779f08a5a3790806a322229620be26
Change message.
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
src/CompetitionPlatform/Views/Shared/CreateClosed.cshtml
src/CompetitionPlatform/Views/Shared/CreateClosed.cshtml
@{ ViewData["Title"] = "Access Denied"; } <div class="container"> <h2 class="text-danger">Creating projects is temporarily unavailable.</h2> <p> The Function "сreating project" is only available for lykke community members with an approved KYC Status. </p> </div>
@{ ViewData["Title"] = "Access Denied"; } <div class="container"> <h2 class="text-danger">Creating projects is temporarily unavailable.</h2> <p> The Function "сreating project" will be available for lykke community members very soon. Thank you for your patience. </p> </div>
mit
C#
a9ac30e48cc5b9ce22932f5ec2d8f0d36d307547
Update JpegSkiaSharpExporter.cs
wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
src/Core2D/FileWriter/SkiaSharp/JpegSkiaSharpExporter.cs
src/Core2D/FileWriter/SkiaSharp/JpegSkiaSharpExporter.cs
using System; using System.IO; using Core2D.Containers; using Core2D.Interfaces; using Core2D.Renderer; using SkiaSharp; namespace Core2D.FileWriter.SkiaSharpJpeg { /// <summary> /// SkiaSharp jpeg <see cref="IProjectExporter"/> implementation. /// </summary> public sealed class JpegSkiaSharpExporter : IProjectExporter { private readonly IShapeRenderer _renderer; private readonly IContainerPresenter _presenter; /// <summary> /// Initializes a new instance of the <see cref="JpegSkiaSharpExporter"/> class. /// </summary> /// <param name="renderer">The shape renderer.</param> /// <param name="presenter">The container presenter.</param> public JpegSkiaSharpExporter(IShapeRenderer renderer, IContainerPresenter presenter) { _renderer = renderer; _presenter = presenter; } /// <inheritdoc/> public void Save(Stream stream, IPageContainer container) { var info = new SKImageInfo((int)container.Width, (int)container.Height, SKImageInfo.PlatformColorType, SKAlphaType.Unpremul); using var bitmap = new SKBitmap(info); using (var canvas = new SKCanvas(bitmap)) { _presenter.Render(canvas, _renderer, container, 0, 0); } using var image = SKImage.FromBitmap(bitmap); using var data = image.Encode(SKEncodedImageFormat.Jpeg, 100); data.SaveTo(stream); } /// <inheritdoc/> public void Save(Stream stream, IDocumentContainer document) { throw new NotSupportedException("Saving documents as jpeg drawing is not supported."); } /// <inheritdoc/> public void Save(Stream stream, IProjectContainer project) { throw new NotSupportedException("Saving projects as jpeg drawing is not supported."); } } }
using System; using System.IO; using Core2D.Containers; using Core2D.Interfaces; using Core2D.Renderer; using SkiaSharp; namespace Core2D.FileWriter.SkiaSharpJpeg { /// <summary> /// SkiaSharp jpeg <see cref="IProjectExporter"/> implementation. /// </summary> public sealed class JpegSkiaSharpExporter : IProjectExporter { private readonly IShapeRenderer _renderer; private readonly IContainerPresenter _presenter; /// <summary> /// Initializes a new instance of the <see cref="JpegSkiaSharpExporter"/> class. /// </summary> /// <param name="renderer">The shape renderer.</param> /// <param name="presenter">The container presenter.</param> public JpegSkiaSharpExporter(IShapeRenderer renderer, IContainerPresenter presenter) { _renderer = renderer; _presenter = presenter; } /// <inheritdoc/> public void Save(Stream stream, IPageContainer container) { var info = new SKImageInfo((int)container.Width, (int)container.Height); using var bitmap = new SKBitmap(info); using (var canvas = new SKCanvas(bitmap)) { _presenter.Render(canvas, _renderer, container, 0, 0); } using var image = SKImage.FromBitmap(bitmap); using var data = image.Encode(SKEncodedImageFormat.Jpeg, 100); data.SaveTo(stream); } /// <inheritdoc/> public void Save(Stream stream, IDocumentContainer document) { throw new NotSupportedException("Saving documents as jpeg drawing is not supported."); } /// <inheritdoc/> public void Save(Stream stream, IProjectContainer project) { throw new NotSupportedException("Saving projects as jpeg drawing is not supported."); } } }
mit
C#
1658f800214b297beb53cfd33b8c0257515c317a
test success
wallymathieu/isop
ConsoleHelpers/ArgumentParser.cs
ConsoleHelpers/ArgumentParser.cs
using System; using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; using System.Linq; using System.Collections.Generic; namespace ConsoleHelpers { delegate void ActionDelegate(); public class Argument { public string Longname{get;private set;} public Argument (string longname) { Longname=longname; } public bool Recognizes(string argument) { return true; } } public class ArgumentWithParameters { public Argument Argument{get;private set;} public string Parameter{get;private set;} public ArgumentWithParameters(Argument argument,string parameter) { Argument = argument; Parameter = parameter; } } public class ArgumentParser { private IEnumerable<string> arguments; private IEnumerable<Argument> actions; public ArgumentParser(IEnumerable<string> arguments,IEnumerable<Argument> actions) { this.arguments = arguments; this.actions = actions; } public IEnumerable<ArgumentWithParameters> GetInvokedArguments () { return actions.Select(act=> new{ arguments= arguments.Where(arg=>act.Recognizes(arg)), action=act }) .Where(couple=>couple.arguments.Any()) .Select(couple=> new ArgumentWithParameters(couple.action,couple.arguments.First())) ; } } [TestFixture] public class ArgumentParserTests { [SetUp] public void SetUp(){} [TearDown] public void TearDown(){} [Test] public void Recognizes_shortform() { var arg = new Argument("argument"); var parser = new ArgumentParser(new []{"-a"},new[]{arg}); var arguments = parser.GetInvokedArguments(); Assert.That(arguments.Count(),Is.EqualTo(1)); var arg1=arguments.First(); Assert.That(arg1.Argument,Is.EqualTo(arg)); } } }
using System; using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; using System.Linq; using System.Collections.Generic; namespace ConsoleHelpers { delegate void ActionDelegate(); public class Argument { public string Longname{get;private set;} public Argument (string longname) { Longname=longname; } } public class ArgumentWithParameters { public Argument Argument{get;private set;} public string Parameter{get;private set;} public ArgumentWithParameters(Argument argument,string parameter) { Argument = argument; Parameter = parameter; } } public class ArgumentParser { public ArgumentParser(IEnumerable<string> arguments,IEnumerable<Argument> actions) { } public IEnumerable<ArgumentWithParameters> GetArguments () { throw new System.NotImplementedException (); } } [TestFixture] public class ArgumentParserTests { [SetUp] public void SetUp(){} [TearDown] public void TearDown(){} [Test] public void Recognizes_shortform() { var arg = new Argument("argument"); var parser = new ArgumentParser(new []{"-a"},new[]{arg}); var arguments = parser.GetArguments(); Assert.That(arguments.Count(),Is.EqualTo(1)); var arg1=arguments.First(); Assert.That(arg1.Argument,Is.EqualTo(arg)); } } }
mit
C#
b07274ba83e1d2eca3b6e470118efdc6b5d836b4
Delete commented code
paganini24/UnityArduinoLED
Assets/Scripts/Network/ArduinoNetworkPlayer.cs
Assets/Scripts/Network/ArduinoNetworkPlayer.cs
using ArduinoUnity; using UnityEngine; using UnityEngine.Networking; /* <copyright company=""> Copyright (c) 2017 All Rights Reserved </copyright> <author>Nevzat Arman</author>*/ namespace Assets.Scripts.Network { public class ArduinoNetworkPlayer : NetworkBehaviour { [SerializeField] private GameObject _canvasLed; ArduinoController arduinoController; void Start() { arduinoController = FindObjectOfType<ArduinoController>(); _canvasLed.SetActive(isLocalPlayer); } [Command] public void CmdWrite(string data) { if (isClient) Write(data); RpcWrite(data); } [ClientRpc] private void RpcWrite(string data) { Write(data); } private void Write(string data) { if (!arduinoController) return; arduinoController.WriteToArduino(data); } } }
using ArduinoUnity; using UnityEngine; using UnityEngine.Networking; /* <copyright company=""> Copyright (c) 2017 All Rights Reserved </copyright> <author>Nevzat Arman</author>*/ namespace Assets.Scripts.Network { public class ArduinoNetworkPlayer : NetworkBehaviour { [SerializeField] private GameObject _canvasLed; ArduinoController arduinoController; void Start() { arduinoController = FindObjectOfType<ArduinoController>(); _canvasLed.SetActive(isLocalPlayer); } [Command] public void CmdWrite(string data) { if (isClient) Write(data); RpcWrite(data); } [ClientRpc] private void RpcWrite(string data) { Write(data); } private void Write(string data) { if (!arduinoController) return; arduinoController.WriteToArduino(data); } //[SerializeField] //protected string writeStream = "A,255,255,0"; //private void OnGUI() //{ // if (!isLocalPlayer) return; // writeStream = GUILayout.TextField(writeStream); // if (GUILayout.Button("Send")) // { // CmdWrite(writeStream); // } //} } }
mit
C#
6b749b7dbc856bff97563b9e63019d17d974ea1c
Fix chat bots list performing the wrong HTTP action
Cyberboss/tgstation-server,tgstation/tgstation-server,tgstation/tgstation-server-tools,Cyberboss/tgstation-server,tgstation/tgstation-server
src/Tgstation.Server.Client/Components/ChatBotsClient.cs
src/Tgstation.Server.Client/Components/ChatBotsClient.cs
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Api; using Tgstation.Server.Api.Models; namespace Tgstation.Server.Client.Components { /// <inheritdoc /> sealed class ChatBotsClient : IChatBotsClient { /// <summary> /// The <see cref="IApiClient"/> for the <see cref="ChatBotsClient"/> /// </summary> readonly IApiClient apiClient; /// <summary> /// The <see cref="Instance"/> for the <see cref="ChatBotsClient"/> /// </summary> readonly Instance instance; /// <summary> /// Construct a <see cref="ChatBotsClient"/> /// </summary> /// <param name="apiClient">The value of <see cref="apiClient"/></param> /// <param name="instance">The value of <see cref="instance"/></param> public ChatBotsClient(IApiClient apiClient, Instance instance) { this.apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient)); this.instance = instance ?? throw new ArgumentNullException(nameof(instance)); } /// <inheritdoc /> public Task<ChatBot> Create(ChatBot settings, CancellationToken cancellationToken) => apiClient.Create<ChatBot, ChatBot>(Routes.Chat, settings ?? throw new ArgumentNullException(nameof(settings)), instance.Id, cancellationToken); /// <inheritdoc /> public Task Delete(ChatBot settings, CancellationToken cancellationToken) => apiClient.Delete(Routes.SetID(Routes.Chat, settings?.Id ?? throw new ArgumentNullException(nameof(settings))), instance.Id, cancellationToken); /// <inheritdoc /> public Task<IReadOnlyList<ChatBot>> List(CancellationToken cancellationToken) => apiClient.Read<IReadOnlyList<ChatBot>>(Routes.List(Routes.Chat), instance.Id, cancellationToken); /// <inheritdoc /> public Task<ChatBot> Update(ChatBot settings, CancellationToken cancellationToken) => apiClient.Update<ChatBot, ChatBot>(Routes.Chat, settings ?? throw new ArgumentNullException(nameof(settings)), instance.Id, cancellationToken); /// <inheritdoc /> public Task<ChatBot> GetId(ChatBot settings, CancellationToken cancellationToken) => apiClient.Read<ChatBot>(Routes.SetID(Routes.Chat, (settings ?? throw new ArgumentNullException(nameof(settings))).Id), instance.Id, cancellationToken); } }
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Api; using Tgstation.Server.Api.Models; namespace Tgstation.Server.Client.Components { /// <inheritdoc /> sealed class ChatBotsClient : IChatBotsClient { /// <summary> /// The <see cref="IApiClient"/> for the <see cref="ChatBotsClient"/> /// </summary> readonly IApiClient apiClient; /// <summary> /// The <see cref="Instance"/> for the <see cref="ChatBotsClient"/> /// </summary> readonly Instance instance; /// <summary> /// Construct a <see cref="ChatBotsClient"/> /// </summary> /// <param name="apiClient">The value of <see cref="apiClient"/></param> /// <param name="instance">The value of <see cref="instance"/></param> public ChatBotsClient(IApiClient apiClient, Instance instance) { this.apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient)); this.instance = instance ?? throw new ArgumentNullException(nameof(instance)); } /// <inheritdoc /> public Task<ChatBot> Create(ChatBot settings, CancellationToken cancellationToken) => apiClient.Create<ChatBot, ChatBot>(Routes.Chat, settings ?? throw new ArgumentNullException(nameof(settings)), instance.Id, cancellationToken); /// <inheritdoc /> public Task Delete(ChatBot settings, CancellationToken cancellationToken) => apiClient.Delete(Routes.SetID(Routes.Chat, settings?.Id ?? throw new ArgumentNullException(nameof(settings))), instance.Id, cancellationToken); /// <inheritdoc /> public Task<IReadOnlyList<ChatBot>> List(CancellationToken cancellationToken) => apiClient.Create<IReadOnlyList<ChatBot>>(Routes.List(Routes.Chat), instance.Id, cancellationToken); /// <inheritdoc /> public Task<ChatBot> Update(ChatBot settings, CancellationToken cancellationToken) => apiClient.Update<ChatBot, ChatBot>(Routes.Chat, settings ?? throw new ArgumentNullException(nameof(settings)), instance.Id, cancellationToken); /// <inheritdoc /> public Task<ChatBot> GetId(ChatBot settings, CancellationToken cancellationToken) => apiClient.Read<ChatBot>(Routes.SetID(Routes.Chat, (settings ?? throw new ArgumentNullException(nameof(settings))).Id), instance.Id, cancellationToken); } }
agpl-3.0
C#
a72aa1fdecb7ad4ffcbed2346ae6f7aa6c9df59d
Replace Enumerable.Repeat call with an one-element array.
mdavid/nuget,mdavid/nuget
src/VisualStudio/PackageSource/AggregatePackageSource.cs
src/VisualStudio/PackageSource/AggregatePackageSource.cs
using System.Collections.Generic; using System.Linq; namespace NuGet.VisualStudio { public static class AggregatePackageSource { public static readonly PackageSource Instance = new PackageSource("(Aggregate source)", Resources.VsResources.AggregateSourceName); public static bool IsAggregate(this PackageSource source) { return source == Instance; } public static IEnumerable<PackageSource> GetPackageSourcesWithAggregate(this IPackageSourceProvider provider) { return new[] { Instance }.Concat(provider.LoadPackageSources()); } public static IEnumerable<PackageSource> GetPackageSourcesWithAggregate() { return GetPackageSourcesWithAggregate(ServiceLocator.GetInstance<IVsPackageSourceProvider>()); } } }
using System.Collections.Generic; using System.Linq; namespace NuGet.VisualStudio { public static class AggregatePackageSource { public static readonly PackageSource Instance = new PackageSource("(Aggregate source)", Resources.VsResources.AggregateSourceName); public static bool IsAggregate(this PackageSource source) { return source == Instance; } public static IEnumerable<PackageSource> GetPackageSourcesWithAggregate(this IPackageSourceProvider provider) { return Enumerable.Repeat(Instance, 1).Concat(provider.LoadPackageSources()); } public static IEnumerable<PackageSource> GetPackageSourcesWithAggregate() { return GetPackageSourcesWithAggregate(ServiceLocator.GetInstance<IVsPackageSourceProvider>()); } } }
apache-2.0
C#
05252609a1ce9d73d61d69c0622158a28dc46be9
Increment version
Solybum/Libraries
ByteArray/ByteArray/Properties/AssemblyInfo.cs
ByteArray/ByteArray/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("ByteArray")] [assembly: AssemblyDescription("Wrapper to ease data type conversions to and from byte arrays")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ByteArray")] [assembly: AssemblyCopyright("Copyright © Soleil Rojas 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("0022ee24-1361-41c8-982b-5b0215834234")] // 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.0")] [assembly: AssemblyFileVersion("1.0.2.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ByteArray")] [assembly: AssemblyDescription("Wrapper to ease data type conversions to and from byte arrays")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ByteArray")] [assembly: AssemblyCopyright("Copyright © Soleil Rojas 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("0022ee24-1361-41c8-982b-5b0215834234")] // 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.1.0")] [assembly: AssemblyFileVersion("1.0.1.0")]
mit
C#
4225bd915edf85c576c0eb0b5091a1df0a716159
adjust C# indentation
moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt,moszinet/BKKCrypt
C#/bkkcrypt.cs
C#/bkkcrypt.cs
using System; namespace BKK { public interface ICrypt { string Encrypt(string input); } public class BKKCrypt : ICrypt { public string Encrypt(string input) { return input; } } }
using System; namespace BKK { public interface ICrypt { string Encrypt(string input); } public class BKKCrypt : ICrypt { public string Encrypt(string input) { return input; } } }
mit
C#
cf645e2bf87dc941dacb5b82dbe61f96802e1295
Revert "Remove RandomTrace stuff from main"
lou1306/CIV,lou1306/CIV
CIV/Program.cs
CIV/Program.cs
using static System.Console; using CIV.Ccs; using CIV.Interfaces; namespace CIV { class Program { static void Main(string[] args) { var text = System.IO.File.ReadAllText(args[0]); var processes = CcsFacade.ParseAll(text); var trace = CcsFacade.RandomTrace(processes["Prison"], 450); foreach (var action in trace) { WriteLine(action); } } } }
using static System.Console; using System.Linq; using CIV.Ccs; using CIV.Hml; namespace CIV { class Program { static void Main(string[] args) { var text = System.IO.File.ReadAllText(args[0]); var processes = CcsFacade.ParseAll(text); var hmlText = "[[ack]][[ack]][[ack]](<<ack>>tt and [[freeAll]]ff)"; var prova = HmlFacade.ParseAll(hmlText); WriteLine(prova.Check(processes["Prison"])); } } }
mit
C#
22dc23111e1431b801f744ce780cf4166ea1fec9
Remove unused field.
jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,mono/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,jonathanpeppers/Embeddinator-4000,mono/Embeddinator-4000
binder/Generators/Template.cs
binder/Generators/Template.cs
using IKVM.Reflection; using CppSharp; using CppSharp.Generators; namespace MonoEmbeddinator4000.Generators { public abstract class Template : BlockGenerator { public BindingContext Context { get; private set; } public Options Options { get; private set; } protected Template(BindingContext context, Options options) { Context = context; Options = options; } public abstract string Name { get; } public abstract string FileExtension { get; } public abstract void Process(); public abstract void WriteHeaders(); } }
using IKVM.Reflection; using CppSharp; using CppSharp.Generators; namespace MonoEmbeddinator4000.Generators { public abstract class Template : BlockGenerator { public BindingContext Context { get; private set; } public Options Options { get; private set; } public Assembly Assembly { get; set; } protected Template(BindingContext context, Options options) { Context = context; Options = options; } public abstract string Name { get; } public abstract string FileExtension { get; } public abstract void Process(); public abstract void WriteHeaders(); } }
mit
C#
5a81898cc05e6b00d0f35e8d49417b448732c209
Allow statements to end with EOF instead of forcing a newline for every evaluated statement
ethanmoffat/EndlessClient
EOBot/Interpreter/States/StatementEvaluator.cs
EOBot/Interpreter/States/StatementEvaluator.cs
using EOBot.Interpreter.Extensions; using System.Collections.Generic; using System.Linq; namespace EOBot.Interpreter.States { public class StatementEvaluator : IScriptEvaluator { private readonly IEnumerable<IScriptEvaluator> _evaluators; public StatementEvaluator(IEnumerable<IScriptEvaluator> evaluators) { _evaluators = evaluators; } public bool Evaluate(ProgramState input) { while (input.Current().TokenType == BotTokenType.NewLine) input.Expect(BotTokenType.NewLine); return (Evaluate<AssignmentEvaluator>(input) || Evaluate<KeywordEvaluator>(input) || Evaluate<LabelEvaluator>(input) || Evaluate<FunctionEvaluator>(input)) && (input.Expect(BotTokenType.NewLine) || input.Expect(BotTokenType.EOF)); } private bool Evaluate<T>(ProgramState input) where T : IScriptEvaluator { return _evaluators .OfType<T>() .Single() .Evaluate(input); } } }
using EOBot.Interpreter.Extensions; using System.Collections.Generic; using System.Linq; namespace EOBot.Interpreter.States { public class StatementEvaluator : IScriptEvaluator { private readonly IEnumerable<IScriptEvaluator> _evaluators; public StatementEvaluator(IEnumerable<IScriptEvaluator> evaluators) { _evaluators = evaluators; } public bool Evaluate(ProgramState input) { while (input.Current().TokenType == BotTokenType.NewLine) input.Expect(BotTokenType.NewLine); return (Evaluate<AssignmentEvaluator>(input) || Evaluate<KeywordEvaluator>(input) || Evaluate<LabelEvaluator>(input) || Evaluate<FunctionEvaluator>(input)) && input.Expect(BotTokenType.NewLine); } private bool Evaluate<T>(ProgramState input) where T : IScriptEvaluator { return _evaluators .OfType<T>() .Single() .Evaluate(input); } } }
mit
C#
3b9c0b08678fecc131452840702823bedc1d1e61
重写 Parent 虚拟属性。
Zongsoft/Zongsoft.Web
src/Controls/DataItemContainer.cs
src/Controls/DataItemContainer.cs
using System; using System.Collections.Generic; using System.Web.UI; namespace Zongsoft.Web.Controls { public class DataItemContainer<TOwner> : Literal, IDataItemContainer where TOwner : CompositeDataBoundControl { #region 成员字段 private TOwner _owner; private object _dataItem; private int _index; private int _displayIndex; #endregion #region 构造函数 internal DataItemContainer(TOwner owner, object dataItem, int index, string tagName = null, string cssClass = "item") : this(owner, dataItem, index, index, tagName, cssClass) { } internal DataItemContainer(TOwner owner, object dataItem, int index, int displayIndex, string tagName = null, string cssClass = "item") : base(tagName, cssClass) { if(owner == null) throw new ArgumentNullException("owner"); _owner = owner; _dataItem = dataItem; _index = index; _displayIndex = displayIndex; } #endregion #region 公共属性 public TOwner Owner { get { return _owner; } } public object DataSource { get { return _owner.DataSource; } } public object DataItem { get { return _dataItem; } } public int Index { get { return _index; } } public int DisplayIndex { get { return _displayIndex; } } #endregion #region 重写属性 public override Control Parent { get { return base.Parent ?? _owner.Parent; } } #endregion #region 显式实现 int IDataItemContainer.DataItemIndex { get { return _index; } } #endregion } }
using System; using System.Collections.Generic; using System.Web.UI; namespace Zongsoft.Web.Controls { public class DataItemContainer<TOwner> : Literal, IDataItemContainer where TOwner : CompositeDataBoundControl { #region 成员字段 private TOwner _owner; private object _dataItem; private int _index; private int _displayIndex; #endregion #region 构造函数 internal DataItemContainer(TOwner owner, object dataItem, int index, string tagName = null, string cssClass = "item") : this(owner, dataItem, index, index, tagName, cssClass) { } internal DataItemContainer(TOwner owner, object dataItem, int index, int displayIndex, string tagName = null, string cssClass = "item") : base(tagName, cssClass) { if(owner == null) throw new ArgumentNullException("owner"); _owner = owner; _dataItem = dataItem; _index = index; _displayIndex = displayIndex; } #endregion #region 公共属性 public TOwner Owner { get { return _owner; } } public object DataSource { get { return _owner.DataSource; } } public object DataItem { get { return _dataItem; } } public int Index { get { return _index; } } public int DisplayIndex { get { return _displayIndex; } } #endregion #region 显式实现 int IDataItemContainer.DataItemIndex { get { return _index; } } #endregion } }
lgpl-2.1
C#
a8f95ffc9778bb0f609f1eb9231af443640725ac
Use colors
wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D
src/Core2D.Avalonia/Editor/Log.cs
src/Core2D.Avalonia/Editor/Log.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; namespace Core2D.Editor { public static class Log { public static bool Enabled { get; set; } public static void Info(string value) { if (Enabled) { var color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(value); Console.ForegroundColor = color; } } public static void Warning(string value) { if (Enabled) { var color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(value); Console.ForegroundColor = color; } } public static void Error(string value) { if (Enabled) { var color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(value); Console.ForegroundColor = color; } } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; namespace Core2D.Editor { public static class Log { public static bool Enabled { get; set; } public static void Info(string value) { if (Enabled) { Console.WriteLine("[Info] " + value); } } public static void Warning(string value) { if (Enabled) { Console.WriteLine("[Warning] " + value); } } public static void Error(string value) { if (Enabled) { Console.WriteLine("[Error] " + value); } } } }
mit
C#
2260b1e1a10dfcf131f63a55f1ff6828ce46a36e
Choose just one
vbatrla/PowerManager
VB.PowerManager/View/MenuComposer.cs
VB.PowerManager/View/MenuComposer.cs
namespace VB.PowerManager.View { using System; using System.Windows.Forms; using Interfaces; public class MenuComposer : IMenuComposer { private readonly MenuItemsNotifier itemsNotifier = new MenuItemsNotifier(); private readonly ContextMenu contextMenu = new ContextMenu(); public void Add(IMenuItemProxy menuItem) { AddMenuItemToMenu(menuItem); } public ContextMenu Display() { contextMenu.MenuItems.Add(new MenuItem("-")); contextMenu.MenuItems.Add("Exit", OnExit); return contextMenu; } private void AddMenuItemToMenu(IMenuItemProxy menuItemProxy) { itemsNotifier.Attach(menuItemProxy); contextMenu.MenuItems.Add((MenuItem)menuItemProxy.GetRealObject()); } private void OnExit(object sender, EventArgs e) { itemsNotifier.Clean(); Application.Exit(); } } }
namespace VB.PowerManager.View { using System; using System.Windows.Forms; using Interfaces; public class MenuComposer : IMenuComposer { private readonly MenuItemsNotifier itemsNotifier = new MenuItemsNotifier(); private readonly ContextMenu contextMenu = new ContextMenu(); public void Add(IMenuItemProxy menuItem) { AddMenuItemToMenu(menuItem); } public ContextMenu Display() { contextMenu.MenuItems.Add(new MenuItem("-")); contextMenu.MenuItems.Add("Exit", OnExit); return contextMenu; } private void AddMenuItemToMenu(IMenuItemProxy menuItemProxy) { contextMenu.MenuItems.Add((MenuItem)menuItemProxy.GetRealObject()); } private void OnExit(object sender, EventArgs e) { itemsNotifier.Clean(); Application.Exit(); } } }
mit
C#
50f8d5c6d819af00166e61fb7db0024b497eada5
Remove new keyword from interface
inputfalken/Sharpy
src/Sharpy.Core/src/IGenerator.cs
src/Sharpy.Core/src/IGenerator.cs
namespace Sharpy.Core { /// <summary> /// <para>Represent a generator which can generate any amount of elements by invoking method <see cref="Generate" />.</para> /// </summary> /// <typeparam name="T"></typeparam> public interface IGenerator<out T> { /// <summary> /// <para>Generate next element.</para> /// </summary> /// <returns> /// A generated element. /// </returns> T Generate(); } }
namespace Sharpy.Core { /// <summary> /// <para>Represent a generator which can generate any amount of elements by invoking method <see cref="Generate" />.</para> /// </summary> /// <typeparam name="T"></typeparam> public interface IGenerator<out T> { /// <summary> /// <para>Generate next element.</para> /// </summary> /// <returns> /// A generated element. /// </returns> new T Generate(); } }
mit
C#
ac2b21fb3110086382fe19d0e9a93772a8f30b0a
Remove BlackHole coloring
iridinite/shiftdrive
Client/BlackHole.cs
Client/BlackHole.cs
/* ** Project ShiftDrive ** (C) Mika Molenkamp, 2016. */ using Microsoft.Xna.Framework; namespace ShiftDrive { /// <summary> /// A <seealso cref="NamedObject"/> representing a gravitational singularity. /// </summary> internal sealed class BlackHole : NamedObject { public BlackHole() { type = ObjectType.BlackHole; facing = 0f; spritename = "map/blackhole"; bounding = 0f; // no bounding sphere; Update handles gravity pull } public override void Update(GameState world, float deltaTime) { base.Update(world, deltaTime); // simulate gravitational pull foreach (GameObject gobj in world.Objects.Values) { // black holes don't affect themselves... if (gobj.type == ObjectType.BlackHole) continue; // objects closer than 140 units are affected by the grav pull if (!(Vector2.DistanceSquared(gobj.position, this.position) < 19600)) continue; // pull this object in closer Vector2 pulldir = Vector2.Normalize(position - gobj.position); float pullpower = 1f - Vector2.Distance(gobj.position, this.position) / 140f; gobj.position += pulldir * pullpower * pullpower * deltaTime * 40f; gobj.changed = true; // objects that are too close to the center are damaged if (pullpower >= 0.35f) gobj.TakeDamage(pullpower * pullpower * deltaTime * 10f); // and stuff at the center is simply destroyed if (pullpower >= 0.95f) gobj.Destroy(); } } public override bool IsTerrain() { return true; } } }
/* ** Project ShiftDrive ** (C) Mika Molenkamp, 2016. */ using Microsoft.Xna.Framework; namespace ShiftDrive { /// <summary> /// A <seealso cref="NamedObject"/> representing a gravitational singularity. /// </summary> internal sealed class BlackHole : NamedObject { public BlackHole() { type = ObjectType.BlackHole; facing = 0f; spritename = "map/blackhole"; color = Color.Blue; bounding = 0f; // no bounding sphere; Update handles gravity pull } public override void Update(GameState world, float deltaTime) { base.Update(world, deltaTime); // simulate gravitational pull foreach (GameObject gobj in world.Objects.Values) { // black holes don't affect themselves... if (gobj.type == ObjectType.BlackHole) continue; // objects closer than 140 units are affected by the grav pull if (!(Vector2.DistanceSquared(gobj.position, this.position) < 19600)) continue; // pull this object in closer Vector2 pulldir = Vector2.Normalize(position - gobj.position); float pullpower = 1f - Vector2.Distance(gobj.position, this.position) / 140f; gobj.position += pulldir * pullpower * pullpower * deltaTime * 40f; gobj.changed = true; // objects that are too close to the center are damaged if (pullpower >= 0.35f) gobj.TakeDamage(pullpower * pullpower * deltaTime * 10f); // and stuff at the center is simply destroyed if (pullpower >= 0.95f) gobj.Destroy(); } } public override bool IsTerrain() { return true; } } }
bsd-3-clause
C#
5fcdc899a289d281c06a1f80727ffa0658408bbd
Change BlackHole to ignore non-physics objects
iridinite/shiftdrive
Client/BlackHole.cs
Client/BlackHole.cs
/* ** Project ShiftDrive ** (C) Mika Molenkamp, 2016. */ using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; namespace ShiftDrive { /// <summary> /// A <seealso cref="NamedObject"/> representing a gravitational singularity. /// </summary> internal sealed class BlackHole : NamedObject { public BlackHole(GameState world) : base(world) { type = ObjectType.BlackHole; facing = 0f; spritename = "map/blackhole"; bounding = 0f; // no bounding sphere; Update handles gravity pull } public override void Update(float deltaTime) { base.Update(deltaTime); // simulate gravitational pull IEnumerable<uint> keys = world.Objects.Keys.OrderByDescending(k => k); foreach (uint key in keys) { GameObject gobj = world.Objects[key]; // black holes don't affect themselves... if (gobj.type == ObjectType.BlackHole) continue; // exclude objects that have no physics if (gobj.layermask == 0 || gobj.bounding <= 0f) continue; // objects closer than 140 units are affected by the grav pull if (!(Vector2.DistanceSquared(gobj.position, this.position) < 19600)) continue; // pull this object in closer Vector2 pulldir = Vector2.Normalize(position - gobj.position); float pullpower = 1f - Vector2.Distance(gobj.position, this.position) / 140f; gobj.position += pulldir * pullpower * pullpower * deltaTime * 40f; gobj.changed = true; // notify player ship if (pullpower >= 0.1f && gobj.type == ObjectType.PlayerShip && world.IsServer) NetServer.PublishAnnouncement(AnnouncementId.BlackHole, null); // objects that are too close to the center are damaged if (pullpower >= 0.35f) gobj.TakeDamage(pullpower * pullpower * deltaTime * 10f); // and stuff at the center is simply destroyed if (pullpower >= 0.95f) gobj.Destroy(); } } public override bool IsTerrain() { return true; } } }
/* ** Project ShiftDrive ** (C) Mika Molenkamp, 2016. */ using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; namespace ShiftDrive { /// <summary> /// A <seealso cref="NamedObject"/> representing a gravitational singularity. /// </summary> internal sealed class BlackHole : NamedObject { public BlackHole(GameState world) : base(world) { type = ObjectType.BlackHole; facing = 0f; spritename = "map/blackhole"; bounding = 0f; // no bounding sphere; Update handles gravity pull } public override void Update(float deltaTime) { base.Update(deltaTime); // simulate gravitational pull IEnumerable<uint> keys = world.Objects.Keys.OrderByDescending(k => k); foreach (uint key in keys) { GameObject gobj = world.Objects[key]; // black holes don't affect themselves... if (gobj.type == ObjectType.BlackHole) continue; // objects closer than 140 units are affected by the grav pull if (!(Vector2.DistanceSquared(gobj.position, this.position) < 19600)) continue; // pull this object in closer Vector2 pulldir = Vector2.Normalize(position - gobj.position); float pullpower = 1f - Vector2.Distance(gobj.position, this.position) / 140f; gobj.position += pulldir * pullpower * pullpower * deltaTime * 40f; gobj.changed = true; // notify player ship if (pullpower >= 0.1f && gobj.type == ObjectType.PlayerShip && world.IsServer) NetServer.PublishAnnouncement(AnnouncementId.BlackHole, null); // objects that are too close to the center are damaged if (pullpower >= 0.35f) gobj.TakeDamage(pullpower * pullpower * deltaTime * 10f); // and stuff at the center is simply destroyed if (pullpower >= 0.95f) gobj.Destroy(); } } public override bool IsTerrain() { return true; } } }
bsd-3-clause
C#
cc43d0156b140a3910b9b567f4d2f226f61cd532
add alias Readd for Unarchive;
ceee/PocketSharp
PocketSharp/Components/Modify.cs
PocketSharp/Components/Modify.cs
using PocketSharp.Models; using System.Collections.Generic; namespace PocketSharp { public partial class PocketClient { /// <summary> /// Archives the specified item ID. /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Archive(int itemID) { return PutAction(itemID, "archive"); } /// <summary> /// Un-archives the specified item ID. /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Readd(int itemID) { return Unarchive(itemID); } /// <summary> /// Un-archives the specified item ID (alias for Readd). /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Unarchive(int itemID) { return PutAction(itemID, "readd"); } /// <summary> /// Favorites the specified item ID. /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Favorite(int itemID) { return PutAction(itemID, "favorite"); } /// <summary> /// Un-favorites the specified item ID. /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Unfavorite(int itemID) { return PutAction(itemID, "unfavorite"); } /// <summary> /// Deletes the specified item ID. /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Delete(int itemID) { return PutAction(itemID, "delete"); } } }
using PocketSharp.Models; using System.Collections.Generic; namespace PocketSharp { public partial class PocketClient { /// <summary> /// Archives the specified item ID. /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Archive(int itemID) { return PutAction(itemID, "archive"); } /// <summary> /// Un-archives the specified item ID. /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Unarchive(int itemID) { return PutAction(itemID, "readd"); } /// <summary> /// Favorites the specified item ID. /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Favorite(int itemID) { return PutAction(itemID, "favorite"); } /// <summary> /// Un-favorites the specified item ID. /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Unfavorite(int itemID) { return PutAction(itemID, "unfavorite"); } /// <summary> /// Deletes the specified item ID. /// </summary> /// <param name="itemID">The item ID.</param> /// <returns></returns> public bool Delete(int itemID) { return PutAction(itemID, "delete"); } } }
mit
C#
c1b4aaaa03334995f4a96f223b3ce446a8ffb0dc
Add doc comment
ppy/osu,peppy/osu,peppy/osu-new,NeoAdonis/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu
osu.Game/Rulesets/Objects/UnmanagedHitObjectEntry.cs
osu.Game/Rulesets/Objects/UnmanagedHitObjectEntry.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Objects { /// <summary> /// Created for a <see cref="DrawableHitObject"/> when only <see cref="HitObject"/> is given /// to make sure a <see cref="DrawableHitObject"/> is always associated with a <see cref="HitObjectLifetimeEntry"/>. /// </summary> internal class UnmanagedHitObjectEntry : HitObjectLifetimeEntry { public readonly DrawableHitObject DrawableHitObject; public UnmanagedHitObjectEntry(HitObject hitObject, DrawableHitObject drawableHitObject) : base(hitObject) { DrawableHitObject = drawableHitObject; LifetimeStart = DrawableHitObject.LifetimeStart; LifetimeEnd = DrawableHitObject.LifetimeEnd; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Objects { internal class UnmanagedHitObjectEntry : HitObjectLifetimeEntry { public readonly DrawableHitObject DrawableHitObject; public UnmanagedHitObjectEntry(HitObject hitObject, DrawableHitObject drawableHitObject) : base(hitObject) { DrawableHitObject = drawableHitObject; LifetimeStart = DrawableHitObject.LifetimeStart; LifetimeEnd = DrawableHitObject.LifetimeEnd; } } }
mit
C#
6e4127a5113b415cf20ce06287c5bd0a01f95469
Fix DockerClient dependency
ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab,ashmind/SharpLab
source/Container.Manager/Azure/ContainerCountMetricReporter.cs
source/Container.Manager/Azure/ContainerCountMetricReporter.cs
using System; using System.Threading; using System.Threading.Tasks; using Docker.DotNet; using Docker.DotNet.Models; using Microsoft.ApplicationInsights; using Microsoft.ApplicationInsights.Metrics; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace SharpLab.Container.Manager.Azure { public class ContainerCountMetricReporter : BackgroundService { private static readonly MetricIdentifier ContainerCountMetric = new("Custom Metrics", "Container Count"); private readonly DockerClient _dockerClient; private readonly TelemetryClient _telemetryClient; private readonly ILogger<ContainerCountMetricReporter> _logger; public ContainerCountMetricReporter( DockerClient dockerClient, TelemetryClient telemetryClient, ILogger<ContainerCountMetricReporter> logger ) { _dockerClient = dockerClient; _telemetryClient = telemetryClient; _logger = logger; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { try { var containers = await _dockerClient.Containers.ListContainersAsync(new ContainersListParameters { All = true }); _telemetryClient.GetMetric(ContainerCountMetric).TrackValue(containers.Count); } catch (Exception ex) { _logger.LogError(ex, "Failed to report container count"); await Task.Delay(TimeSpan.FromMinutes(4), stoppingToken); } await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken); } } } }
using System; using System.Threading; using System.Threading.Tasks; using Docker.DotNet; using Docker.DotNet.Models; using Microsoft.ApplicationInsights; using Microsoft.ApplicationInsights.Metrics; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace SharpLab.Container.Manager.Azure { public class ContainerCountMetricReporter : BackgroundService { private static readonly MetricIdentifier ContainerCountMetric = new("Custom Metrics", "Container Count"); private readonly DockerClientConfiguration _dockerClientConfiguration; private readonly TelemetryClient _telemetryClient; private readonly ILogger<ContainerCountMetricReporter> _logger; public ContainerCountMetricReporter( DockerClientConfiguration dockerClientConfiguration, TelemetryClient telemetryClient, ILogger<ContainerCountMetricReporter> logger ) { _dockerClientConfiguration = dockerClientConfiguration; _telemetryClient = telemetryClient; _logger = logger; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { try { using var client = _dockerClientConfiguration.CreateClient(); var containers = await client.Containers.ListContainersAsync(new ContainersListParameters { All = true }); _telemetryClient.GetMetric(ContainerCountMetric).TrackValue(containers.Count); } catch (Exception ex) { _logger.LogError(ex, "Failed to report container count"); await Task.Delay(TimeSpan.FromMinutes(4), stoppingToken); } await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken); } } } }
bsd-2-clause
C#
847c1a434d91cf8be94f618d527aaa30348016f0
Set the StatusCode
jmptrader/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jacksonh/manos,jmptrader/manos,jacksonh/manos,jmptrader/manos,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,jacksonh/manos,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos
server/Mango.Server/mango.cs
server/Mango.Server/mango.cs
using System; using System.IO; using System.Text; using Mango.Server; public class T { public static void Main () { HttpServer server = new HttpServer (HandleRequest); server.Bind (8080); server.Start (); server.IOLoop.Start (); } public static void HandleRequest (HttpConnection con) { string message = String.Format ("You requested {0}\n", con.Request.Path); string fullpath = con.Request.Path; if (fullpath.Length > 0) { string path = fullpath.Substring (1); int query = path.IndexOf ('?'); if (query > 0) path = path.Substring (0, query); Console.WriteLine ("PATH: {0}", path); if (File.Exists (path)) { con.Response.StatusCode = 200; con.Response.SendFile (path); } else con.Response.StatusCode = 404; } // con.Response.Write (String.Format ("HTTP/1.1 200 OK\r\nContent-Length: {0}\r\n\r\n{1}", Encoding.ASCII.GetBytes (message).Length, message)); con.Response.Finish (); } }
using System; using System.IO; using System.Text; using Mango.Server; public class T { public static void Main () { HttpServer server = new HttpServer (HandleRequest); server.Bind (8080); server.Start (); server.IOLoop.Start (); } public static void HandleRequest (HttpConnection con) { string message = String.Format ("You requested {0}\n", con.Request.Path); string fullpath = con.Request.Path; if (fullpath.Length > 0) { string path = fullpath.Substring (1); int query = path.IndexOf ('?'); if (query > 0) path = path.Substring (0, query); Console.WriteLine ("PATH: {0}", path); if (File.Exists (path)) con.Response.SendFile (path); } // con.Response.Write (String.Format ("HTTP/1.1 200 OK\r\nContent-Length: {0}\r\n\r\n{1}", Encoding.ASCII.GetBytes (message).Length, message)); con.Response.Finish (); } }
mit
C#
8c68d0d1b7fbc4bcc4c9c3407ba1fc666b4ca237
Remove using statements
ppy/osu-framework,EVAST9919/osu-framework,naoey/osu-framework,default0/osu-framework,smoogipooo/osu-framework,Nabile-Rahmani/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,paparony03/osu-framework,ZLima12/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,peppy/osu-framework,Tom94/osu-framework,peppy/osu-framework,ZLima12/osu-framework,paparony03/osu-framework,naoey/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,Nabile-Rahmani/osu-framework,default0/osu-framework
osu.Framework/Audio/Track/TrackManager.cs
osu.Framework/Audio/Track/TrackManager.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using osu.Framework.IO.Stores; namespace osu.Framework.Audio.Track { public class TrackManager : AudioCollectionManager<Track> { private readonly IResourceStore<byte[]> store; public TrackManager(IResourceStore<byte[]> store) { this.store = store; } public Track Get(string name) { TrackBass track = new TrackBass(store.GetStream(name)); AddItem(track); return track; } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System.Linq; using osu.Framework.IO.Stores; using System; namespace osu.Framework.Audio.Track { public class TrackManager : AudioCollectionManager<Track> { private readonly IResourceStore<byte[]> store; public TrackManager(IResourceStore<byte[]> store) { this.store = store; } public Track Get(string name) { TrackBass track = new TrackBass(store.GetStream(name)); AddItem(track); return track; } } }
mit
C#
f3dccf1283a334100360be1e09737b21e65a0962
Make TrackManager implement IResourceStore (#2452)
ppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework
osu.Framework/Audio/Track/TrackManager.cs
osu.Framework/Audio/Track/TrackManager.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.IO; using System.Threading.Tasks; using osu.Framework.IO.Stores; namespace osu.Framework.Audio.Track { public class TrackManager : AudioCollectionManager<Track>, IResourceStore<Track> { private readonly IResourceStore<byte[]> store; public TrackManager(IResourceStore<byte[]> store) { this.store = store; } public Track Get(string name) { if (string.IsNullOrEmpty(name)) return null; var dataStream = store.GetStream(name); if (dataStream == null) return null; Track track = new TrackBass(dataStream); AddItem(track); return track; } public Task<Track> GetAsync(string name) => Task.Run(() => Get(name)); public Stream GetStream(string name) => store.GetStream(name); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.IO.Stores; namespace osu.Framework.Audio.Track { public class TrackManager : AudioCollectionManager<Track> { private readonly IResourceStore<byte[]> store; public TrackManager(IResourceStore<byte[]> store) { this.store = store; } public Track Get(string name) { if (string.IsNullOrEmpty(name)) return null; var dataStream = store.GetStream(name); if (dataStream == null) return null; Track track = new TrackBass(dataStream); AddItem(track); return track; } } }
mit
C#
22b9ede5c02f348d717046ab7bfaf720159e7d76
clear TaskCompletionSource after we finish to use it
kerryjiang/WebSocket4Net,kerryjiang/WebSocket4Net,kerryjiang/WebSocket4Net
WebSocket4Net/WebSocket.Await.cs
WebSocket4Net/WebSocket.Await.cs
using System; using System.Net; using System.Text; using System.Threading; using System.Threading.Tasks; namespace WebSocket4Net { public partial class WebSocket { private TaskCompletionSource<bool> m_OpenTaskSrc; public async Task<bool> OpenAsync() { if (m_OpenTaskSrc != null) return await m_OpenTaskSrc.Task; m_OpenTaskSrc = new TaskCompletionSource<bool>(); this.Opened += OnOpenCompleted; Open(); return await m_OpenTaskSrc.Task; } private void OnOpenCompleted(object sender, EventArgs e) { this.Opened -= OnOpenCompleted; m_OpenTaskSrc?.SetResult(this.StateCode == WebSocketStateConst.Open); m_OpenTaskSrc = null; } } }
using System; using System.Net; using System.Text; using System.Threading; using System.Threading.Tasks; namespace WebSocket4Net { public partial class WebSocket { private TaskCompletionSource<bool> m_OpenTaskSrc; public async Task<bool> OpenAsync() { if (m_OpenTaskSrc != null) return await m_OpenTaskSrc.Task; m_OpenTaskSrc = new TaskCompletionSource<bool>(); this.Opened += OnOpenCompleted; Open(); return await m_OpenTaskSrc.Task; } private void OnOpenCompleted(object sender, EventArgs e) { this.Opened -= OnOpenCompleted; m_OpenTaskSrc?.SetResult(this.StateCode == WebSocketStateConst.Open); } } }
apache-2.0
C#
d724df25d2d5d891a3baa1a6850c1c95e2536dd9
Document the GameBoy class
izik1/JAGBE
JAGBE/GB/GameBoy.cs
JAGBE/GB/GameBoy.cs
using System.IO; using JAGBE.GB.Computation; namespace JAGBE.GB { /// <summary> /// A UI level Wrapper for accessing running a <see cref="Cpu"/> /// </summary> internal sealed class GameBoy { /// <summary> /// The cpu /// </summary> internal Cpu cpu; /// <summary> /// Initializes a new instance of the <see cref="GameBoy"/> class. /// </summary> /// <param name="romPath">The rom path.</param> /// <param name="BootromPath">The bootrom path.</param> /// <param name="inputHandler">The input handler.</param> internal GameBoy(string romPath, string BootromPath, Input.IInputHandler inputHandler) => this.cpu = new Cpu(File.ReadAllBytes(BootromPath), File.ReadAllBytes(romPath), inputHandler); /// <summary> /// Updates the cpu using the given <paramref name="targetUpdateRate"/> to determine the /// number of ticks to run. /// </summary> /// <param name="targetUpdateRate">The target update rate.</param> internal void Update(int targetUpdateRate) => this.cpu.Tick(this.cpu.WriteToConsole ? 160 : Cpu.ClockSpeedHz / targetUpdateRate); } }
using System.IO; using JAGBE.GB.Computation; namespace JAGBE.GB { internal sealed class GameBoy { internal Cpu cpu; internal GameBoy(string romPath, string BootromPath, Input.IInputHandler inputHandler) => this.cpu = new Cpu(File.ReadAllBytes(BootromPath), File.ReadAllBytes(romPath), inputHandler); internal void Update(int targetUpdateRate) => this.cpu.Tick(this.cpu.WriteToConsole ? 160 : Cpu.ClockSpeedHz / targetUpdateRate); } }
mit
C#
f054289a5e479b3b4c1be0f453c8adcbf6a6ce2c
Remove unused usings
dirkrombauts/AppVeyor-Light
AppVeyorServices.IntegrationTests/AppVeyorGatewayTests.cs
AppVeyorServices.IntegrationTests/AppVeyorGatewayTests.cs
using System; using NFluent; using NUnit.Framework; namespace AppVeyorLight.AppVeyorServices.IntegrationTests { [TestFixture] public class AppVeyorGatewayTests { [Test] public void GetProjects_Always_ReturnsListOfProjects() { var apiToken = System.Configuration.ConfigurationManager.AppSettings["ApiKey"]; var gateway = new AppVeyorGateway(apiToken); var projects = gateway.GetProjects(); Check.That(projects).IsNotNull(); var project = projects[0]; Check.That(project.Name).IsNotNull(); Check.That(project.Slug).IsNotNull(); Check.That(project.AccountName).IsNotNull(); Check.That(project.Builds[0].Status[0]).IsNotNull(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NFluent; using NUnit.Framework; namespace AppVeyorLight.AppVeyorServices.IntegrationTests { [TestFixture] public class AppVeyorGatewayTests { [Test] public void GetProjects_Always_ReturnsListOfProjects() { var apiToken = System.Configuration.ConfigurationManager.AppSettings["ApiKey"]; var gateway = new AppVeyorGateway(apiToken); var projects = gateway.GetProjects(); Check.That(projects).IsNotNull(); var project = projects[0]; Check.That(project.Name).IsNotNull(); Check.That(project.Slug).IsNotNull(); Check.That(project.AccountName).IsNotNull(); Check.That(project.Builds[0].Status[0]).IsNotNull(); } } }
mit
C#
fd9b1c6b8a38c8cfe0e31ac8cbf8f2785434ee91
Update UWPCapabilityUtility.cs
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity
Assets/MRTK/Core/Utilities/Editor/UWPCapabilityUtility.cs
Assets/MRTK/Core/Utilities/Editor/UWPCapabilityUtility.cs
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Editor; using System; using UnityEngine; using UnityEditor; namespace Microsoft.MixedReality.Toolkit.Utilities.Editor { /// <summary> /// Utility to check and configure UWP capability request from MRTK systems /// </summary> public class UWPCapabilityUtility { /// <summary> /// Given capability is required by the given component. Check if capability is enabled, if not auto-enable if possible and log to console /// </summary> /// <param name="capability">Desired capability needed</param> /// <param name="dependentComponent">Component type that requires the associated capability to perform operations</param> public static void RequireCapability(PlayerSettings.WSACapability capability, Type dependentComponent) { // Any changes made in editor while playing will not save if (!EditorApplication.isPlaying && !PlayerSettings.WSA.GetCapability(capability)) { if (MixedRealityProjectPreferences.AutoEnableUWPCapabilities) { Debug.Log($"<b>{dependentComponent.Name}</b> requires the UWP <b>{capability}</b> capability. Auto-enabling this capability in Player Settings.\nDisable this automation tool via MRTK Preferences under <i>Project Settings</i>."); PlayerSettings.WSA.SetCapability(capability, true); } else { Debug.LogWarning($"<b>{dependentComponent.Name}</b> requires the UWP <b>{capability}</b> capability which is currently not enabled. To utilize this component on device, enable the capability in <i>Player Settings</i> > <i>Publishing Settings</i>."); } } } } }
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Editor; using System; using UnityEngine; using UnityEditor; namespace Microsoft.MixedReality.Toolkit.Utilities.Editor { /// <summary> /// Utility to check and configure UWP capability request from MRTK systems /// </summary> public class UWPCapabilityUtility { /// <summary> /// Given capability is required by the given component. Check if capability is enabled, if not auto-enable if possible and log to console /// </summary> /// <param name="capability">Desired capability needed</param> /// <param name="dependentComponent">Component type that requires the associated capability to perform operations</param> public static void RequireCapability(PlayerSettings.WSACapability capability, Type dependentComponent) { // Any changes made in editor while playing will not save if (!EditorApplication.isPlaying && !PlayerSettings.WSA.GetCapability(capability)) { if (MixedRealityProjectPreferences.AutoEnableUWPCapabilities) { Debug.Log($"<b>{dependentComponent.Name}</b> requires the UWP <b>{capability.ToString()}</b> capability. Auto-enabling this capability in Player Settings.\nDisable this automation tool via MRTK Preferences under <i>Project Settings</i>."); PlayerSettings.WSA.SetCapability(capability, true); } else { Debug.LogWarning($"<b>{dependentComponent.Name}</b> requires the UWP <b>{capability.ToString()}</b> capability which is currently not enabled. To utilize this component on device, enable the capability in <i>Player Settings</i> > <i>Publishing Settings</i>."); } } } } }
mit
C#
2b3b2d8f76f36474521951e2d9c83f37bbfbf622
Fix #3713 - System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
peppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ppy/osu-framework
osu.Framework/Audio/AudioCollectionManager.cs
osu.Framework/Audio/AudioCollectionManager.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Linq; namespace osu.Framework.Audio { /// <summary> /// A collection of audio components which need central property control. /// </summary> public class AudioCollectionManager<T> : AdjustableAudioComponent, IBassAudio where T : AdjustableAudioComponent { internal List<T> Items = new List<T>(); public void AddItem(T item) { EnqueueAction(delegate { if (Items.Contains(item)) return; item.BindAdjustments(this); Items.Add(item); }); } public virtual void UpdateDevice(int deviceIndex) { foreach (var item in Items.OfType<IBassAudio>()) item.UpdateDevice(deviceIndex); } protected override void UpdateChildren() { base.UpdateChildren(); for (int i = 0; i < Items.Count; i++) { var item = Items[i]; if (!item.IsAlive) { Items.RemoveAt(i--); continue; } item.Update(); } } protected override void Dispose(bool disposing) { // we need to queue disposal of our Items before enqueueing the main dispose. foreach (var i in Items) i.Dispose(); base.Dispose(disposing); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Linq; namespace osu.Framework.Audio { /// <summary> /// A collection of audio components which need central property control. /// </summary> public class AudioCollectionManager<T> : AdjustableAudioComponent, IBassAudio where T : AdjustableAudioComponent { internal List<T> Items = new List<T>(); public void AddItem(T item) { EnqueueAction(delegate { if (Items.Contains(item)) return; item.BindAdjustments(this); Items.Add(item); }); } public virtual void UpdateDevice(int deviceIndex) { foreach (var item in Items.OfType<IBassAudio>()) item.UpdateDevice(deviceIndex); } protected override void UpdateChildren() { base.UpdateChildren(); for (int i = 0; i < Items.Count; i++) { var item = Items[i]; if (!item.IsAlive) { Items.RemoveAt(i--); continue; } item.Update(); } } public override void Dispose() { // we need to queue disposal of our Items before enqueueing the main dispose. foreach (var i in Items) i.Dispose(); base.Dispose(); } } }
mit
C#
19c663da110cf62ceda4cf4df8f608c7f1917e41
Remove scale effect on editor screen switches
peppy/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,2yangk23/osu,EVAST9919/osu,smoogipoo/osu,DrabWeb/osu,NeoAdonis/osu,ZLima12/osu,smoogipoo/osu,naoey/osu,smoogipooo/osu,johnneijzen/osu,Frontear/osuKyzer,peppy/osu,Drezi126/osu,Nabile-Rahmani/osu,peppy/osu,2yangk23/osu,peppy/osu-new,ZLima12/osu,naoey/osu,johnneijzen/osu,ppy/osu,DrabWeb/osu,NeoAdonis/osu,ppy/osu,ppy/osu,naoey/osu,DrabWeb/osu,EVAST9919/osu,smoogipoo/osu,UselessToucan/osu
osu.Game/Screens/Edit/Screens/EditorScreen.cs
osu.Game/Screens/Edit/Screens/EditorScreen.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; namespace osu.Game.Screens.Edit.Screens { public class EditorScreen : Container { public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); protected override Container<Drawable> Content => content; private readonly Container content; public EditorScreen() { Anchor = Anchor.Centre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.Both; InternalChild = content = new Container { RelativeSizeAxes = Axes.Both }; } protected override void LoadComplete() { base.LoadComplete(); this.FadeTo(0) .Then() .FadeTo(1f, 250, Easing.OutQuint); } public void Exit() { this.FadeOut(250).Expire(); } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; namespace osu.Game.Screens.Edit.Screens { public class EditorScreen : Container { public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>(); protected override Container<Drawable> Content => content; private readonly Container content; public EditorScreen() { Anchor = Anchor.Centre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.Both; InternalChild = content = new Container { RelativeSizeAxes = Axes.Both }; } protected override void LoadComplete() { base.LoadComplete(); this.ScaleTo(0.75f).FadeTo(0) .Then() .ScaleTo(1f, 500, Easing.OutQuint).FadeTo(1f, 250, Easing.OutQuint); } public void Exit() { this.ScaleTo(1.25f, 500).FadeOut(250).Expire(); } } }
mit
C#
eb93706c26baec129a0f33d5833e30611ac636aa
Remove useless usings
EVAST9919/osu,NeoAdonis/osu,ZLima12/osu,ppy/osu,johnneijzen/osu,naoey/osu,ZLima12/osu,NeoAdonis/osu,naoey/osu,naoey/osu,johnneijzen/osu,smoogipoo/osu,UselessToucan/osu,DrabWeb/osu,peppy/osu-new,UselessToucan/osu,EVAST9919/osu,DrabWeb/osu,NeoAdonis/osu,Frontear/osuKyzer,2yangk23/osu,Nabile-Rahmani/osu,Drezi126/osu,peppy/osu,smoogipooo/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,ppy/osu,UselessToucan/osu,DrabWeb/osu,2yangk23/osu
osu.Game/Tests/Visual/TestCaseBreakOverlay.cs
osu.Game/Tests/Visual/TestCaseBreakOverlay.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Timing; using osu.Game.Beatmaps.Timing; using osu.Game.Screens.Play; using System.Collections.Generic; namespace osu.Game.Tests.Visual { internal class TestCaseBreakOverlay : OsuTestCase { public override string Description => @"Tests breaks behavior"; private readonly BreakOverlay breakOverlay; public TestCaseBreakOverlay() { Clock = new FramedClock(); Child = breakOverlay = new BreakOverlay(true); AddStep("Add 2s break", () => startBreak(2000)); AddStep("Add 5s break", () => startBreak(5000)); AddStep("Add 2 breaks (2s each)", startMultipleBreaks); } private void startBreak(double duration) { breakOverlay.Breaks = new List<BreakPeriod> { new BreakPeriod { StartTime = Clock.CurrentTime, EndTime = Clock.CurrentTime + duration, } }; breakOverlay.InitializeBreaks(); } private void startMultipleBreaks() { double currentTime = Clock.CurrentTime; breakOverlay.Breaks = new List<BreakPeriod> { new BreakPeriod { StartTime = currentTime, EndTime = currentTime + 2000, }, new BreakPeriod { StartTime = currentTime + 4000, EndTime = currentTime + 6000, } }; breakOverlay.InitializeBreaks(); } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Timing; using osu.Game.Beatmaps.Timing; using osu.Game.Screens.Play; using System.Collections.Generic; namespace osu.Game.Tests.Visual { internal class TestCaseBreakOverlay : OsuTestCase { public override string Description => @"Tests breaks behavior"; private readonly BreakOverlay breakOverlay; public TestCaseBreakOverlay() { Clock = new FramedClock(); Child = breakOverlay = new BreakOverlay(true); AddStep("Add 2s break", () => startBreak(2000)); AddStep("Add 5s break", () => startBreak(5000)); AddStep("Add 2 breaks (2s each)", startMultipleBreaks); } private void startBreak(double duration) { breakOverlay.Breaks = new List<BreakPeriod> { new BreakPeriod { StartTime = Clock.CurrentTime, EndTime = Clock.CurrentTime + duration, } }; breakOverlay.InitializeBreaks(); } private void startMultipleBreaks() { double currentTime = Clock.CurrentTime; breakOverlay.Breaks = new List<BreakPeriod> { new BreakPeriod { StartTime = currentTime, EndTime = currentTime + 2000, }, new BreakPeriod { StartTime = currentTime + 4000, EndTime = currentTime + 6000, } }; breakOverlay.InitializeBreaks(); } } }
mit
C#
8d5bf646a6da114a3dfbfa70e6bbdf6bcf8aadba
Update System Programming Lab2 AutomatonBuilder.cs
pugachAG/univ,pugachAG/univ,pugachAG/univ
SystemProgramming/Lab2/Lab2/Automaton/AutomatonBuilder.cs
SystemProgramming/Lab2/Lab2/Automaton/AutomatonBuilder.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Lab2.Automaton { public class AutomatonBuilder : IIOAutomatonBuilder { private FiniteStateAutomaton automaton = new FiniteStateAutomaton(); public void AddState(int identifier) { StateDescription state = new StateDescription(identifier.ToString()); automaton.AddNewState(state); } public void AddTransition(int from, int to, char? label) { StateDescription head = automaton.FindByName(from.ToString()); StateDescription tale = automaton.FindByName(to.ToString()); if (head == null || tale == null) { throw new ArgumentException(); } SymbolBase symbol = null; if (label.HasValue) { symbol = new CharSymbol(label.Value); } else { symbol = EpsilonSymbol.Instance; } head.AddNewTransition(symbol, tale); } public void SetStartState(int identifier) { StateDescription start = automaton.FindByName(identifier.ToString()); if (start == null) { throw new ArgumentException(); } start.IsStart = true; } public void SetFinishState(int identifier) { StateDescription finish = automaton.FindByName(identifier.ToString()); if (finish == null) { throw new ArgumentException(); } finish.IsFinish = true; } public IAutomaton GetAutomaton() { return automaton; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Lab2.Automaton { public class AutomatonBuilder : IIOAutomatonBuilder { private FiniteStateAutomaton automaton = new FiniteStateAutomaton(); public void AddState(int identifier) { StateDescription state = new StateDescription(identifier.ToString()); automaton.AddNewState(state); } public void AddTransition(int from, int to, char? label) { StateDescription head = automaton.FindByName(from.ToString()); StateDescription tale = automaton.FindByName(to.ToString()); if (head == null || tale == null) { throw new ArgumentException(); } SymbolBase symbol = null; if (label.HasValue) { symbol = new CharSymbol(label.Value); } else { symbol = new EpsilonSymbol(); } head.AddNewTransition(symbol, tale); } public void SetStartState(int identifier) { StateDescription start = automaton.FindByName(identifier.ToString()); if (start == null) { throw new ArgumentException(); } start.IsStart = true; } public void SetFinishState(int identifier) { StateDescription finish = automaton.FindByName(identifier.ToString()); if (finish == null) { throw new ArgumentException(); } finish.IsFinish = true; } public IAutomaton GetAutomaton() { return automaton; } } }
mit
C#
da4c9228147b008f94601c5b8d0b41b7f9e8155e
Mark MoveType with FlagsAttribute
ProgramFOX/Chess.NET
ChessDotNet/MoveType.cs
ChessDotNet/MoveType.cs
namespace ChessDotNet { [System.Flags] public enum MoveType { Invalid = 1, Move = 2, Capture = 4, Castling = 8, Promotion = 16 } }
namespace ChessDotNet { public enum MoveType { Move, Capture, Castling, Promotion, Invalid } }
mit
C#
999afb559fa8d45bc53d2c87aad560464c405d2a
Update sign-message.cs
klabarge/qz-print,gillg/qz-print,tresf/qz-print,tresf/qz-print,tresf/qz-print,gillg/qz-print,qzind/qz-print,klabarge/qz-print,gillg/qz-print,tresf/qz-print,klabarge/qz-print,klabarge/qz-print,tresf/qz-print,gillg/qz-print,tresf/qz-print,qzind/qz-print,klabarge/qz-print,klabarge/qz-print,qzind/qz-print,gillg/qz-print,qzind/qz-print,qzind/qz-print,qzind/qz-print,tresf/qz-print,klabarge/qz-print,tresf/qz-print,klabarge/qz-print,qzind/qz-print,gillg/qz-print,qzind/qz-print,gillg/qz-print,klabarge/qz-print,qzind/qz-print,tresf/qz-print,gillg/qz-print
assets/signing/sign-message.cs
assets/signing/sign-message.cs
/** * Echoes the signed message and exits */ public void SignMessage(String message) { // ######################################################### // # WARNING WARNING WARNING # // ######################################################### // # # // # This file is intended for demonstration purposes # // # only. # // # # // # It is the SOLE responsibility of YOU, the programmer # // # to prevent against unauthorized access to any signing # // # functions. # // # # // # Organizations that do not protect against un- # // # authorized signing will be black-listed to prevent # // # software piracy. # // # # // # -QZ Industries, LLC # // # # // ######################################################### // Sample key. Replace with one used for CSR generation // How to associate a private key with the X509Certificate2 class in .net // openssl pkcs12 -export -inkey private-key.pem -in digital-certificate.txt -out private-key.pfx var KEY = "private-key.pfx"; var PASS = "S3cur3P@ssw0rd"; var cert = new X509Certificate2( KEY, PASS ); RSACryptoServiceProvider csp = (RSACryptoServiceProvider)cert.PrivateKey; byte[] data = new ASCIIEncoding().GetBytes(message); byte[] hash = new SHA1Managed().ComputeHash(data); Response.ContentType = "text/plain"; Response.Write(csp.SignHash(hash, CryptoConfig.MapNameToOID("SHA1"))); Environment.Exit(0) }
/** * Echoes the signed message and exits */ public void SignMessage(String message) { // ######################################################### // # WARNING WARNING WARNING # // ######################################################### // # # // # This file is intended for demonstration purposes # // # only. # // # # // # It is the SOLE responsibility of YOU, the programmer # // # to prevent against unauthorized access to any signing # // # functions. # // # # // # Organizations that do not protect against un- # // # authorized signing will be black-listed to prevent # // # software piracy. # // # # // # -QZ Industries, LLC # // # # // ######################################################### // Sample key. Replace with one used for CSR generation // How to associate a private key with the X509Certificate2 class in .net // openssl pkcs12 -export -in private-key.pem -inkey digital-certificate.txt -out private-key.pfx var KEY = "private-key.pfx"; var PASS = "S3cur3P@ssw0rd"; var cert = new X509Certificate2( KEY, PASS ); RSACryptoServiceProvider csp = (RSACryptoServiceProvider)cert.PrivateKey; byte[] data = new ASCIIEncoding().GetBytes(message); byte[] hash = new SHA1Managed().ComputeHash(data); Response.ContentType = "text/plain"; Response.Write(csp.SignHash(hash, CryptoConfig.MapNameToOID("SHA1"))); Environment.Exit(0) }
lgpl-2.1
C#
bce576864407ea3507f87fee8b3e79f0d830060c
Read environment variables for test settings.
keith-hall/schemazen,Zocdoc/schemazen,sethreno/schemazen,sethreno/schemazen
test/ConfigHelper.cs
test/ConfigHelper.cs
using System; using System.Configuration; namespace SchemaZen.test { public class ConfigHelper { public static string TestDB { get { return GetSetting("testdb"); } } public static string TestSchemaDir { get { return GetSetting("test_schema_dir"); } } public static string SqlDbDiffPath { get { return GetSetting("SqlDbDiffPath"); } } private static string GetSetting(string key) { var val = Environment.GetEnvironmentVariable(key); return val ?? ConfigurationManager.AppSettings[key]; } } }
using System.Configuration; namespace SchemaZen.test { public class ConfigHelper { public static string TestDB { get { return ConfigurationManager.AppSettings["testdb"]; } } public static string TestSchemaDir { get { return ConfigurationManager.AppSettings["test_schema_dir"]; } } public static string SqlDbDiffPath { get { return ConfigurationManager.AppSettings["SqlDbDiffPath"]; } } } }
mit
C#
23e1cacc9bdfa74e774bf01a5639eea66a01a60f
introduce httpResponseMessage field
zhangyuan/UFO-API,zhangyuan/UFO-API,zhangyuan/UFO-API
test/ProductFacts.cs
test/ProductFacts.cs
using System.Linq; using System.Net; using System.Net.Http; using Newtonsoft.Json; using Xunit; namespace test { public class ProductFacts : TestBase { private HttpResponseMessage httpResponseMessage; [Fact] public void ShouldReturnOk() { var httpResponseMessage = Server.CreateRequest("api/products").GetAsync().Result; Assert.Equal(HttpStatusCode.OK, httpResponseMessage.StatusCode); } [Fact] public void ShouldReturnAllProducts() { httpResponseMessage = Get("api/products"); var products = Body(httpResponseMessage, new [] { new { Name = default(string) } }); Assert.Equal(1, products.Count()); Assert.Equal("Subway", products[0].Name); } private HttpResponseMessage Get(string path) { var httpResponseMessage = Server.CreateRequest(path).GetAsync().Result; return httpResponseMessage; } public T Body<T>(HttpResponseMessage httpResponseMessage, T anonymousTypeObject) { return JsonConvert.DeserializeAnonymousType(httpResponseMessage.Content.ReadAsStringAsync().Result, anonymousTypeObject); } } }
using System.Linq; using System.Net; using System.Net.Http; using Newtonsoft.Json; using Xunit; namespace test { public class ProductFacts : TestBase { [Fact] public void ShouldReturnOk() { var httpResponseMessage = Server.CreateRequest("api/products").GetAsync().Result; Assert.Equal(HttpStatusCode.OK, httpResponseMessage.StatusCode); } [Fact] public void ShouldReturnAllProducts() { var httpResponseMessage = Get("api/products"); var products = Body(httpResponseMessage, new [] { new { Name = default(string) } }); Assert.Equal(1, products.Count()); Assert.Equal("Subway", products[0].Name); } private HttpResponseMessage Get(string path) { var httpResponseMessage = Server.CreateRequest(path).GetAsync().Result; return httpResponseMessage; } public T Body<T>(HttpResponseMessage httpResponseMessage, T anonymousTypeObject) { return JsonConvert.DeserializeAnonymousType(httpResponseMessage.Content.ReadAsStringAsync().Result, anonymousTypeObject); } } }
mit
C#
258856ae9e79f3ba4dedcfaef5cbf3204ace9516
Bump version to v0.1
nicolaiarocci/Eve.NET
Eve.Client/Properties/AssemblyInfo.cs
Eve.Client/Properties/AssemblyInfo.cs
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Eve.NET")] [assembly: AssemblyDescription("Simple portable HTTP and REST Client for Humans")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Nicola Iarocci")] [assembly: AssemblyProduct("Eve.NET")] [assembly: AssemblyCopyright("Copyright © Nicola Iarocci and CIR2000 - 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")]
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Amica.vNext.Http")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CIR 2000")] [assembly: AssemblyProduct("Amica.vNext.Http")] [assembly: AssemblyCopyright("Copyright © CIR 2000 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // 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")]
bsd-3-clause
C#
71d8740b7d80a8fb545c7e58304ac940bc09c780
Check instance if attribute doesn't support section
SparkViewEngine/spark,RobertTheGrey/spark,SparkViewEngine/spark,SparkViewEngine/spark,SparkViewEngine/spark,SparkViewEngine/spark,SparkViewEngine/spark,RobertTheGrey/spark,RobertTheGrey/spark,RobertTheGrey/spark,RobertTheGrey/spark,RobertTheGrey/spark,SparkViewEngine/spark,RobertTheGrey/spark
src/Castle.MonoRail.Views.Spark/ViewComponentInfo.cs
src/Castle.MonoRail.Views.Spark/ViewComponentInfo.cs
// Copyright 2008-2009 Louis DeJardin - http://whereslou.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System; using System.Linq; using Castle.MonoRail.Framework; namespace Castle.MonoRail.Views.Spark { public class ViewComponentInfo { public ViewComponentInfo() { } public ViewComponentInfo(ViewComponent component) { Type = component.GetType(); Details = Type.GetCustomAttributes(typeof(ViewComponentDetailsAttribute), false).OfType<ViewComponentDetailsAttribute>().FirstOrDefault(); Instance = component; } public Type Type { get; set; } public ViewComponentDetailsAttribute Details { get; set; } public ViewComponent Instance { get; set; } public bool SupportsSection(string sectionName) { // only return if supporting in the attribute if (Details != null && Details.SupportsSection(sectionName) == true) return true; // research ahead for answer in the instance if available if (Instance != null) { // if a component doesn't provide an implementation the default may throw an exception try { if (Instance.SupportsSection(sectionName)) return true; } catch (NullReferenceException) { } } return false; } } }
// Copyright 2008-2009 Louis DeJardin - http://whereslou.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System; using System.Linq; using Castle.MonoRail.Framework; namespace Castle.MonoRail.Views.Spark { public class ViewComponentInfo { public ViewComponentInfo() { } public ViewComponentInfo(ViewComponent component) { Type = component.GetType(); Details = Type.GetCustomAttributes(typeof(ViewComponentDetailsAttribute), false).OfType<ViewComponentDetailsAttribute>().FirstOrDefault(); Instance = component; } public Type Type { get; set; } public ViewComponentDetailsAttribute Details { get; set; } public ViewComponent Instance { get; set; } public bool SupportsSection(string sectionName) { if (Details != null) return Details.SupportsSection(sectionName); if (Instance != null) { // if a component doesn't provide an implementation the default may throw an exception try { return Instance.SupportsSection(sectionName); } catch (NullReferenceException) { } } return false; } } }
apache-2.0
C#
26018a7b84686fb17a0aa2fca592783793f981fd
update version
jefking/King.Azure
King.Azure/Properties/AssemblyInfo.cs
King.Azure/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("King.Azure")] [assembly: AssemblyDescription("Azure Library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("King.Azure")] [assembly: AssemblyCopyright("Copyright © Jef King 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("4e7ae8fe-0ee3-44a4-bae7-2ea46062c10e")] [assembly: AssemblyVersion("1.0.0.13")] [assembly: AssemblyFileVersion("1.0.0.13")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("King.Azure")] [assembly: AssemblyDescription("Azure Library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("King.Azure")] [assembly: AssemblyCopyright("Copyright © Jef King 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("4e7ae8fe-0ee3-44a4-bae7-2ea46062c10e")] [assembly: AssemblyVersion("1.0.0.12")] [assembly: AssemblyFileVersion("1.0.0.12")]
apache-2.0
C#
8904ebd42216529a76bf2b959dc4834d1a3634ce
Update KeyGenerator/Program.cs
appharbor/AppHarbor.Web.Security
KeyGenerator/Program.cs
KeyGenerator/Program.cs
using System; using System.Runtime.Remoting.Metadata.W3cXsd2001; using System.Security.Cryptography; class Program { static void Main(string[] args) { using (var rijndael = new RijndaelManaged()) using (var hmacsha256 = new HMACSHA256()) { rijndael.GenerateKey(); hmacsha256.Initialize(); Console.WriteLine(template, new SoapHexBinary(rijndael.Key), new SoapHexBinary(hmacsha256.Key)); } Console.WriteLine("press any key to exit..."); Console.ReadKey(); } const string template = @"<add key=""cookieauthentication.encryptionkey"" value=""{0}""/> <add key=""cookieauthentication.validationkey"" value=""{1}""/>"; }
using System; using System.Runtime.Remoting.Metadata.W3cXsd2001; using System.Security.Cryptography; class Program { static void Main(string[] args) { using (var rijndael = new RijndaelManaged()) using (var hmacsha256 = new HMACSHA256()) { rijndael.GenerateKey(); hmacsha256.Initialize(); Console.WriteLine(template, new SoapHexBinary(rijndael.Key), new SoapHexBinary(hmacsha256.Key)); } Console.WriteLine("press any key to exit..."); Console.ReadKey(); } const string template = @"<add key=""cookieauthentication.encryptionkey"" value=""{0}""/> <add key=""cookieauthentication.validationkey"" value=""{2}""/>"; }
mit
C#
cf111ad7b6543b121b1e5a4aa4315b6ac4d7464a
Add missing null check to NestedLoops.cs.
ddpruitt/morelinq,smzinovyev/MoreLINQ,fsateler/MoreLINQ,ddpruitt/morelinq,fsateler/MoreLINQ,morelinq/MoreLINQ,morelinq/MoreLINQ
MoreLinq/NestedLoops.cs
MoreLinq/NestedLoops.cs
#region License and Terms // MoreLINQ - Extensions to LINQ to Objects // Copyright (c) 2008 Jonathan Skeet. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion namespace MoreLinq { using System; using System.Collections.Generic; using System.Linq; public static partial class MoreEnumerable { // This extension method was developed (primarily) to support the // implementation of the Permutations() extension methods. However, // it is of sufficient generality and usefulness to be elevated to // a public extension method in its own right. /// <summary> /// Produces a sequence from an action based on the dynamic generation of N nested loops /// who iteration counts are defined by <paramref name="loopCounts"/>. /// </summary> /// <param name="action">Action delegate for which to produce a nested loop sequence</param> /// <param name="loopCounts">A sequence of loop repetition counts</param> /// <returns>A sequence of Action representing the expansion of a set of nested loops</returns> public static IEnumerable<Action> NestedLoops(this Action action, IEnumerable<int> loopCounts) { if (action == null) throw new ArgumentNullException("action"); if (loopCounts == null) throw new ArgumentNullException("loopCounts"); using (var iter = loopCounts.GetEnumerator()) { var loopCount = NextLoopCount(iter); if (loopCount == null) return Enumerable.Empty<Action>(); // null loop var loop = Enumerable.Repeat(action, loopCount.Value); while ((loopCount = NextLoopCount(iter)) != null) loop = loop.Repeat(loopCount.Value); return loop; } } private static int? NextLoopCount(IEnumerator<int> iter) { if (!iter.MoveNext()) return null; if (iter.Current < 0) throw new ArgumentException("All loop counts must be greater than or equal to zero.", "loopCounts"); return iter.Current; } } }
#region License and Terms // MoreLINQ - Extensions to LINQ to Objects // Copyright (c) 2008 Jonathan Skeet. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion namespace MoreLinq { using System; using System.Collections.Generic; using System.Linq; public static partial class MoreEnumerable { // This extension method was developed (primarily) to support the // implementation of the Permutations() extension methods. However, // it is of sufficient generality and usefulness to be elevated to // a public extension method in its own right. /// <summary> /// Produces a sequence from an action based on the dynamic generation of N nested loops /// who iteration counts are defined by <paramref name="loopCounts"/>. /// </summary> /// <param name="action">Action delegate for which to produce a nested loop sequence</param> /// <param name="loopCounts">A sequence of loop repetition counts</param> /// <returns>A sequence of Action representing the expansion of a set of nested loops</returns> public static IEnumerable<Action> NestedLoops(this Action action, IEnumerable<int> loopCounts) { if (loopCounts == null) throw new ArgumentNullException("loopCounts"); using (var iter = loopCounts.GetEnumerator()) { var loopCount = NextLoopCount(iter); if (loopCount == null) return Enumerable.Empty<Action>(); // null loop var loop = Enumerable.Repeat(action, loopCount.Value); while ((loopCount = NextLoopCount(iter)) != null) loop = loop.Repeat(loopCount.Value); return loop; } } private static int? NextLoopCount(IEnumerator<int> iter) { if (!iter.MoveNext()) return null; if (iter.Current < 0) throw new ArgumentException("All loop counts must be greater than or equal to zero.", "loopCounts"); return iter.Current; } } }
apache-2.0
C#
d09522d955564ebe2ac4c6d0ccf2e0b781f8ca5b
Update NTask.cs
demigor/nreact
NReact/Classes/NTask.cs
NReact/Classes/NTask.cs
using System; using System.Diagnostics; using System.Threading; #if NETFX_CORE using Windows.System.Threading; #endif namespace NReact { public class NDispatcher { public static readonly NDispatcher Default = new NDispatcher(); #if !NETFX_CORE Thread _taskProcessor; #endif AutoResetEvent _signal = new AutoResetEvent(false); NTask _head; NDispatcher() { #if NETFX_CORE ThreadPool.RunAsync(Process); #else _taskProcessor = new Thread(Process) { IsBackground = true }; _taskProcessor.Start(); #endif } void Process(object obj) { try { while (true) { _signal.WaitOne(); var head = Interlocked.Exchange(ref _head, null); if (head != null) head.BackwardRun(); } } catch { Debugger.Launch(); } } void Enqueue(NTask task) { #if DUMP Debug.WriteLine("Enqueue Task"); #endif while (true) { var head = _head; task.Next = head; if (Interlocked.CompareExchange(ref _head, task, head) == head) { _signal.Set(); break; } } } public void Enqueue(Action task) { Enqueue(new NTask { Action = task }); } class NTask { internal NTask Next; public Action Action; public void BackwardRun() { if (Next != null) Next.BackwardRun(); Action(); } } } }
using System; using System.Diagnostics; using System.Threading; #if NETFX_CORE using Windows.System.Threading; #endif namespace NReact { class NDispatcher { public static readonly NDispatcher Default = new NDispatcher(); #if !NETFX_CORE Thread _taskProcessor; #endif AutoResetEvent _signal = new AutoResetEvent(false); NTask _head; NDispatcher() { #if NETFX_CORE ThreadPool.RunAsync(Process); #else _taskProcessor = new Thread(Process) { IsBackground = true }; _taskProcessor.Start(); #endif } void Process(object obj) { try { while (true) { _signal.WaitOne(); var head = Interlocked.Exchange(ref _head, null); if (head != null) head.BackwardRun(); } } catch { Debugger.Launch(); } } void Enqueue(NTask task) { #if DUMP Debug.WriteLine("Enqueue " + task); #endif while (true) { var head = _head; task.Next = head; if (Interlocked.CompareExchange(ref _head, task, head) == head) { _signal.Set(); break; } } } public void Enqueue(Action task) { Enqueue(new NTask { Action = task }); } internal void EnqueueUpdate(NComponent component) { Enqueue(component.UpdateCore); } class NTask { internal NTask Next; public Action Action; public void BackwardRun() { if (Next != null) Next.BackwardRun(); Action(); } } } }
mit
C#
c4eecf2480fa0cb1924df562024c4a3d580333de
Add extra property to use new long Id's
MiXTelematics/MiX.Integrate.Api.Client
MiX.Integrate.Shared/Entities/Messages/SendJobMessageCarrier.cs
MiX.Integrate.Shared/Entities/Messages/SendJobMessageCarrier.cs
using System; using System.Collections.Generic; using System.Text; using MiX.Integrate.Shared.Entities.Communications; namespace MiX.Integrate.Shared.Entities.Messages { public class SendJobMessageCarrier { public SendJobMessageCarrier() { } public short VehicleId { get; set; } public string Description { get; set; } public string UserDescription { get; set; } public string Body { get; set; } public DateTime? StartDate { get; set; } public DateTime? ExpiryDate { get; set; } public bool RequiresAddress { get; set; } public bool AddAddressSummary { get; set; } public bool UseFirstAddressForSummary { get; set; } public JobMessageActionNotifications NotificationSettings { get; set; } public int[] AddressList { get; set; } public long[] LocationList { get; set; } public CommsTransports Transport { get; set; } public bool Urgent { get; set; } } }
using System; using System.Collections.Generic; using System.Text; using MiX.Integrate.Shared.Entities.Communications; namespace MiX.Integrate.Shared.Entities.Messages { public class SendJobMessageCarrier { public SendJobMessageCarrier() { } public short VehicleId { get; set; } public string Description { get; set; } public string UserDescription { get; set; } public string Body { get; set; } public DateTime? StartDate { get; set; } public DateTime? ExpiryDate { get; set; } public bool RequiresAddress { get; set; } public bool AddAddressSummary { get; set; } public bool UseFirstAddressForSummary { get; set; } public JobMessageActionNotifications NotificationSettings { get; set; } public long[] AddressList { get; set; } public CommsTransports Transport { get; set; } public bool Urgent { get; set; } } }
mit
C#
1a83413e06761b402a39e9fa22155fe7c20c6c19
refactor and integrate Trie and Patricia Trie
gawronsk/triedictive-text
TrieExperimentPlatform/TrieExperimentPlatform/TrieExperiment.cs
TrieExperimentPlatform/TrieExperimentPlatform/TrieExperiment.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Gma.DataStructures.StringSearch; namespace TrieExperimentPlatform { class TrieExperiment { static void Main(string[] args) { string[] lines = System.IO.File.ReadAllLines(@"..\..\Data\count_1w_small.txt"); Console.WriteLine("Read {0} lines from file", lines.Length); var words = lines .Select(x => x.Split('\t').FirstOrDefault()) .Where(x => !String.IsNullOrEmpty(x)) .ToArray(); RunExperiment(new Trie<string>(), words); RunExperiment(new SuffixTrie<string>(0), words); RunExperiment(new PatriciaTrie<string>(), words); //RunExperiment(new PatriciaSuffixTrie<string>(0), words); Console.Read(); } public static void RunExperiment(ITrie<string> trie, IEnumerable<string> words) { Console.WriteLine("Running experiment for: " + trie.GetType().ToString()); var s = Stopwatch.StartNew(); var proc = Process.GetCurrentProcess(); var startMemory = proc.WorkingSet64; // build trie foreach (var word in words) { trie.Add(word, word); } s.Stop(); Console.WriteLine("Elapsed Time Building Tree: {0} ms", s.ElapsedMilliseconds); s = Stopwatch.StartNew(); //run experiment RandomTestcaseProvider testcase = new RandomTestcaseProvider(); foreach (var testWord in testcase.GetTestWords()) { var result = trie.Retrieve(testWord); //Console.WriteLine(String.Join(" ", result)); } s.Stop(); Console.WriteLine("Elapsed Time Running Experiment: {0} ms", s.ElapsedMilliseconds); var endMemory = proc.WorkingSet64; Console.WriteLine("Memory Usage: {0}", endMemory - startMemory); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Gma.DataStructures.StringSearch; namespace TrieExperimentPlatform { class TrieExperiment { static void Main(string[] args) { string[] lines = System.IO.File.ReadAllLines(@"..\..\Data\count_1w_small.txt"); Console.WriteLine("Read {0} lines from file", lines.Length); var s = Stopwatch.StartNew(); var proc = Process.GetCurrentProcess(); var startMemory = proc.WorkingSet64; var SuffixTrie = new SuffixTrie<string>(0); // build trie foreach(var line in lines) { var word = line.Split('\t').FirstOrDefault(); if (word != null) { // add to trie SuffixTrie.Add(word, word); } } s.Stop(); Console.WriteLine("Elapsed Time Building Tree: {0} ms", s.ElapsedMilliseconds); s = Stopwatch.StartNew(); //run experiment RandomTestcaseProvider testcase = new RandomTestcaseProvider(); foreach(var testWord in testcase.GetTestWords()) { var result = SuffixTrie.Retrieve(testWord); //Console.WriteLine(String.Join(" ", result)); } s.Stop(); Console.WriteLine("Elapsed Time Running Experiment: {0} ms", s.ElapsedMilliseconds); var endMemory = proc.WorkingSet64; Console.WriteLine("Memory Usage: {0}", endMemory - startMemory); Console.Read(); } } }
unlicense
C#
3efaeaa4fad3d365582b0575e430682e5e0ed0e1
Fix DeviceIdentifier to return sensible values.
ValentinMinder/pocketcampus,ValentinMinder/pocketcampus,ValentinMinder/pocketcampus,ValentinMinder/pocketcampus,ValentinMinder/pocketcampus,ValentinMinder/pocketcampus,ValentinMinder/pocketcampus,ValentinMinder/pocketcampus,ValentinMinder/pocketcampus
Windows/Source/Main.WindowsRuntime/Services/DeviceIdentifier.cs
Windows/Source/Main.WindowsRuntime/Services/DeviceIdentifier.cs
// Copyright (c) PocketCampus.Org 2014-15 // See LICENSE file for more details // File author: Solal Pirelli using System; using System.Runtime.InteropServices.WindowsRuntime; using PocketCampus.Common.Services; using Windows.System.Profile; namespace PocketCampus.Main.Services { public sealed class DeviceIdentifier : IDeviceIdentifier { private static string _current; public string Current { get { if ( _current == null ) { var token = HardwareIdentification.GetPackageSpecificToken( null ); _current = BitConverter.ToString( token.Id.ToArray() ); } return _current; } } } }
// Copyright (c) PocketCampus.Org 2014-15 // See LICENSE file for more details // File author: Solal Pirelli using System.Runtime.InteropServices.WindowsRuntime; using System.Text; using PocketCampus.Common.Services; using Windows.System.Profile; namespace PocketCampus.Main.Services { public sealed class DeviceIdentifier : IDeviceIdentifier { private static string _current; public string Current { get { if ( _current == null ) { var token = HardwareIdentification.GetPackageSpecificToken( null ); _current = TokenToString( token ); } return _current; } } private static string TokenToString( HardwareToken token ) { var bytes = token.Id.ToArray(); return Encoding.UTF8.GetString( bytes, 0, bytes.Length ); } } }
bsd-3-clause
C#
fc9d0e55c9df3374fe36cfef30f2bd97ecb859f7
remove unused field
LayoutFarm/PixelFarm
a_mini/projects/PixelFarm/MiniAgg/04_Scanline/0_ScanlineSpan.cs
a_mini/projects/PixelFarm/MiniAgg/04_Scanline/0_ScanlineSpan.cs
//BSD, 2014-2016, WinterDev //---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // C# Port port by: Lars Brubaker // larsbrubaker@gmail.com // Copyright (C) 2007 // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Class scanline_p - a general purpose scanline container with packed spans. // //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates (scanline32_p) has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- namespace PixelFarm.Agg { public struct ScanlineSpan { public readonly short x; public short len; //+ or - public readonly short cover_index; public ScanlineSpan(int x, int cover_index) { this.x = (short)x; this.len = 1; this.cover_index = (short)cover_index; } public ScanlineSpan(int x, int len, int cover_index) { this.x = (short)x; this.len = (short)len; this.cover_index = (short)cover_index; } #if DEBUG public override string ToString() { return "x:" + x + ",len:" + len + ",cover:" + cover_index; } #endif } }
//BSD, 2014-2016, WinterDev //---------------------------------------------------------------------------- // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // // C# Port port by: Lars Brubaker // larsbrubaker@gmail.com // Copyright (C) 2007 // // Permission to copy, use, modify, sell and distribute this software // is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // //---------------------------------------------------------------------------- // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://www.antigrain.com //---------------------------------------------------------------------------- // // Class scanline_p - a general purpose scanline container with packed spans. // //---------------------------------------------------------------------------- // // Adaptation for 32-bit screen coordinates (scanline32_p) has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. // //---------------------------------------------------------------------------- namespace PixelFarm.Agg { public struct ScanlineSpan { public readonly short x; public short len; //+ or - public readonly short cover_index; public bool isDownHill; public ScanlineSpan(int x, int cover_index) { this.x = (short)x; this.len = 1; this.cover_index = (short)cover_index; this.isDownHill = false; } public ScanlineSpan(int x, int len, int cover_index) { this.x = (short)x; this.len = (short)len; this.cover_index = (short)cover_index; this.isDownHill = false; } #if DEBUG public override string ToString() { return "x:" + x + ",len:" + len + ",cover:" + cover_index; } #endif } }
bsd-2-clause
C#
4b5da9b3ffcc4d5a94691dab767f8961d7c52a51
Edit it
jogibear9988/websocket-sharp,sta/websocket-sharp,2Toad/websocket-sharp,sta/websocket-sharp,2Toad/websocket-sharp,jogibear9988/websocket-sharp,2Toad/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp,2Toad/websocket-sharp
websocket-sharp/Server/HttpRequestEventArgs.cs
websocket-sharp/Server/HttpRequestEventArgs.cs
#region License /* * HttpRequestEventArgs.cs * * The MIT License * * Copyright (c) 2012-2015 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion using System; using WebSocketSharp.Net; namespace WebSocketSharp.Server { /// <summary> /// Represents the event data for the HTTP request events of /// the <see cref="HttpServer"/>. /// </summary> /// <remarks> /// <para> /// An HTTP request event occurs when the <see cref="HttpServer"/> /// receives an HTTP request. /// </para> /// <para> /// You should access the <see cref="Request"/> property if you would /// like to get the request data sent from a client. /// </para> /// <para> /// And you should access the <see cref="Response"/> property if you would /// like to get the response data to return to the client. /// </para> /// </remarks> public class HttpRequestEventArgs : EventArgs { #region Private Fields private HttpListenerContext _context; #endregion #region Internal Constructors internal HttpRequestEventArgs (HttpListenerContext context) { _context = context; } #endregion #region Public Properties /// <summary> /// Gets the HTTP request data sent from a client. /// </summary> /// <value> /// A <see cref="HttpListenerRequest"/> that represents the request data. /// </value> public HttpListenerRequest Request { get { return _context.Request; } } /// <summary> /// Gets the HTTP response data to return to the client. /// </summary> /// <value> /// A <see cref="HttpListenerResponse"/> that represents the response data. /// </value> public HttpListenerResponse Response { get { return _context.Response; } } #endregion } }
#region License /* * HttpRequestEventArgs.cs * * The MIT License * * Copyright (c) 2012-2015 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion using System; using WebSocketSharp.Net; namespace WebSocketSharp.Server { /// <summary> /// Represents the event data for the HTTP request events of /// the <see cref="HttpServer"/>. /// </summary> /// <remarks> /// <para> /// An HTTP request event occurs when the <see cref="HttpServer"/> /// receives an HTTP request. /// </para> /// <para> /// You should access the <see cref="Request"/> property if you would /// like to get the request data sent from a client. /// </para> /// <para> /// And you should access the <see cref="Response"/> property if you would /// like to get the response data to return to the client. /// </para> /// </remarks> public class HttpRequestEventArgs : EventArgs { #region Private Fields private HttpListenerContext _context; #endregion #region Internal Constructors internal HttpRequestEventArgs (HttpListenerContext context) { _context = context; } #endregion #region Public Properties /// <summary> /// Gets the HTTP request data sent from a client. /// </summary> /// <value> /// A <see cref="HttpListenerRequest"/> that represents the request data. /// </value> public HttpListenerRequest Request { get { return _context.Request; } } /// <summary> /// Gets the HTTP response data used to return a response to the client. /// </summary> /// <value> /// A <see cref="HttpListenerResponse"/> that represents the response data. /// </value> public HttpListenerResponse Response { get { return _context.Response; } } #endregion } }
mit
C#
039bd52b4399e5cb39d568905cddf6dfe8916bd7
add a link to older logs
codingteam/codingteam.org.ru,codingteam/codingteam.org.ru
Views/Home/Index.cshtml
Views/Home/Index.cshtml
<p>Welcome! Codingteam is an open community of engineers and programmers.</p> <p>And here're today's conference logs:</p> <iframe class="logs" src="@ViewData["LogUrl"]"></iframe> <a href="/old-logs/codingteam@conference.jabber.ru/">Older logs (mostly actual in period 2008-08-22 — 2016-12-09)</a>
<p>Welcome! Codingteam is an open community of engineers and programmers.</p> <p>And here're today's conference logs:</p> <iframe class="logs" src="@ViewData["LogUrl"]"></iframe>
mit
C#
0d4576e599e7ffd22c41716c903afc0ac121bd8f
Bump version
thesmallbang/EverquestOpenParser
OpenParser/Properties/AssemblyInfo.cs
OpenParser/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("OpenParser")] [assembly: AssemblyDescription("Open Source parser for Everquest log files")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Daniel Dorantes")] [assembly: AssemblyProduct("OpenParser")] [assembly: AssemblyCopyright("")] [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("2a1ca212-29dc-42ac-ba76-ecf5936a8786")] // 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.4.0")] [assembly: AssemblyFileVersion("1.0.4.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("OpenParser")] [assembly: AssemblyDescription("Open Source parser for Everquest log files")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Daniel Dorantes")] [assembly: AssemblyProduct("OpenParser")] [assembly: AssemblyCopyright("")] [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("2a1ca212-29dc-42ac-ba76-ecf5936a8786")] // 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.0")] [assembly: AssemblyFileVersion("1.0.3.0")]
mit
C#
9f28c4c033264d8b7a8701c5b326a73abf65125b
Adjust test values
ppy/osu,ppy/osu,peppy/osu,peppy/osu,peppy/osu,ppy/osu
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Osu.Difficulty; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; [TestCase(6.7115569159190587d, 206, "diffcalc-test")] [TestCase(1.4391311903612753d, 45, "zero-length-sliders")] public void Test(double expectedStarRating, int expectedMaxCombo, string name) => base.Test(expectedStarRating, expectedMaxCombo, name); [TestCase(8.9757300665532966d, 206, "diffcalc-test")] [TestCase(1.7437232654020756d, 45, "zero-length-sliders")] public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name) => Test(expectedStarRating, expectedMaxCombo, name, new OsuModDoubleTime()); [TestCase(6.7115569159190587d, 239, "diffcalc-test")] [TestCase(1.4391311903612753d, 54, "zero-length-sliders")] public void TestClassicMod(double expectedStarRating, int expectedMaxCombo, string name) => Test(expectedStarRating, expectedMaxCombo, name, new OsuModClassic()); protected override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset().RulesetInfo, beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Osu.Difficulty; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; [TestCase(6.6369583000323935d, 206, "diffcalc-test")] [TestCase(1.4476531024675374d, 45, "zero-length-sliders")] public void Test(double expectedStarRating, int expectedMaxCombo, string name) => base.Test(expectedStarRating, expectedMaxCombo, name); [TestCase(8.8816128335486386d, 206, "diffcalc-test")] [TestCase(1.7540389962596916d, 45, "zero-length-sliders")] public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name) => Test(expectedStarRating, expectedMaxCombo, name, new OsuModDoubleTime()); [TestCase(6.6369583000323935d, 239, "diffcalc-test")] [TestCase(1.4476531024675374d, 54, "zero-length-sliders")] public void TestClassicMod(double expectedStarRating, int expectedMaxCombo, string name) => Test(expectedStarRating, expectedMaxCombo, name, new OsuModClassic()); protected override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset().RulesetInfo, beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } }
mit
C#
775c4bad973c3f9afba809851b0b63add97929a1
Remove unneeded lifetime assignment
smoogipoo/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu
osu.Game.Rulesets.Catch/Objects/Drawables/CaughtObject.cs
osu.Game.Rulesets.Catch/Objects/Drawables/CaughtObject.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Skinning; using osuTK; using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawables { /// <summary> /// Represents a <see cref="PalpableCatchHitObject"/> caught by the catcher. /// </summary> [Cached(typeof(IHasCatchObjectState))] public abstract class CaughtObject : SkinnableDrawable, IHasCatchObjectState { public PalpableCatchHitObject HitObject { get; private set; } public Bindable<Color4> AccentColour { get; } = new Bindable<Color4>(); public Bindable<bool> HyperDash { get; } = new Bindable<bool>(); /// <summary> /// Whether this hit object should stay on the catcher plate when the object is caught by the catcher. /// </summary> public virtual bool StaysOnPlate => true; public override bool RemoveWhenNotAlive => true; protected CaughtObject(CatchSkinComponents skinComponent, Func<ISkinComponent, Drawable> defaultImplementation) : base(new CatchSkinComponent(skinComponent), defaultImplementation) { Origin = Anchor.Centre; RelativeSizeAxes = Axes.None; Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2); } /// <summary> /// Copies the hit object visual state from another <see cref="IHasCatchObjectState"/> object. /// </summary> public virtual void CopyStateFrom(IHasCatchObjectState objectState) { HitObject = objectState.HitObject; Scale = objectState.Scale; Rotation = objectState.Rotation; AccentColour.Value = objectState.AccentColour.Value; HyperDash.Value = objectState.HyperDash.Value; } protected override void FreeAfterUse() { ClearTransforms(); Alpha = 1; base.FreeAfterUse(); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Skinning; using osuTK; using osuTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawables { /// <summary> /// Represents a <see cref="PalpableCatchHitObject"/> caught by the catcher. /// </summary> [Cached(typeof(IHasCatchObjectState))] public abstract class CaughtObject : SkinnableDrawable, IHasCatchObjectState { public PalpableCatchHitObject HitObject { get; private set; } public Bindable<Color4> AccentColour { get; } = new Bindable<Color4>(); public Bindable<bool> HyperDash { get; } = new Bindable<bool>(); /// <summary> /// Whether this hit object should stay on the catcher plate when the object is caught by the catcher. /// </summary> public virtual bool StaysOnPlate => true; public override bool RemoveWhenNotAlive => true; protected CaughtObject(CatchSkinComponents skinComponent, Func<ISkinComponent, Drawable> defaultImplementation) : base(new CatchSkinComponent(skinComponent), defaultImplementation) { Origin = Anchor.Centre; RelativeSizeAxes = Axes.None; Size = new Vector2(CatchHitObject.OBJECT_RADIUS * 2); } /// <summary> /// Copies the hit object visual state from another <see cref="IHasCatchObjectState"/> object. /// </summary> public virtual void CopyStateFrom(IHasCatchObjectState objectState) { HitObject = objectState.HitObject; Scale = objectState.Scale; Rotation = objectState.Rotation; AccentColour.Value = objectState.AccentColour.Value; HyperDash.Value = objectState.HyperDash.Value; } protected override void FreeAfterUse() { ClearTransforms(); Alpha = 1; LifetimeStart = double.MinValue; LifetimeEnd = double.MaxValue; base.FreeAfterUse(); } } }
mit
C#
f5c12cf18b616a76961062361dd1932f2c17d853
Remove unused property from Track model
gusper/Peekify,gusper/SpotiPeek
SpotiPeek/SpotiPeek.App/TrackModel.cs
SpotiPeek/SpotiPeek.App/TrackModel.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SpotiPeek.App { class TrackModel { public string SongTitle; public string ArtistName; public string AlbumTitle; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SpotiPeek.App { class TrackModel { public string SongTitle; public string ArtistName; public string AlbumTitle; public string AlbumYear; } }
mit
C#
791779913e6c554cef7e34e07ee01854e3c73966
add DefaultFileSystems
CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos
source/Cosmos.System2/FileSystem/VFS/FileSystemManager.cs
source/Cosmos.System2/FileSystem/VFS/FileSystemManager.cs
using System; using System.Collections.Generic; namespace Cosmos.System.FileSystem.VFS { public static class FileSystemManager { private static List<FileSystemFactory> registeredFileSystems = DefaultFileSystems; public static List<FileSystemFactory> DefaultFileSystems { get { return new List<FileSystemFactory>() { new FAT.FatFileSystemFactory(), new ISO9660.ISO9660FileSystemFactory() }; } } public static List<FileSystemFactory> RegisteredFileSystems { get { return registeredFileSystems; }} public static bool Register(FileSystemFactory factory) { foreach (var item in registeredFileSystems) { if(item.Name == factory.Name) { return false; } } registeredFileSystems.Add(factory); return true; } public static bool Remove(FileSystemFactory factory) { return Remove(factory.Name); } public static bool Remove(string factoryName) { foreach (var item in registeredFileSystems) { if(item.Name == factoryName) { registeredFileSystems.Remove(item); return true; } } return false; } } }
using System; using System.Collections.Generic; namespace Cosmos.System.FileSystem.VFS { public static class FileSystemManager { private static List<FileSystemFactory> registeredFileSystems = new List<FileSystemFactory>() { new FAT.FatFileSystemFactory(), new ISO9660.ISO9660FileSystemFactory() }; public static List<FileSystemFactory> RegisteredFileSystems { get { return registeredFileSystems; }} public static bool Register(FileSystemFactory factory) { foreach (var item in registeredFileSystems) { if(item.Name == factory.Name) { return false; } } registeredFileSystems.Add(factory); return true; } public static bool Remove(FileSystemFactory factory) { return Remove(factory.Name); } public static bool Remove(string factoryName) { foreach (var item in registeredFileSystems) { if(item.Name == factoryName) { registeredFileSystems.Remove(item); return true; } } return false; } } }
bsd-3-clause
C#
76fa2d1734e38c28d99ffc73c8d73b682e2b19b6
Fix Empty
yufeih/Common
src/CommonTasks.cs
src/CommonTasks.cs
namespace System.Threading.Tasks { using System.Collections.Generic; using System.IO; using System.Linq; static class CommonTasks { public static readonly Task Completed = Task.FromResult(true); public static readonly Task<bool> True = Task.FromResult(true); public static readonly Task<bool> False = Task.FromResult(false); public static readonly Task<string> NullString = Task.FromResult<string>(null); public static readonly Task<string> EmptyString = Task.FromResult(""); public static readonly Task<Stream> NullStream = Task.FromResult<Stream>(null); public static Task<T> Null<T>() where T : class => Nulls<T>.Value; public static Task<T> Default<T>() => Defaults<T>.Value; public static Task<IEnumerable<T>> Empty<T>() => Emptys<T>.Value; public static Task<T[]> EmptyArray<T>() => EmptyArrays<T>.Value; class Defaults<T> { public static readonly Task<T> Value = Task.FromResult(default(T)); } class Nulls<T> where T : class { public static readonly Task<T> Value = Task.FromResult<T>(null); } class Emptys<T> { public static readonly Task<IEnumerable<T>> Value = Task.FromResult(Enumerable.Empty<T>()); } class EmptyArrays<T> { public static readonly Task<T[]> Value = Task.FromResult(new T[0]); } public static void Go(this Task task) { } } static class Empty { public static T[] Array<T>() => Backing<T>.Array; public static List<T> List<T>() => Backing<T>.List; public static Dictionary<TKey, TValue> Dictionary<TKey, TValue>() => Backing<TKey, TValue>.Dictionary; class Backing<T> { public static readonly T[] Array = new T[0]; public static readonly List<T> List = new List<T>(0); } class Backing<T1, T2> { public static readonly Dictionary<T1, T2> Dictionary = new Dictionary<T1, T2>(0); } } }
namespace System.Threading.Tasks { using System.Collections.Generic; using System.IO; using System.Linq; static class CommonTasks { public static readonly Task Completed = Task.FromResult(true); public static readonly Task<bool> True = Task.FromResult(true); public static readonly Task<bool> False = Task.FromResult(false); public static readonly Task<string> NullString = Task.FromResult<string>(null); public static readonly Task<string> EmptyString = Task.FromResult(""); public static readonly Task<Stream> NullStream = Task.FromResult<Stream>(null); public static Task<T> Null<T>() where T : class => Nulls<T>.Value; public static Task<T> Default<T>() => Defaults<T>.Value; public static Task<IEnumerable<T>> Empty<T>() => Emptys<T>.Value; public static Task<T[]> EmptyArray<T>() => EmptyArrays<T>.Value; class Defaults<T> { public static readonly Task<T> Value = Task.FromResult(default(T)); } class Nulls<T> where T : class { public static readonly Task<T> Value = Task.FromResult<T>(null); } class Emptys<T> { public static readonly Task<IEnumerable<T>> Value = Task.FromResult(Enumerable.Empty<T>()); } class EmptyArrays<T> { public static readonly Task<T[]> Value = Task.FromResult(new T[0]); } public static void Go(this Task task) { } } static class Empty { public static Array<T> => Backing<T>.Array; public static List<T> => Backing<T>.List; public static Dictionary<TKey, TValue> => Backing<TKey, TValue>.Dictionary; class Backing<T> { public static readonly T[] Array = new T[0]; public static readonly List<T> List = new List<T>(0); } class Backing<T1, T2> { public static readonly Dictionary<T1, T2> Dictionary = new Dictionary<T1, T2>(0); } } }
mit
C#
c2d4672b8deadc8ddfc471b31cada648cbf837ed
Add osu! prefix to mode descriptions.
EVAST9919/osu,peppy/osu-new,smoogipoo/osu,naoey/osu,NeoAdonis/osu,EVAST9919/osu,DrabWeb/osu,smoogipooo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,ppy/osu,peppy/osu,smoogipoo/osu,DrabWeb/osu,theguii/osu,naoey/osu,UselessToucan/osu,NeoAdonis/osu,tacchinotacchi/osu,Drezi126/osu,smoogipoo/osu,2yangk23/osu,johnneijzen/osu,NotKyon/lolisu,ZLima12/osu,naoey/osu,ppy/osu,peppy/osu,nyaamara/osu,ppy/osu,2yangk23/osu,Nabile-Rahmani/osu,Frontear/osuKyzer,default0/osu,johnneijzen/osu,ZLima12/osu,UselessToucan/osu,RedNesto/osu,DrabWeb/osu,Damnae/osu,osu-RP/osu-RP
osu.Game/GameModes/Play/PlayMode.cs
osu.Game/GameModes/Play/PlayMode.cs
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; namespace osu.Game.GameModes.Play { public enum PlayMode { [Description(@"osu!")] Osu = 0, [Description(@"osu!taiko")] Taiko = 1, [Description(@"osu!catch")] Catch = 2, [Description(@"osu!mania")] Mania = 3 } }
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; namespace osu.Game.GameModes.Play { public enum PlayMode { [Description(@"osu!")] Osu = 0, [Description(@"taiko")] Taiko = 1, [Description(@"catch")] Catch = 2, [Description(@"mania")] Mania = 3 } }
mit
C#
8216aabbf8eb3e73352988dd97cbe1681c16807d
Remove empty line.
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
src/MitternachtBot/Modules/Games/Services/GamesService.cs
src/MitternachtBot/Modules/Games/Services/GamesService.cs
using System; using System.Collections.Concurrent; using System.Linq; using System.Threading; using Mitternacht.Modules.Games.Common; using Mitternacht.Services; namespace Mitternacht.Modules.Games.Services { public class GamesService : IMService { private readonly IBotConfigProvider _bcp; public readonly ConcurrentDictionary<ulong, GirlRating> GirlRatings = new ConcurrentDictionary<ulong, GirlRating>(); public string[] EightBallResponses => _bcp.BotConfig.EightBallResponses.Select(ebr => ebr.Text).ToArray(); public GamesService(IBotConfigProvider bcp) { _bcp = bcp; var timer = new Timer(_ => { GirlRatings.Clear(); }, null, TimeSpan.FromDays(1), TimeSpan.FromDays(1)); } } }
using System; using System.Collections.Concurrent; using System.Linq; using System.Threading; using Mitternacht.Modules.Games.Common; using Mitternacht.Services; namespace Mitternacht.Modules.Games.Services { public class GamesService : IMService { private readonly IBotConfigProvider _bcp; public readonly ConcurrentDictionary<ulong, GirlRating> GirlRatings = new ConcurrentDictionary<ulong, GirlRating>(); public string[] EightBallResponses => _bcp.BotConfig.EightBallResponses.Select(ebr => ebr.Text).ToArray(); public GamesService(IBotConfigProvider bcp) { _bcp = bcp; var timer = new Timer(_ => { GirlRatings.Clear(); }, null, TimeSpan.FromDays(1), TimeSpan.FromDays(1)); } } }
mit
C#
d43f6582c79663c0d59942f998221eb2aa6ce6c8
Update application version.
RadishSystems/choiceview-webapitester-csharp
ApiTester/Properties/AssemblyInfo.cs
ApiTester/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("ApiTester")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Radish Systems, LLC")] [assembly: AssemblyProduct("ChoiceViewIVR")] [assembly: AssemblyCopyright("Copyright © 2012")] [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("11c518e8-6b26-4116-ab41-42f18f80a49a")] // 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")] [assembly: AssemblyFileVersion("1.0.0.2")] [assembly: AssemblyInformationalVersion("1.0 Development")]
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("ApiTester")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Radish Systems, LLC")] [assembly: AssemblyProduct("ChoiceViewIVR")] [assembly: AssemblyCopyright("Copyright © 2012")] [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("11c518e8-6b26-4116-ab41-42f18f80a49a")] // 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")] [assembly: AssemblyFileVersion("1.0.0.1")] [assembly: AssemblyInformationalVersion("1.0 Development")]
mit
C#
8a6c86c0feca37a837e7b5be60ab9f5ea172725e
Fix unresolved cref
benjamin-hodgson/Pidgin
Pidgin/Unit.cs
Pidgin/Unit.cs
namespace Pidgin { /// <summary> /// An uninteresting type with only one value (<see cref="Unit.Value"/>) and no fields. /// Like <c>void</c>, but valid as a type parameter /// </summary> public sealed class Unit { private Unit() {} /// <summary> /// The single unique <see cref="Unit"/> value. /// </summary> public static Unit Value { get; } = new Unit(); } }
namespace Pidgin { /// <summary> /// An uninteresting type with only one value (<see cref="Unit.Value"/>) and no fields. /// Like <see cref="System.Void"/>, but valid as a type parameter /// </summary> public sealed class Unit { private Unit() {} /// <summary> /// The single unique <see cref="Unit"/> value. /// </summary> public static Unit Value { get; } = new Unit(); } }
mit
C#