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
131375fdfe5146e6c6fc9674df10ec22cbc26f09
Remove debug stuff.
KirillOsenkov/SourceBrowser,KirillOsenkov/SourceBrowser,akrisiun/SourceBrowser,akrisiun/SourceBrowser,KirillOsenkov/SourceBrowser,KirillOsenkov/SourceBrowser,akrisiun/SourceBrowser,akrisiun/SourceBrowser
src/SourceIndexServer/Program.cs
src/SourceIndexServer/Program.cs
using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; namespace Microsoft.SourceBrowser.SourceIndexServer { public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IHost BuildWebHost(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults( builder => { builder .UseStartup<Startup>(); }) .Build(); } }
using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; namespace Microsoft.SourceBrowser.SourceIndexServer { public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IHost BuildWebHost(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults( builder => { builder .UseContentRoot(@"C:\Dev\GitHub\Reegeek\SourceBrowser\src\HtmlGenerator\bin\Debug\net472\Web") .UseStartup<Startup>(); }) .Build(); } }
apache-2.0
C#
ad463cd3ea37e34a134568f4544ecf765675ad8f
Fix issue with StringLexerSource.getPath
SiliconStudio/CppNet,manu-silicon/CppNet,xtravar/CppNet
StringLexerSource.cs
StringLexerSource.cs
/* * Anarres C Preprocessor * Copyright (c) 2007-2008, Shevek * * 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.IO; namespace CppNet { /** * A Source for lexing a String. * * This class is used by token pasting, but can be used by user * code. */ public class StringLexerSource : LexerSource { private readonly string filename; /** * Creates a new Source for lexing the given String. * * @param ppvalid true if preprocessor directives are to be * honoured within the string. */ public StringLexerSource(String str, bool ppvalid, string fileName = null) : base(new StringReader(str), ppvalid) { this.filename = fileName ?? string.Empty; // Always use empty otherwise cpp.token() will fail on NullReferenceException } /** * Creates a new Source for lexing the given String. * * By default, preprocessor directives are not honoured within * the string. */ public StringLexerSource(String str, string fileName = null) : this(str, false, fileName) { } override internal String getPath() { return filename; } override internal String getName() { return getPath(); } override public String ToString() { return "string literal"; } } }
/* * Anarres C Preprocessor * Copyright (c) 2007-2008, Shevek * * 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.IO; namespace CppNet { /** * A Source for lexing a String. * * This class is used by token pasting, but can be used by user * code. */ public class StringLexerSource : LexerSource { private readonly string filename; /** * Creates a new Source for lexing the given String. * * @param ppvalid true if preprocessor directives are to be * honoured within the string. */ public StringLexerSource(String str, bool ppvalid, string fileName = null) : base(new StringReader(str), ppvalid) { this.filename = fileName ?? string.Empty; // Always use empty otherwise cpp.token() will fail on NullReferenceException } /** * Creates a new Source for lexing the given String. * * By default, preprocessor directives are not honoured within * the string. */ public StringLexerSource(String str, string fileName = null) : this(str, false, fileName) { } internal override string getName() { return filename; } override public String ToString() { return "string literal"; } } }
apache-2.0
C#
dac0ed5e8df83aac035dc3b21f76554fd738f9d1
add missing model: FeedAdapter
lvermeulen/ProGet.Net
src/ProGet.Net/Native/Models/FeedAdapter.cs
src/ProGet.Net/Native/Models/FeedAdapter.cs
// ReSharper disable InconsistentNaming namespace ProGet.Net.Native.Models { public class FeedAdapter { public int Feed_Id { get; set; } public int FeedAdapter_Sequence { get; set; } public string FeedAdapter_Name { get; set; } public string FeedAdapterType_Code { get; set; } public string FeedAdapter_Configuration { get; set; } } }
namespace ProGet.Net.Native.Models { public class FeedAdapter { } }
mit
C#
40e7b31952ee181e518ffb349d3605d0a43feea8
Make InputManager work from a stack.
grokys/Avalonia
Avalonia/Input/InputManager.cs
Avalonia/Input/InputManager.cs
// ----------------------------------------------------------------------- // <copyright file="InputManager.cs" company="Steven Kirk"> // Copyright 2013 MIT Licence. See licence.md for more information. // </copyright> // ----------------------------------------------------------------------- namespace Avalonia.Input { using System; using System.Collections.Generic; using System.Linq; using Avalonia.Media; using Avalonia.Platform; using Avalonia.Threading; public sealed class InputManager : DispatcherObject { private Stack<InputEventArgs> stack = new Stack<InputEventArgs>(); static InputManager() { Current = new InputManager(); } public event PreProcessInputEventHandler PreProcessInput; public static InputManager Current { get; private set; } public void ProcessInput(InputEventArgs input) { this.stack.Push(input); } private void ProcessStack() { InputEventArgs input = stack.Pop(); while (input != null) { PreProcessInputEventArgs e = new PreProcessInputEventArgs(input); input.OriginalSource = input.Device.Target; if (this.PreProcessInput != null) { foreach (var handler in this.PreProcessInput.GetInvocationList().Reverse()) { handler.DynamicInvoke(this, e); } } if (!e.Canceled) { UIElement uiElement = input.OriginalSource as UIElement; if (uiElement != null) { uiElement.RaiseEvent(input); } } } } } }
// ----------------------------------------------------------------------- // <copyright file="InputManager.cs" company="Steven Kirk"> // Copyright 2013 MIT Licence. See licence.md for more information. // </copyright> // ----------------------------------------------------------------------- namespace Avalonia.Input { using System; using System.Collections.Generic; using System.Linq; using Avalonia.Media; using Avalonia.Platform; using Avalonia.Threading; public sealed class InputManager : DispatcherObject { static InputManager() { Current = new InputManager(); } public event PreProcessInputEventHandler PreProcessInput; public static InputManager Current { get; private set; } public bool ProcessInput(InputEventArgs input) { PreProcessInputEventArgs e = new PreProcessInputEventArgs(input); input.OriginalSource = input.Device.Target; if (this.PreProcessInput != null) { foreach (var handler in this.PreProcessInput.GetInvocationList().Reverse()) { handler.DynamicInvoke(this, e); } } if (!e.Canceled) { UIElement uiElement = input.OriginalSource as UIElement; if (uiElement != null) { uiElement.RaiseEvent(input); } } return input.Handled; } } }
mit
C#
5cc81d5c65f239439a0ee25e93d583199273d631
fix - addutente
vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf
src/backend/SO115App.Models/Classi/ServiziEsterni/Utility/MapSediDistaccamentiUC.cs
src/backend/SO115App.Models/Classi/ServiziEsterni/Utility/MapSediDistaccamentiUC.cs
using SO115App.API.Models.Classi.Condivise; using SO115App.Models.Classi.Composizione; using SO115App.Models.Classi.Condivise; using SO115App.Models.Classi.ServiziEsterni.UtenteComune; namespace SO115App.Models.Classi.ServiziEsterni.Utility { public static class MapSediDistaccamentiUC { public static Sede MapSede(this DistaccamentoUC distaccamento) => new Sede ( distaccamento.CodDistaccamento, distaccamento.Descrizione, distaccamento.Indirizzo, distaccamento.Coordinate ); public static Sede MapSede(this Distaccamento distaccamento) => new Sede ( distaccamento.Id, distaccamento.DescDistaccamento, distaccamento.Indirizzo, distaccamento.Coordinate ); public static Distaccamento MapDistaccamento(this DistaccamentoUC distaccamento) => new Distaccamento() { Id = distaccamento.Id, Cap = distaccamento.Cap, CodDistaccamento = int.Parse(distaccamento.Id.Substring(0, 3)), CodSede = distaccamento.Id, Coordinate = distaccamento.Coordinate, DescDistaccamento = distaccamento.Descrizione, Indirizzo = distaccamento.Indirizzo, CoordinateString = string.IsNullOrEmpty(distaccamento.coordinate) ? distaccamento.coordinate.Split('.') : new string[] { "", "" }, }; public static Distaccamento MapDistaccamento(this Sede sede) => new Distaccamento() { Id = sede.Codice, CodSede = sede.Codice, Coordinate = sede.Coordinate, Indirizzo = sede.Indirizzo, DescDistaccamento = sede.Descrizione }; public static DistaccamentoComposizione MapDistaccamentoComposizione(this Sede distaccamento) => new DistaccamentoComposizione() { Codice = distaccamento.Codice, Coordinate = distaccamento.Coordinate, Descrizione = distaccamento.Descrizione, Indirizzo = distaccamento.Indirizzo, }; } }
using SO115App.API.Models.Classi.Condivise; using SO115App.Models.Classi.Composizione; using SO115App.Models.Classi.Condivise; using SO115App.Models.Classi.ServiziEsterni.UtenteComune; namespace SO115App.Models.Classi.ServiziEsterni.Utility { public static class MapSediDistaccamentiUC { public static Sede MapSede(this DistaccamentoUC distaccamento) => new Sede ( distaccamento.CodDistaccamento, distaccamento.Descrizione, distaccamento.Indirizzo, distaccamento.Coordinate ); public static Sede MapSede(this Distaccamento distaccamento) => new Sede ( distaccamento.Id, distaccamento.DescDistaccamento, distaccamento.Indirizzo, distaccamento.Coordinate ); public static Distaccamento MapDistaccamento(this DistaccamentoUC distaccamento) => new Distaccamento() { Id = distaccamento.Id, Cap = distaccamento.Cap, CodDistaccamento = int.Parse(distaccamento.Id.Substring(3)), CodSede = distaccamento.Id, Coordinate = distaccamento.Coordinate, DescDistaccamento = distaccamento.Descrizione, Indirizzo = distaccamento.Indirizzo, CoordinateString = string.IsNullOrEmpty(distaccamento.coordinate) ? distaccamento.coordinate.Split('.') : new string[] { "", "" }, }; public static Distaccamento MapDistaccamento(this Sede sede) => new Distaccamento() { Id = sede.Codice, CodSede = sede.Codice, Coordinate = sede.Coordinate, Indirizzo = sede.Indirizzo, DescDistaccamento = sede.Descrizione }; public static DistaccamentoComposizione MapDistaccamentoComposizione(this Sede distaccamento) => new DistaccamentoComposizione() { Codice = distaccamento.Codice, Coordinate = distaccamento.Coordinate, Descrizione = distaccamento.Descrizione, Indirizzo = distaccamento.Indirizzo, }; } }
agpl-3.0
C#
00dc96527a02ab20b70bc9a2482d8a875c5f4832
修复递增语句生成器中未生成子查询语句的参数问题。 :pear:
Zongsoft/Zongsoft.Data
src/Common/Expressions/IncrementStatementBuilder.cs
src/Common/Expressions/IncrementStatementBuilder.cs
/* * _____ ______ * /_ / ____ ____ ____ _________ / __/ /_ * / / / __ \/ __ \/ __ \/ ___/ __ \/ /_/ __/ * / /__/ /_/ / / / / /_/ /\_ \/ /_/ / __/ /_ * /____/\____/_/ /_/\__ /____/\____/_/ \__/ * /____/ * * Authors: * 钟峰(Popeye Zhong) <zongsoft@qq.com> * * Copyright (C) 2015-2018 Zongsoft Corporation <http://www.zongsoft.com> * * This file is part of Zongsoft.Data. * * Zongsoft.Data is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * Zongsoft.Data is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * You should have received a copy of the GNU Lesser General Public * License along with Zongsoft.Data; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ using System; using System.Collections.Generic; namespace Zongsoft.Data.Common.Expressions { public class IncrementStatementBuilder : IStatementBuilder<DataIncrementContext> { public IEnumerable<IStatementBase> Build(DataIncrementContext context) { var statement = new UpdateStatement(context.Entity); var source = statement.From(context.Member, out var property); var field = source.CreateField(property); var value = context.Interval > 0 ? Expression.Add(field, Expression.Constant(context.Interval)) : Expression.Subtract(field, Expression.Constant(-context.Interval)); //添加修改字段 statement.Fields.Add(new FieldValue(field, value)); //构建WHERE子句 statement.Where = statement.Where(context.Condition); if(context.Source.Features.Support(Feature.Updation.Outputting)) statement.Returning = new ReturningClause(field); else { var slave = new SelectStatement(); foreach(var from in statement.From) slave.From.Add(from); slave.Where = statement.Where; slave.Select.Members.Add(field); //注:由于从属语句的WHERE子句只是简单的指向父语句的WHERE子句, //因此必须手动将父语句的参数依次添加到从属语句中。 foreach(var parameter in statement.Parameters) { slave.Parameters.Add(parameter); } statement.Slaves.Add(slave); } yield return statement; } } }
/* * _____ ______ * /_ / ____ ____ ____ _________ / __/ /_ * / / / __ \/ __ \/ __ \/ ___/ __ \/ /_/ __/ * / /__/ /_/ / / / / /_/ /\_ \/ /_/ / __/ /_ * /____/\____/_/ /_/\__ /____/\____/_/ \__/ * /____/ * * Authors: * 钟峰(Popeye Zhong) <zongsoft@qq.com> * * Copyright (C) 2015-2018 Zongsoft Corporation <http://www.zongsoft.com> * * This file is part of Zongsoft.Data. * * Zongsoft.Data is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * Zongsoft.Data is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * You should have received a copy of the GNU Lesser General Public * License along with Zongsoft.Data; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ using System; using System.Collections.Generic; namespace Zongsoft.Data.Common.Expressions { public class IncrementStatementBuilder : IStatementBuilder<DataIncrementContext> { public IEnumerable<IStatementBase> Build(DataIncrementContext context) { var statement = new UpdateStatement(context.Entity); var source = statement.From(context.Member, out var property); var field = source.CreateField(property); var value = context.Interval > 0 ? Expression.Add(field, Expression.Constant(context.Interval)) : Expression.Subtract(field, Expression.Constant(-context.Interval)); //添加修改字段 statement.Fields.Add(new FieldValue(field, value)); //构建WHERE子句 statement.Where = statement.Where(context.Condition); if(context.Source.Features.Support(Feature.Updation.Outputting)) statement.Returning = new ReturningClause(field); else { var slave = new SelectStatement(); foreach(var from in statement.From) slave.From.Add(from); slave.Where = statement.Where; slave.Select.Members.Add(field); statement.Slaves.Add(slave); } yield return statement; } } }
lgpl-2.1
C#
fb1ba17cbd91ebe6fbe565883164e9abb37f9a0f
support scrolling to the bottom of the page
mvbalaw/FluentBrowserAutomation
src/FluentBrowserAutomation/Controls/PageWrapper.cs
src/FluentBrowserAutomation/Controls/PageWrapper.cs
using FluentBrowserAutomation.Accessors; using OpenQA.Selenium; namespace FluentBrowserAutomation.Controls { public class PageWrapper { private readonly IBrowserContext _browserContext; public PageWrapper(IBrowserContext browserContext) { _browserContext = browserContext; } public void ScrollToBottom() { var browser = _browserContext.Browser; const string js = "window.scrollTo(0, document.body.scrollHeight);"; ((IJavaScriptExecutor)browser).ExecuteScript(js); } public ReadOnlyText Text() { return new ReadOnlyText("Page", _browserContext.Browser.PageSource); } public string Title() { return _browserContext.Browser.Title; } } }
using FluentBrowserAutomation.Accessors; namespace FluentBrowserAutomation.Controls { public class PageWrapper { private readonly IBrowserContext _browserContext; public PageWrapper(IBrowserContext browserContext) { _browserContext = browserContext; } public ReadOnlyText Text() { return new ReadOnlyText("Page", _browserContext.Browser.PageSource); } public string Title() { return _browserContext.Browser.Title; } } }
mit
C#
181602a92766d96d769758dca1193e5d84d87fa1
Use Path.Combine better for "Tools/PEVerify".
fredericDelaporte/nhibernate-core,lnu/nhibernate-core,gliljas/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,fredericDelaporte/nhibernate-core,ManufacturingIntelligence/nhibernate-core,hazzik/nhibernate-core,hazzik/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,gliljas/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,nkreipke/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,fredericDelaporte/nhibernate-core,nkreipke/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,fredericDelaporte/nhibernate-core,lnu/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core
src/NHibernate.Test/DynamicProxyTests/PeVerifier.cs
src/NHibernate.Test/DynamicProxyTests/PeVerifier.cs
using System; using System.Diagnostics; using System.IO; using NUnit.Framework; namespace NHibernate.Test.DynamicProxyTests { // utility class to run PEVerify.exe against a saved-to-disk assembly, similar to: // http://stackoverflow.com/questions/7290893/is-there-an-api-for-verifying-the-msil-of-a-dynamic-assembly-at-runtime public partial class PeVerifier { private string _assemlyLocation; private string _peVerifyPath; public PeVerifier(string assemblyFileName) { var assemblyLocation = Path.Combine(TestContext.CurrentContext.TestDirectory, assemblyFileName); if (!File.Exists(assemblyLocation)) throw new ArgumentException(string.Format("Could not locate assembly {0}", assemblyLocation), "assemblyLocation"); _assemlyLocation = assemblyLocation; var dir = Path.GetDirectoryName(_assemlyLocation); while (!Directory.Exists(Path.Combine(dir, "Tools", "PEVerify"))) { if (Directory.GetParent(dir) == null) throw new Exception(string.Format("Could not find Tools/PEVerify directory in ancestor of {0}", _assemlyLocation)); dir = Directory.GetParent(dir).FullName; } var versionFolder = "4.0"; if (Environment.Version.Major == 2) versionFolder = "3.5"; _peVerifyPath = Path.Combine(dir, "Tools", "PEVerify", versionFolder, "PEVerify.exe"); if (!File.Exists(_peVerifyPath)) throw new Exception(string.Format("Could not find PEVerify.exe at {0}", _peVerifyPath)); } public void AssertIsValid() { var process = new Process { StartInfo = { FileName = _peVerifyPath, RedirectStandardOutput = true, UseShellExecute = false, Arguments = "\"" + _assemlyLocation + "\" /VERBOSE", CreateNoWindow = true } }; process.Start(); var processOutput = process.StandardOutput.ReadToEnd(); process.WaitForExit(); var result = process.ExitCode + " code "; if (process.ExitCode != 0) Assert.Fail("PeVerify reported error(s): " + Environment.NewLine + processOutput, result); } } }
using System; using System.Diagnostics; using System.IO; using NUnit.Framework; namespace NHibernate.Test.DynamicProxyTests { // utility class to run PEVerify.exe against a saved-to-disk assembly, similar to: // http://stackoverflow.com/questions/7290893/is-there-an-api-for-verifying-the-msil-of-a-dynamic-assembly-at-runtime public partial class PeVerifier { private string _assemlyLocation; private string _peVerifyPath; public PeVerifier(string assemblyFileName) { var assemblyLocation = Path.Combine(TestContext.CurrentContext.TestDirectory, assemblyFileName); if (!File.Exists(assemblyLocation)) throw new ArgumentException(string.Format("Could not locate assembly {0}", assemblyLocation), "assemblyLocation"); _assemlyLocation = assemblyLocation; var dir = Path.GetDirectoryName(_assemlyLocation); while (!Directory.Exists(Path.Combine(dir, "Tools/PEVerify"))) { if (Directory.GetParent(dir) == null) throw new Exception(string.Format("Could not find Tools/PEVerify directory in ancestor of {0}", _assemlyLocation)); dir = Directory.GetParent(dir).FullName; } var versionFolder = "4.0"; if (Environment.Version.Major == 2) versionFolder = "3.5"; _peVerifyPath = Path.Combine(dir, "Tools/PEVerify/" + versionFolder + "/PEVerify.exe"); if (!File.Exists(_peVerifyPath)) throw new Exception(string.Format("Could not find PEVerify.exe at {0}", _peVerifyPath)); } public void AssertIsValid() { var process = new Process { StartInfo = { FileName = _peVerifyPath, RedirectStandardOutput = true, UseShellExecute = false, Arguments = "\"" + _assemlyLocation + "\" /VERBOSE", CreateNoWindow = true } }; process.Start(); var processOutput = process.StandardOutput.ReadToEnd(); process.WaitForExit(); var result = process.ExitCode + " code "; if (process.ExitCode != 0) Assert.Fail("PeVerify reported error(s): " + Environment.NewLine + processOutput, result); } } }
lgpl-2.1
C#
901c2df4033b30fa595a09be97b00c726fe98a91
Make portable library able to load configuration
meixger/common-logging,tablesmit/common-logging,net-commons/common-logging,xlgwr/common-logging,ajayanandgit/common-logging,Moily/common-logging,net-commons/common-logging
src/Common.Logging/Logging/Configuration/DefaultConfigurationReader.cs
src/Common.Logging/Logging/Configuration/DefaultConfigurationReader.cs
#region License /* * Copyright 2002-2009 the original author or authors. * * 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 #if PORTABLE #else using System.Collections.Specialized; using System.Configuration; #endif namespace Common.Logging.Configuration { /// <summary> /// Implementation of <see cref="IConfigurationReader"/> that uses the standard .NET /// configuration APIs, ConfigurationSettings in 1.x and ConfigurationManager in 2.0 /// </summary> /// <author>Mark Pollack</author> public class DefaultConfigurationReader : IConfigurationReader { /// <summary> /// Parses the configuration section and returns the resulting object. /// </summary> /// <param name="sectionName">Name of the configuration section.</param> /// <returns> /// Object created by a corresponding <see cref="IConfigurationSectionHandler"/>. /// </returns> /// <remarks> /// <p> /// Primary purpose of this method is to allow us to parse and /// load configuration sections using the same API regardless /// of the .NET framework version. /// </p> /// </remarks> /// <see cref="ConfigurationSectionHandler"/> public object GetSection(string sectionName) { #if PORTABLE // We should instead look for something implementing // IConfigurationReader in (platform specific) Common.Logging dll and use that const string configManager40 = "System.Configuration.ConfigurationManager, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; var configurationManager = Type.GetType(configManager40); if(configurationManager == null) { // Silverlight, and maybe if System.Configuration is not loaded? return null; } var getSection = configurationManager.GetMethod("GetSection", new[] { typeof(string) }); if (getSection == null) throw new PlatformNotSupportedException("Could not find System.Configuration.ConfigurationManager.GetSection method"); return getSection.Invoke(null, new[] {sectionName}); ; #else return ConfigurationManager.GetSection(sectionName); #endif } } }
#region License /* * Copyright 2002-2009 the original author or authors. * * 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 #if PORTABLE #else using System.Collections.Specialized; using System.Configuration; #endif namespace Common.Logging.Configuration { /// <summary> /// Implementation of <see cref="IConfigurationReader"/> that uses the standard .NET /// configuration APIs, ConfigurationSettings in 1.x and ConfigurationManager in 2.0 /// </summary> /// <author>Mark Pollack</author> public class DefaultConfigurationReader : IConfigurationReader { /// <summary> /// Parses the configuration section and returns the resulting object. /// </summary> /// <param name="sectionName">Name of the configuration section.</param> /// <returns> /// Object created by a corresponding <see cref="IConfigurationSectionHandler"/>. /// </returns> /// <remarks> /// <p> /// Primary purpose of this method is to allow us to parse and /// load configuration sections using the same API regardless /// of the .NET framework version. /// </p> /// </remarks> /// <see cref="ConfigurationSectionHandler"/> public object GetSection(string sectionName) { #if PORTABLE return null; #else return ConfigurationManager.GetSection(sectionName); #endif } } }
apache-2.0
C#
21ea93b8c6711f04e9ee14137088d2c964a4b01a
Update SharedAssemblyInfo.cs
XamlBehaviors/XamlBehaviors,XamlBehaviors/XamlBehaviors,wieslawsoltes/AvaloniaBehaviors,wieslawsoltes/AvaloniaBehaviors
src/Shared/SharedAssemblyInfo.cs
src/Shared/SharedAssemblyInfo.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; using System.Resources; [assembly: AssemblyCompany("Wiesław Šoltés")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2017")] [assembly: AssemblyCulture("")] [assembly: AssemblyDescription("")] [assembly: AssemblyProduct("Avalonia")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en")] [assembly: AssemblyVersion("0.5.0.1")] [assembly: AssemblyFileVersion("0.5.0.1")] [assembly: AssemblyInformationalVersion("0.5.0.1")]
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System.Reflection; using System.Resources; [assembly: AssemblyCompany("Wiesław Šoltés")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCopyright("Copyright © Wiesław Šoltés 2017")] [assembly: AssemblyCulture("")] [assembly: AssemblyDescription("")] [assembly: AssemblyProduct("Avalonia")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en")] [assembly: AssemblyVersion("0.6.0")] [assembly: AssemblyFileVersion("0.6.0")] [assembly: AssemblyInformationalVersion("0.6.0")]
mit
C#
52550a371640ae1cd89bc8ecc787705d6bd795f6
Add asserts for types in Constants unit tests for SimpleExprBuilder
symbooglix/symbooglix,symbooglix/symbooglix,symbooglix/symbooglix
src/ExprBuilderTests/Constants.cs
src/ExprBuilderTests/Constants.cs
using NUnit.Framework; using System; using Symbooglix; namespace ExprBuilderTests { [TestFixture()] public class Constants { [Test()] public void True() { var builder = new SimpleExprBuilder(); var constant = builder.True; Assert.AreEqual("true", constant.ToString()); Assert.IsNotNull(constant.Type); Assert.AreEqual(constant.ShallowType, constant.Type); Assert.IsTrue(constant.Type.IsBool); var constant2 = builder.ConstantBool(true); Assert.AreEqual("true", constant2.ToString()); Assert.IsNotNull(constant2.Type); Assert.AreEqual(constant2.ShallowType, constant.Type); Assert.IsTrue(constant2.Type.IsBool); } [Test()] public void False() { var builder = new SimpleExprBuilder(); var constant = builder.False; Assert.AreEqual("false", constant.ToString()); Assert.IsNotNull(constant.Type); Assert.AreEqual(constant.ShallowType, constant.Type); Assert.IsTrue(constant.Type.IsBool); var constant2 = builder.ConstantBool(false); Assert.AreEqual("false", constant2.ToString()); Assert.IsNotNull(constant2.Type); Assert.AreEqual(constant2.ShallowType, constant.Type); Assert.IsTrue(constant2.Type.IsBool); } } }
using NUnit.Framework; using System; using Symbooglix; namespace ExprBuilderTests { [TestFixture()] public class Constants { [Test()] public void True() { var builder = new SimpleExprBuilder(); var constant = builder.True; Assert.AreEqual("true", constant.ToString()); var constant2 = builder.ConstantBool(true); Assert.AreEqual("true", constant2.ToString()); } [Test()] public void False() { var builder = new SimpleExprBuilder(); var constant = builder.False; Assert.AreEqual("false", constant.ToString()); var constant2 = builder.ConstantBool(false); Assert.AreEqual("false", constant2.ToString()); } } }
bsd-2-clause
C#
5cdf2695e315d96507bf4fb63dec6b4330873221
Update TestMongoRepository.cs
tiksn/TIKSN-Framework
TIKSN.Framework.IntegrationTests/Data/Mongo/TestMongoRepository.cs
TIKSN.Framework.IntegrationTests/Data/Mongo/TestMongoRepository.cs
using System; using TIKSN.Data.Mongo; namespace TIKSN.Framework.IntegrationTests.Data.Mongo { public class TestMongoRepository : MongoRepository<TestMongoEntity, Guid>, ITestMongoRepository { public TestMongoRepository( IMongoClientSessionProvider mongoClientSessionProvider, IMongoDatabaseProvider mongoDatabaseProvider) : base(mongoClientSessionProvider, mongoDatabaseProvider, "Tests") { } } }
using System; using TIKSN.Data.Mongo; namespace TIKSN.Framework.IntegrationTests.Data.Mongo { public class TestMongoRepository : MongoRepository<TestMongoEntity, Guid>, ITestMongoRepository { public TestMongoRepository(IMongoDatabaseProvider mongoDatabaseProvider) : base(mongoDatabaseProvider, "Tests") { } } }
mit
C#
40f9adde0d53bdd9cb6fddc283836d06a9f5dd0b
fix merge conflict
VenusInterns/BlogTemplate,VenusInterns/BlogTemplate,VenusInterns/BlogTemplate
BlogTemplate/Pages/Post.cshtml
BlogTemplate/Pages/Post.cshtml
@page "{slug}" @model PostModel @using Microsoft.AspNetCore.Mvc.RazorPages @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" @functions { [BindProperty] public Models.Comment Comment { get; set; } public void OnCommentSaveComment() { if (ModelState.IsValid) { Model.Post.Comments.Add(Comment); Response.Redirect("/Post"); } } } @{ ViewData["Title"] = Model.Post.Title; } <article> <h1>@Model.Post.Title</h1> <p id="date">@Model.Post.PubDate.ToString("MMM dd, yyyy")</p> <span>@string.Join(", ", Model.Post.Tags)</span> <p>@Model.Post.Body</p> 5 <h2>Comments</h2> @for (int i = 0; i < Model.Post.Comments.Count; i++) { <p id="Comment-Title">@Model.Post.Comments[i].AuthorName</p> <p id="Comment-Body">@Model.Post.Comments[i].AuthorEmail</p> <p id="Comment-Date">@Model.Post.Comments[i].PubDate.ToString("MMM dd, yyyy")</p> <p id="Comment-Body">@Model.Post.Comments[i].Body</p> } <h3>Add Comment</h3> <form method="POST"> <div> Name <input asp-for="Post.Comments[Model.Post.Comments.Count-2].AuthorName" /></div> <div>Email <input asp-for="Post.Comments[Model.Post.Comments.Count-2].AuthorEmail" /></div> <div>Write a Comment... <input asp-for="Post.Comments[Model.Post.Comments.Count-1].Body" /></div> <input type="submit" name="save" value="Submit" asp-page-handler="SaveComment" /> @*<input type="submit" name="publish" value="Publish" asp-page-handler="SaveComment" />*@ </form> </article>
@page "{slug}" @model PostModel @using Microsoft.AspNetCore.Mvc.RazorPages @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" @{ ViewData["Title"] = Model.Post.Title; } <article> <h1>@Model.Post.Title</h1> <p id="date">@Model.Post.PubDate.ToString("MMM dd, yyyy")</p> <span>@string.Join(", ", Model.Post.Tags)</span> <p>@Model.Post.Body</p> 5 <h2>Comments</h2> @for (int i = 0; i < Model.Post.Comments.Count; i++) { <p id="Comment-Title">@Model.Post.Comments[i].AuthorName</p> <p id="Comment-Body">@Model.Post.Comments[i].AuthorEmail</p> <p id="Comment-Date">@Model.Post.Comments[i].PubDate.ToString("MMM dd, yyyy")</p> <p id="Comment-Body">@Model.Post.Comments[i].Body</p> } @functions { [BindProperty] public Models.Comment Comment { get; set; } public async Task<IActionResult> OnPostAsync() { if (ModelState.IsValid) { // Db.Model.Comments.Add(Comment); // await Db.SaveChangesAsync(); //return RedirectToPage(); } return Page(); } } <h3>Add Comment</h3> <form method = "POST"> <div > Name: <input asp-for="Post.Comments[Model.Post.Comments.Count-2].AuthorName" /></div> <div>Email: <input asp-for="Post.Comments[Model.Post.Comments.Count-2].AuthorEmail" /></div> <div>Body: <input asp-for="Post.Comments[Model.Post.Comments.Count-1].Body" /></div> <input type="submit" /> </form> </article>
mit
C#
598183be0f51cbea20051331e292c22977114ba5
change highlighting goup id
prodot/ReCommended-Extension
Sources/ReCommendedExtension/Highlightings/RegionWithinTypeMemberBodyHighlighting.cs
Sources/ReCommendedExtension/Highlightings/RegionWithinTypeMemberBodyHighlighting.cs
using JetBrains.Annotations; using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReCommendedExtension.Highlightings; using ZoneMarker = ReCommendedExtension.ZoneMarker; [assembly: RegisterConfigurableSeverity( RegionWithinTypeMemberBodyHighlighting.SeverityId, null, HighlightingGroupIds.CodeStyleIssues, "Region is contained within a type member body" + ZoneMarker.Suffix, "", Severity.WARNING)] namespace ReCommendedExtension.Highlightings { [ConfigurableSeverityHighlighting(SeverityId, CSharpLanguage.Name)] public sealed class RegionWithinTypeMemberBodyHighlighting : RegionHighlighting { internal const string SeverityId = "RegionWithinTypeMemberBody"; internal RegionWithinTypeMemberBodyHighlighting([NotNull] string message, [NotNull] IStartRegion startRegion) : base(message, startRegion) { } } }
using JetBrains.Annotations; using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReCommendedExtension.Highlightings; using ZoneMarker = ReCommendedExtension.ZoneMarker; [assembly: RegisterConfigurableSeverity( RegionWithinTypeMemberBodyHighlighting.SeverityId, null, HighlightingGroupIds.CodeSmell, "Region is contained within a type member body" + ZoneMarker.Suffix, "", Severity.WARNING)] namespace ReCommendedExtension.Highlightings { [ConfigurableSeverityHighlighting(SeverityId, CSharpLanguage.Name)] public sealed class RegionWithinTypeMemberBodyHighlighting : RegionHighlighting { internal const string SeverityId = "RegionWithinTypeMemberBody"; internal RegionWithinTypeMemberBodyHighlighting([NotNull] string message, [NotNull] IStartRegion startRegion) : base(message, startRegion) { } } }
apache-2.0
C#
6d91ca5fcf11e462756305cf5949182efc1910b5
Use uint instead of Uint32 for consistency (even though they're exactly the same)
windygu/CefSharp,rlmcneary2/CefSharp,VioletLife/CefSharp,illfang/CefSharp,twxstar/CefSharp,ruisebastiao/CefSharp,VioletLife/CefSharp,twxstar/CefSharp,windygu/CefSharp,Octopus-ITSM/CefSharp,wangzheng888520/CefSharp,AJDev77/CefSharp,ruisebastiao/CefSharp,Livit/CefSharp,zhangjingpu/CefSharp,zhangjingpu/CefSharp,twxstar/CefSharp,haozhouxu/CefSharp,Octopus-ITSM/CefSharp,battewr/CefSharp,twxstar/CefSharp,yoder/CefSharp,windygu/CefSharp,wangzheng888520/CefSharp,Octopus-ITSM/CefSharp,AJDev77/CefSharp,zhangjingpu/CefSharp,Haraguroicha/CefSharp,AJDev77/CefSharp,ruisebastiao/CefSharp,Haraguroicha/CefSharp,gregmartinhtc/CefSharp,rlmcneary2/CefSharp,Haraguroicha/CefSharp,rover886/CefSharp,windygu/CefSharp,VioletLife/CefSharp,yoder/CefSharp,jamespearce2006/CefSharp,zhangjingpu/CefSharp,Octopus-ITSM/CefSharp,gregmartinhtc/CefSharp,joshvera/CefSharp,yoder/CefSharp,rover886/CefSharp,battewr/CefSharp,dga711/CefSharp,wangzheng888520/CefSharp,ITGlobal/CefSharp,ITGlobal/CefSharp,NumbersInternational/CefSharp,AJDev77/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,joshvera/CefSharp,dga711/CefSharp,Haraguroicha/CefSharp,dga711/CefSharp,VioletLife/CefSharp,jamespearce2006/CefSharp,joshvera/CefSharp,rlmcneary2/CefSharp,haozhouxu/CefSharp,haozhouxu/CefSharp,battewr/CefSharp,ITGlobal/CefSharp,rlmcneary2/CefSharp,Haraguroicha/CefSharp,battewr/CefSharp,NumbersInternational/CefSharp,ruisebastiao/CefSharp,illfang/CefSharp,wangzheng888520/CefSharp,haozhouxu/CefSharp,NumbersInternational/CefSharp,joshvera/CefSharp,Livit/CefSharp,Livit/CefSharp,NumbersInternational/CefSharp,rover886/CefSharp,gregmartinhtc/CefSharp,gregmartinhtc/CefSharp,ITGlobal/CefSharp,dga711/CefSharp,illfang/CefSharp,Livit/CefSharp,rover886/CefSharp,rover886/CefSharp,yoder/CefSharp,illfang/CefSharp
CefSharp/DragOperationsMask.cs
CefSharp/DragOperationsMask.cs
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; namespace CefSharp { [Flags] public enum DragOperationsMask : uint { None = 0, Copy = 1, Link = 2, Generic = 4, Private = 8, Move = 16, Delete = 32, Every = uint.MaxValue } }
// Copyright © 2010-2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; namespace CefSharp { [Flags] public enum DragOperationsMask : uint { None = 0, Copy = 1, Link = 2, Generic = 4, Private = 8, Move = 16, Delete = 32, Every = UInt32.MaxValue } }
bsd-3-clause
C#
191d53e25b60a8739b0c6ef1eb7b2ab6b9d05caf
Increment version
R-Smith/vmPing
vmPing/Properties/AssemblyInfo.cs
vmPing/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("vmPing")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("vmPing")] [assembly: AssemblyCopyright("Copyright © 2020 Ryan Smith")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.4.0")] [assembly: AssemblyFileVersion("1.3.4.0")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("vmPing")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("vmPing")] [assembly: AssemblyCopyright("Copyright © 2019 Ryan Smith")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.3.0")] [assembly: AssemblyFileVersion("1.3.3.0")]
mit
C#
a7ae8ed3091442bb20b4f6842dfebebca8d9b932
Comment update.
jbakic/Shielded,wizardbeard/Shielded
Trans/IShielded.cs
Trans/IShielded.cs
using System; namespace Trans { internal interface IShielded { bool HasChanges { get; } // this locks the implementor. All reads with >stamp are // spinwaited, all other threads' CanCommits() return false, // and only a Commit() or Rollback(with the same stamp) release it. bool CanCommit(bool strict, long writeStamp); bool Commit(long writeStamp); void Rollback(long? writeStamp = null); void TrimCopies(long smallestOpenTransactionId); } }
using System; namespace Trans { internal interface IShielded { bool HasChanges { get; } // once having responded to this, implementor must ensure answer stays // the same until Commit() or Rollback(). other threads asking to read // will get immediate response if their reading stamp is less // then this one here. if it is greater, callers spin wait until that // Commit() or Rollback() from before happens. calls to CanCommit // always spin wait, their stamp is always larger. bool CanCommit(bool strict, long writeStamp); bool Commit(long writeStamp); void Rollback(long? writeStamp = null); void TrimCopies(long smallestOpenTransactionId); } }
mit
C#
147ad7e0e82e8366fbdf381a7ced3f64bf56deb6
rework comparer for T (which was wrong).
neitsa/PrepareLanding,neitsa/PrepareLanding
src/Extensions/ListExtensions.cs
src/Extensions/ListExtensions.cs
using System.Collections.Generic; using System.Linq; namespace PrepareLanding.Extensions { public static class ListExtensions { public static bool ContainsAll<T>(this List<T> thisList, List<T> other) { return thisList.Intersect(other).Count() == other.Count; } public static bool ContainsAll<T>(this IEnumerable<T> thisEnumerable, IEnumerable<T> other) { var otherList = other as IList<T> ?? other.ToList(); return thisEnumerable.Intersect(otherList).Count() == otherList.Count(); } public static bool IsSubset<T>(this IEnumerable<T> thisEnumerable, IEnumerable<T> other) { return !thisEnumerable.Except(other).Any(); } public static bool IsSubsetInOrder<T>(this List<T> subsetList, List<T> containingList) { if (!IsSubset(subsetList, containingList)) return false; var otherIndex = containingList.IndexOf(subsetList[0]); return !subsetList.Where((t, i) => Comparer<T>.Default.Compare(containingList[i + otherIndex], t) != 0).Any(); } public static bool IsSubsetInOrderSamePos<T>(this List<T> subsetList, List<T> containingList) { if (subsetList.Count > containingList.Count) return false; if (!subsetList.IsSubset(containingList)) return false; //return !subsetList.Where((t, i) => Comparer<T>.Default.Compare(t, containingList[i]) != 0).Any(); var count = subsetList.Count; for (var i = 0; i < count; i++) { if (!EqualityComparer<T>.Default.Equals(subsetList[i], containingList[i])) return false; } return true; } } }
using System.Collections.Generic; using System.Linq; namespace PrepareLanding.Extensions { public static class ListExtensions { public static bool ContainsAll<T>(this List<T> thisList, List<T> other) { return thisList.Intersect(other).Count() == other.Count; } public static bool ContainsAll<T>(this IEnumerable<T> thisEnumerable, IEnumerable<T> other) { var otherList = other as IList<T> ?? other.ToList(); return thisEnumerable.Intersect(otherList).Count() == otherList.Count(); } public static bool IsSubset<T>(this IEnumerable<T> thisEnumerable, IEnumerable<T> other) { return !thisEnumerable.Except(other).Any(); } public static bool IsSubsetInOrder<T>(this List<T> subsetList, List<T> containingList) { if (!IsSubset(subsetList, containingList)) return false; var otherIndex = containingList.IndexOf(subsetList[0]); return !subsetList.Where((t, i) => Comparer<T>.Default.Compare(containingList[i + otherIndex], t) != 0).Any(); } public static bool IsSubsetInOrderSamePos<T>(this List<T> subsetList, List<T> containingList) { if (subsetList.Count > containingList.Count) return false; if (!subsetList.IsSubset(containingList)) return false; //return !subsetList.Where((t, i) => t != containingList[i]).Any(); return !subsetList.Where((t, i) => Comparer<T>.Default.Compare(t, containingList[i]) != 0).Any(); } } }
mit
C#
d513e31392c199d28bcd3ede4f0bdc1f760fc98f
fix to jpeg save
i-e-b/ImageTools
src/ImageTools/Utilities/Save.cs
src/ImageTools/Utilities/Save.cs
using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; namespace ImageTools { public static class Save { public static void SaveJpeg(this Bitmap src, string filePath, int quality = 95) { var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); filePath = Path.Combine(basePath, filePath); var p = Path.GetDirectoryName(filePath); if (!string.IsNullOrEmpty(p)) { Directory.CreateDirectory(p); } using (var fs = new FileStream(filePath, FileMode.Create)) { src.JpegStream(fs, quality); fs.Close(); } } public static void SaveBmp(this Bitmap src, string filePath) { var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); filePath = Path.Combine(basePath, filePath); var p = Path.GetDirectoryName(filePath); if (!string.IsNullOrEmpty(p)) { Directory.CreateDirectory(p); } if (File.Exists(filePath)) File.Delete(filePath); src.Save(filePath, ImageFormat.Bmp); } public static void JpegStream(this Bitmap src, Stream outputStream, int quality = 95) { var encoder = ImageCodecInfo.GetImageEncoders().First(c => c.FormatID == ImageFormat.Jpeg.Guid); var parameters = new EncoderParameters(1); parameters.Param[0] = new EncoderParameter(Encoder.Quality, quality); src.Save(outputStream, encoder, parameters); outputStream.Flush(); } } }
using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; namespace ImageTools { public static class Save { public static void SaveJpeg(this Bitmap src, string filePath, int quality = 95) { var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); filePath = Path.Combine(basePath, filePath); var p = Path.GetDirectoryName(filePath); if (!string.IsNullOrEmpty(p)) { Directory.CreateDirectory(p); } using (var fs = new FileStream(filePath, FileMode.Create)) { src.JpegStream(fs); fs.Close(); } } public static void SaveBmp(this Bitmap src, string filePath) { var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); filePath = Path.Combine(basePath, filePath); var p = Path.GetDirectoryName(filePath); if (!string.IsNullOrEmpty(p)) { Directory.CreateDirectory(p); } if (File.Exists(filePath)) File.Delete(filePath); src.Save(filePath, ImageFormat.Bmp); } public static void JpegStream(this Bitmap src, Stream outputStream, int quality = 95) { var encoder = ImageCodecInfo.GetImageEncoders().First(c => c.FormatID == ImageFormat.Jpeg.Guid); var parameters = new EncoderParameters(1); parameters.Param[0] = new EncoderParameter(Encoder.Quality, 95L); src.Save(outputStream, encoder, parameters); outputStream.Flush(); } } }
mit
C#
78f3d167bdf0a18d6f2a11ecd0a43c7d9535b550
Remove unneeded using statement.
jacksonh/manos,mdavid/manos-spdy,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos,mdavid/manos-spdy,jacksonh/manos,jmptrader/manos,jacksonh/manos,jacksonh/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos
src/Manos/Manos.IO/FileSystem.cs
src/Manos/Manos.IO/FileSystem.cs
// // Copyright (C) 2010 Jackson Harper (jackson@manosdemono.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // using System; using System.Linq; using System.Text; using System.Threading; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using Libev; using System.IO; namespace Manos.IO { public static class FileSystem { #if WINDOWS public static void GetFileLength(string path, Action<long, int> cb) { long l = 0; int e = 0; try { l = new System.IO.FileInfo(path).Length; } catch (FileNotFoundException) { e = 1; } catch (IOException) { e = 2; } cb(l, e); } #else public static void GetFileLength (string path, Action<long,int> cb) { GCHandle handle = GCHandle.Alloc (cb); manos_file_get_length (path, LengthCallbackHandler, GCHandle.ToIntPtr (handle)); } public static void LengthCallbackHandler (IntPtr gchandle, IntPtr length, int error) { GCHandle handle = GCHandle.FromIntPtr (gchandle); Action<long,int> cb = (Action<long,int>) handle.Target; handle.Free (); cb (length.ToInt64 (), error); } [DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)] private static extern void manos_file_get_length (string path, Action<IntPtr,IntPtr,int> cb, IntPtr gchandle); #endif } }
// // Copyright (C) 2010 Jackson Harper (jackson@manosdemono.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // using System; using System.Linq; using System.Text; using System.Threading; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using Libev; using Libeio; using System.IO; namespace Manos.IO { public static class FileSystem { #if WINDOWS public static void GetFileLength(string path, Action<long, int> cb) { long l = 0; int e = 0; try { l = new System.IO.FileInfo(path).Length; } catch (FileNotFoundException) { e = 1; } catch (IOException) { e = 2; } cb(l, e); } #else public static void GetFileLength (string path, Action<long,int> cb) { GCHandle handle = GCHandle.Alloc (cb); manos_file_get_length (path, LengthCallbackHandler, GCHandle.ToIntPtr (handle)); } public static void LengthCallbackHandler (IntPtr gchandle, IntPtr length, int error) { GCHandle handle = GCHandle.FromIntPtr (gchandle); Action<long,int> cb = (Action<long,int>) handle.Target; handle.Free (); cb (length.ToInt64 (), error); } [DllImport ("libmanos", CallingConvention = CallingConvention.Cdecl)] private static extern void manos_file_get_length (string path, Action<IntPtr,IntPtr,int> cb, IntPtr gchandle); #endif } }
mit
C#
0e78ce30e46cfb431d8b2c7333506743c4540695
allow Collapsed to be set
rolembergfilho/Serenity,volkanceylan/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,WasimAhmad/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,dfaruque/Serenity
Serenity.Core/ComponentModel/PropertyGrid/CollapsibleAttribute.cs
Serenity.Core/ComponentModel/PropertyGrid/CollapsibleAttribute.cs
using System; namespace Serenity.ComponentModel { public class CollapsibleAttribute : Attribute { public CollapsibleAttribute(bool value = false) { Value = value; } public bool Value { get; private set; } public bool Collapsed { get; set; } } }
using System; namespace Serenity.ComponentModel { public class CollapsibleAttribute : Attribute { public CollapsibleAttribute(bool value = false) { Value = value; } public bool Value { get; private set; } public bool Collapsed { get; private set; } } }
mit
C#
cfd5cf330cef11178d3d1a6c2b662ffcf5034f01
comment on IsEnum
aloneguid/support
src/Aloneguid.Support.Portable/Extensions/TypeExtensions.cs
src/Aloneguid.Support.Portable/Extensions/TypeExtensions.cs
// ReSharper disable once CheckNamespace namespace System { public static class TypeExtensions { /// <summary> /// More reliable way to determine if a type is Enum, especially in a portable reflection /// </summary> public static bool IsEnum(this Type t) { if(t == null) return false; try { // ReSharper disable once ReturnValueOfPureMethodIsNotUsed Enum.GetUnderlyingType(t); return true; } catch(ArgumentException) { return false; } } } }
// ReSharper disable once CheckNamespace namespace System { public static class TypeExtensions { public static bool IsEnum(this Type t) { try { Enum.GetUnderlyingType(t); return true; } catch(ArgumentException) { return false; } } } }
mit
C#
0737ea392f9747f80ebc0854cb29b544958994a1
Add NotNull to Predicate setter.
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNet.Http.Core/Extensions/MapWhenOptions.cs
src/Microsoft.AspNet.Http.Core/Extensions/MapWhenOptions.cs
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Threading.Tasks; using Microsoft.AspNet.Http; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Builder.Extensions { /// <summary> /// Options for the MapWhen middleware /// </summary> public class MapWhenOptions { /// <summary> /// The user callback that determines if the branch should be taken /// </summary> public Func<HttpContext, bool> Predicate { get; [param: NotNull] set; } /// <summary> /// The branch taken for a positive match /// </summary> public RequestDelegate Branch { get; set; } } }
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Threading.Tasks; using Microsoft.AspNet.Http; namespace Microsoft.AspNet.Builder.Extensions { /// <summary> /// Options for the MapWhen middleware /// </summary> public class MapWhenOptions { /// <summary> /// The user callback that determines if the branch should be taken /// </summary> public Func<HttpContext, bool> Predicate { get; set; } /// <summary> /// The branch taken for a positive match /// </summary> public RequestDelegate Branch { get; set; } } }
apache-2.0
C#
c291e7550354a5ecb1b795d7544cd3eef695c8bd
Add Admin user in Seed method
pacho10/Student-System-Project,pacho10/Student-System-Project,pacho10/Student-System-Project
StudentSystem/Data/StudentSystem.Data/Migrations/Configuration.cs
StudentSystem/Data/StudentSystem.Data/Migrations/Configuration.cs
namespace StudentSystem.Data.Migrations { using System; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; using StudentSystem.Models; public sealed class Configuration : DbMigrationsConfiguration<ApplicationDbContext> { public Configuration() { this.AutomaticMigrationsEnabled = true; this.AutomaticMigrationDataLossAllowed = true; } protected override void Seed(ApplicationDbContext context) { if (!context.Roles.Any()) { const string adminUsername = "admin@admin.com"; const string adminPass = "administrator"; const string roleName = "Administrator"; var roleStore = new RoleStore<IdentityRole>(context); var roleManager = new RoleManager<IdentityRole>(roleStore); var role = new IdentityRole { Name = roleName }; roleManager.Create(role); var userStore = new UserStore<User>(context); var userManager = new UserManager<User>(userStore); var admin = new User { Email = adminUsername }; userManager.Create(admin, adminPass); userManager.AddToRole(admin.Id, roleName); } } } }
namespace StudentSystem.Data.Migrations { using System; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; public sealed class Configuration : DbMigrationsConfiguration<ApplicationDbContext> { public Configuration() { this.AutomaticMigrationsEnabled = true; this.AutomaticMigrationDataLossAllowed = true; } protected override void Seed(ApplicationDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // } } }
mit
C#
3dc7ccc273a69b950edffb7c5e0f11a2a2b004b5
Fix AssemblyVersionLayoutRenderer on ASP.NET to work with async=true (Rename to FixThreadAgnostic) (#635)
NLog/NLog.Web
src/Shared/LayoutRenderers/AssemblyVersionLayoutRenderer.cs
src/Shared/LayoutRenderers/AssemblyVersionLayoutRenderer.cs
using System.Reflection; using System.Text; using NLog.Common; using NLog.Config; using NLog.LayoutRenderers; namespace NLog.Web.LayoutRenderers { /// <summary> /// Extend NLog.LayoutRenderers.AssemblyVersionLayoutRenderer with ASP.NET Full and Core support /// </summary> [LayoutRenderer("assembly-version")] [ThreadAgnostic] [ThreadSafe] public class AssemblyVersionLayoutRenderer : NLog.LayoutRenderers.AssemblyVersionLayoutRenderer { #if !ASP_NET_CORE /// <summary> /// Support capture of Assembly-Version from active HttpContext ApplicationInstance /// </summary> public LayoutRenderer FixThreadAgnostic => string.IsNullOrEmpty(Name) ? _fixThreadAgnostic : null; private readonly LayoutRenderer _fixThreadAgnostic = new ThreadIdLayoutRenderer(); #endif /// <inheritdoc /> protected override void InitializeLayoutRenderer() { InternalLogger.Debug("Extending ${assembly-version} " + nameof(NLog.LayoutRenderers.AssemblyVersionLayoutRenderer) + " with NLog.Web implementation"); base.InitializeLayoutRenderer(); } /// <inheritdoc /> protected override Assembly GetAssembly() { var assembly = base.GetAssembly(); #if !ASP_NET_CORE if (assembly == null) { assembly = GetAspNetEntryAssembly(); } #endif return assembly; } #if !ASP_NET_CORE private static Assembly GetAspNetEntryAssembly() { var applicatonType = System.Web.HttpContext.Current?.ApplicationInstance?.GetType(); while (applicatonType != null && applicatonType.Namespace == "ASP") { applicatonType = applicatonType.BaseType; } return applicatonType?.Assembly; } #endif } }
using System.Reflection; using System.Text; using NLog.Common; using NLog.Config; using NLog.LayoutRenderers; namespace NLog.Web.LayoutRenderers { /// <summary> /// Extend NLog.LayoutRenderers.AssemblyVersionLayoutRenderer with ASP.NET Full and Core support /// </summary> [LayoutRenderer("assembly-version")] [ThreadAgnostic] [ThreadSafe] public class AssemblyVersionLayoutRenderer : NLog.LayoutRenderers.AssemblyVersionLayoutRenderer { #if !ASP_NET_CORE /// <summary> /// Support capture of Assembly-Version from active HttpContext /// </summary> public LayoutRenderer ThreadAgnostic => string.IsNullOrEmpty(Name) ? _threadAgnostic : null; private readonly LayoutRenderer _threadAgnostic = new ThreadIdLayoutRenderer(); #endif /// <inheritdoc /> protected override void Append(StringBuilder builder, LogEventInfo logEvent) { InternalLogger.Trace("Extending ${assembly-version} " + nameof(NLog.LayoutRenderers.AssemblyVersionLayoutRenderer) + " with NLog.Web implementation"); base.Append(builder, logEvent); } /// <inheritdoc /> protected override Assembly GetAssembly() { var assembly = base.GetAssembly(); #if !ASP_NET_CORE if (assembly == null) { assembly = GetAspNetEntryAssembly(); } #endif return assembly; } #if !ASP_NET_CORE private static Assembly GetAspNetEntryAssembly() { var applicatonType = System.Web.HttpContext.Current?.ApplicationInstance?.GetType(); while (applicatonType != null && applicatonType.Namespace == "ASP") { applicatonType = applicatonType.BaseType; } return applicatonType?.Assembly; } #endif } }
bsd-3-clause
C#
25f1fbd1069f788bfb111b263c8e0af0529aad9e
fix test directory
gomafutofu/BtrieveWrapper,yezorat/BtrieveWrapper,yezorat/BtrieveWrapper,gomafutofu/BtrieveWrapper
BtrieveWrapper.Orm.Tests/Settings.cs
BtrieveWrapper.Orm.Tests/Settings.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BtrieveWrapper.Orm.Tests { class Settings { public const string DllPath = null; public const string TemporaryDirectory = @"c:\tmp\BtrieveWrapper.Orm.Tests"; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BtrieveWrapper.Orm.Tests { class Settings { public const string DllPath = null; public const string TemporaryDirectory = @"\\development\test"; } }
mit
C#
489f7bd099caeab13e6750d7d7c468f427f10868
remove ignoreLayerCollision
nferruzzi/xplode
Assets/Scripts/WeaponController.cs
Assets/Scripts/WeaponController.cs
using UnityEngine; using System.Collections; using System.Collections.Generic; public interface IWeaponInterface { void FireDown (GameObject parent, Vector3 offset); void FireUp (); } public interface IProjectileInterface { float damage { get; set; } GameObject gameObject { get; } void ShowExplosionAt (Vector3 point, Vector3 normal); } public class WeaponController : MonoBehaviour { List<IWeaponInterface> currentWeapons; public GameObject mainGun; // Use this for initialization void Start () { currentWeapons = new List<IWeaponInterface>(); currentWeapons.Add (GetWeaponInterfaceFromGameObject(mainGun)); } IWeaponInterface GetWeaponInterfaceFromGameObject(GameObject go) { return go.GetComponentInChildren<IWeaponInterface> (); } // Update is called once per frame void Update () { } public void FireDown (GameObject parent, Vector3 offset) { foreach (var weapon in currentWeapons) { weapon.FireDown (parent, offset); } } public void FireUp() { foreach (var weapon in currentWeapons) { weapon.FireUp (); } } }
using UnityEngine; using System.Collections; using System.Collections.Generic; public interface IWeaponInterface { void FireDown (GameObject parent, Vector3 offset); void FireUp (); } public interface IProjectileInterface { float damage { get; set; } GameObject gameObject { get; } void ShowExplosionAt (Vector3 point, Vector3 normal); } public class WeaponController : MonoBehaviour { List<IWeaponInterface> currentWeapons; public GameObject mainGun; // Use this for initialization void Start () { Physics.IgnoreLayerCollision (8, 8); currentWeapons = new List<IWeaponInterface>(); currentWeapons.Add (GetWeaponInterfaceFromGameObject(mainGun)); } IWeaponInterface GetWeaponInterfaceFromGameObject(GameObject go) { return go.GetComponentInChildren<IWeaponInterface> (); } // Update is called once per frame void Update () { } public void FireDown (GameObject parent, Vector3 offset) { foreach (var weapon in currentWeapons) { weapon.FireDown (parent, offset); } } public void FireUp() { foreach (var weapon in currentWeapons) { weapon.FireUp (); } } }
mit
C#
809786c9471d531bcba28f3538a47dc74235edd3
fix import for taghelpers
sebastieno/sebastienollivier.fr,sebastieno/sebastienollivier.fr
Blog.Web/Views/_ViewImports.cshtml
Blog.Web/Views/_ViewImports.cshtml
@using Blog.Web @using Blog.Data @using Blog.Domain @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
@using Blog.Web @using Blog.Data @using Blog.Domain @addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
mit
C#
e78b76064db5e1e387d15bb43f39f37cee610fae
Add check to stop replying to invalid commands
portaljacker/portalbot
src/portalbot/Program.cs
src/portalbot/Program.cs
using Discord; using Discord.Commands; using Discord.WebSocket; using System; using System.Reflection; using System.Threading.Tasks; namespace portalbot { class Program { private CommandService _commands; private DiscordSocketClient _client; private DependencyMap _map; static void Main(string[] args) => new Program().Run().GetAwaiter().GetResult(); public async Task Run() { string token = Environment.GetEnvironmentVariable("DISCORD_BOT_TOKEN"); _client = new DiscordSocketClient(); _commands = new CommandService(); _map = new DependencyMap(); _map.Add(_client); _map.Add(_commands); _map.Add(new Random()); await InstallCommands(); /*_client.MessageReceived += async (message) => { if (message.Content == "!ping") await message.Channel.SendMessageAsync("pong"); };//*/ await _client.LoginAsync(TokenType.Bot, token); await _client.ConnectAsync(); // Block this task until the program is exited. await Task.Delay(-1); } public async Task InstallCommands() { _client.MessageReceived += HandleCommand; await _commands.AddModulesAsync(Assembly.GetEntryAssembly()); } public async Task HandleCommand(SocketMessage messageParam) { var message = messageParam as SocketUserMessage; if (message == null) return; int argPos = 0; if (!message.HasCharPrefix('!', ref argPos) || message.HasMentionPrefix(_client.CurrentUser, ref argPos)) return; var context = new CommandContext(_client, message); var result = await _commands.ExecuteAsync(context, argPos, _map); if (!result.IsSuccess) { // Don't report when command doesn't exist. if (result is SearchResult) return; await context.Channel.SendMessageAsync(result.ErrorReason); } } } }
using Discord; using Discord.Commands; using Discord.WebSocket; using System; using System.Reflection; using System.Threading.Tasks; namespace portalbot { class Program { private CommandService _commands; private DiscordSocketClient _client; private DependencyMap _map; static void Main(string[] args) => new Program().Run().GetAwaiter().GetResult(); public async Task Run() { string token = Environment.GetEnvironmentVariable("DISCORD_BOT_TOKEN"); _client = new DiscordSocketClient(); _commands = new CommandService(); _map = new DependencyMap(); _map.Add(_client); _map.Add(_commands); _map.Add(new Random()); await InstallCommands(); /*_client.MessageReceived += async (message) => { if (message.Content == "!ping") await message.Channel.SendMessageAsync("pong"); };//*/ await _client.LoginAsync(TokenType.Bot, token); await _client.ConnectAsync(); // Block this task until the program is exited. await Task.Delay(-1); } public async Task InstallCommands() { _client.MessageReceived += HandleCommand; await _commands.AddModulesAsync(Assembly.GetEntryAssembly()); } public async Task HandleCommand(SocketMessage messageParam) { var message = messageParam as SocketUserMessage; if (message == null) return; int argPos = 0; if (!message.HasCharPrefix('!', ref argPos) || message.HasMentionPrefix(_client.CurrentUser, ref argPos)) return; var context = new CommandContext(_client, message); var result = await _commands.ExecuteAsync(context, argPos, _map); if (!result.IsSuccess) await context.Channel.SendMessageAsync(result.ErrorReason); } } }
mit
C#
b9c778ea000d78a93bd0ad31631409af657adae4
Update comment per PR review.
jetreports/EPPlus
EPPlus/Table/PivotTable/RangePr.cs
EPPlus/Table/PivotTable/RangePr.cs
using System; using System.Xml; using OfficeOpenXml.Utils; namespace OfficeOpenXml.Table.PivotTable { /// <summary> /// Represents the rangePr XML element. /// </summary> public class RangePr : XmlHelper { #region Properties /// <summary> /// Gets or sets the @startDate xml attribute value. /// </summary> public DateTime? StartDate { get { string value = base.GetXmlNodeString("@startDate"); if (string.IsNullOrEmpty(value)) return null; return DateTime.Parse(value); } set { base.SetXmlNodeString("@startDate", ConvertUtil.ConvertObjectToXmlAttributeString(value), true); } } /// <summary> /// Gets or sets the @endDate xml attribute value. /// </summary> public DateTime? EndDate { get { string value = base.GetXmlNodeString("@endDate"); if (string.IsNullOrEmpty(value)) return null; return DateTime.Parse(value); } set { base.SetXmlNodeString("@endDate", ConvertUtil.ConvertObjectToXmlAttributeString(value), true); } } /// <summary> /// Gets the type of group by that this grouping represents. /// </summary> public string GroupBy { get { return base.GetXmlNodeString("@groupBy"); } } #endregion #region Constructors /// <summary> /// Constructor. /// </summary> /// <param name="ns">The namespace manager to use for this element.</param> /// <param name="topNode">The topnode that represents this xml element.</param> public RangePr(XmlNamespaceManager ns, XmlNode topNode) : base(ns, topNode) { if (ns == null) throw new ArgumentNullException(nameof(ns)); if (topNode == null) throw new ArgumentNullException(nameof(topNode)); } #endregion } }
using System; using System.Xml; using OfficeOpenXml.Utils; namespace OfficeOpenXml.Table.PivotTable { /// <summary> /// Represents the rangePr XML element. /// </summary> public class RangePr : XmlHelper { #region Properties /// <summary> /// Gets or sets the @startDate xml attribute value. /// </summary> public DateTime? StartDate { get { string value = base.GetXmlNodeString("@startDate"); if (string.IsNullOrEmpty(value)) return null; return DateTime.Parse(value); } set { base.SetXmlNodeString("@startDate", ConvertUtil.ConvertObjectToXmlAttributeString(value), true); } } /// <summary> /// Gets or sets the @endDate xml attribute value. /// </summary> public DateTime? EndDate { get { string value = base.GetXmlNodeString("@endDate"); if (string.IsNullOrEmpty(value)) return null; return DateTime.Parse(value); } set { base.SetXmlNodeString("@endDate", ConvertUtil.ConvertObjectToXmlAttributeString(value), true); } } /// <summary> /// Gets or sets the type of group by that this grouping represents. /// </summary> public string GroupBy { get { return base.GetXmlNodeString("@groupBy"); } } #endregion #region Constructors /// <summary> /// Constructor. /// </summary> /// <param name="ns">The namespace manager to use for this element.</param> /// <param name="topNode">The topnode that represents this xml element.</param> public RangePr(XmlNamespaceManager ns, XmlNode topNode) : base(ns, topNode) { if (ns == null) throw new ArgumentNullException(nameof(ns)); if (topNode == null) throw new ArgumentNullException(nameof(topNode)); } #endregion } }
lgpl-2.1
C#
8549e2ab9de3c0e28f4f52c0f405ed6e4c3962d0
Add IsDownloading property
witoong623/TirkxDownloader,witoong623/TirkxDownloader
Framework/Interface/IDownloader.cs
Framework/Interface/IDownloader.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TirkxDownloader.Framework.Interface { public interface IDownloader { bool IsDownloading { get; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TirkxDownloader.Framework.Interface { interface IDownloader { } }
mit
C#
5963fa52aa7f301aba7963b5c684930faab74573
Update AssemblyInfo.cs
mcintyre321/Noodles,mcintyre321/Noodles
Noodles/Properties/AssemblyInfo.cs
Noodles/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("Noodles")] [assembly: AssemblyDescription("Noodles transforms your object modelinto a web app. This is the core library without a dependency on ASP MVC")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Harry McIntyre")] [assembly: AssemblyProduct("Noodles")] [assembly: AssemblyCopyright("MIT Licence")] [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("791aaafa-a6a8-4997-8621-4ae98ddf0e1c")] // 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.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("Noodles")] [assembly: AssemblyDescription("Noodles transforms your object modelinto a web app. This is the core library without a dependency on ASP MVC")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Harry McIntyre")] [assembly: AssemblyProduct("Noodles")] [assembly: AssemblyCopyright("MIT Licence")] [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("791aaafa-a6a8-4997-8621-4ae98ddf0e1c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
f47b21655215ff425ebd113e152a945a97de8580
Update DistributedCacheQueryRepository.cs
tiksn/TIKSN-Framework
TIKSN.Core/Data/Cache/Distributed/DistributedCacheQueryRepository.cs
TIKSN.Core/Data/Cache/Distributed/DistributedCacheQueryRepository.cs
using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Options; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using TIKSN.Serialization; namespace TIKSN.Data.Cache.Distributed { public class DistributedCacheQueryRepository<TEntity, TIdentity> : DistributedCacheRepository<TEntity, TIdentity>, IQueryRepository<TEntity, TIdentity> where TEntity : IEntity<TIdentity> where TIdentity : IEquatable<TIdentity> { public DistributedCacheQueryRepository( IDistributedCache distributedCache, ISerializer<byte[]> serializer, IDeserializer<byte[]> deserializer, IOptions<DistributedCacheDecoratorOptions> genericOptions, IOptions<DistributedCacheDecoratorOptions<TEntity>> specificOptions) : base(distributedCache, serializer, deserializer, genericOptions, specificOptions) { } public async Task<bool> ExistsAsync(TIdentity id, CancellationToken cancellationToken) { var cachedBytes = await _distributedCache.GetAsync(CreateEntryCacheKey(id), cancellationToken); return cachedBytes != null; } public async Task<TEntity> GetAsync(TIdentity id, CancellationToken cancellationToken) { var result = await GetFromDistributedCacheAsync<TEntity>(CreateEntryCacheKey(id), cancellationToken); if (result == null) { throw new NullReferenceException("Result retrieved from cache or from original source is null."); } return result; } public Task<TEntity> GetOrDefaultAsync(TIdentity id, CancellationToken cancellationToken) { return GetFromDistributedCacheAsync<TEntity>(CreateEntryCacheKey(id), cancellationToken); } public async Task<IEnumerable<TEntity>> ListAsync(IEnumerable<TIdentity> ids, CancellationToken cancellationToken) { return await BatchOperationHelper.BatchOperationAsync(ids, cancellationToken, (id, ct) => GetAsync(id, ct)); } } }
using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Options; using System; using System.Threading; using System.Threading.Tasks; using TIKSN.Serialization; namespace TIKSN.Data.Cache.Distributed { public class DistributedCacheQueryRepository<TEntity, TIdentity> : DistributedCacheRepository<TEntity, TIdentity>, IQueryRepository<TEntity, TIdentity> where TEntity : IEntity<TIdentity> where TIdentity : IEquatable<TIdentity> { public DistributedCacheQueryRepository( IDistributedCache distributedCache, ISerializer<byte[]> serializer, IDeserializer<byte[]> deserializer, IOptions<DistributedCacheDecoratorOptions> genericOptions, IOptions<DistributedCacheDecoratorOptions<TEntity>> specificOptions) : base(distributedCache, serializer, deserializer, genericOptions, specificOptions) { } public async Task<bool> ExistsAsync(TIdentity id, CancellationToken cancellationToken) { var cachedBytes = await _distributedCache.GetAsync(CreateEntryCacheKey(id), cancellationToken); return cachedBytes != null; } public async Task<TEntity> GetAsync(TIdentity id, CancellationToken cancellationToken) { var result = await GetFromDistributedCacheAsync<TEntity>(CreateEntryCacheKey(id), cancellationToken); if (result == null) { throw new NullReferenceException("Result retrieved from cache or from original source is null."); } return result; } public Task<TEntity> GetOrDefaultAsync(TIdentity id, CancellationToken cancellationToken) { return GetFromDistributedCacheAsync<TEntity>(CreateEntryCacheKey(id), cancellationToken); } } }
mit
C#
afb2111caf04aafead70647d8c544914478625d9
Test for default plex path before checking for registry key.
cjmurph/PmsService,cjmurph/PmsService
PlexServiceCommon/PlexDirHelper.cs
PlexServiceCommon/PlexDirHelper.cs
using System; using System.IO; using Microsoft.Win32; namespace PlexServiceCommon { public static class PlexDirHelper { /// <summary> /// Returns the full path and filename of the plex media server executable /// </summary> /// <returns></returns> public static string GetPlexDataDir() { var result = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var path = Path.Combine(result, "Plex Media Server"); if (Directory.Exists(path)) { return path; } result = String.Empty; //work out the os type (32 or 64) and set the registry view to suit. this is only a reliable check when this project is compiled to x86. var is64Bit = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")); var architecture = RegistryView.Registry32; if (is64Bit) { architecture = RegistryView.Registry64; } using var pmsDataKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, architecture).OpenSubKey(@"Software\Plex, Inc.\Plex Media Server"); if (pmsDataKey == null) { return result; } path = (string) pmsDataKey.GetValue("LocalAppdataPath"); result = path; return result; } } }
using System; using Microsoft.Win32; namespace PlexServiceCommon { public static class PlexDirHelper { /// <summary> /// Returns the full path and filename of the plex media server executable /// </summary> /// <returns></returns> public static string GetPlexDataDir() { var result = string.Empty; //work out the os type (32 or 64) and set the registry view to suit. this is only a reliable check when this project is compiled to x86. var is64Bit = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")); var architecture = RegistryView.Registry32; if (is64Bit) { architecture = RegistryView.Registry64; } using var pmsDataKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, architecture).OpenSubKey(@"Software\Plex, Inc.\Plex Media Server"); if (pmsDataKey == null) { return result; } var path = (string) pmsDataKey.GetValue("LocalAppdataPath"); result = path; return result; } } }
mit
C#
ef15d64ec30a1ce69a47b6341de20ee085004dfb
Fix for bad crop.
SuperJMN/Glass,SuperJMN/Glass-Legacy
Glass.Imaging/Core/RecognizedZone.cs
Glass.Imaging/Core/RecognizedZone.cs
namespace Glass.Imaging.Core { using System.Windows.Media.Imaging; public class RecognizedZone { public RecognizedZone(BitmapSource bitmap, ZoneConfiguration zoneConfiguration, RecognitionResult recognitionResult) { ZoneConfig = zoneConfiguration; Bitmap = bitmap; RecognitionResult = recognitionResult; } public RecognitionResult RecognitionResult { get; set; } public BitmapSource Bitmap { get; set; } public ZoneConfiguration ZoneConfig { get; set; } public string Id => ZoneConfig.Id; } }
namespace Glass.Imaging.Core { using System.Windows.Media; using System.Windows.Media.Imaging; public class RecognizedZone { public RecognizedZone(BitmapSource bitmap, ZoneConfiguration zoneConfiguration, RecognitionResult recognitionResult) { ZoneConfig = zoneConfiguration; var bitmapSource = ImagingContext.BitmapOperations.Crop(bitmap, zoneConfiguration.Bounds); bitmapSource.Freeze(); Bitmap = bitmapSource; RecognitionResult = recognitionResult; } public RecognitionResult RecognitionResult { get; set; } public BitmapSource Bitmap { get; set; } public ZoneConfiguration ZoneConfig { get; set; } public string Id => ZoneConfig.Id; } }
mit
C#
a54a8737a882b76d6ac13114f5d3e5eed1f1c0d1
Add Join extension for strings
SaberSnail/GoldenAnvil.Utility
GoldenAnvil.Utility/StringUtility.cs
GoldenAnvil.Utility/StringUtility.cs
using System.Collections.Generic; using System.Globalization; using System.Text; namespace GoldenAnvil.Utility { public static class StringUtility { public static string FormatInvariant(this string format, params object[] args) { return string.Format(CultureInfo.InvariantCulture, format, args); } public static string Join(this IEnumerable<string> parts, string joinText) { var builder = new StringBuilder(); foreach (var part in parts) { if (builder.Length != 0) builder.Append(joinText); builder.Append(part); } return builder.ToString(); } } }
using System.Globalization; namespace GoldenAnvil.Utility { public static class StringUtility { public static string FormatInvariant(this string format, params object[] args) { return string.Format(CultureInfo.InvariantCulture, format, args); } } }
mit
C#
3806a050c42cc351c83d9a1944430a6929cbb1ad
delete for hard-coded
ralbu/FunBrain-DotNetCore
src/FunBrainInfrastructure/Repositories/UserRepositoryHardCoded.cs
src/FunBrainInfrastructure/Repositories/UserRepositoryHardCoded.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FunBrainDomain; using FunBrainInfrastructure.Models; namespace FunBrainInfrastructure.Repositories { public class UserRepositoryHardCoded : IUserRepository { private List<User> _users; public UserRepositoryHardCoded() { _users = new List<User> { new User {Id = 1, Name = "User 1", Email = "user1@email.com"}, new User {Id = 2, Name = "User 2", Email = "user2@email.com"}, new User {Id = 3, Name = "User 3", Email = "user3@email.com"}, new User {Id = 4, Name = "User 4", Email = "user4@email.com"} }; } public IEnumerable<User> Get() { return _users; } public User GetById(int id) { return _users.FirstOrDefault(user => user.Id == id); } public User Create(UserCreate newUser) { var userToCreate = newUser.ToUser(_users.Count + 1); _users.Add(userToCreate); return userToCreate; } public User Update(int userId, UserUpdate updateUser) { var userToUpdate = _users.FirstOrDefault(user => user.Id == userId); userToUpdate.Name = updateUser.Name; userToUpdate.Email = updateUser.Email; return userToUpdate; } public bool Delete(int userId) { var userToDelete = _users.FirstOrDefault(user => user.Id == userId); if (userToDelete == null) return false; _users.Remove(userToDelete); return true; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FunBrainDomain; using FunBrainInfrastructure.Models; namespace FunBrainInfrastructure.Repositories { public class UserRepositoryHardCoded : IUserRepository { private List<User> _users; public UserRepositoryHardCoded() { _users = new List<User> { new User {Id = 1, Name = "User 1", Email = "user1@email.com"}, new User {Id = 2, Name = "User 2", Email = "user2@email.com"}, new User {Id = 3, Name = "User 3", Email = "user3@email.com"}, new User {Id = 4, Name = "User 4", Email = "user4@email.com"} }; } public IEnumerable<User> Get() { return _users; } public User GetById(int id) { return _users.FirstOrDefault(user => user.Id == id); } public User Create(UserCreate newUser) { var userToCreate = newUser.ToUser(_users.Count + 1); _users.Add(userToCreate); return userToCreate; } public User Update(int userId, UserUpdate updateUser) { var userToUpdate = _users.FirstOrDefault(user => user.Id == userId); userToUpdate.Name = updateUser.Name; userToUpdate.Email = updateUser.Email; return userToUpdate; } public bool Delete(int userId) { throw new NotImplementedException(); } } }
mit
C#
fe38d887bd418459503ca13b930a8ef41cc45896
Fix UL not using css classes for Lists in Widgets, too.
m2cms/Orchard,neTp9c/Orchard,abhishekluv/Orchard,jimasp/Orchard,xkproject/Orchard,salarvand/orchard,Praggie/Orchard,yersans/Orchard,OrchardCMS/Orchard-Harvest-Website,yersans/Orchard,omidnasri/Orchard,NIKASoftwareDevs/Orchard,yonglehou/Orchard,luchaoshuai/Orchard,salarvand/Portal,emretiryaki/Orchard,jchenga/Orchard,Fogolan/OrchardForWork,jaraco/orchard,andyshao/Orchard,dburriss/Orchard,RoyalVeterinaryCollege/Orchard,infofromca/Orchard,dcinzona/Orchard-Harvest-Website,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,xiaobudian/Orchard,oxwanawxo/Orchard,xiaobudian/Orchard,harmony7/Orchard,johnnyqian/Orchard,jimasp/Orchard,mgrowan/Orchard,Codinlab/Orchard,Lombiq/Orchard,qt1/orchard4ibn,OrchardCMS/Orchard-Harvest-Website,OrchardCMS/Orchard,armanforghani/Orchard,cryogen/orchard,hannan-azam/Orchard,huoxudong125/Orchard,AEdmunds/beautiful-springtime,cryogen/orchard,mgrowan/Orchard,armanforghani/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,infofromca/Orchard,rtpHarry/Orchard,mgrowan/Orchard,SouleDesigns/SouleDesigns.Orchard,escofieldnaxos/Orchard,planetClaire/Orchard-LETS,salarvand/orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,JRKelso/Orchard,SeyDutch/Airbrush,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,TalaveraTechnologySolutions/Orchard,OrchardCMS/Orchard-Harvest-Website,Serlead/Orchard,Inner89/Orchard,abhishekluv/Orchard,Ermesx/Orchard,Dolphinsimon/Orchard,LaserSrl/Orchard,Sylapse/Orchard.HttpAuthSample,IDeliverable/Orchard,arminkarimi/Orchard,luchaoshuai/Orchard,oxwanawxo/Orchard,abhishekluv/Orchard,gcsuk/Orchard,fortunearterial/Orchard,omidnasri/Orchard,aaronamm/Orchard,hannan-azam/Orchard,Codinlab/Orchard,salarvand/orchard,gcsuk/Orchard,jimasp/Orchard,phillipsj/Orchard,patricmutwiri/Orchard,AndreVolksdorf/Orchard,DonnotRain/Orchard,jersiovic/Orchard,TalaveraTechnologySolutions/Orchard,TalaveraTechnologySolutions/Orchard,qt1/Orchard,ericschultz/outercurve-orchard,kouweizhong/Orchard,marcoaoteixeira/Orchard,Praggie/Orchard,Praggie/Orchard,Ermesx/Orchard,Dolphinsimon/Orchard,cooclsee/Orchard,mvarblow/Orchard,fassetar/Orchard,stormleoxia/Orchard,qt1/Orchard,AdvantageCS/Orchard,TalaveraTechnologySolutions/Orchard,RoyalVeterinaryCollege/Orchard,omidnasri/Orchard,arminkarimi/Orchard,jimasp/Orchard,kgacova/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,dcinzona/Orchard-Harvest-Website,infofromca/Orchard,fassetar/Orchard,aaronamm/Orchard,ericschultz/outercurve-orchard,Anton-Am/Orchard,xiaobudian/Orchard,bigfont/orchard-cms-modules-and-themes,patricmutwiri/Orchard,IDeliverable/Orchard,luchaoshuai/Orchard,neTp9c/Orchard,jagraz/Orchard,IDeliverable/Orchard,bigfont/orchard-cms-modules-and-themes,marcoaoteixeira/Orchard,KeithRaven/Orchard,angelapper/Orchard,OrchardCMS/Orchard-Harvest-Website,xkproject/Orchard,brownjordaninternational/OrchardCMS,dburriss/Orchard,dozoft/Orchard,TaiAivaras/Orchard,spraiin/Orchard,MetSystem/Orchard,jerryshi2007/Orchard,Anton-Am/Orchard,hannan-azam/Orchard,oxwanawxo/Orchard,yersans/Orchard,angelapper/Orchard,Inner89/Orchard,sfmskywalker/Orchard,aaronamm/Orchard,escofieldnaxos/Orchard,vard0/orchard.tan,austinsc/Orchard,Sylapse/Orchard.HttpAuthSample,TaiAivaras/Orchard,RoyalVeterinaryCollege/Orchard,sfmskywalker/Orchard,johnnyqian/Orchard,alejandroaldana/Orchard,enspiral-dev-academy/Orchard,brownjordaninternational/OrchardCMS,stormleoxia/Orchard,marcoaoteixeira/Orchard,huoxudong125/Orchard,smartnet-developers/Orchard,grapto/Orchard.CloudBust,vairam-svs/Orchard,grapto/Orchard.CloudBust,Cphusion/Orchard,TaiAivaras/Orchard,ehe888/Orchard,jersiovic/Orchard,vairam-svs/Orchard,xkproject/Orchard,Lombiq/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,arminkarimi/Orchard,alejandroaldana/Orchard,dozoft/Orchard,patricmutwiri/Orchard,aaronamm/Orchard,dozoft/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,Dolphinsimon/Orchard,Morgma/valleyviewknolls,omidnasri/Orchard,NIKASoftwareDevs/Orchard,li0803/Orchard,dburriss/Orchard,jtkech/Orchard,hbulzy/Orchard,sfmskywalker/Orchard,yonglehou/Orchard,Lombiq/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,mvarblow/Orchard,hbulzy/Orchard,jtkech/Orchard,sfmskywalker/Orchard,MetSystem/Orchard,fortunearterial/Orchard,harmony7/Orchard,geertdoornbos/Orchard,Ermesx/Orchard,dozoft/Orchard,caoxk/orchard,stormleoxia/Orchard,johnnyqian/Orchard,patricmutwiri/Orchard,jerryshi2007/Orchard,Sylapse/Orchard.HttpAuthSample,xiaobudian/Orchard,dcinzona/Orchard-Harvest-Website,Serlead/Orchard,cryogen/orchard,MpDzik/Orchard,TalaveraTechnologySolutions/Orchard,hhland/Orchard,dburriss/Orchard,yersans/Orchard,caoxk/orchard,spraiin/Orchard,Lombiq/Orchard,omidnasri/Orchard,ericschultz/outercurve-orchard,SouleDesigns/SouleDesigns.Orchard,jchenga/Orchard,jchenga/Orchard,abhishekluv/Orchard,RoyalVeterinaryCollege/Orchard,jerryshi2007/Orchard,SeyDutch/Airbrush,SeyDutch/Airbrush,Ermesx/Orchard,fortunearterial/Orchard,vard0/orchard.tan,bigfont/orchard-continuous-integration-demo,escofieldnaxos/Orchard,SzymonSel/Orchard,KeithRaven/Orchard,dcinzona/Orchard,kgacova/Orchard,mgrowan/Orchard,OrchardCMS/Orchard,ericschultz/outercurve-orchard,Inner89/Orchard,salarvand/Portal,jersiovic/Orchard,armanforghani/Orchard,AdvantageCS/Orchard,fortunearterial/Orchard,oxwanawxo/Orchard,vard0/orchard.tan,jagraz/Orchard,li0803/Orchard,gcsuk/Orchard,brownjordaninternational/OrchardCMS,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,kouweizhong/Orchard,sfmskywalker/Orchard,bigfont/orchard-cms-modules-and-themes,vard0/orchard.tan,MetSystem/Orchard,salarvand/Portal,tobydodds/folklife,luchaoshuai/Orchard,IDeliverable/Orchard,neTp9c/Orchard,tobydodds/folklife,ehe888/Orchard,Dolphinsimon/Orchard,yersans/Orchard,omidnasri/Orchard,mgrowan/Orchard,Fogolan/OrchardForWork,fassetar/Orchard,IDeliverable/Orchard,LaserSrl/Orchard,dburriss/Orchard,sebastienros/msc,grapto/Orchard.CloudBust,DonnotRain/Orchard,andyshao/Orchard,OrchardCMS/Orchard,Fogolan/OrchardForWork,SouleDesigns/SouleDesigns.Orchard,AndreVolksdorf/Orchard,alejandroaldana/Orchard,austinsc/Orchard,MpDzik/Orchard,yonglehou/Orchard,enspiral-dev-academy/Orchard,jersiovic/Orchard,johnnyqian/Orchard,emretiryaki/Orchard,phillipsj/Orchard,TalaveraTechnologySolutions/Orchard,AdvantageCS/Orchard,OrchardCMS/Orchard-Harvest-Website,fassetar/Orchard,DonnotRain/Orchard,smartnet-developers/Orchard,angelapper/Orchard,Cphusion/Orchard,austinsc/Orchard,m2cms/Orchard,huoxudong125/Orchard,Anton-Am/Orchard,andyshao/Orchard,oxwanawxo/Orchard,mvarblow/Orchard,Praggie/Orchard,Ermesx/Orchard,cooclsee/Orchard,patricmutwiri/Orchard,marcoaoteixeira/Orchard,austinsc/Orchard,omidnasri/Orchard,AndreVolksdorf/Orchard,LaserSrl/Orchard,Codinlab/Orchard,cooclsee/Orchard,dcinzona/Orchard,geertdoornbos/Orchard,MpDzik/Orchard,KeithRaven/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,dcinzona/Orchard-Harvest-Website,bedegaming-aleksej/Orchard,planetClaire/Orchard-LETS,AEdmunds/beautiful-springtime,jaraco/orchard,marcoaoteixeira/Orchard,openbizgit/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,jtkech/Orchard,dcinzona/Orchard,salarvand/orchard,NIKASoftwareDevs/Orchard,luchaoshuai/Orchard,JRKelso/Orchard,Morgma/valleyviewknolls,SzymonSel/Orchard,MpDzik/Orchard,openbizgit/Orchard,sfmskywalker/Orchard,vairam-svs/Orchard,LaserSrl/Orchard,RoyalVeterinaryCollege/Orchard,spraiin/Orchard,brownjordaninternational/OrchardCMS,cooclsee/Orchard,Morgma/valleyviewknolls,TaiAivaras/Orchard,qt1/Orchard,JRKelso/Orchard,openbizgit/Orchard,qt1/Orchard,harmony7/Orchard,openbizgit/Orchard,AndreVolksdorf/Orchard,bedegaming-aleksej/Orchard,harmony7/Orchard,alejandroaldana/Orchard,geertdoornbos/Orchard,mvarblow/Orchard,hannan-azam/Orchard,infofromca/Orchard,JRKelso/Orchard,asabbott/chicagodevnet-website,Fogolan/OrchardForWork,planetClaire/Orchard-LETS,dcinzona/Orchard,OrchardCMS/Orchard,qt1/orchard4ibn,bedegaming-aleksej/Orchard,jimasp/Orchard,escofieldnaxos/Orchard,arminkarimi/Orchard,emretiryaki/Orchard,kgacova/Orchard,bigfont/orchard-continuous-integration-demo,DonnotRain/Orchard,SzymonSel/Orchard,neTp9c/Orchard,jaraco/orchard,angelapper/Orchard,Cphusion/Orchard,asabbott/chicagodevnet-website,arminkarimi/Orchard,rtpHarry/Orchard,tobydodds/folklife,mvarblow/Orchard,hhland/Orchard,Inner89/Orchard,Morgma/valleyviewknolls,caoxk/orchard,dmitry-urenev/extended-orchard-cms-v10.1,kouweizhong/Orchard,sebastienros/msc,DonnotRain/Orchard,Praggie/Orchard,SzymonSel/Orchard,li0803/Orchard,Anton-Am/Orchard,TalaveraTechnologySolutions/Orchard,qt1/orchard4ibn,Sylapse/Orchard.HttpAuthSample,tobydodds/folklife,AndreVolksdorf/Orchard,caoxk/orchard,austinsc/Orchard,armanforghani/Orchard,kgacova/Orchard,huoxudong125/Orchard,SeyDutch/Airbrush,grapto/Orchard.CloudBust,emretiryaki/Orchard,salarvand/Portal,hbulzy/Orchard,smartnet-developers/Orchard,asabbott/chicagodevnet-website,tobydodds/folklife,jaraco/orchard,Codinlab/Orchard,rtpHarry/Orchard,OrchardCMS/Orchard-Harvest-Website,LaserSrl/Orchard,bedegaming-aleksej/Orchard,xiaobudian/Orchard,MetSystem/Orchard,KeithRaven/Orchard,Sylapse/Orchard.HttpAuthSample,SzymonSel/Orchard,abhishekluv/Orchard,openbizgit/Orchard,omidnasri/Orchard,li0803/Orchard,hannan-azam/Orchard,AEdmunds/beautiful-springtime,qt1/orchard4ibn,dozoft/Orchard,kouweizhong/Orchard,gcsuk/Orchard,rtpHarry/Orchard,huoxudong125/Orchard,AdvantageCS/Orchard,xkproject/Orchard,salarvand/orchard,kouweizhong/Orchard,Serlead/Orchard,sebastienros/msc,phillipsj/Orchard,emretiryaki/Orchard,omidnasri/Orchard,aaronamm/Orchard,xkproject/Orchard,grapto/Orchard.CloudBust,angelapper/Orchard,gcsuk/Orchard,NIKASoftwareDevs/Orchard,TalaveraTechnologySolutions/Orchard,ehe888/Orchard,planetClaire/Orchard-LETS,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,OrchardCMS/Orchard,MpDzik/Orchard,sfmskywalker/Orchard,geertdoornbos/Orchard,ehe888/Orchard,bigfont/orchard-continuous-integration-demo,tobydodds/folklife,bedegaming-aleksej/Orchard,qt1/orchard4ibn,bigfont/orchard-cms-modules-and-themes,cooclsee/Orchard,jerryshi2007/Orchard,AEdmunds/beautiful-springtime,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,AdvantageCS/Orchard,MpDzik/Orchard,jersiovic/Orchard,abhishekluv/Orchard,ehe888/Orchard,li0803/Orchard,qt1/Orchard,alejandroaldana/Orchard,andyshao/Orchard,sebastienros/msc,m2cms/Orchard,Dolphinsimon/Orchard,dcinzona/Orchard-Harvest-Website,vairam-svs/Orchard,Morgma/valleyviewknolls,geertdoornbos/Orchard,stormleoxia/Orchard,spraiin/Orchard,yonglehou/Orchard,andyshao/Orchard,neTp9c/Orchard,enspiral-dev-academy/Orchard,Cphusion/Orchard,SouleDesigns/SouleDesigns.Orchard,Serlead/Orchard,m2cms/Orchard,jchenga/Orchard,SeyDutch/Airbrush,MetSystem/Orchard,spraiin/Orchard,Inner89/Orchard,armanforghani/Orchard,yonglehou/Orchard,hbulzy/Orchard,vard0/orchard.tan,Fogolan/OrchardForWork,jtkech/Orchard,NIKASoftwareDevs/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,Serlead/Orchard,brownjordaninternational/OrchardCMS,enspiral-dev-academy/Orchard,Lombiq/Orchard,smartnet-developers/Orchard,hhland/Orchard,dcinzona/Orchard,hbulzy/Orchard,johnnyqian/Orchard,Anton-Am/Orchard,bigfont/orchard-cms-modules-and-themes,TaiAivaras/Orchard,vairam-svs/Orchard,KeithRaven/Orchard,JRKelso/Orchard,planetClaire/Orchard-LETS,rtpHarry/Orchard,Codinlab/Orchard,kgacova/Orchard,vard0/orchard.tan,hhland/Orchard,jerryshi2007/Orchard,smartnet-developers/Orchard,phillipsj/Orchard,sebastienros/msc,escofieldnaxos/Orchard,hhland/Orchard,Cphusion/Orchard,harmony7/Orchard,jtkech/Orchard,jagraz/Orchard,salarvand/Portal,qt1/orchard4ibn,m2cms/Orchard,jchenga/Orchard,fassetar/Orchard,bigfont/orchard-continuous-integration-demo,enspiral-dev-academy/Orchard,fortunearterial/Orchard,SouleDesigns/SouleDesigns.Orchard,sfmskywalker/Orchard,dcinzona/Orchard-Harvest-Website,phillipsj/Orchard,jagraz/Orchard,asabbott/chicagodevnet-website,cryogen/orchard,stormleoxia/Orchard,jagraz/Orchard,infofromca/Orchard,grapto/Orchard.CloudBust
src/Orchard.Web/Core/Containers/Views/Parts.ContainerWidget.cshtml
src/Orchard.Web/Core/Containers/Views/Parts.ContainerWidget.cshtml
@{ IEnumerable<object> items = Model.ContentItems; Model.ContentItems.Classes.Add("content-items"); Model.ContentItems.Classes.Add("list-items"); } @Display(items)
@Display(Model.ContentItems)
bsd-3-clause
C#
101494139d2006e66f476b42068b421096def0ee
Implement cache for DotNetRestore #26
Julien-Mialon/Cake.Storm,Julien-Mialon/Cake.Storm
fluent/src/Cake.Storm.Fluent.DotNetCore/Steps/DotNetRestoreStep.cs
fluent/src/Cake.Storm.Fluent.DotNetCore/Steps/DotNetRestoreStep.cs
using Cake.Common.IO; using Cake.Common.Tools.DotNetCore; using Cake.Core; using Cake.Storm.Fluent.Interfaces; using Cake.Storm.Fluent.InternalExtensions; using Cake.Storm.Fluent.Steps; namespace Cake.Storm.Fluent.DotNetCore.Steps { [PreBuildStep] internal class DotNetRestoreStep : ICacheableStep { public void Execute(IConfiguration configuration, StepType currentStep) { string solutionPath = configuration.GetSolutionPath(); if (!configuration.Context.CakeContext.FileExists(solutionPath)) { configuration.Context.CakeContext.LogAndThrow($"Solution file {solutionPath} does not exists"); } configuration.Context.CakeContext.DotNetCoreRestore(solutionPath); } public string GetCacheId(IConfiguration configuration, StepType currentStep) { return configuration.GetSolutionPath(); } } }
using Cake.Common.IO; using Cake.Common.Tools.DotNetCore; using Cake.Core; using Cake.Storm.Fluent.Interfaces; using Cake.Storm.Fluent.InternalExtensions; using Cake.Storm.Fluent.Steps; namespace Cake.Storm.Fluent.DotNetCore.Steps { [PreBuildStep] internal class DotNetRestoreStep : IStep { public void Execute(IConfiguration configuration, StepType currentStep) { string solutionPath = configuration.GetSolutionPath(); if (!configuration.Context.CakeContext.FileExists(solutionPath)) { configuration.Context.CakeContext.LogAndThrow($"Solution file {solutionPath} does not exists"); } configuration.Context.CakeContext.DotNetCoreRestore(solutionPath); } } }
mit
C#
f22dd3acd5176504c2e115cb1ad62e7225396539
fix tests
tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools
src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers.Tests/AZC0001Tests.cs
src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers.Tests/AZC0001Tests.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Threading.Tasks; using Xunit; namespace Azure.ClientSdk.Analyzers.Tests { public class AZC0001Tests { private readonly DiagnosticAnalyzerRunner _runner = new DiagnosticAnalyzerRunner(new ClientAssemblyNamespaceAnalyzer()); [Fact] public async Task AZC0001ProducedForInvalidNamespaces() { var testSource = TestSource.Read(@" namespace /*MM*/RandomNamespace { public class Program { } } "); var diagnostics = await _runner.GetDiagnosticsAsync(testSource.Source); var diagnostic = Assert.Single(diagnostics); Assert.Equal("AZC0001", diagnostic.Id); Assert.Equal("Namespace 'RandomNamespace' shouldn't contain public types. Use one of the following pre-approved namespace groups: " + "Azure.AI, Azure.Analytics, Azure.Data, Azure.Iot, Azure.Media, Azure.Messaging, Azure.Security, Azure.Storage", diagnostic.GetMessage()); AnalyzerAssert.DiagnosticLocation(testSource.DefaultMarkerLocation, diagnostic.Location); } [Fact] public async Task AZC0001ProducedOneErrorPerNamspaceDefinition() { var testSource = TestSource.Read(@" namespace RandomNamespace { public class Program { } } namespace RandomNamespace { public class Program2 { } } "); var diagnostics = await _runner.GetDiagnosticsAsync(testSource.Source); Assert.Equal(2, diagnostics.Length); Assert.All(diagnostics, d => Assert.Equal("AZC0001", d.Id)); } [Fact] public async Task AZC0001NotProducedForNamespacesWithPrivateMembersOnly() { var testSource = TestSource.Read(@" namespace RandomNamespace { internal class Program { } } "); var diagnostics = await _runner.GetDiagnosticsAsync(testSource.Source); Assert.Empty(diagnostics); } [Fact] public async Task AZC0001NotProducedForAllowedNamespaces() { var testSource = TestSource.Read(@" namespace Azure.Storage.Hello { public class Program { } } "); var diagnostics = await _runner.GetDiagnosticsAsync(testSource.Source); Assert.Empty(diagnostics); } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Threading.Tasks; using Xunit; namespace Azure.ClientSdk.Analyzers.Tests { public class AZC0001Tests { private readonly DiagnosticAnalyzerRunner _runner = new DiagnosticAnalyzerRunner(new ClientAssemblyNamespaceAnalyzer()); [Fact] public async Task AZC0001ProducedForInvalidNamespaces() { var testSource = TestSource.Read(@" namespace /*MM*/RandomNamespace { public class Program { } } "); var diagnostics = await _runner.GetDiagnosticsAsync(testSource.Source); var diagnostic = Assert.Single(diagnostics); Assert.Equal("AZC0001", diagnostic.Id); Assert.Equal("Namespace 'RandomNamespace' shouldn't contain public types. Use one of the following pre-approved namespace groups: " + "Azure.ApplicationModel, Azure.Analytics, Azure.Data, Azure.Iot, Azure.Media, Azure.Messaging, Azure.ML, Azure.Security, Azure.Storage", diagnostic.GetMessage()); AnalyzerAssert.DiagnosticLocation(testSource.DefaultMarkerLocation, diagnostic.Location); } [Fact] public async Task AZC0001ProducedOneErrorPerNamspaceDefinition() { var testSource = TestSource.Read(@" namespace RandomNamespace { public class Program { } } namespace RandomNamespace { public class Program2 { } } "); var diagnostics = await _runner.GetDiagnosticsAsync(testSource.Source); Assert.Equal(2, diagnostics.Length); Assert.All(diagnostics, d => Assert.Equal("AZC0001", d.Id)); } [Fact] public async Task AZC0001NotProducedForNamespacesWithPrivateMembersOnly() { var testSource = TestSource.Read(@" namespace RandomNamespace { internal class Program { } } "); var diagnostics = await _runner.GetDiagnosticsAsync(testSource.Source); Assert.Empty(diagnostics); } [Fact] public async Task AZC0001NotProducedForAllowedNamespaces() { var testSource = TestSource.Read(@" namespace Azure.Storage.Hello { public class Program { } } "); var diagnostics = await _runner.GetDiagnosticsAsync(testSource.Source); Assert.Empty(diagnostics); } } }
mit
C#
4d177274d48888d1b38880b3af89b1d515dfb1cf
test env vars on prod
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
src/FilterLists.Agent/Program.cs
src/FilterLists.Agent/Program.cs
using System; using System.Threading.Tasks; using FilterLists.Agent.AppSettings; using FilterLists.Agent.Extensions; using FilterLists.Agent.Features.Lists; using FilterLists.Agent.Features.Urls; using FilterLists.Agent.Features.Urls.Models.DataFileUrls; using MediatR; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace FilterLists.Agent { public static class Program { private static IServiceProvider _serviceProvider; public static async Task Main() { BuildServiceProvider(); var mediator = _serviceProvider.GetService<IOptions<GitHub>>().Value; Console.WriteLine(mediator.ProductHeaderValue); //await mediator.Send(new CaptureLists.Command()); //await mediator.Send(new ValidateAllUrls.Command()); } private static void BuildServiceProvider() { var serviceCollection = new ServiceCollection(); serviceCollection.RegisterAgentServices(); _serviceProvider = serviceCollection.BuildServiceProvider(); } } }
using System; using System.Threading.Tasks; using FilterLists.Agent.Extensions; using FilterLists.Agent.Features.Lists; using FilterLists.Agent.Features.Urls; using MediatR; using Microsoft.Extensions.DependencyInjection; namespace FilterLists.Agent { public static class Program { private static IServiceProvider _serviceProvider; public static async Task Main() { BuildServiceProvider(); var mediator = _serviceProvider.GetService<IMediator>(); await mediator.Send(new CaptureLists.Command()); await mediator.Send(new ValidateAllUrls.Command()); } private static void BuildServiceProvider() { var serviceCollection = new ServiceCollection(); serviceCollection.RegisterAgentServices(); _serviceProvider = serviceCollection.BuildServiceProvider(); } } }
mit
C#
f8d2fe7b091973b560b9d864aad714386ff078a8
return negative error code from acceptance tests if failed
mattherman/MbDotNet,mattherman/MbDotNet,SuperDrew/MbDotNet
MbDotNet.Acceptance.Tests/Program.cs
MbDotNet.Acceptance.Tests/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MbDotNet.Acceptance.Tests { class Program { public static MountebankClient Client { get; set; } static void Main(string[] args) { SetupTestEnvironment(); int resultCode = RunAcceptanceTests(); Environment.Exit(resultCode); } private static int RunAcceptanceTests() { try { AcceptanceTest.CanCreateImposter(Client); AcceptanceTest.CanDeleteImposter(Client); } catch (Exception) { return -1; } return 0; } private static void SetupTestEnvironment() { Client = new MountebankClient(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MbDotNet.Acceptance.Tests { class Program { public static MountebankClient Client { get; set; } static void Main(string[] args) { SetupTestEnvironment(); RunAcceptanceTests(); } private static void RunAcceptanceTests() { AcceptanceTest.CanCreateImposter(Client); AcceptanceTest.CanDeleteImposter(Client); } private static void SetupTestEnvironment() { Client = new MountebankClient(); } } }
mit
C#
14130e909dd0290975ece6d1420d2839a86e8609
Delete System.Reflection.AssemblyNameProxyTest
ericstj/corefx,ptoonen/corefx,nbarbettini/corefx,DnlHarvey/corefx,parjong/corefx,krk/corefx,mazong1123/corefx,krytarowski/corefx,weltkante/corefx,dhoehna/corefx,twsouthwick/corefx,mmitche/corefx,rubo/corefx,alexperovich/corefx,mazong1123/corefx,yizhang82/corefx,wtgodbe/corefx,mmitche/corefx,dotnet-bot/corefx,alexperovich/corefx,dotnet-bot/corefx,wtgodbe/corefx,mmitche/corefx,wtgodbe/corefx,nbarbettini/corefx,mmitche/corefx,stone-li/corefx,gkhanna79/corefx,alexperovich/corefx,Ermiar/corefx,JosephTremoulet/corefx,billwert/corefx,ViktorHofer/corefx,seanshpark/corefx,krk/corefx,dhoehna/corefx,stephenmichaelf/corefx,axelheer/corefx,stone-li/corefx,the-dwyer/corefx,MaggieTsang/corefx,ericstj/corefx,mazong1123/corefx,elijah6/corefx,dotnet-bot/corefx,YoupHulsebos/corefx,shimingsg/corefx,mazong1123/corefx,richlander/corefx,jlin177/corefx,ericstj/corefx,YoupHulsebos/corefx,richlander/corefx,ptoonen/corefx,richlander/corefx,seanshpark/corefx,cydhaselton/corefx,elijah6/corefx,yizhang82/corefx,cydhaselton/corefx,ravimeda/corefx,parjong/corefx,weltkante/corefx,Petermarcu/corefx,shimingsg/corefx,YoupHulsebos/corefx,cydhaselton/corefx,wtgodbe/corefx,shimingsg/corefx,twsouthwick/corefx,cydhaselton/corefx,stone-li/corefx,Petermarcu/corefx,ravimeda/corefx,fgreinacher/corefx,dhoehna/corefx,Jiayili1/corefx,Ermiar/corefx,Petermarcu/corefx,krk/corefx,Ermiar/corefx,DnlHarvey/corefx,ptoonen/corefx,krytarowski/corefx,stone-li/corefx,shimingsg/corefx,MaggieTsang/corefx,parjong/corefx,seanshpark/corefx,ericstj/corefx,richlander/corefx,DnlHarvey/corefx,Ermiar/corefx,billwert/corefx,twsouthwick/corefx,gkhanna79/corefx,billwert/corefx,mmitche/corefx,nchikanov/corefx,axelheer/corefx,fgreinacher/corefx,tijoytom/corefx,stephenmichaelf/corefx,shimingsg/corefx,the-dwyer/corefx,twsouthwick/corefx,JosephTremoulet/corefx,rjxby/corefx,elijah6/corefx,dotnet-bot/corefx,zhenlan/corefx,zhenlan/corefx,weltkante/corefx,billwert/corefx,axelheer/corefx,nchikanov/corefx,Petermarcu/corefx,YoupHulsebos/corefx,ptoonen/corefx,ericstj/corefx,nchikanov/corefx,MaggieTsang/corefx,mmitche/corefx,nbarbettini/corefx,tijoytom/corefx,the-dwyer/corefx,ViktorHofer/corefx,jlin177/corefx,seanshpark/corefx,stone-li/corefx,rjxby/corefx,Ermiar/corefx,krk/corefx,MaggieTsang/corefx,jlin177/corefx,ViktorHofer/corefx,rjxby/corefx,yizhang82/corefx,zhenlan/corefx,krk/corefx,the-dwyer/corefx,tijoytom/corefx,stephenmichaelf/corefx,gkhanna79/corefx,Petermarcu/corefx,zhenlan/corefx,stone-li/corefx,ptoonen/corefx,parjong/corefx,krytarowski/corefx,JosephTremoulet/corefx,Petermarcu/corefx,ravimeda/corefx,shimingsg/corefx,krytarowski/corefx,parjong/corefx,yizhang82/corefx,mazong1123/corefx,rubo/corefx,nbarbettini/corefx,elijah6/corefx,MaggieTsang/corefx,elijah6/corefx,krytarowski/corefx,stephenmichaelf/corefx,fgreinacher/corefx,jlin177/corefx,ravimeda/corefx,JosephTremoulet/corefx,YoupHulsebos/corefx,rubo/corefx,tijoytom/corefx,YoupHulsebos/corefx,weltkante/corefx,alexperovich/corefx,JosephTremoulet/corefx,jlin177/corefx,ravimeda/corefx,seanshpark/corefx,alexperovich/corefx,yizhang82/corefx,elijah6/corefx,nbarbettini/corefx,dotnet-bot/corefx,DnlHarvey/corefx,cydhaselton/corefx,shimingsg/corefx,BrennanConroy/corefx,stephenmichaelf/corefx,cydhaselton/corefx,BrennanConroy/corefx,billwert/corefx,billwert/corefx,weltkante/corefx,rjxby/corefx,parjong/corefx,krytarowski/corefx,elijah6/corefx,axelheer/corefx,rjxby/corefx,alexperovich/corefx,jlin177/corefx,stephenmichaelf/corefx,Jiayili1/corefx,dotnet-bot/corefx,tijoytom/corefx,krk/corefx,gkhanna79/corefx,JosephTremoulet/corefx,richlander/corefx,axelheer/corefx,BrennanConroy/corefx,nbarbettini/corefx,ravimeda/corefx,ptoonen/corefx,dhoehna/corefx,yizhang82/corefx,axelheer/corefx,alexperovich/corefx,the-dwyer/corefx,ViktorHofer/corefx,twsouthwick/corefx,ViktorHofer/corefx,nbarbettini/corefx,ravimeda/corefx,yizhang82/corefx,billwert/corefx,dotnet-bot/corefx,Jiayili1/corefx,tijoytom/corefx,mazong1123/corefx,fgreinacher/corefx,seanshpark/corefx,Jiayili1/corefx,DnlHarvey/corefx,twsouthwick/corefx,nchikanov/corefx,dhoehna/corefx,Jiayili1/corefx,mazong1123/corefx,nchikanov/corefx,wtgodbe/corefx,stone-li/corefx,ViktorHofer/corefx,Jiayili1/corefx,gkhanna79/corefx,jlin177/corefx,zhenlan/corefx,ViktorHofer/corefx,nchikanov/corefx,zhenlan/corefx,gkhanna79/corefx,rubo/corefx,weltkante/corefx,ericstj/corefx,Jiayili1/corefx,mmitche/corefx,rubo/corefx,rjxby/corefx,ptoonen/corefx,the-dwyer/corefx,krytarowski/corefx,stephenmichaelf/corefx,dhoehna/corefx,Ermiar/corefx,DnlHarvey/corefx,twsouthwick/corefx,ericstj/corefx,MaggieTsang/corefx,weltkante/corefx,zhenlan/corefx,JosephTremoulet/corefx,parjong/corefx,nchikanov/corefx,seanshpark/corefx,DnlHarvey/corefx,cydhaselton/corefx,richlander/corefx,wtgodbe/corefx,dhoehna/corefx,wtgodbe/corefx,the-dwyer/corefx,YoupHulsebos/corefx,rjxby/corefx,Ermiar/corefx,richlander/corefx,gkhanna79/corefx,MaggieTsang/corefx,tijoytom/corefx,krk/corefx,Petermarcu/corefx
src/System.Runtime.Extensions/tests/System/Reflection/AssemblyNameProxyTests.cs
src/System.Runtime.Extensions/tests/System/Reflection/AssemblyNameProxyTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.IO; using System.Collections.Generic; using System.Reflection; using System.Globalization; using Xunit; namespace System.Reflection.Tests { public static class AssemblyNameProxyTests { [Fact] public static void GetAssemblyName_AssemblyNameProxy() { AssemblyNameProxy anp = new AssemblyNameProxy(); AssertExtensions.Throws<ArgumentNullException>("assemblyFile", () => anp.GetAssemblyName(null)); Assert.Throws<ArgumentException>(() => anp.GetAssemblyName(string.Empty)); Assert.Throws<FileNotFoundException>(() => anp.GetAssemblyName(Guid.NewGuid().ToString("N"))); Assembly a = typeof(AssemblyNameProxyTests).Assembly; Assert.Equal(new AssemblyName(a.FullName).ToString(), anp.GetAssemblyName(Path.GetFullPath(a.Location)).ToString()); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.IO; using System.Collections.Generic; using System.Reflection; using System.Globalization; using Xunit; namespace System.Reflection.Tests { public static class AssemblyNameProxyTests { [Fact] public static void GetAssemblyName_AssemblyNameProxy() { AssemblyNameProxy anp = new AssemblyNameProxy(); AssertExtensions.Throws<ArgumentNullException>("assemblyFile", () => anp.GetAssemblyName(null)); Assert.Throws<ArgumentException>(() => anp.GetAssemblyName(string.Empty)); Assert.Throws<FileNotFoundException>(() => anp.GetAssemblyName(Guid.NewGuid().ToString("N"))); Assembly a = typeof(AssemblyNameProxyTests).Assembly; Assert.Equal(new AssemblyName(a.FullName).ToString(), anp.GetAssemblyName(Path.GetFullPath(a.Location)).ToString()); } public static IEnumerable<object[]> ReferenceMatchesDefinition_TestData() { yield return new object[] { new AssemblyName(typeof(AssemblyNameProxy).GetTypeInfo().Assembly.FullName), new AssemblyName("System.Runtime.Extensions"), true }; } [Theory] [MemberData(nameof(ReferenceMatchesDefinition_TestData))] public static void ReferenceMatchesDefinition(AssemblyName a1, AssemblyName a2, bool expected) { Assert.Equal(expected, AssemblyName.ReferenceMatchesDefinition(a1, a2)); } } }
mit
C#
3c10edec8fc7cddb190340a726f7bdf7de4d691f
Make struct readonly
ErikSchierboom/roslyn,KirillOsenkov/roslyn,brettfo/roslyn,davkean/roslyn,AlekseyTs/roslyn,panopticoncentral/roslyn,sharwell/roslyn,mavasani/roslyn,stephentoub/roslyn,physhi/roslyn,stephentoub/roslyn,KevinRansom/roslyn,dotnet/roslyn,agocke/roslyn,jmarolf/roslyn,reaction1989/roslyn,sharwell/roslyn,jmarolf/roslyn,brettfo/roslyn,KevinRansom/roslyn,AmadeusW/roslyn,mgoertz-msft/roslyn,mavasani/roslyn,wvdd007/roslyn,ErikSchierboom/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,gafter/roslyn,bartdesmet/roslyn,aelij/roslyn,physhi/roslyn,agocke/roslyn,reaction1989/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,agocke/roslyn,gafter/roslyn,sharwell/roslyn,bartdesmet/roslyn,diryboy/roslyn,brettfo/roslyn,abock/roslyn,wvdd007/roslyn,davkean/roslyn,panopticoncentral/roslyn,genlu/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,heejaechang/roslyn,AlekseyTs/roslyn,jasonmalinowski/roslyn,panopticoncentral/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,dotnet/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,gafter/roslyn,abock/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,tannergooding/roslyn,reaction1989/roslyn,tmat/roslyn,aelij/roslyn,heejaechang/roslyn,aelij/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,tmat/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,physhi/roslyn,mgoertz-msft/roslyn,eriawan/roslyn,AmadeusW/roslyn,AlekseyTs/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,davkean/roslyn,genlu/roslyn,abock/roslyn,weltkante/roslyn,mgoertz-msft/roslyn,genlu/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,dotnet/roslyn,wvdd007/roslyn,jmarolf/roslyn,tmat/roslyn,mavasani/roslyn,tannergooding/roslyn
src/Features/Core/Portable/SolutionCrawler/ISolutionCrawlerProgressReporter.cs
src/Features/Core/Portable/SolutionCrawler/ISolutionCrawlerProgressReporter.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; namespace Microsoft.CodeAnalysis.SolutionCrawler { /// <summary> /// Provide a way to see whether solution crawler is started or not /// </summary> internal interface ISolutionCrawlerProgressReporter { /// <summary> /// Return true if solution crawler is in progress. /// </summary> bool InProgress { get; } /// <summary> /// Raised when solution crawler progress changed /// /// Notifications for this event are serialized to preserve order. /// However, individual event notifications may occur on any thread. /// </summary> event EventHandler<ProgressData> ProgressChanged; } internal readonly struct ProgressData { public ProgressStatus Status { get; } /// <summary> /// number of pending work item in the queue. /// null means N/A for the associated <see cref="Status"/> /// </summary> public int? PendingItemCount { get; } public ProgressData(ProgressStatus type, int? pendingItemCount) { Status = type; PendingItemCount = pendingItemCount; } } internal enum ProgressStatus { Started, Paused, PendingItemCountUpdated, Evaluating, Stopped } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; namespace Microsoft.CodeAnalysis.SolutionCrawler { /// <summary> /// Provide a way to see whether solution crawler is started or not /// </summary> internal interface ISolutionCrawlerProgressReporter { /// <summary> /// Return true if solution crawler is in progress. /// </summary> bool InProgress { get; } /// <summary> /// Raised when solution crawler progress changed /// /// Notifications for this event are serialized to preserve order. /// However, individual event notifications may occur on any thread. /// </summary> event EventHandler<ProgressData> ProgressChanged; } internal struct ProgressData { public ProgressStatus Status { get; } /// <summary> /// number of pending work item in the queue. /// null means N/A for the associated <see cref="Status"/> /// </summary> public int? PendingItemCount { get; } public ProgressData(ProgressStatus type, int? pendingItemCount) { Status = type; PendingItemCount = pendingItemCount; } } internal enum ProgressStatus { Started, Paused, PendingItemCountUpdated, Evaluating, Stopped } }
mit
C#
f79e09286e114de92a890d6b505e68840f6e47f5
update SingleStateAniamtorControllerCreator
RyotaMurohoshi/character_animator_creator
unity/Assets/Editor/CharacterAnimatorCreator/SingleStateAnimatorControllerCreator.cs
unity/Assets/Editor/CharacterAnimatorCreator/SingleStateAnimatorControllerCreator.cs
using UnityEngine; using UnityEditor; using UnityEditor.Animations; using System.Linq; public static class SingleStateAnimatorControllerCreator { public static RuntimeAnimatorController CreateAnimatorController(SingleStateAnimatorControllerDefinition definition) { AnimatorController animatorController = AnimatorController.CreateAnimatorControllerAtPath(definition.ResulutPath); AnimatorControllerLayer layer = animatorController.layers.First(); layer.name = definition.LayerName; AnimatorStateMachine stateMachine = layer.stateMachine; foreach (AnimationClip clip in definition.AnimationClipList) { AnimatorState state = stateMachine.AddState(clip.name); state.motion = clip; } EditorUtility.SetDirty(animatorController); return animatorController; } }
using UnityEngine; using UnityEditor; using UnityEditor.Animations; public static class SingleStateAnimatorControllerCreator { public static RuntimeAnimatorController CreateAnimatorController(SingleStateAnimatorControllerDefinition definition) { AnimatorController animatorController = AnimatorController.CreateAnimatorControllerAtPath(definition.ResulutPath); AnimatorStateMachine stateMachine = animatorController.layers[0].stateMachine; foreach (AnimationClip clip in definition.AnimationClipList) { AnimatorState state = stateMachine.AddState(clip.name); state.motion = clip; } EditorUtility.SetDirty(animatorController); return animatorController; } }
mit
C#
c5320f872cd9010a502cb1f57763d4f1481c9b34
Update OAuthUserInfo.cs
lishewen/WeiXinMPSDK,lishewen/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,mc7246/WeiXinMPSDK,down4u/WeiXinMPSDK,lishewen/WeiXinMPSDK,wanddy/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,mc7246/WeiXinMPSDK,JeffreySu/WxOpen,mc7246/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,down4u/WeiXinMPSDK,wanddy/WeiXinMPSDK,down4u/WeiXinMPSDK,JeffreySu/WxOpen,JeffreySu/WeiXinMPSDK,wanddy/WeiXinMPSDK,jiehanlin/WeiXinMPSDK
Senparc.Weixin.MP/Senparc.Weixin.MP/AdvancedAPIs/OAuth/OAuthUserInfo.cs
Senparc.Weixin.MP/Senparc.Weixin.MP/AdvancedAPIs/OAuth/OAuthUserInfo.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Senparc.Weixin.MP.AdvancedAPIs { /// <summary> /// 通过OAuth的获取到的用户信息(snsapi_userinfo=scope) /// </summary> public class OAuthUserInfo { public string openid { get; set; } public string nickname { get; set; } /// <summary> /// 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知 /// </summary> public int sex { get; set; } public string province { get; set; } public string city { get; set; } public string country { get; set; } /// <summary> /// 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空 /// </summary> public string headimgurl { get; set; } /// <summary> /// 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) /// 作者注:其实这个格式称不上JSON,只是个单纯数组。 /// </summary> public string[] privilege { get; set; } //绑定开放平台后会有这个字段 public string unionid { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Senparc.Weixin.MP.AdvancedAPIs { /// <summary> /// 通过OAuth的获取到的用户信息(snsapi_userinfo=scope) /// </summary> public class OAuthUserInfo { public string openid { get; set; } public string nickname { get; set; } /// <summary> /// 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知 /// </summary> public int sex { get; set; } public string province { get; set; } public string city { get; set; } public string country { get; set; } /// <summary> /// 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空 /// </summary> public string headimgurl { get; set; } /// <summary> /// 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) /// 作者注:其实这个格式称不上JSON,只是个单纯数组。 /// </summary> public string[] privilege { get; set; } } }
apache-2.0
C#
b2c8e33cdd1c6e0f6dd3c01bc5965ccb45dfa0ba
Update Global.cs
CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,jp2masa/Cosmos,jp2masa/Cosmos,zarlo/Cosmos,jp2masa/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos
source/Cosmos.HAL2/Global.cs
source/Cosmos.HAL2/Global.cs
using System; using System.Threading; using Cosmos.Core; using Cosmos.Debug.Kernel; using Cosmos.HAL.BlockDevice; namespace Cosmos.HAL { public static class Global { public static readonly Debugger mDebugger = new Debugger("HAL", "Global"); static public PIT PIT = new PIT(); // Must be static init, other static inits rely on it not being null public static TextScreenBase TextScreen = new TextScreen(); public static PCI Pci; static public void Init(TextScreenBase textScreen) { if (textScreen != null) { TextScreen = textScreen; } mDebugger.Send("Before Core.Global.Init"); Core.Global.Init(); //TODO Redo this - Global init should be other. // Move PCI detection to hardware? Or leave it in core? Is Core PC specific, or deeper? // If we let hardware do it, we need to protect it from being used by System. // Probably belongs in hardware, and core is more specific stuff like CPU, memory, etc. //Core.PCI.OnPCIDeviceFound = PCIDeviceFound; //TODO: Since this is FCL, its "common". Otherwise it should be // system level and not accessible from Core. Need to think about this // for the future. Console.WriteLine("Finding PCI Devices"); mDebugger.Send("PCI Devices"); PCI.Setup(); Console.WriteLine("Starting ACPI"); mDebugger.Send("ACPI Init"); ACPI.Start(); Console.WriteLine("Finding ATA Devices"); mDebugger.Send("ATA Devices") IDE.InitDriver(); AHCI.InitDriver(); //EHCI.InitDriver(); Console.WriteLine("Starting Processor Scheduler"); mDebugger.Send("Processor Scheduler") Core.Processing.ProcessorScheduler.Initialize(); mDebugger.Send("Done initializing Cosmos.HAL.Global"); } public static void EnableInterrupts() { CPU.EnableInterrupts(); } public static bool InterruptsEnabled => CPU.mInterruptsEnabled; public static uint SpawnThread(ThreadStart aStart) { return Core.Processing.ProcessContext.StartContext("", aStart, Core.Processing.ProcessContext.Context_Type.THREAD); } public static uint SpawnThread(ParameterizedThreadStart aStart, object param) { return Core.Processing.ProcessContext.StartContext("", aStart, Core.Processing.ProcessContext.Context_Type.THREAD, param); } } }
using System; using System.Threading; using Cosmos.Core; using Cosmos.Debug.Kernel; using Cosmos.HAL.BlockDevice; namespace Cosmos.HAL { public static class Global { public static readonly Debugger mDebugger = new Debugger("HAL", "Global"); static public PIT PIT = new PIT(); // Must be static init, other static inits rely on it not being null public static TextScreenBase TextScreen = new TextScreen(); public static PCI Pci; static public void Init(TextScreenBase textScreen) { if (textScreen != null) { TextScreen = textScreen; } mDebugger.Send("Before Core.Global.Init"); Core.Global.Init(); //TODO Redo this - Global init should be other. // Move PCI detection to hardware? Or leave it in core? Is Core PC specific, or deeper? // If we let hardware do it, we need to protect it from being used by System. // Probably belongs in hardware, and core is more specific stuff like CPU, memory, etc. //Core.PCI.OnPCIDeviceFound = PCIDeviceFound; //TODO: Since this is FCL, its "common". Otherwise it should be // system level and not accessible from Core. Need to think about this // for the future. Console.WriteLine("Finding PCI Devices"); mDebugger.Send("PCI Devices"); PCI.Setup(); Console.WriteLine("Starting ACPI"); mDebugger.Send("ACPI Init"); ACPI.Start(); IDE.InitDriver(); AHCI.InitDriver(); //EHCI.InitDriver(); Core.Processing.ProcessorScheduler.Initialize(); mDebugger.Send("Done initializing Cosmos.HAL.Global"); } public static void EnableInterrupts() { CPU.EnableInterrupts(); } public static bool InterruptsEnabled => CPU.mInterruptsEnabled; public static uint SpawnThread(ThreadStart aStart) { return Core.Processing.ProcessContext.StartContext("", aStart, Core.Processing.ProcessContext.Context_Type.THREAD); } public static uint SpawnThread(ParameterizedThreadStart aStart, object param) { return Core.Processing.ProcessContext.StartContext("", aStart, Core.Processing.ProcessContext.Context_Type.THREAD, param); } } }
bsd-3-clause
C#
dac98a73118fa5354d0b6f820d8be4d3d33b21a5
Enable UpnEndpointIdentity tests on UWP
dotnet/wcf,imcarolwang/wcf,MattGal/wcf,MattGal/wcf,hongdai/wcf,imcarolwang/wcf,shmao/wcf,zhenlan/wcf,KKhurin/wcf,ericstj/wcf,ElJerry/wcf,StephenBonikowsky/wcf,ElJerry/wcf,dotnet/wcf,dotnet/wcf,StephenBonikowsky/wcf,iamjasonp/wcf,hongdai/wcf,mconnew/wcf,mconnew/wcf,mconnew/wcf,KKhurin/wcf,ericstj/wcf,shmao/wcf,iamjasonp/wcf,imcarolwang/wcf,zhenlan/wcf
src/System.ServiceModel.Security/tests/ServiceModel/UpnEndpointIdentityTest.cs
src/System.ServiceModel.Security/tests/ServiceModel/UpnEndpointIdentityTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.ServiceModel; using Infrastructure.Common; using Xunit; public static class UpnEndpointIdentityTest { #if FULLXUNIT_NOTSUPPORTED [Theory] #endif [WcfTheory] [InlineData("")] [InlineData("test@wcf.example.com")] public static void Ctor_UpnName(string upn) { UpnEndpointIdentity upnEndpointEntity = new UpnEndpointIdentity(upn); } #if FULLXUNIT_NOTSUPPORTED [Fact] #endif [WcfFact] public static void Ctor_NullUpn() { string upnName = null; Assert.Throws<ArgumentNullException>("upnName", () => { UpnEndpointIdentity upnEndpointEntity = new UpnEndpointIdentity(upnName); }); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.ServiceModel; using Infrastructure.Common; using Xunit; public static class UpnEndpointIdentityTest { #if FULLXUNIT_NOTSUPPORTED [Theory] #endif [WcfTheory] [InlineData("")] [InlineData("test@wcf.example.com")] [Issue(1454, Framework = FrameworkID.NetNative)] public static void Ctor_UpnName(string upn) { UpnEndpointIdentity upnEndpointEntity = new UpnEndpointIdentity(upn); } #if FULLXUNIT_NOTSUPPORTED [Fact] #endif [WcfFact] public static void Ctor_NullUpn() { string upnName = null; Assert.Throws<ArgumentNullException>("upnName", () => { UpnEndpointIdentity upnEndpointEntity = new UpnEndpointIdentity(upnName); }); } }
mit
C#
36aa4a3bbe8ebc56fb082a399c2614611cc6c295
Validate remote script MIME type early
filipw/dotnet-script,filipw/dotnet-script
src/Dotnet.Script.Core/ScriptDownloader.cs
src/Dotnet.Script.Core/ScriptDownloader.cs
using System; using System.IO; using System.Net.Http; using System.Net.Mime; using System.Threading.Tasks; namespace Dotnet.Script.Core { public class ScriptDownloader { public async Task<string> Download(string uri) { const string plainTextMediaType = "text/plain"; using (HttpClient client = new HttpClient()) { using (HttpResponseMessage response = await client.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead)) { response.EnsureSuccessStatusCode(); using (HttpContent content = response.Content) { string mediaType = content.Headers.ContentType.MediaType; if (string.IsNullOrWhiteSpace(mediaType) || mediaType.Equals(plainTextMediaType, StringComparison.InvariantCultureIgnoreCase)) { return await content.ReadAsStringAsync(); } throw new NotSupportedException($"The media type '{mediaType}' is not supported when executing a script over http/https"); } } } } } }
using System; using System.IO; using System.Net.Http; using System.Net.Mime; using System.Threading.Tasks; namespace Dotnet.Script.Core { public class ScriptDownloader { public async Task<string> Download(string uri) { const string plainTextMediaType = "text/plain"; using (HttpClient client = new HttpClient()) { using (HttpResponseMessage response = await client.GetAsync(uri)) { response.EnsureSuccessStatusCode(); using (HttpContent content = response.Content) { string mediaType = content.Headers.ContentType.MediaType; if (string.IsNullOrWhiteSpace(mediaType) || mediaType.Equals(plainTextMediaType, StringComparison.InvariantCultureIgnoreCase)) { return await content.ReadAsStringAsync(); } throw new NotSupportedException($"The media type '{mediaType}' is not supported when executing a script over http/https"); } } } } } }
mit
C#
9483faeab3628b4a3a8b19c478b2022621efc702
Bump version
canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor
src/SyncTrayzor/Properties/AssemblyInfo.cs
src/SyncTrayzor/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SyncTrayzor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SyncTrayzor")] [assembly: AssemblyCopyright("Copyright © Antony Male 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.11.0")] [assembly: AssemblyFileVersion("1.0.11.0")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SyncTrayzor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SyncTrayzor")] [assembly: AssemblyCopyright("Copyright © Antony Male 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.10.0")] [assembly: AssemblyFileVersion("1.0.10.0")]
mit
C#
1edbca6e6552f6c5a148ea30f31b3530cb7d9656
Add note about action type
peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework
osu.Framework/Input/Bindings/IKeyBinding.cs
osu.Framework/Input/Bindings/IKeyBinding.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. namespace osu.Framework.Input.Bindings { /// <summary> /// A binding of a <see cref="Bindings.KeyCombination"/> to an action. /// </summary> public interface IKeyBinding { /// <summary> /// The combination of keys which will trigger this binding. /// </summary> KeyCombination KeyCombination { get; set; } /// <summary> /// The resultant action which is triggered by this binding. /// Generally an enum type, but may also be an int representing an enum (converted via <see cref="KeyBindingExtensions.GetAction{T}"/> /// </summary> object Action { get; set; } } }
// 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. namespace osu.Framework.Input.Bindings { /// <summary> /// A binding of a <see cref="Bindings.KeyCombination"/> to an action. /// </summary> public interface IKeyBinding { /// <summary> /// The combination of keys which will trigger this binding. /// </summary> KeyCombination KeyCombination { get; set; } /// <summary> /// The resultant action which is triggered by this binding. /// </summary> object Action { get; set; } } }
mit
C#
dbab38cf3aa401fbf12c21c108ba24461f4f446a
Bump version associated with issue 19
tnachen/kafka,tnachen/kafka,tnachen/kafka,tnachen/kafka,tnachen/kafka,tnachen/kafka,tnachen/kafka,tnachen/kafka
clients/csharp/src/Kafka/Kafka.Client/Properties/AssemblyInfo.cs
clients/csharp/src/Kafka/Kafka.Client/Properties/AssemblyInfo.cs
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Kafka.Client")] [assembly: AssemblyDescription(".NET Client for Kafka")] [assembly: AssemblyCompany("ExactTarget")] [assembly: AssemblyProduct("Kafka.Client")] [assembly: AssemblyCopyright("Copyright © ExactTarget 2011")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("0.7.0.11")] [assembly: AssemblyFileVersion("0.7.0.11")] [assembly: InternalsVisibleTo("Kafka.Client.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b7f32f49e159548e1d6821848560fc2dd80e724909f763f83c06f47f0f42c60d7cb54e42eb3cae0591197a187c2af4dfab2fdcd39c7e1f18b192d3b66175b1ac488a88823c15f787bdc3dc7efefaa5c37891aa1988e81a780c46f97ca1283e039e8b11aa1c4d07d5f001913ca6fe44a0105c1178294e7fbafd03cfa2f2da49b0")] [assembly: InternalsVisibleTo("Kafka.Client.IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b7f32f49e159548e1d6821848560fc2dd80e724909f763f83c06f47f0f42c60d7cb54e42eb3cae0591197a187c2af4dfab2fdcd39c7e1f18b192d3b66175b1ac488a88823c15f787bdc3dc7efefaa5c37891aa1988e81a780c46f97ca1283e039e8b11aa1c4d07d5f001913ca6fe44a0105c1178294e7fbafd03cfa2f2da49b0")] [assembly: CLSCompliant(true)]
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Kafka.Client")] [assembly: AssemblyDescription(".NET Client for Kafka")] [assembly: AssemblyCompany("ExactTarget")] [assembly: AssemblyProduct("Kafka.Client")] [assembly: AssemblyCopyright("Copyright © ExactTarget 2011")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("0.7.0.10")] [assembly: AssemblyFileVersion("0.7.0.10")] [assembly: InternalsVisibleTo("Kafka.Client.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b7f32f49e159548e1d6821848560fc2dd80e724909f763f83c06f47f0f42c60d7cb54e42eb3cae0591197a187c2af4dfab2fdcd39c7e1f18b192d3b66175b1ac488a88823c15f787bdc3dc7efefaa5c37891aa1988e81a780c46f97ca1283e039e8b11aa1c4d07d5f001913ca6fe44a0105c1178294e7fbafd03cfa2f2da49b0")] [assembly: InternalsVisibleTo("Kafka.Client.IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b7f32f49e159548e1d6821848560fc2dd80e724909f763f83c06f47f0f42c60d7cb54e42eb3cae0591197a187c2af4dfab2fdcd39c7e1f18b192d3b66175b1ac488a88823c15f787bdc3dc7efefaa5c37891aa1988e81a780c46f97ca1283e039e8b11aa1c4d07d5f001913ca6fe44a0105c1178294e7fbafd03cfa2f2da49b0")] [assembly: CLSCompliant(true)]
apache-2.0
C#
d17d6995c83466c415b0adde18efcc4f407af8c3
Remove Http.
kmjonmastro/Akavache,akavache/Akavache,ghuntley/AkavacheSandpit,christer155/Akavache,gimsum/Akavache,shana/Akavache,mms-/Akavache,jcomtois/Akavache,shana/Akavache,MathieuDSTP/MyAkavache,martijn00/Akavache,PureWeen/Akavache,MarcMagnin/Akavache,Loke155/Akavache,bbqchickenrobot/Akavache
Akavache/Portable/DependencyResolverMixin.cs
Akavache/Portable/DependencyResolverMixin.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using Splat; namespace Akavache { internal interface IWantsToRegisterStuff { void Register(IMutableDependencyResolver resolverToUse); } public static class DependencyResolverMixin { /// <summary> /// Initializes a ReactiveUI dependency resolver with classes that /// Akavache uses internally. /// </summary> public static void InitializeAkavache(this IMutableDependencyResolver This) { var namespaces = new[] { "Akavache", "Akavache.Mac", "Akavache.Deprecated", "Akavache.Mobile", "Akavache.Sqlite3", }; var fdr = typeof(DependencyResolverMixin); var assmName = new AssemblyName( fdr.AssemblyQualifiedName.Replace(fdr.FullName + ", ", "")); foreach (var ns in namespaces) { var targetType = ns + ".Registrations"; string fullName = targetType + ", " + assmName.FullName.Replace(assmName.Name, ns); var registerTypeClass = Type.GetType(fullName, false); if (registerTypeClass == null) continue; var registerer = (IWantsToRegisterStuff)Activator.CreateInstance(registerTypeClass); registerer.Register(This); }; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using Splat; namespace Akavache { internal interface IWantsToRegisterStuff { void Register(IMutableDependencyResolver resolverToUse); } public static class DependencyResolverMixin { /// <summary> /// Initializes a ReactiveUI dependency resolver with classes that /// Akavache uses internally. /// </summary> public static void InitializeAkavache(this IMutableDependencyResolver This) { var namespaces = new[] { "Akavache", "Akavache.Mac", "Akavache.Deprecated", "Akavache.Mobile", "Akavache.Http", "Akavache.Sqlite3", }; var fdr = typeof(DependencyResolverMixin); var assmName = new AssemblyName( fdr.AssemblyQualifiedName.Replace(fdr.FullName + ", ", "")); foreach (var ns in namespaces) { var targetType = ns + ".Registrations"; string fullName = targetType + ", " + assmName.FullName.Replace(assmName.Name, ns); var registerTypeClass = Type.GetType(fullName, false); if (registerTypeClass == null) continue; var registerer = (IWantsToRegisterStuff)Activator.CreateInstance(registerTypeClass); registerer.Register(This); }; } } }
mit
C#
6e26ca4fd1bdba4e1257a984b18b546235ef25d5
Update Assemply Information
harouny/NLog.Extensions.AzureTableStorage
NLog.Extensions.AzureTableStorage/Properties/AssemblyInfo.cs
NLog.Extensions.AzureTableStorage/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // 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("NLog.Extensions.AzureTableStorage")] [assembly: AssemblyDescription("Azure Table Storage Target for NLog")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("harouny")] [assembly: AssemblyProduct("NLog.Extensions.AzureTableStorage")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5f9b332d-1edb-4e18-bc2f-e1d5b5fbd76b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en")]
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("NLog.Extensions.AzureTableStorage")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NLog.Extensions.AzureTableStorage")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5f9b332d-1edb-4e18-bc2f-e1d5b5fbd76b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
683f5d910061fbe8653448c75db28170f13a6ccc
Update PasAccountApiClientFactory.cs
SkillsFundingAgency/das-providerapprenticeshipsservice,SkillsFundingAgency/das-providerapprenticeshipsservice,SkillsFundingAgency/das-providerapprenticeshipsservice
src/SFA.DAS.PAS.Account.Api.ClientV2/PasAccountApiClientFactory.cs
src/SFA.DAS.PAS.Account.Api.ClientV2/PasAccountApiClientFactory.cs
using Microsoft.Extensions.Logging; using SFA.DAS.Http; using SFA.DAS.PAS.Account.Api.ClientV2.Configuration; namespace SFA.DAS.PAS.Account.Api.ClientV2 { internal class PasAccountApiClientFactory { private readonly PasAccountApiConfiguration _configuration; private readonly ILoggerFactory _loggerFactory; public PasAccountApiClientFactory(PasAccountApiConfiguration configuration, ILoggerFactory loggerFactory) { _configuration = configuration; _loggerFactory = loggerFactory; } public IPasAccountApiClient CreateClient() { IHttpClientFactory httpClientFactory; if (IsClientCredentialConfiguration(_configuration.ClientId, _configuration.ClientSecret, _configuration.Tenant)) { httpClientFactory = new AzureActiveDirectoryHttpClientFactory(_configuration, _loggerFactory); } else { httpClientFactory = new ManagedIdentityHttpClientFactory(_configuration, _loggerFactory); } var httpClient = httpClientFactory.CreateHttpClient(); var restHttpClient = new RestHttpClient(httpClient); var apiClient = new PasAccountApiClient(restHttpClient); return apiClient; } private bool IsClientCredentialConfiguration(string clientId, string clientSecret, string tenant) { return !string.IsNullOrWhiteSpace(clientId) && !string.IsNullOrWhiteSpace(clientSecret) && !string.IsNullOrWhiteSpace(tenant); } } }
using Microsoft.Extensions.Logging; using SFA.DAS.Http; using SFA.DAS.PAS.Account.Api.ClientV2.Configuration; namespace SFA.DAS.PAS.Account.Api.ClientV2 { internal class PasAccountApiClientFactory { private readonly PasAccountApiConfiguration _configuration; private readonly ILoggerFactory _loggerFactory; public PasAccountApiClientFactory(PasAccountApiConfiguration configuration, ILoggerFactory loggerFactory) { _configuration = configuration; _loggerFactory = loggerFactory; } public IPasAccountApiClient CreateClient() { IHttpClientFactory httpClientFactory = IsClientCredentialConfiguration(_configuration.ClientId, _configuration.ClientSecret, _configuration.Tenant) ? new AzureActiveDirectoryHttpClientFactory(_configuration, _loggerFactory) : new ManagedIdentityHttpClientFactory(_configuration, _loggerFactory); var httpClient = httpClientFactory.CreateHttpClient(); var restHttpClient = new RestHttpClient(httpClient); var apiClient = new PasAccountApiClient(restHttpClient); return apiClient; } private bool IsClientCredentialConfiguration(string clientId, string clientSecret, string tenant) { return !string.IsNullOrWhiteSpace(clientId) && !string.IsNullOrWhiteSpace(clientSecret) && !string.IsNullOrWhiteSpace(tenant); } } }
mit
C#
bad508675a26164f3a559b7a1e98f82a92df9500
Fix run without debugger on Windows
mrward/monodevelop-powershell-addin
src/MonoDevelop.PowerShell/MonoDevelop.PowerShell/PowerShellExecutionCommand.cs
src/MonoDevelop.PowerShell/MonoDevelop.PowerShell/PowerShellExecutionCommand.cs
// // PowerShellExecutionCommand.cs // // Author: // Matt Ward <matt.ward@xamarin.com> // // Copyright (c) 2016 Xamarin Inc. (http://xamarin.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.IO; using System.Text; using MonoDevelop.Core; using MonoDevelop.Core.Execution; namespace MonoDevelop.PowerShell { class PowerShellExecutionCommand : NativeExecutionCommand { public PowerShellExecutionCommand (string scriptFileName, params string[] parameters) { Arguments = GetArguments (scriptFileName, parameters); PowerShellArguments = Arguments; Command = PowerShellPathLocator.PowerShellPath; ScriptFileName = scriptFileName; WorkingDirectory = Path.GetDirectoryName (scriptFileName); } string GetArguments (string scriptFileName, params string[] parameters) { var arguments = new StringBuilder (); if (Platform.IsWindows) { arguments.Append ("-ExecutionPolicy Unrestricted "); } arguments.Append ("-Command \"& '" + scriptFileName + "'\""); foreach (string parameter in parameters) { arguments.Append (' '); arguments.Append (parameter); } return arguments.ToString (); } public string ScriptFileName { get; private set; } public string PowerShellArguments { get; private set; } /// <summary> /// If the PowerShellArguments have been overridden in the Arguments /// then use these arguments when debugging the PowerShell script. These /// will be passed to the script as parameters. /// </summary> public string DebuggerArguments { get { if (Arguments != PowerShellArguments) return Arguments; return null; } } /// <summary> /// Returns false if Run - Debug Application has been used to change the /// arguments. /// </summary> public bool UsingOriginalArguments () { return Arguments == PowerShellArguments; } public static bool CanExecute (string path) { if (!PowerShellPathLocator.Exists) return false; if (path == null) return false; string extension = Path.GetExtension (path); return StringComparer.OrdinalIgnoreCase.Equals (extension, ".ps1"); } } }
// // PowerShellExecutionCommand.cs // // Author: // Matt Ward <matt.ward@xamarin.com> // // Copyright (c) 2016 Xamarin Inc. (http://xamarin.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.IO; using System.Text; using MonoDevelop.Core; using MonoDevelop.Core.Execution; namespace MonoDevelop.PowerShell { class PowerShellExecutionCommand : NativeExecutionCommand { public PowerShellExecutionCommand (string scriptFileName, params string[] parameters) { Arguments = GetArguments (scriptFileName, parameters); PowerShellArguments = Arguments; Command = PowerShellPathLocator.PowerShellPath; ScriptFileName = scriptFileName; WorkingDirectory = Path.GetDirectoryName (scriptFileName); } string GetArguments (string scriptFileName, params string[] parameters) { var arguments = new StringBuilder (); if (Platform.IsWindows) { arguments.Append ("-ExecutionPolicy Unrestricted "); } arguments.Append ("-Command '& \"" + scriptFileName + "\"'"); foreach (string parameter in parameters) { arguments.Append (' '); arguments.Append (parameter); } return arguments.ToString (); } public string ScriptFileName { get; private set; } public string PowerShellArguments { get; private set; } /// <summary> /// If the PowerShellArguments have been overridden in the Arguments /// then use these arguments when debugging the PowerShell script. These /// will be passed to the script as parameters. /// </summary> public string DebuggerArguments { get { if (Arguments != PowerShellArguments) return Arguments; return null; } } /// <summary> /// Returns false if Run - Debug Application has been used to change the /// arguments. /// </summary> public bool UsingOriginalArguments () { return Arguments == PowerShellArguments; } public static bool CanExecute (string path) { if (!PowerShellPathLocator.Exists) return false; if (path == null) return false; string extension = Path.GetExtension (path); return StringComparer.OrdinalIgnoreCase.Equals (extension, ".ps1"); } } }
mit
C#
32a7af4d015cd0ed50c490d0d7f5433c60695e53
update ulong to long?
hungmai-msft/azure-powershell,devigned/azure-powershell,hungmai-msft/azure-powershell,naveedaz/azure-powershell,devigned/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,hungmai-msft/azure-powershell,hungmai-msft/azure-powershell,AzureAutomationTeam/azure-powershell,devigned/azure-powershell,naveedaz/azure-powershell,AzureAutomationTeam/azure-powershell,naveedaz/azure-powershell,hungmai-msft/azure-powershell,devigned/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,devigned/azure-powershell,naveedaz/azure-powershell,AzureAutomationTeam/azure-powershell,naveedaz/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,devigned/azure-powershell,naveedaz/azure-powershell,hungmai-msft/azure-powershell
src/ResourceManager/Network/Commands.Network/Models/PSTunnelConnectionHealth.cs
src/ResourceManager/Network/Commands.Network/Models/PSTunnelConnectionHealth.cs
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- namespace Microsoft.Azure.Commands.Network.Models { using System; public class PSTunnelConnectionHealth { public string Tunnel { get; set; } public string ConnectionStatus { get; set; } public long? IngressBytesTransferred { get; set; } public long? EgressBytesTransferred { get; set; } public string LastConnectionEstablishedUtcTime { get; set; } } }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- namespace Microsoft.Azure.Commands.Network.Models { using System; public class PSTunnelConnectionHealth { public string Tunnel { get; set; } public string ConnectionStatus { get; set; } public ulong IngressBytesTransferred { get; set; } public ulong EgressBytesTransferred { get; set; } public string LastConnectionEstablishedUtcTime { get; set; } } }
apache-2.0
C#
42c8ff099ecbcb12602de43e4ef46b4e1e888964
add comment to FacileRequiredAttribute
peasy/Peasy.NET,peasy/Samples,peasy/Samples,ahanusa/Peasy.NET,peasy/Samples,ahanusa/facile.net
Facile/Attributes/FacileRequiredAttribute.cs
Facile/Attributes/FacileRequiredAttribute.cs
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Facile.Attributes { /// <summary> /// Validates that non-zero values are supplied for int, decimal or non-default values for dates /// </summary> public class FacileRequiredAttribute : ValidationAttribute { protected override ValidationResult IsValid(object value, ValidationContext validationContext) { var errorMessage = string.Format("The {0} field is required.", validationContext.DisplayName); var validationResult = new ValidationResult(errorMessage, new string[] { validationContext.DisplayName }); if (value == null) return validationResult; if (value is string && string.IsNullOrWhiteSpace(value.ToString())) { return validationResult; } string incoming = value.ToString(); decimal val = 0; if (Decimal.TryParse(incoming, out val)) { if (val == 0) return validationResult; } DateTime date = DateTime.MinValue; if (DateTime.TryParse(incoming, out date)) { if (date == DateTime.MinValue) return validationResult; } return ValidationResult.Success; } } }
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Facile.Attributes { public class FacileRequiredAttribute : ValidationAttribute { protected override ValidationResult IsValid(object value, ValidationContext validationContext) { var errorMessage = string.Format("The {0} field is required.", validationContext.DisplayName); var validationResult = new ValidationResult(errorMessage, new string[] { validationContext.DisplayName }); if (value == null) return validationResult; if (value is string && string.IsNullOrWhiteSpace(value.ToString())) { return validationResult; } string incoming = value.ToString(); decimal val = 0; if (Decimal.TryParse(incoming, out val)) { if (val == 0) return validationResult; } DateTime date = DateTime.MinValue; if (DateTime.TryParse(incoming, out date)) { if (date == DateTime.MinValue) return validationResult; } return ValidationResult.Success; } } }
mit
C#
006b24f05779c0eafd5367fcd4dd3199edc2cb83
Set ComVisible=false
goblincoding/globalmousekeyhook,gmamaladze/globalmousekeyhook,mhxjzq/globalmousekeyhook
MouseKeyboardActivityMonitor/AssemblyInfo.cs
MouseKeyboardActivityMonitor/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("MouseKeyboardActivityMonitor")] [assembly: AssemblyDescription("This class library contains components to monitor mouse and keyboard activities and provides appropriate events.")] [assembly: AssemblyCompany("Mouse and Keyboard Hooks .NET")] [assembly: AssemblyProduct("Mouse and Keyboard Hooks .NET")] [assembly: AssemblyCopyright("Open Source under New BSD License.")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("4.1.0")]
using System.Reflection; [assembly: AssemblyTitle("MouseKeyboardActivityMonitor")] [assembly: AssemblyDescription("This class library contains components to monitor mouse and keyboard activities and provides appropriate events.")] [assembly: AssemblyCompany("Mouse and Keyboard Hooks .NET")] [assembly: AssemblyProduct("Mouse and Keyboard Hooks .NET")] [assembly: AssemblyCopyright("Open Source under New BSD License.")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("4.1.0")]
mit
C#
df60cd790da894831a1df6a8eec14b38a826532f
use simple options in sample
MetaG8/Metrics.NET,etishor/Metrics.NET,DeonHeyns/Metrics.NET,alhardy/Metrics.NET,MetaG8/Metrics.NET,cvent/Metrics.NET,DeonHeyns/Metrics.NET,huoxudong125/Metrics.NET,huoxudong125/Metrics.NET,Liwoj/Metrics.NET,Liwoj/Metrics.NET,MetaG8/Metrics.NET,Recognos/Metrics.NET,cvent/Metrics.NET,ntent-ad/Metrics.NET,mnadel/Metrics.NET,etishor/Metrics.NET,alhardy/Metrics.NET,mnadel/Metrics.NET,ntent-ad/Metrics.NET,Recognos/Metrics.NET
Samples/NancyFx.Sample/SampleBootstrapper.cs
Samples/NancyFx.Sample/SampleBootstrapper.cs
using System; using System.Collections.Generic; using Metrics; using Nancy; using Nancy.Authentication.Stateless; using Nancy.Bootstrapper; using Nancy.Security; using Nancy.TinyIoc; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; namespace NancyFx.Sample { public class SampleBootstrapper : DefaultNancyBootstrapper { internal class CustomJsonSerializer : JsonSerializer { public CustomJsonSerializer() { this.ContractResolver = new CamelCasePropertyNamesContractResolver(); this.Formatting = Formatting.Indented; } } protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) { base.ApplicationStartup(container, pipelines); StatelessAuthentication.Enable(pipelines, new StatelessAuthenticationConfiguration(AuthenticateUser)); Metric.Config .WithAllCounters() .WithReporting(r => r.WithConsoleReport(TimeSpan.FromSeconds(30))) .WithNancy(pipelines); pipelines.AfterRequest += ctx => { if (ctx.Response != null) { ctx.Response .WithHeader("Access-Control-Allow-Origin", "*") .WithHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); } }; } class FakeUser : IUserIdentity { public IEnumerable<string> Claims { get { yield return "Admin"; } } public string UserName { get { return "admin"; } } } private IUserIdentity AuthenticateUser(NancyContext context) { return new FakeUser(); } protected override void ConfigureApplicationContainer(TinyIoCContainer container) { base.ConfigureApplicationContainer(container); container.Register(typeof(JsonSerializer), typeof(CustomJsonSerializer)); } } }
using System; using System.Collections.Generic; using Metrics; using Nancy; using Nancy.Authentication.Stateless; using Nancy.Bootstrapper; using Nancy.Security; using Nancy.TinyIoc; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; namespace NancyFx.Sample { public class SampleBootstrapper : DefaultNancyBootstrapper { internal class CustomJsonSerializer : JsonSerializer { public CustomJsonSerializer() { this.ContractResolver = new CamelCasePropertyNamesContractResolver(); this.Formatting = Formatting.Indented; } } protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) { base.ApplicationStartup(container, pipelines); StatelessAuthentication.Enable(pipelines, new StatelessAuthenticationConfiguration(AuthenticateUser)); Metric.Config .WithAllCounters() .WithReporting(r => r.WithConsoleReport(TimeSpan.FromSeconds(30))) .WithNancy(pipelines, config => config .WithNancyMetrics(c => c.WithAllMetrics()) .WithMetricsModule(m => m.RequiresAuthentication(), "/admin/metrics") ); pipelines.AfterRequest += ctx => { if (ctx.Response != null) { ctx.Response .WithHeader("Access-Control-Allow-Origin", "*") .WithHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); } }; } class FakeUser : IUserIdentity { public IEnumerable<string> Claims { get { yield return "Admin"; } } public string UserName { get { return "admin"; } } } private IUserIdentity AuthenticateUser(NancyContext context) { return new FakeUser(); } protected override void ConfigureApplicationContainer(TinyIoCContainer container) { base.ConfigureApplicationContainer(container); container.Register(typeof(JsonSerializer), typeof(CustomJsonSerializer)); } } }
apache-2.0
C#
89b99a8412f4b13c59dc873b862fde80c94fcc06
Increment the app version.
ladimolnar/BitcoinBlockchain
Sources/BitcoinBlockchain/Properties/AssemblyInfo.cs
Sources/BitcoinBlockchain/Properties/AssemblyInfo.cs
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs"> // Copyright © Ladislau Molnar. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; 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("BitcoinBlockchain")] [assembly: AssemblyDescription("A .NET Class Library that provides parsing functionality over files containing the Bitcoin blockchain.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ladislau Molnar")] [assembly: AssemblyProduct("BitcoinBlockchain")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(false)] // 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("4d8ebb2b-d182-4106-8d15-5fb864de6706")] // 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.2.1.0")] [assembly: AssemblyFileVersion("1.2.1.0")]
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs"> // Copyright © Ladislau Molnar. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; 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("BitcoinBlockchain")] [assembly: AssemblyDescription("A .NET Class Library that provides parsing functionality over files containing the Bitcoin blockchain.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ladislau Molnar")] [assembly: AssemblyProduct("BitcoinBlockchain")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(false)] // 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("4d8ebb2b-d182-4106-8d15-5fb864de6706")] // 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.2.0.0")] [assembly: AssemblyFileVersion("1.2.0.0")]
apache-2.0
C#
3c5673f5285d5c116a4eccd580ca3f1619074050
Fix issue with readonly RedirectUri
Amialc/auth0-aspnet-owin,auth0/auth0-aspnet-owin,jerriep/auth0-aspnet-owin,jerriep/auth0-aspnet-owin,jerriep/auth0-aspnet-owin,auth0/auth0-aspnet-owin,Amialc/auth0-aspnet-owin,auth0/auth0-aspnet-owin,Amialc/auth0-aspnet-owin
Auth0.Owin/Provider/Auth0CustomizeTokenExchangeRedirectUriContext.cs
Auth0.Owin/Provider/Auth0CustomizeTokenExchangeRedirectUriContext.cs
using Microsoft.Owin; using Microsoft.Owin.Security; using Microsoft.Owin.Security.Provider; namespace Auth0.Owin { /// <summary> /// Context passed when the redirect_uri is generated during the token exchange. /// </summary> public class Auth0CustomizeTokenExchangeRedirectUriContext : BaseContext<Auth0AuthenticationOptions> { /// <summary> /// Creates a new context object. /// </summary> /// <param name="context">The OWIN request context</param> /// <param name="options">The Auth0 middleware options</param> /// <param name="properties">The authenticaiton properties of the challenge</param> /// <param name="redirectUri">The initial redirect URI</param> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "3#", Justification = "Represents header value")] public Auth0CustomizeTokenExchangeRedirectUriContext(IOwinContext context, Auth0AuthenticationOptions options, AuthenticationProperties properties, string redirectUri) : base(context, options) { RedirectUri = redirectUri; Properties = properties; } /// <summary> /// Gets the URI used for the redirect operation. /// </summary> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings", Justification = "Represents header value")] public string RedirectUri { get; set; } /// <summary> /// Gets the authenticaiton properties of the challenge /// </summary> public AuthenticationProperties Properties { get; private set; } } }
using Microsoft.Owin; using Microsoft.Owin.Security; using Microsoft.Owin.Security.Provider; namespace Auth0.Owin { /// <summary> /// Context passed when the redirect_uri is generated during the token exchange. /// </summary> public class Auth0CustomizeTokenExchangeRedirectUriContext : BaseContext<Auth0AuthenticationOptions> { /// <summary> /// Creates a new context object. /// </summary> /// <param name="context">The OWIN request context</param> /// <param name="options">The Auth0 middleware options</param> /// <param name="properties">The authenticaiton properties of the challenge</param> /// <param name="redirectUri">The initial redirect URI</param> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "3#", Justification = "Represents header value")] public Auth0CustomizeTokenExchangeRedirectUriContext(IOwinContext context, Auth0AuthenticationOptions options, AuthenticationProperties properties, string redirectUri) : base(context, options) { RedirectUri = redirectUri; Properties = properties; } /// <summary> /// Gets the URI used for the redirect operation. /// </summary> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings", Justification = "Represents header value")] public string RedirectUri { get; private set; } /// <summary> /// Gets the authenticaiton properties of the challenge /// </summary> public AuthenticationProperties Properties { get; private set; } } }
mit
C#
df72f59bc62f17bee321992cf63c6bc9cfa491a2
Generalize Label on item type.
plioi/parsley
src/Parsley/Grammar.Label.cs
src/Parsley/Grammar.Label.cs
using System.Diagnostics.CodeAnalysis; namespace Parsley; partial class Grammar { /// <summary> /// When parser p consumes any input, Label(p, l) is the same as p. /// When parser p does not consume any input, Label(p, l) is the same /// as p, except any messages are replaced with expectation label l. /// </summary> public static Parser<TItem, TValue> Label<TItem, TValue>(Parser<TItem, TValue> parse, string label) { return (ReadOnlySpan<TItem> input, ref int index, [NotNullWhen(true)] out TValue? value, [NotNullWhen(false)] out string? expectation) => { var originalIndex = index; if (parse(input, ref index, out value, out expectation)) return true; if (originalIndex == index) expectation = label; return false; }; } }
using System.Diagnostics.CodeAnalysis; namespace Parsley; partial class Grammar { /// <summary> /// When parser p consumes any input, Label(p, l) is the same as p. /// When parser p does not consume any input, Label(p, l) is the same /// as p, except any messages are replaced with expectation label l. /// </summary> public static Parser<char, TValue> Label<TValue>(Parser<char, TValue> parse, string label) { return (ReadOnlySpan<char> input, ref int index, [NotNullWhen(true)] out TValue? value, [NotNullWhen(false)] out string? expectation) => { var originalIndex = index; if (parse(input, ref index, out value, out expectation)) return true; if (originalIndex == index) expectation = label; return false; }; } }
mit
C#
b400ae17bf464d0a7b7dd877069e11605eb9a308
Use KeyExists for Contains method
mackayj/WebApi.OutputCache.Redis.StackExchange
Source/WebApi.OutputCache.Redis.StackExchange/StackExchangeRedisCacheProvider.cs
Source/WebApi.OutputCache.Redis.StackExchange/StackExchangeRedisCacheProvider.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using StackExchange.Redis; using WebApi.OutputCache.Core.Cache; namespace WebApi.OutputCache.Redis.StackExchange { public class StackExchangeRedisCacheProvider : IApiOutputCache { private ConnectionMultiplexer _connection; private IDatabase _database; public StackExchangeRedisCacheProvider(string connectionString) { Init(ConnectionMultiplexer.Connect(connectionString)); } public StackExchangeRedisCacheProvider(ConnectionMultiplexer connection) { Init(connection); } public StackExchangeRedisCacheProvider(IDatabase database) { _database = database; } private void Init(ConnectionMultiplexer connection) { _connection = connection; _database = _connection.GetDatabase(); } public void Dispose() { if (_connection != null) _connection.Dispose(); } public void RemoveStartsWith(string key) { var keys = _database.SetMembers(key); foreach (var memberKey in keys) { Remove(memberKey); } Remove(key); } public T Get<T>(string key) where T : class { var result = _database.StringGet(key); return result as T; } public object Get(string key) { // Need to return this as a direct OBJECT and not the RedisValue because it can't convert using 'as string' or 'as byte[]' correctly :( dynamic result = _database.StringGet(key); return result; } public void Remove(string key) { var result = _database.KeyDelete(key); } public bool Contains(string key) { var exists = _database.KeyExists(key); return exists; } public void Add(string key, object o, DateTimeOffset expiration, string dependsOnKey = null) { // Lets not store the base type (will be dependsOnKey later) since we want to use it as a set! if (Equals(o, "")) return; // We'd rather just store it as an object type in the database and not have to convert it to RedisValue! RedisValue value; if (o is string) { value = o as string; } else if (o is byte[]) { value = o as byte[]; } else { // Need to try more casts first... value = o.ToString(); } var primaryAdded = _database.StringSet(key, value, expiration.Subtract(DateTimeOffset.Now)); if (dependsOnKey != null && primaryAdded) { _database.SetAdd(dependsOnKey, key); } } public IEnumerable<string> AllKeys { get; private set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using StackExchange.Redis; using WebApi.OutputCache.Core.Cache; namespace WebApi.OutputCache.Redis.StackExchange { public class StackExchangeRedisCacheProvider : IApiOutputCache { private ConnectionMultiplexer _connection; private IDatabase _database; public StackExchangeRedisCacheProvider(string connectionString) { Init(ConnectionMultiplexer.Connect(connectionString)); } public StackExchangeRedisCacheProvider(ConnectionMultiplexer connection) { Init(connection); } public StackExchangeRedisCacheProvider(IDatabase database) { _database = database; } private void Init(ConnectionMultiplexer connection) { _connection = connection; _database = _connection.GetDatabase(); } public void Dispose() { if (_connection != null) _connection.Dispose(); } public void RemoveStartsWith(string key) { var keys = _database.SetMembers(key); foreach (var memberKey in keys) { Remove(memberKey); } Remove(key); } public T Get<T>(string key) where T : class { var result = _database.StringGet(key); return result as T; } public object Get(string key) { // Need to return this as a direct OBJECT and not the RedisValue because it can't convert using 'as string' or 'as byte[]' correctly :( dynamic result = _database.StringGet(key); return result; } public void Remove(string key) { var result = _database.KeyDelete(key); } public bool Contains(string key) { var exists = _database.StringGet(key).HasValue; // Is there another way to check if the key exists first? return exists; } public void Add(string key, object o, DateTimeOffset expiration, string dependsOnKey = null) { // Lets not store the base type (will be dependsOnKey later) since we want to use it as a set! if (Equals(o, "")) return; // We'd rather just store it as an object type in the database and not have to convert it to RedisValue! RedisValue value; if (o is string) { value = o as string; } else if (o is byte[]) { value = o as byte[]; } else { // Need to try more casts first... value = o.ToString(); } var primaryAdded = _database.StringSet(key, value, expiration.Subtract(DateTimeOffset.Now)); if (dependsOnKey != null && primaryAdded) { _database.SetAdd(dependsOnKey, key); } } public IEnumerable<string> AllKeys { get; private set; } } }
mit
C#
e265beb289a3d1df5c5d0645526884e85c410ac9
Fix merge error
2yangk23/osu,peppy/osu,NeoAdonis/osu,2yangk23/osu,ZLima12/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,ZLima12/osu,UselessToucan/osu,ppy/osu,ppy/osu,smoogipooo/osu,EVAST9919/osu,smoogipoo/osu,johnneijzen/osu,johnneijzen/osu,smoogipoo/osu,ppy/osu,peppy/osu,EVAST9919/osu,peppy/osu,peppy/osu-new,smoogipoo/osu,UselessToucan/osu
osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; using osuTK; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles { public class HitCirclePlacementBlueprint : PlacementBlueprint { public new HitCircle HitObject => (HitCircle)base.HitObject; private readonly HitCirclePiece circlePiece; public HitCirclePlacementBlueprint() : base(new HitCircle()) { InternalChild = circlePiece = new HitCirclePiece(); } protected override void Update() { base.Update(); circlePiece.UpdateFrom(HitObject); } protected override bool OnClick(ClickEvent e) { HitObject.StartTime = EditorClock.CurrentTime; EndPlacement(); return true; } public override void UpdatePosition(Vector2 screenSpacePosition) { HitObject.Position = ToLocalSpace(screenSpacePosition); } } }
// 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.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; using osuTK; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles { public class HitCirclePlacementBlueprint : PlacementBlueprint { public new HitCircle HitObject => (HitCircle)base.HitObject; private readonly HitCirclePiece circlePiece; public HitCirclePlacementBlueprint() : base(new HitCircle()) { InternalChild = circlePiece = new HitCirclePiece(); } protected override bool OnClick(ClickEvent e) { HitObject.StartTime = EditorClock.CurrentTime; EndPlacement(); return true; } public override void UpdatePosition(Vector2 screenSpacePosition) { HitObject.Position = ToLocalSpace(screenSpacePosition); } } }
mit
C#
07dfb7b7530528a065a2eccb09b6df560e2547c5
Add unit tests for PEHeaderBuilder factory methods
shimingsg/corefx,wtgodbe/corefx,shimingsg/corefx,shimingsg/corefx,wtgodbe/corefx,wtgodbe/corefx,ptoonen/corefx,BrennanConroy/corefx,shimingsg/corefx,ericstj/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ptoonen/corefx,shimingsg/corefx,ericstj/corefx,wtgodbe/corefx,ptoonen/corefx,ptoonen/corefx,ptoonen/corefx,ericstj/corefx,shimingsg/corefx,ViktorHofer/corefx,BrennanConroy/corefx,ericstj/corefx,ViktorHofer/corefx,wtgodbe/corefx,ericstj/corefx,ericstj/corefx,ViktorHofer/corefx,wtgodbe/corefx,ptoonen/corefx,ptoonen/corefx,ericstj/corefx,wtgodbe/corefx,ViktorHofer/corefx,shimingsg/corefx,BrennanConroy/corefx
src/System.Reflection.Metadata/tests/PortableExecutable/PEHeaderBuilderTests.cs
src/System.Reflection.Metadata/tests/PortableExecutable/PEHeaderBuilderTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Xunit; namespace System.Reflection.PortableExecutable.Tests { public class PEHeaderBuilderTests { [Fact] public void Ctor_Errors() { Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(sectionAlignment: 0)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(fileAlignment: 0)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(sectionAlignment: 512, fileAlignment: 1024)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(sectionAlignment: 513)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(sectionAlignment: int.MinValue)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(fileAlignment: 513)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(fileAlignment: 64*1024*2)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(fileAlignment: int.MaxValue)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(fileAlignment: int.MinValue)); } [Fact] public void ValidateFactoryMethods() { var peHeaderExe = PEHeaderBuilder.CreateExecutableHeader(); Assert.NotNull(peHeaderExe); Assert.True((peHeaderExe.ImageCharacteristics & Characteristics.ExecutableImage) != 0); var peHeaderLib = PEHeaderBuilder.CreateLibraryHeader(); Assert.NotNull(peHeaderLib); Assert.True((peHeaderLib.ImageCharacteristics & Characteristics.ExecutableImage) != 0); Assert.True((peHeaderLib.ImageCharacteristics & Characteristics.Dll) != 0); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Xunit; namespace System.Reflection.PortableExecutable.Tests { public class PEHeaderBuilderTests { [Fact] public void Ctor_Errors() { Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(sectionAlignment: 0)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(fileAlignment: 0)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(sectionAlignment: 512, fileAlignment: 1024)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(sectionAlignment: 513)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(sectionAlignment: int.MinValue)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(fileAlignment: 513)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(fileAlignment: 64*1024*2)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(fileAlignment: int.MaxValue)); Assert.Throws<ArgumentOutOfRangeException>(() => new PEHeaderBuilder(fileAlignment: int.MinValue)); } } }
mit
C#
43019e8983a18b9fd5b17a263a161ddf7aa04c63
fix the reset password link redirection issue #1887 (#1888)
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
src/Tooling/Bit.Tooling.Templates/TodoTemplate/Web/Pages/ResetPassword.razor.cs
src/Tooling/Bit.Tooling.Templates/TodoTemplate/Web/Pages/ResetPassword.razor.cs
using TodoTemplate.Shared.Dtos.Account; namespace TodoTemplate.App.Pages; public partial class ResetPassword { [Parameter] [SupplyParameterFromQuery] public string? Email { get; set; } [Parameter] [SupplyParameterFromQuery] public string? Token { get; set; } public ResetPasswordRequestDto ResetPasswordModel { get; set; } = new(); public bool IsLoading { get; set; } public BitMessageBarType ResetPasswordMessageType { get; set; } public string? ResetPasswordMessage { get; set; } [Inject] public HttpClient HttpClient { get; set; } = default!; [Inject] public NavigationManager NavigationManager { get; set; } = default!; [Inject] public ITodoTemplateAuthenticationService TodoTemplateAuthenticationService { get; set; } = default!; [Inject] public TodoTemplateAuthenticationStateProvider TodoTemplateAuthenticationStateProvider { get; set; } = default!; private async Task Submit() { if (IsLoading) { return; } IsLoading = true; ResetPasswordMessage = null; try { ResetPasswordModel.Email = Email; ResetPasswordModel.Token = Token; await HttpClient.PostAsJsonAsync("Auth/ResetPassword", ResetPasswordModel, TodoTemplateJsonContext.Default.ResetPasswordRequestDto); ResetPasswordMessageType = BitMessageBarType.Success; ResetPasswordMessage = "Your password changed successfully."; await TodoTemplateAuthenticationService.SignIn(new SignInRequestDto { UserName = Email, Password = ResetPasswordModel.Password }); NavigationManager.NavigateTo("/"); } catch (KnownException e) { ResetPasswordMessageType = BitMessageBarType.Error; ResetPasswordMessage = ErrorStrings.ResourceManager.Translate(e.Message, Email!); } finally { IsLoading = false; } } protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { if (await TodoTemplateAuthenticationStateProvider.IsUserAuthenticated()) { NavigationManager.NavigateTo("/"); } } await base.OnAfterRenderAsync(firstRender); } }
using TodoTemplate.Shared.Dtos.Account; namespace TodoTemplate.App.Pages; public partial class ResetPassword { [Parameter] [SupplyParameterFromQuery] public string? Email { get; set; } [Parameter] [SupplyParameterFromQuery] public string? Token { get; set; } public ResetPasswordRequestDto ResetPasswordModel { get; set; } = new(); public bool IsLoading { get; set; } public BitMessageBarType ResetPasswordMessageType { get; set; } public string? ResetPasswordMessage { get; set; } [Inject] public HttpClient HttpClient { get; set; } = default!; [Inject] public NavigationManager NavigationManager { get; set; } = default!; [Inject] public ITodoTemplateAuthenticationService TodoTemplateAuthenticationService { get; set; } = default!; private async Task Submit() { if (IsLoading) { return; } IsLoading = true; ResetPasswordMessage = null; try { ResetPasswordModel.Email = Email; ResetPasswordModel.Token = Token; await HttpClient.PostAsJsonAsync("Auth/ResetPassword", ResetPasswordModel, TodoTemplateJsonContext.Default.ResetPasswordRequestDto); ResetPasswordMessageType = BitMessageBarType.Success; ResetPasswordMessage = "Your password changed successfully."; await TodoTemplateAuthenticationService.SignIn(new SignInRequestDto { UserName = Email, Password = ResetPasswordModel.Password }); NavigationManager.NavigateTo("/"); } catch (KnownException e) { ResetPasswordMessageType = BitMessageBarType.Error; ResetPasswordMessage = ErrorStrings.ResourceManager.Translate(e.Message, Email!); } finally { IsLoading = false; } } }
mit
C#
34fb255da39f0f24749c2219735e365d0a62fed5
Fix Default Directory/DbName for jsonDbCore
xivSolutions/biggy
src/Biggy.Data.Json/jsonDbCore.cs
src/Biggy.Data.Json/jsonDbCore.cs
using System; using System.IO; using System.Linq; using Biggy.Core; using System.Reflection; namespace Biggy.Data.Json { public class JsonDbCore { public virtual IDataStore<T> CreateStoreFor<T>() where T : new() { return new JsonStore<T>(this); } public JsonDbCore() { this.DatabaseName = GetDefaultDbName(); this.DbDirectory = GetDefaultDirectory(); Directory.CreateDirectory(this.DbDirectory); } public JsonDbCore(string dbName) { this.DatabaseName = dbName; this.DbDirectory = GetDefaultDirectory(); Directory.CreateDirectory(this.DbDirectory); } public JsonDbCore(string DbDirectory, string dbName) { this.DatabaseName = dbName; this.DbDirectory = Path.Combine(DbDirectory, dbName); Directory.CreateDirectory(this.DbDirectory); } public virtual string DbDirectory { get; set; } public virtual string DatabaseName { get; set; } public virtual string GetDefaultDirectory() { string defaultDirectory = ""; var currentDir = Directory.GetCurrentDirectory(); if (currentDir.EndsWith("Debug") || currentDir.EndsWith("Release")) { var projectRoot = Directory.GetParent(@"..\..\").FullName; defaultDirectory = Path.Combine(projectRoot, @"Data\Json", this.DatabaseName); } return defaultDirectory; } protected virtual string GetDefaultDbName() { return System.Reflection.Assembly.GetEntryAssembly().GetName().Name; } public virtual int TryDropTable(string tableName) { if (!tableName.Contains(".")) { tableName = tableName + ".json"; } string filePath = Path.Combine(this.DbDirectory, tableName); if (File.Exists(filePath)) { File.Delete(filePath); return 1; } return 0; } public virtual bool TableExists(string tableName) { return File.Exists(Path.Combine(this.DbDirectory, tableName)); } } }
using System; using System.IO; using System.Linq; using Biggy.Core; namespace Biggy.Data.Json { public class JsonDbCore { public virtual IDataStore<T> CreateStoreFor<T>() where T : new() { return new JsonStore<T>(this); } public JsonDbCore(string dbName = "Data") { this.DatabaseName = dbName; this.DbDirectory = GetDefaultDirectory(); Directory.CreateDirectory(this.DbDirectory); } public JsonDbCore(string DbDirectory, string dbName) { this.DatabaseName = dbName; this.DbDirectory = Path.Combine(DbDirectory, dbName); Directory.CreateDirectory(this.DbDirectory); } public virtual string DbDirectory { get; set; } public virtual string DatabaseName { get; set; } public virtual string GetDefaultDirectory() { string defaultDirectory = ""; var currentDir = Directory.GetCurrentDirectory(); if (currentDir.EndsWith("Debug") || currentDir.EndsWith("Release")) { var projectRoot = Directory.GetParent(@"..\..\").FullName; defaultDirectory = Path.Combine(projectRoot, this.DatabaseName); } return defaultDirectory; } public virtual int TryDropTable(string tableName) { if (!tableName.Contains(".")) { tableName = tableName + ".json"; } string filePath = Path.Combine(this.DbDirectory, tableName); if (File.Exists(filePath)) { File.Delete(filePath); return 1; } return 0; } public virtual bool TableExists(string tableName) { return File.Exists(Path.Combine(this.DbDirectory, tableName)); } } }
bsd-3-clause
C#
7b5aef553026cbc2c0f2b745145d268b6f95d3ca
Make components of IRequestContext independently injectable.
jammycakes/dolstagis.web,jammycakes/dolstagis.web,jammycakes/dolstagis.web
src/Dolstagis.Web/CoreServices.cs
src/Dolstagis.Web/CoreServices.cs
using Dolstagis.Web.Auth; using Dolstagis.Web.Http; using Dolstagis.Web.Lifecycle; using Dolstagis.Web.Lifecycle.ResultProcessors; using Dolstagis.Web.Sessions; using Dolstagis.Web.Static; using Dolstagis.Web.Views; namespace Dolstagis.Web { internal class CoreServices : Feature { public CoreServices() { Container.Setup.Application(c => { c.Use<IExceptionHandler, ExceptionHandler>(Scope.Request); c.Use<ISessionStore, InMemorySessionStore>(Scope.Application); c.Use<IAuthenticator, SessionAuthenticator>(Scope.Application); c.Use<ILoginHandler, LoginHandler>(Scope.Request); c.Add<IResultProcessor, StaticResultProcessor>(Scope.Transient); c.Add<IResultProcessor, ViewResultProcessor>(Scope.Transient); c.Add<IResultProcessor>(JsonResultProcessor.Instance); c.Add<IResultProcessor>(ContentResultProcessor.Instance); c.Add<IResultProcessor>(HeadResultProcessor.Instance); c.Use<ViewRegistry, ViewRegistry>(Scope.Request); c.Use<IRequest>(ctx => ctx.GetService<IRequestContext>().Request, Scope.Request); c.Use<IResponse>(ctx => ctx.GetService<IRequestContext>().Response, Scope.Request); c.Use<IUser>(ctx => ctx.GetService<IRequestContext>().User, Scope.Request); c.Use<ISession>(ctx => ctx.GetService<IRequestContext>().Session, Scope.Request); }) .Setup.Request(c => { }); } } }
using Dolstagis.Web.Auth; using Dolstagis.Web.Lifecycle; using Dolstagis.Web.Lifecycle.ResultProcessors; using Dolstagis.Web.Sessions; using Dolstagis.Web.Static; using Dolstagis.Web.Views; namespace Dolstagis.Web { internal class CoreServices : Feature { public CoreServices() { Container.Setup.Application(c => { c.Use<IExceptionHandler, ExceptionHandler>(Scope.Request); c.Use<ISessionStore, InMemorySessionStore>(Scope.Application); c.Use<IAuthenticator, SessionAuthenticator>(Scope.Application); c.Use<ILoginHandler, LoginHandler>(Scope.Request); c.Add<IResultProcessor, StaticResultProcessor>(Scope.Transient); c.Add<IResultProcessor, ViewResultProcessor>(Scope.Transient); c.Add<IResultProcessor>(JsonResultProcessor.Instance); c.Add<IResultProcessor>(ContentResultProcessor.Instance); c.Add<IResultProcessor>(HeadResultProcessor.Instance); c.Use<ViewRegistry, ViewRegistry>(Scope.Request); }); } } }
mit
C#
ecb3b909846c1ab14e60e7f8463e6c54c8eb419b
Undo change to the GoogleDefaults
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNetCore.Authentication.Google/GoogleDefaults.cs
src/Microsoft.AspNetCore.Authentication.Google/GoogleDefaults.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.AspNetCore.Authentication.Google { /// <summary> /// Default values for Google authentication /// </summary> public static class GoogleDefaults { public const string AuthenticationScheme = "Google"; public static readonly string AuthorizationEndpoint = "https://accounts.google.com/o/oauth2/auth"; public static readonly string TokenEndpoint = "https://www.googleapis.com/oauth2/v4/token"; public static readonly string UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me"; } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.AspNetCore.Authentication.Google { /// <summary> /// Default values for Google authentication /// </summary> public static class GoogleDefaults { public static readonly string AuthenticationScheme = "Google"; public static readonly string AuthorizationEndpoint = "https://accounts.google.com/o/oauth2/auth"; public static readonly string TokenEndpoint = "https://www.googleapis.com/oauth2/v4/token"; public static readonly string UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me"; } }
apache-2.0
C#
6258179247f0862f18f813de62e8a0676b1ff708
Address feedback
mavasani/roslyn,bartdesmet/roslyn,eriawan/roslyn,KevinRansom/roslyn,jasonmalinowski/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,sharwell/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,KevinRansom/roslyn,diryboy/roslyn,diryboy/roslyn,sharwell/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,diryboy/roslyn,mavasani/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,dotnet/roslyn
src/Features/CSharp/Portable/MakeMemberStatic/CSharpMakeMemberStaticCodeFixProvider.cs
src/Features/CSharp/Portable/MakeMemberStatic/CSharpMakeMemberStaticCodeFixProvider.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Immutable; using System.Composition; using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.MakeMemberStatic; namespace Microsoft.CodeAnalysis.CSharp.MakeMemberStatic { [ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.MakeMemberStatic), Shared] internal sealed class CSharpMakeMemberStaticCodeFixProvider : AbstractMakeMemberStaticCodeFixProvider { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public CSharpMakeMemberStaticCodeFixProvider() { } public override ImmutableArray<string> FixableDiagnosticIds { get; } = ImmutableArray.Create( "CS0708" // 'MyMethod': cannot declare instance members in a static class ); protected override bool TryGetMemberDeclaration(SyntaxNode node, [NotNullWhen(true)] out SyntaxNode? memberDeclaration) { if (node is MemberDeclarationSyntax) { memberDeclaration = node; return true; } if (node.IsKind(SyntaxKind.VariableDeclarator) && node.Parent is VariableDeclarationSyntax { Parent: FieldDeclarationSyntax or EventFieldDeclarationSyntax }) { memberDeclaration = node.Parent.Parent; return true; } memberDeclaration = null; return false; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Immutable; using System.Composition; using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.MakeMemberStatic; namespace Microsoft.CodeAnalysis.CSharp.MakeMemberStatic { [ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.MakeMemberStatic), Shared] internal sealed class CSharpMakeMemberStaticCodeFixProvider : AbstractMakeMemberStaticCodeFixProvider { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public CSharpMakeMemberStaticCodeFixProvider() { } public override ImmutableArray<string> FixableDiagnosticIds { get; } = ImmutableArray.Create( "CS0708" // 'MyMethod': cannot declare instance members in a static class ); protected override bool TryGetMemberDeclaration(SyntaxNode node, [NotNullWhen(true)] out SyntaxNode? memberDeclaration) { if (node is MemberDeclarationSyntax) { memberDeclaration = node; return true; } if (node.IsKind(SyntaxKind.VariableDeclarator)) { memberDeclaration = node.FirstAncestorOrSelf<MemberDeclarationSyntax>(a => a.IsKind(SyntaxKind.FieldDeclaration) || a.IsKind(SyntaxKind.EventFieldDeclaration)); return memberDeclaration is not null; } memberDeclaration = null; return false; } } }
mit
C#
6929d94296176bfa9331fd18add29aa2dae8b3bf
Fix per review
quantumagi/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode
src/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/CheckDifficultykHybridRule.cs
src/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/CheckDifficultykHybridRule.cs
using System.Threading.Tasks; using Microsoft.Extensions.Logging; using NBitcoin; using Stratis.Bitcoin.Consensus.Rules; namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules { /// <summary> /// Calculate the difficulty of a POS network for both Pow/POS blocks. /// </summary> [PartialValidationRule(CanSkipValidation = true)] public class CheckDifficultykHybridRule : StakeStoreConsensusRule { /// <inheritdoc /> /// <exception cref="ConsensusErrors.HighHash">Thrown if block doesn't have a valid PoW header.</exception> /// <exception cref="ConsensusErrors.BadDiffBits">Thrown if proof of stake is incorrect.</exception> public override Task RunAsync(RuleContext context) { var posRuleContext = context as PosRuleContext; posRuleContext.BlockStake = BlockStake.Load(context.ValidationContext.Block); if (posRuleContext.BlockStake.IsProofOfWork()) { if (!context.MinedBlock && !context.ValidationContext.Block.Header.CheckProofOfWork()) { this.Logger.LogTrace("(-)[HIGH_HASH]"); ConsensusErrors.HighHash.Throw(); } } Target nextWorkRequired = this.PosParent.StakeValidator.GetNextTargetRequired(this.PosParent.StakeChain, context.ValidationContext.ChainTipToExtand.Previous, this.Parent.Network.Consensus, posRuleContext.BlockStake.IsProofOfStake()); BlockHeader header = context.ValidationContext.Block.Header; // Check proof of stake. if (header.Bits != nextWorkRequired) { this.Logger.LogTrace("(-)[BAD_DIFF_BITS]"); ConsensusErrors.BadDiffBits.Throw(); } return Task.CompletedTask; } } }
using System.Threading.Tasks; using Microsoft.Extensions.Logging; using NBitcoin; using Stratis.Bitcoin.Consensus.Rules; namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules { /// <summary> /// Calculate the difficulty of a POS network for both Pow/POS blocks. /// </summary> [PartialValidationRule] public class CheckDifficultykHybridRule : StakeStoreConsensusRule { /// <inheritdoc /> /// <exception cref="ConsensusErrors.HighHash">Thrown if block doesn't have a valid PoW header.</exception> /// <exception cref="ConsensusErrors.BadDiffBits">Thrown if proof of stake is incorrect.</exception> public override Task RunAsync(RuleContext context) { if (context.SkipValidation) { this.Logger.LogTrace("(-)[SKIP_VALIDATION]"); return Task.CompletedTask; } var posRuleContext = context as PosRuleContext; posRuleContext.BlockStake = BlockStake.Load(context.ValidationContext.Block); if (posRuleContext.BlockStake.IsProofOfWork()) { if (!context.MinedBlock && !context.ValidationContext.Block.Header.CheckProofOfWork()) { this.Logger.LogTrace("(-)[HIGH_HASH]"); ConsensusErrors.HighHash.Throw(); } } Target nextWorkRequired = this.PosParent.StakeValidator.GetNextTargetRequired(this.PosParent.StakeChain, context.ValidationContext.ChainTipToExtand.Previous, this.Parent.Network.Consensus, posRuleContext.BlockStake.IsProofOfStake()); BlockHeader header = context.ValidationContext.Block.Header; // Check proof of stake. if (header.Bits != nextWorkRequired) { this.Logger.LogTrace("(-)[BAD_DIFF_BITS]"); ConsensusErrors.BadDiffBits.Throw(); } return Task.CompletedTask; } } }
mit
C#
6447d4f98d732c20b1682d98592d1cfa07545639
Use TypeConverter correctly.
jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,akrisiun/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,Perspex/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Perspex,SuperJMN/Avalonia,Perspex/Perspex
src/Avalonia.Diagnostics/Diagnostics/ViewModels/PropertyViewModel.cs
src/Avalonia.Diagnostics/Diagnostics/ViewModels/PropertyViewModel.cs
using System; using System.ComponentModel; using System.Globalization; using System.Reflection; namespace Avalonia.Diagnostics.ViewModels { internal abstract class PropertyViewModel : ViewModelBase { private const BindingFlags PublicStatic = BindingFlags.Public | BindingFlags.Static; private static readonly Type[] StringParameter = new[] { typeof(string) }; private static readonly Type[] StringIFormatProviderParameters = new[] { typeof(string), typeof(IFormatProvider) }; public abstract object Key { get; } public abstract string Name { get; } public abstract string Group { get; } public abstract string Type { get; } public abstract string Value { get; set; } public abstract void Update(); protected static string ConvertToString(object value) { if (value is null) { return "(null)"; } var converter = TypeDescriptor.GetConverter(value); return converter?.ConvertToString(value) ?? value.ToString(); } protected static object ConvertFromString(string s, Type targetType) { var converter = TypeDescriptor.GetConverter(targetType); if (converter != null && converter.CanConvertFrom(typeof(string))) { return converter.ConvertFrom(null, CultureInfo.InvariantCulture, s); } else { var method = targetType.GetMethod("Parse", PublicStatic, null, StringIFormatProviderParameters, null); if (method != null) { return method.Invoke(null, new object[] { s, CultureInfo.InvariantCulture }); } method = targetType.GetMethod("Parse", PublicStatic, null, StringParameter, null); if (method != null) { return method.Invoke(null, new object[] { s }); } } throw new InvalidCastException("Unable to convert value."); } } }
using System; using System.ComponentModel; using System.Globalization; using System.Reflection; namespace Avalonia.Diagnostics.ViewModels { internal abstract class PropertyViewModel : ViewModelBase { private const BindingFlags PublicStatic = BindingFlags.Public | BindingFlags.Static; private static readonly Type[] StringParameter = new[] { typeof(string) }; private static readonly Type[] StringIFormatProviderParameters = new[] { typeof(string), typeof(IFormatProvider) }; public abstract object Key { get; } public abstract string Name { get; } public abstract string Group { get; } public abstract string Type { get; } public abstract string Value { get; set; } public abstract void Update(); protected static string ConvertToString(object value) { if (value is null) { return "(null)"; } var converter = TypeDescriptor.GetConverter(value); return converter?.ConvertToString(value) ?? value.ToString(); } protected static object ConvertFromString(string s, Type targetType) { var converter = TypeDescriptor.GetConverter(targetType); if (converter != null && converter.CanConvertFrom(typeof(string)) && converter.CanConvertTo(targetType)) { return converter.ConvertTo(null, CultureInfo.InvariantCulture, s, targetType); } else { var method = targetType.GetMethod("Parse", PublicStatic, null, StringIFormatProviderParameters, null); if (method != null) { return method.Invoke(null, new object[] { s, CultureInfo.InvariantCulture }); } method = targetType.GetMethod("Parse", PublicStatic, null, StringParameter, null); if (method != null) { return method.Invoke(null, new object[] { s }); } } throw new InvalidCastException("Unable to convert value."); } } }
mit
C#
d6021a004fe59ec60212d03da159e9b6e5f43bd4
Make DeleteBatch a class
carbon/Amazon
src/Amazon.S3/Actions/BatchDeleteRequest.cs
src/Amazon.S3/Actions/BatchDeleteRequest.cs
using System; using System.Net.Http; using System.Security.Cryptography; using System.Text; using System.Xml.Linq; namespace Amazon.S3 { public sealed class BatchDeleteRequest : S3Request { public BatchDeleteRequest(string host, string bucketName, DeleteBatch batch) : base(HttpMethod.Post, host, bucketName, "?delete") { var xmlText = batch.ToXmlString(); Content = new StringContent(xmlText, Encoding.UTF8, "text/xml"); Content.Headers.ContentMD5 = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(xmlText)); CompletionOption = HttpCompletionOption.ResponseContentRead; } } public sealed class DeleteBatch { private readonly string[] keys; public DeleteBatch(params string[] keys) { this.keys = keys ?? throw new ArgumentNullException(nameof(keys)); } public string ToXmlString() { var root = new XElement("Delete"); foreach (string key in keys) { root.Add(new XElement("Object", new XElement("Key", key) )); } return root.ToString(); } } } /* <?xml version="1.0" encoding="UTF-8"?> <Delete> <Quiet>true</Quiet> <Object> <Key>Key</Key> <VersionId>VersionId</VersionId> </Object> <Object> <Key>Key</Key> </Object> ... </Delete> */
using System; using System.Net.Http; using System.Security.Cryptography; using System.Text; using System.Xml.Linq; namespace Amazon.S3 { public sealed class BatchDeleteRequest : S3Request { public BatchDeleteRequest(string host, string bucketName, DeleteBatch batch) : base(HttpMethod.Post, host, bucketName, "?delete") { var xmlText = batch.ToXmlString(); Content = new StringContent(xmlText, Encoding.UTF8, "text/xml"); Content.Headers.ContentMD5 = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(xmlText)); CompletionOption = HttpCompletionOption.ResponseContentRead; } } public readonly struct DeleteBatch { private readonly string[] keys; public DeleteBatch(params string[] keys) { this.keys = keys ?? throw new ArgumentNullException(nameof(keys)); } public string ToXmlString() { var root = new XElement("Delete"); foreach (string key in keys) { root.Add(new XElement("Object", new XElement("Key", key) )); } return root.ToString(); } } } /* <?xml version="1.0" encoding="UTF-8"?> <Delete> <Quiet>true</Quiet> <Object> <Key>Key</Key> <VersionId>VersionId</VersionId> </Object> <Object> <Key>Key</Key> </Object> ... </Delete> */
mit
C#
4b31a98812f7db6877382d54a3ba4a5b94ab5ffe
Fix test broken by e771e78
rasmuseeg/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,mattbrailsford/Umbraco-CMS,bjarnef/Umbraco-CMS,tompipe/Umbraco-CMS,WebCentrum/Umbraco-CMS,NikRimington/Umbraco-CMS,tcmorris/Umbraco-CMS,leekelleher/Umbraco-CMS,dawoe/Umbraco-CMS,tompipe/Umbraco-CMS,marcemarc/Umbraco-CMS,lars-erik/Umbraco-CMS,leekelleher/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,tompipe/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,madsoulswe/Umbraco-CMS,bjarnef/Umbraco-CMS,WebCentrum/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abryukhov/Umbraco-CMS,leekelleher/Umbraco-CMS,rasmuseeg/Umbraco-CMS,arknu/Umbraco-CMS,lars-erik/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,tcmorris/Umbraco-CMS,robertjf/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,tcmorris/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,madsoulswe/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,lars-erik/Umbraco-CMS,NikRimington/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,lars-erik/Umbraco-CMS,bjarnef/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,bjarnef/Umbraco-CMS,NikRimington/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,tcmorris/Umbraco-CMS,umbraco/Umbraco-CMS,arknu/Umbraco-CMS,rasmuseeg/Umbraco-CMS,dawoe/Umbraco-CMS,tcmorris/Umbraco-CMS,WebCentrum/Umbraco-CMS,robertjf/Umbraco-CMS,madsoulswe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,lars-erik/Umbraco-CMS
src/Umbraco.Tests/Web/AngularIntegration/JsInitializationTests.cs
src/Umbraco.Tests/Web/AngularIntegration/JsInitializationTests.cs
using System.Linq; using NUnit.Framework; using Umbraco.Core; using Umbraco.Web.UI.JavaScript; namespace Umbraco.Tests.Web.AngularIntegration { [TestFixture] public class JsInitializationTests { [Test] public void Get_Default_Init() { var init = JsInitialization.GetDefaultInitialization(); Assert.IsTrue(init.Any()); } [Test] public void Parse_Main() { var result = JsInitialization.WriteScript("[World]", "Hello", "Blah"); Assert.AreEqual(@"LazyLoad.js([World], function () { //we need to set the legacy UmbClientMgr path if ((typeof UmbClientMgr) !== ""undefined"") { UmbClientMgr.setUmbracoPath('Hello'); } jQuery(document).ready(function () { angular.bootstrap(document, ['Blah']); }); });".StripWhitespace(), result.StripWhitespace()); } } }
using System.Linq; using NUnit.Framework; using Umbraco.Core; using Umbraco.Web.UI.JavaScript; namespace Umbraco.Tests.Web.AngularIntegration { [TestFixture] public class JsInitializationTests { [Test] public void Get_Default_Init() { var init = JsInitialization.GetDefaultInitialization(); Assert.IsTrue(init.Any()); } [Test] public void Parse_Main() { var result = JsInitialization.WriteScript("[World]", "Hello", "Blah"); Assert.AreEqual(@"LazyLoad.js([World], function () { //we need to set the legacy UmbClientMgr path UmbClientMgr.setUmbracoPath('Hello'); jQuery(document).ready(function () { angular.bootstrap(document, ['Blah']); }); });".StripWhitespace(), result.StripWhitespace()); } } }
mit
C#
ad448cbbea8b960d006af5478f06b5b0e36e53ea
Allow mixed path references and url transforms
brondavies/wwwplatform.net,brondavies/wwwplatform.net,brondavies/wwwplatform.net
src/web/App_Start/BundleConfig.cs
src/web/App_Start/BundleConfig.cs
using System.Web; using System.Web.Optimization; using wwwplatform.Models; using wwwplatform.Models.Support; namespace wwwplatform { public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { var settings = Settings.Create(new HttpContextWrapper(HttpContext.Current)); string skin = settings.SkinDefinitionFile ?? "~/App_Data/Skins/Default/skin.json"; SkinDefinition skindef = SkinDefinition.Load(HttpContext.Current.Server.MapPath(skin)); HttpContext.Current.Application["Layout"] = skindef.layout; foreach (var script in skindef.scripts.Keys) { bundles.Add(new ScriptBundle(script).Include(skindef.scripts[script].ToArray())); } foreach (var css in skindef.css.Keys) { StyleBundle bundle = new StyleBundle(css); foreach(string file in skindef.css[css]) { bundle.Include(file, new CssRewriteUrlTransform()); } bundles.Add(bundle); } } } }
using System.Web; using System.Web.Optimization; using wwwplatform.Models; using wwwplatform.Models.Support; namespace wwwplatform { public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { var settings = Settings.Create(new HttpContextWrapper(HttpContext.Current)); string skin = settings.SkinDefinitionFile ?? "~/App_Data/Skins/Default/skin.json"; SkinDefinition skindef = SkinDefinition.Load(HttpContext.Current.Server.MapPath(skin)); HttpContext.Current.Application["Layout"] = skindef.layout; foreach (var script in skindef.scripts.Keys) { bundles.Add(new ScriptBundle(script).Include(skindef.scripts[script].ToArray())); } foreach (var css in skindef.css.Keys) { bundles.Add(new StyleBundle(css).Include(skindef.css[css].ToArray())); } } } }
apache-2.0
C#
dd5b90cf6cde83e0b59f282f0bdb1aa75e30a6d5
Add test coverage of animation restarting
ppy/osu,smoogipoo/osu,smoogipooo/osu,UselessToucan/osu,peppy/osu,peppy/osu-new,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,peppy/osu,smoogipoo/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu
osu.Game.Tests/Visual/Gameplay/TestSceneParticleExplosion.cs
osu.Game.Tests/Visual/Gameplay/TestSceneParticleExplosion.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.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osuTK; namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestSceneParticleExplosion : OsuTestScene { private ParticleExplosion explosion; [BackgroundDependencyLoader] private void load(TextureStore textures) { AddStep("create initial", () => { Child = explosion = new ParticleExplosion(textures.Get("Cursor/cursortrail"), 150, 1200) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(400) }; }); AddWaitStep("wait for playback", 5); AddRepeatStep(@"restart animation", () => { explosion.Restart(); }, 10); } } }
// 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.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osuTK; namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestSceneParticleExplosion : OsuTestScene { [BackgroundDependencyLoader] private void load(TextureStore textures) { AddRepeatStep(@"display", () => { Child = new ParticleExplosion(textures.Get("Cursor/cursortrail"), 150, 1200) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(400) }; }, 10); } } }
mit
C#
5a5693958110a9cba4ed77d47073c0255480183a
Fix for missing correlationId preventing startup of EAS
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Data/UserRepository.cs
src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Data/UserRepository.cs
using System; using System.Data; using System.Data.Entity; using System.Linq; using System.Threading.Tasks; using Dapper; using SFA.DAS.EAS.Domain.Configuration; using SFA.DAS.EAS.Domain.Data.Repositories; using SFA.DAS.EAS.Domain.Models.UserProfile; using SFA.DAS.Sql.Client; using SFA.DAS.NLog.Logger; namespace SFA.DAS.EAS.Infrastructure.Data { public class UserRepository : BaseRepository, IUserRepository { private readonly Lazy<EmployerAccountsDbContext> _db; public UserRepository(EmployerApprenticeshipsServiceConfiguration configuration, ILog logger, Lazy<EmployerAccountsDbContext> db) : base(configuration.DatabaseConnectionString, logger) { _db = db; } public Task Upsert(User user) { return WithConnection(c => { var parameters = new DynamicParameters(); parameters.Add("@email", user.Email, DbType.String); parameters.Add("@userRef", new Guid(user.UserRef), DbType.Guid); parameters.Add("@firstName", user.FirstName, DbType.String); parameters.Add("@lastName", user.LastName, DbType.String); parameters.Add("@correlationId", null, DbType.String); return c.ExecuteAsync( sql: "[employer_account].[UpsertUser] @userRef, @email, @firstName, @lastName, @correlationId", param: parameters, commandType: CommandType.Text); }); } } }
using System; using System.Data; using System.Data.Entity; using System.Linq; using System.Threading.Tasks; using Dapper; using SFA.DAS.EAS.Domain.Configuration; using SFA.DAS.EAS.Domain.Data.Repositories; using SFA.DAS.EAS.Domain.Models.UserProfile; using SFA.DAS.Sql.Client; using SFA.DAS.NLog.Logger; namespace SFA.DAS.EAS.Infrastructure.Data { public class UserRepository : BaseRepository, IUserRepository { private readonly Lazy<EmployerAccountsDbContext> _db; public UserRepository(EmployerApprenticeshipsServiceConfiguration configuration, ILog logger, Lazy<EmployerAccountsDbContext> db) : base(configuration.DatabaseConnectionString, logger) { _db = db; } public Task Upsert(User user) { return WithConnection(c => { var parameters = new DynamicParameters(); parameters.Add("@email", user.Email, DbType.String); parameters.Add("@userRef", new Guid(user.UserRef), DbType.Guid); parameters.Add("@firstName", user.FirstName, DbType.String); parameters.Add("@lastName", user.LastName, DbType.String); return c.ExecuteAsync( sql: "[employer_account].[UpsertUser] @userRef, @email, @firstName, @lastName", param: parameters, commandType: CommandType.Text); }); } } }
mit
C#
fad5fb6aff41cbb455f8a8d36972b11ed4dfcc7b
Make FreePortFinder more resilient
canton7/SyncTrayzor,canton7/SyncTrayzor,canton7/SyncTrayzor
src/SyncTrayzor/Syncthing/FreePortFinder.cs
src/SyncTrayzor/Syncthing/FreePortFinder.cs
using NLog; using System; using System.Net; using System.Net.Sockets; namespace SyncTrayzor.Syncthing { public interface IFreePortFinder { int FindFreePort(int startingPort); } public class FreePortFinder : IFreePortFinder { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); public int FindFreePort(int startingPort) { Exception lastException = null; for (int i = startingPort; i < 65535; i++) { try { var listener = new TcpListener(IPAddress.Loopback, i); listener.Start(); listener.Stop(); logger.Debug("Found free port: {0}", i); return i; } catch (SocketException e) { lastException = e; } } throw lastException; } } }
using NLog; using System; using System.Net; using System.Net.Sockets; namespace SyncTrayzor.Syncthing { public interface IFreePortFinder { int FindFreePort(int startingPort); } public class FreePortFinder : IFreePortFinder { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); public int FindFreePort(int startingPort) { Exception lastException = null; for (int i = startingPort; i < 65535; i++) { try { var listener = new TcpListener(IPAddress.Loopback, i); listener.Start(); listener.Stop(); logger.Debug("Found free port: {0}", i); return i; } catch (SocketException e) { if (e.SocketErrorCode == SocketError.AddressAlreadyInUse) lastException = e; else throw; } } throw lastException; } } }
mit
C#
d40333de64ab89ea1deb15ea0a8833fb9aaa45a5
Bump the Assembly version to 1.2.5 like the VERSION file.
Misterblue/convoar,Misterblue/convoar
convoar/Properties/AssemblyInfo.cs
convoar/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("convoar")] [assembly: AssemblyDescription("Convert OpenSimulator OAR files to GLTF scene files")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("convoar")] [assembly: AssemblyCopyright("Copyright © 2018")] [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("bd9942a1-315c-4961-b56a-d1770bed83b0")] // 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.2.5.0")] [assembly: AssemblyFileVersion("1.2.5.0")] [assembly: log4net.Config.XmlConfigurator(Watch = true)]
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("convoar")] [assembly: AssemblyDescription("Convert OpenSimulator OAR files to GLTF scene files")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("convoar")] [assembly: AssemblyCopyright("Copyright © 2018")] [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("bd9942a1-315c-4961-b56a-d1770bed83b0")] // 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.2.4.0")] [assembly: AssemblyFileVersion("1.2.4.0")] [assembly: log4net.Config.XmlConfigurator(Watch = true)]
apache-2.0
C#
a882eca1956ea0370c5ec01c598e2c7d14fa11ec
Fix some formatting for Teams
laurentkempe/HipChatConnect,laurentkempe/HipChatConnect
src/HipChatConnect/Controllers/Listeners/Github/GithubAggregator.cs
src/HipChatConnect/Controllers/Listeners/Github/GithubAggregator.cs
using System.Linq; using System.Text; using System.Threading.Tasks; using HipChatConnect.Controllers.Listeners.Github.Models; using HipChatConnect.Controllers.Listeners.TeamCity; namespace HipChatConnect.Controllers.Listeners.Github { public class GithubAggregator { private IHipChatRoom Room { get; } public GithubAggregator(IHipChatRoom room) { Room = room; } public async Task Handle(GithubPushNotification notification) { await SendTeamsInformationAsync(notification); } private async Task SendTeamsInformationAsync(GithubPushNotification notification) { var githubModel = notification.GithubModel; (var title, var text) = BuildMessage(githubModel); var cardData = new SuccessfulTeamsActivityCardData { Title = title, Text = text }; await Room.SendTeamsActivityCardAsync(cardData); } private static (string Title, string Text) BuildMessage(GithubModel model) { var branch = model.Ref.Replace("refs/heads/", ""); var authorNames = model.Commits.Select(c => c.Author.Name).Distinct().ToList(); var title = $"{string.Join(", ", authorNames)} committed on {branch}"; var stringBuilder = new StringBuilder(); stringBuilder.AppendLine( $"**{string.Join(", ", authorNames)}** committed on [{branch}]({model.Repository.HtmlUrl + "/tree/" + branch})"); stringBuilder.AppendLine(); foreach (var commit in model.Commits.Reverse()) { stringBuilder.AppendLine($@"* {commit.Message} [{commit.Id.Substring(0, 11)}]({commit.Url})"); stringBuilder.AppendLine(); } return (title, stringBuilder.ToString()); } } }
using System.Linq; using System.Text; using System.Threading.Tasks; using HipChatConnect.Controllers.Listeners.Github.Models; using HipChatConnect.Controllers.Listeners.TeamCity; namespace HipChatConnect.Controllers.Listeners.Github { public class GithubAggregator { private IHipChatRoom Room { get; } public GithubAggregator(IHipChatRoom room) { Room = room; } public async Task Handle(GithubPushNotification notification) { await SendTeamsInformationAsync(notification); } private async Task SendTeamsInformationAsync(GithubPushNotification notification) { var githubModel = notification.GithubModel; (var title, var text) = BuildMessage(githubModel); var cardData = new SuccessfulTeamsActivityCardData { Title = title, Text = text }; await Room.SendTeamsActivityCardAsync(cardData); } private static (string Title, string Text) BuildMessage(GithubModel model) { var branch = model.Ref.Replace("refs/heads/", ""); var authorNames = model.Commits.Select(c => c.Author.Name).Distinct().ToList(); var title = $"{string.Join(", ", authorNames)} committed on {branch}"; var stringBuilder = new StringBuilder(); stringBuilder.AppendLine( $"**{string.Join(", ", authorNames)}** committed on [{branch}]({model.Repository.HtmlUrl + "/tree/" + branch})"); foreach (var commit in model.Commits) { stringBuilder.AppendLine($@"* {commit.Message} [{commit.Id.Substring(0, 11)}]({commit.Url})"); stringBuilder.AppendLine(); } return (title, stringBuilder.ToString()); } } }
mit
C#
cda72efe1f11cf4ad7c5dde11ad178751eff3c59
Update Index.cshtml
SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers,SkillsFundingAgency/das-employerusers
src/SFA.DAS.EmployerUsers.Web/Views/TermsAndConditions/Index.cshtml
src/SFA.DAS.EmployerUsers.Web/Views/TermsAndConditions/Index.cshtml
@{ ViewBag.PageID = "page-terms"; ViewBag.Title = "Terms of use"; } <div class="grid-row"> <div class="column-two-thirds"> <h1 class="heading-xlarge">@ViewBag.Title</h1> @Html.Partial("_TermsAndConditionBody") </div> </div>
@{ ViewBag.PageID = "page-terms"; ViewBag.Title = "Terms and conditions"; } <div class="grid-row"> <div class="column-two-thirds"> <h1 class="heading-xlarge">@ViewBag.Title</h1> @Html.Partial("_TermsAndConditionBody") </div> </div>
mit
C#
72d296f4128066787bf0c098d52422aefe363622
Add received timestamp and basic xmldoc for header class
UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipooo/osu,peppy/osu,peppy/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu
osu.Game/Online/Spectator/FrameHeader.cs
osu.Game/Online/Spectator/FrameHeader.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 System; using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; namespace osu.Game.Online.Spectator { [Serializable] public class FrameHeader { /// <summary> /// The current combo of the score. /// </summary> public int Combo { get; set; } /// <summary> /// The maximum combo achieved up to the current point in time. /// </summary> public int MaxCombo { get; set; } /// <summary> /// Cumulative hit statistics. /// </summary> public Dictionary<HitResult, int> Statistics { get; set; } /// <summary> /// The time at which this frame was received by the server. /// </summary> public DateTimeOffset ReceivedTime { get; set; } /// <summary> /// Construct header summary information from a point-in-time reference to a score which is actively being played. /// </summary> /// <param name="score">The score for reference.</param> public FrameHeader(ScoreInfo score) { Combo = score.Combo; MaxCombo = score.MaxCombo; // copy for safety Statistics = new Dictionary<HitResult, int>(score.Statistics); } [JsonConstructor] public FrameHeader(int combo, int maxCombo, Dictionary<HitResult, int> statistics, DateTimeOffset receivedTime) { Combo = combo; MaxCombo = maxCombo; Statistics = statistics; ReceivedTime = receivedTime; } } }
// 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 System; using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; namespace osu.Game.Online.Spectator { [Serializable] public class FrameHeader { public int Combo { get; set; } public int MaxCombo { get; set; } public Dictionary<HitResult, int> Statistics { get; set; } /// <summary> /// Construct header summary information from a point-in-time reference to a score which is actively being played. /// </summary> /// <param name="score">The score for reference.</param> public FrameHeader(ScoreInfo score) { Combo = score.Combo; MaxCombo = score.MaxCombo; // copy for safety Statistics = new Dictionary<HitResult, int>(score.Statistics); } [JsonConstructor] public FrameHeader(int combo, int maxCombo, Dictionary<HitResult, int> statistics) { Combo = combo; MaxCombo = maxCombo; Statistics = statistics; } } }
mit
C#
93d4c77a4bcfcb97af749c93f10bfd555694deef
Fix a few for AuthenticationSchemes.cs
alberist/websocket-sharp,jmptrader/websocket-sharp,microdee/websocket-sharp,zq513705971/WebSocketApp,jmptrader/websocket-sharp,2Toad/websocket-sharp,zhangwei900808/websocket-sharp,zhangwei900808/websocket-sharp,pjc0247/websocket-sharp-unity,zq513705971/WebSocketApp,sinha-abhishek/websocket-sharp,zq513705971/WebSocketApp,pjc0247/websocket-sharp-unity,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,sinha-abhishek/websocket-sharp,hybrid1969/websocket-sharp,prepare/websocket-sharp,prepare/websocket-sharp,juoni/websocket-sharp,zq513705971/WebSocketApp,TabbedOut/websocket-sharp,jjrdk/websocket-sharp,microdee/websocket-sharp,hybrid1969/websocket-sharp,sinha-abhishek/websocket-sharp,alberist/websocket-sharp,TabbedOut/websocket-sharp,zhangwei900808/websocket-sharp,pjc0247/websocket-sharp-unity,Liryna/websocket-sharp,juoni/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp,Liryna/websocket-sharp,alberist/websocket-sharp,alberist/websocket-sharp,hybrid1969/websocket-sharp,hybrid1969/websocket-sharp,TabbedOut/websocket-sharp,2Toad/websocket-sharp,2Toad/websocket-sharp,Liryna/websocket-sharp,zhangwei900808/websocket-sharp,juoni/websocket-sharp,juoni/websocket-sharp,2Toad/websocket-sharp,jogibear9988/websocket-sharp,microdee/websocket-sharp,jmptrader/websocket-sharp,sta/websocket-sharp,sinha-abhishek/websocket-sharp,jogibear9988/websocket-sharp,pjc0247/websocket-sharp-unity,prepare/websocket-sharp,jjrdk/websocket-sharp,prepare/websocket-sharp,TabbedOut/websocket-sharp,sta/websocket-sharp,microdee/websocket-sharp,jmptrader/websocket-sharp
websocket-sharp/Net/AuthenticationSchemes.cs
websocket-sharp/Net/AuthenticationSchemes.cs
#region License /* * AuthenticationSchemes.cs * * This code is derived from System.Net.AuthenticationSchemes.cs of Mono * (http://www.mono-project.com). * * The MIT License * * Copyright (c) 2005 Novell, Inc. (http://www.novell.com) * Copyright (c) 2012-2014 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 #region Authors /* * Authors: * - Atsushi Enomoto <atsushi@ximian.com> */ #endregion using System; namespace WebSocketSharp.Net { /// <summary> /// Contains the values of the schemes for authentication. /// </summary> [Flags] public enum AuthenticationSchemes { /// <summary> /// Indicates that no authentication is allowed. /// </summary> None, /// <summary> /// Indicates digest authentication. /// </summary> Digest = 1, /// <summary> /// Indicates basic authentication. /// </summary> Basic = 8, /// <summary> /// Indicates anonymous authentication. /// </summary> Anonymous = 0x8000 } }
#region License /* * AuthenticationSchemes.cs * * This code is derived from System.Net.AuthenticationSchemes.cs of Mono * (http://www.mono-project.com). * * The MIT License * * Copyright (c) 2005 Novell, Inc. (http://www.novell.com) * Copyright (c) 2012-2013 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 #region Authors /* * Authors: * Atsushi Enomoto <atsushi@ximian.com> */ #endregion using System; namespace WebSocketSharp.Net { /// <summary> /// Contains the values of the schemes for authentication. /// </summary> [Flags] public enum AuthenticationSchemes { /// <summary> /// Indicates that no authentication is allowed. /// </summary> None, /// <summary> /// Indicates digest authentication. /// </summary> Digest = 1, /// <summary> /// Indicates basic authentication. /// </summary> Basic = 8, /// <summary> /// Indicates anonymous authentication. /// </summary> Anonymous = 0x8000, } }
mit
C#
dc72b7ce92173f629668f87df6233a0ccd747198
Fix Clean ordering
blackdwarf/cli,johnbeisner/cli,svick/cli,ravimeda/cli,johnbeisner/cli,johnbeisner/cli,harshjain2/cli,blackdwarf/cli,EdwardBlair/cli,blackdwarf/cli,ravimeda/cli,livarcocc/cli-1,Faizan2304/cli,EdwardBlair/cli,Faizan2304/cli,dasMulli/cli,livarcocc/cli-1,ravimeda/cli,livarcocc/cli-1,EdwardBlair/cli,Faizan2304/cli,svick/cli,svick/cli,dasMulli/cli,harshjain2/cli,harshjain2/cli,dasMulli/cli,blackdwarf/cli
src/dotnet/commands/dotnet-clean/Program.cs
src/dotnet/commands/dotnet-clean/Program.cs
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools.MSBuild; using Microsoft.DotNet.Cli; using Parser = Microsoft.DotNet.Cli.Parser; namespace Microsoft.DotNet.Tools.Clean { public class CleanCommand : MSBuildForwardingApp { public CleanCommand(IEnumerable<string> msbuildArgs, string msbuildPath = null) : base(msbuildArgs, msbuildPath) { } public static CleanCommand FromArgs(string[] args, string msbuildPath = null) { var msbuildArgs = new List<string>(); var parser = Parser.Instance; var result = parser.ParseFrom("dotnet clean", args); Reporter.Output.WriteLine(result.Diagram()); result.ShowHelpIfRequested(); var parsedClean = result["dotnet"]["clean"]; msbuildArgs.AddRange(parsedClean.Arguments); msbuildArgs.Add("/t:Clean"); msbuildArgs.AddRange(parsedClean.OptionValuesToBeForwarded()); return new CleanCommand(msbuildArgs, msbuildPath); } public static int Run(string[] args) { DebugHelper.HandleDebugSwitch(ref args); CleanCommand cmd; try { cmd = FromArgs(args); } catch (CommandCreationException e) { return e.ExitCode; } return cmd.Execute(); } } }
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools.MSBuild; using Microsoft.DotNet.Cli; using Parser = Microsoft.DotNet.Cli.Parser; namespace Microsoft.DotNet.Tools.Clean { public class CleanCommand : MSBuildForwardingApp { public CleanCommand(IEnumerable<string> msbuildArgs, string msbuildPath = null) : base(msbuildArgs, msbuildPath) { } public static CleanCommand FromArgs(string[] args, string msbuildPath = null) { var msbuildArgs = new List<string>(); var parser = Parser.Instance; var result = parser.ParseFrom("dotnet clean", args); Reporter.Output.WriteLine(result.Diagram()); result.ShowHelpIfRequested(); var parsedClean = result["dotnet"]["clean"]; msbuildArgs.Add("/t:Clean"); msbuildArgs.AddRange(parsedClean.OptionValuesToBeForwarded()); msbuildArgs.AddRange(parsedClean.Arguments); return new CleanCommand(msbuildArgs, msbuildPath); } public static int Run(string[] args) { DebugHelper.HandleDebugSwitch(ref args); CleanCommand cmd; try { cmd = FromArgs(args); } catch (CommandCreationException e) { return e.ExitCode; } return cmd.Execute(); } } }
mit
C#
55a09f50e1afac6c0bdff559290974bcfc733ede
update geotargeting
alecgorge/adzerk-dot-net
Adzerk.Api/Models/GeoTargeting.cs
Adzerk.Api/Models/GeoTargeting.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Adzerk.Api.Models { public class GeoTargeting { public long LocationId { get; set; } public string CountryCode { get; set; } public string Region { get; set; } public int MetroCode { get; set; } public bool IsExclude { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Adzerk.Api.Models { public class GeoTargeting { public string CountryCode { get; set; } public string Region { get; set; } public string MetroCode { get; set; } public bool IsExclude { get; set; } } }
mit
C#
5c41205ab793d64af33b74334664e7c77308421c
use regex
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Core/Models/AccountModel.cs
Anlab.Core/Models/AccountModel.cs
using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace Anlab.Jobs.MoneyMovement { public class AccountModel { public AccountModel(string rawAccount) { var regx = Regex.Match(rawAccount, @"(\w)-(\w{7})\/?(\w{5})?"); Chart = regx.Groups[1].Value; Account = regx.Groups[2].Value; SubAccount = regx.Groups[3].Value; } public string Chart { get; set; } public string Account { get; set; } public string SubAccount { get; set; } } }
using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace Anlab.Jobs.MoneyMovement { public class AccountModel { public AccountModel(string rawAccount) { //var temp = rawAccount.Split('-'); //var tempSub = temp[1].Split('/'); //Chart = temp[0]; //if (tempSub.Length > 1) //{ // Account = tempSub[0]; // SubAccount = tempSub[1]; //} //else //{ // Account = temp[1]; //} var temp = Regex.Split(rawAccount, @"(\w)-(\w{7})\/?(\w{5})?"); Chart = temp[1]; Account = temp[2]; SubAccount = temp[3]; //string pattern = @"(\w)-(\w{7})\/?(\w{5})?"; //Regex rgx = new Regex(pattern); //foreach (Match match in rgx.Matches(rawAccount)) //{ // var test1 = match.Value; // var zzz = 1; //} ////var temp2 = Regex.Matches(rawAccount, @"(\w)-(\w{7})\/?(\w{5})?"); ////foreach (var VARIABLE in temp2) ////{ //// var test = VARIABLE; ////} ////var aaa = 1; } public string Chart { get; set; } public string Account { get; set; } public string SubAccount { get; set; } } }
mit
C#
007e0849efb708d27ee15dacf3d3843904d7a863
Update Index.cshtml
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Mvc/Views/Home/Index.cshtml
Anlab.Mvc/Views/Home/Index.cshtml
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: June 10, 2020<br /><br /> We are open and receiving samples as usual.<br /><br /> Thank you for your patience over the last several months. </div> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses. </p> <p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the operation of a number of analytical methods and instruments.</p> <p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory. We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/> Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> </address> </div>
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <div class="alert alert-info"> <button type="button" class="close" data-dismiss="alert">×</button> Update posted: Update posted: June 10, 2020<br /><br /> We are open and receiving samples as usual.<br /><br /> Thank you for your patience over the last several months. </div> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses. </p> <p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the operation of a number of analytical methods and instruments.</p> <p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory. We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/> Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> </address> </div>
mit
C#
b6249c186489b22912f1c2503f94b26a40348f3b
Delete the actual date folder
chadly/cams,chadly/vlc-rtsp,chadly/vlc-rtsp,chadly/vlc-rtsp
src/AmcrestCamera.cs
src/AmcrestCamera.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; namespace Cams { public class AmcrestCamera : Camera { public override string Type => "Amcrest"; public AmcrestCamera(string path) : base(path) { } protected override IEnumerable<VideoFile> DiscoverVideoFiles() { var dateDirs = Directory.GetDirectories(RawFilePath); foreach (string dateDir in dateDirs) { DateTime date = DateTime.Parse(new DirectoryInfo(dateDir).Name); var timeDirs = Directory.GetDirectories(Path.Combine(dateDir, "001", "dav")); foreach (string timeDir in timeDirs) { var files = Directory.GetFiles(timeDir, "*.dav"); foreach (string file in files) { var match = Regex.Match(file, @"(\d{2})\.(\d{2})\.(\d{2})-\d{2}\.\d{2}\.\d{2}"); if (!match.Success) { Console.WriteLine($"Filename is in an unexpected format: {file}"); } else { int hour = int.Parse(match.Groups[1].Value); int minute = int.Parse(match.Groups[2].Value); int second = int.Parse(match.Groups[3].Value); date = new DateTime(date.Year, date.Month, date.Day, hour, minute, second); yield return new VideoFile(file, date); } } } } } protected override void Cleanup(VideoFile file) { File.Delete(file.FilePath); File.Delete(file.FilePath.Replace(".dav", ".idx")); string timeDir = Path.Combine(file.FilePath, ".."); if (!Directory.GetFileSystemEntries(timeDir).Any()) { Directory.Delete(timeDir); string dateDir = Path.Combine(timeDir, ".."); if (!Directory.GetFileSystemEntries(dateDir).Any()) { //the date directory is actually up two more levels (e.g. 2017-12-27/001/dav/11/whatever.mp4) Directory.Delete(Path.Combine(dateDir, "../../"), true); } } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; namespace Cams { public class AmcrestCamera : Camera { public override string Type => "Amcrest"; public AmcrestCamera(string path) : base(path) { } protected override IEnumerable<VideoFile> DiscoverVideoFiles() { var dateDirs = Directory.GetDirectories(RawFilePath); foreach (string dateDir in dateDirs) { DateTime date = DateTime.Parse(new DirectoryInfo(dateDir).Name); var timeDirs = Directory.GetDirectories(Path.Combine(dateDir, "001", "dav")); foreach (string timeDir in timeDirs) { var files = Directory.GetFiles(timeDir, "*.dav"); foreach (string file in files) { var match = Regex.Match(file, @"(\d{2})\.(\d{2})\.(\d{2})-\d{2}\.\d{2}\.\d{2}"); if (!match.Success) { Console.WriteLine($"Filename is in an unexpected format: {file}"); } else { int hour = int.Parse(match.Groups[1].Value); int minute = int.Parse(match.Groups[2].Value); int second = int.Parse(match.Groups[3].Value); date = new DateTime(date.Year, date.Month, date.Day, hour, minute, second); yield return new VideoFile(file, date); } } } } } protected override void Cleanup(VideoFile file) { File.Delete(file.FilePath); File.Delete(file.FilePath.Replace(".dav", ".idx")); string timeDir = Path.Combine(file.FilePath, ".."); if (!Directory.GetFileSystemEntries(timeDir).Any()) { Directory.Delete(timeDir); string dateDir = Path.Combine(timeDir, ".."); if (!Directory.GetFileSystemEntries(dateDir).Any()) { Directory.Delete(dateDir); } } } } }
mit
C#
7a35f6806485f6ba6beadf9005b0855eda013af5
Use version parser instead of string.split
File-New-Project/EarTrumpet
EarTrumpet/Services/WhatsNewDisplayService.cs
EarTrumpet/Services/WhatsNewDisplayService.cs
using System; using System.Threading.Tasks; using Windows.ApplicationModel; using Windows.System; namespace EarTrumpet.Services { public static class WhatsNewDisplayService { internal static void ShowIfAppropriate() { if (App.HasIdentity()) { var currentVersion = PackageVersionToReadableString(Package.Current.Id.Version); var hasShownFirstRun = false; var lastVersion = Windows.Storage.ApplicationData.Current.LocalSettings.Values[nameof(currentVersion)]; if ((lastVersion != null && currentVersion == (string)lastVersion)) { return; } Windows.Storage.ApplicationData.Current.LocalSettings.Values[nameof(currentVersion)] = currentVersion; Version.TryParse(lastVersion?.ToString(), out var oldVersion); if (oldVersion?.Major == Package.Current.Id.Version.Major && oldVersion?.Minor == Package.Current.Id.Version.Minor) { return; } if (!Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey(nameof(hasShownFirstRun))) { return; } try { System.Diagnostics.Process.Start("eartrumpet:"); } catch { } } } private static string PackageVersionToReadableString(PackageVersion packageVersion) { return $"{packageVersion.Major}.{packageVersion.Minor}.{packageVersion.Build}.{packageVersion.Revision}"; } } }
using System; using System.Threading.Tasks; using Windows.ApplicationModel; using Windows.System; namespace EarTrumpet.Services { public static class WhatsNewDisplayService { internal static void ShowIfAppropriate() { if (App.HasIdentity()) { var currentVersion = PackageVersionToReadableString(Package.Current.Id.Version); var hasShownFirstRun = false; var lastVersion = Windows.Storage.ApplicationData.Current.LocalSettings.Values[nameof(currentVersion)]; if ((lastVersion != null && currentVersion == (string)lastVersion)) { return; } Windows.Storage.ApplicationData.Current.LocalSettings.Values[nameof(currentVersion)] = currentVersion; var versionArray = lastVersion?.ToString().Split('.'); if (versionArray?.Length > 2 && (versionArray[0] == Package.Current.Id.Version.Major.ToString() && versionArray[1] == Package.Current.Id.Version.Minor.ToString())) { return; } if (!Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey(nameof(hasShownFirstRun))) { return; } try { System.Diagnostics.Process.Start("eartrumpet:"); } catch { } } } private static string PackageVersionToReadableString(PackageVersion packageVersion) { return $"{packageVersion.Major}.{packageVersion.Minor}.{packageVersion.Build}.{packageVersion.Revision}"; } } }
mit
C#
ab4f31639d9e2ccfd8ac4cc61091c024aa0c6827
Remove weird time clause
johnneijzen/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,EVAST9919/osu,peppy/osu,ppy/osu,EVAST9919/osu,2yangk23/osu,2yangk23/osu,ppy/osu,smoogipoo/osu,ppy/osu,johnneijzen/osu,NeoAdonis/osu,peppy/osu-new,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu
osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.cs
osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ReverseArrowPiece.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.Audio.Track; using osu.Framework.Graphics; using osuTK; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class ReverseArrowPiece : BeatSyncedContainer { private readonly RepeatPoint repeatPoint; public ReverseArrowPiece(RepeatPoint repeatPoint) { this.repeatPoint = repeatPoint; Divisor = 2; MinimumBeatLength = 200; Anchor = Anchor.Centre; Origin = Anchor.Centre; Blending = BlendingParameters.Additive; Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon { RelativeSizeAxes = Axes.Both, Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(0.35f) }) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }; } protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { if (Clock.CurrentTime < repeatPoint.StartTime) Child.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out); } } }
// 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.Audio.Track; using osu.Framework.Graphics; using osuTK; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class ReverseArrowPiece : BeatSyncedContainer { private readonly RepeatPoint repeatPoint; public ReverseArrowPiece(RepeatPoint repeatPoint) { this.repeatPoint = repeatPoint; Divisor = 2; MinimumBeatLength = 200; Anchor = Anchor.Centre; Origin = Anchor.Centre; Blending = BlendingParameters.Additive; Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2); Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon { RelativeSizeAxes = Axes.Both, Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(0.35f) }) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }; } protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { if (Clock.CurrentTime < repeatPoint.StartTime) Child.ScaleTo(1.3f).ScaleTo(1f, Math.Min(timingPoint.BeatLength, repeatPoint.StartTime - Clock.CurrentTime), Easing.Out); } } }
mit
C#
7fefea48e1ffc043261154c28bbebdef5c36b586
use "var" keyword for readability
Voxelgon/Voxelgon,Voxelgon/Voxelgon
Assets/Voxelgon/Math/Geometry.cs
Assets/Voxelgon/Math/Geometry.cs
using UnityEngine; using System.Collections; using System.Collections.Generic; using Voxelgon; namespace Voxelgon.Math { public static class Geometry { //merges a list of meshes into a single mesh (limited at 65534 vertices) public static Mesh MergeMeshes(List<Mesh> meshes) { var compoundMesh = new Mesh(); var compoundVertices = new List<Vector3>(); var compoundNormals = new List<Vector3>(); var compoundColors = new List<Color>(); var compoundTriangles = new List<int>(); foreach (Mesh m in meshes) { if (compoundVertices.Count + m.vertices.Length > 65534) { break; } compoundVertices.AddRange(m.vertices); compoundNormals.AddRange(m.normals); compoundColors.AddRange(m.colors); compoundTriangles.AddRange(m.triangles); if (compoundTriangles.Count - m.triangles.Length != 0) { for (int t = 1; t <= m.triangles.Length; t++) { compoundTriangles[compoundTriangles.Count - t] += compoundVertices.Count - m.vertices.Length; } } } compoundMesh.SetVertices(compoundVertices); compoundMesh.SetNormals(compoundNormals); compoundMesh.SetColors(compoundColors); compoundMesh.SetTriangles(compoundTriangles, 0); compoundMesh.RecalculateBounds(); compoundMesh.RecalculateNormals(); return compoundMesh; } //public static List<Mesh> MergeMeshesWithOverflow(List<Mesh> meshes, int vertexMax) { } }
using UnityEngine; using System.Collections; using System.Collections.Generic; using Voxelgon; namespace Voxelgon.Math { public static class Geometry { //merges a list of meshes into a single mesh (limited at 65534 vertices) public static Mesh MergeMeshes(List<Mesh> meshes) { Mesh compoundMesh = new Mesh(); List<Vector3> compoundVertices = new List<Vector3>(); List<Vector3> compoundNormals = new List<Vector3>(); List<Color> compoundColors = new List<Color>(); List<int> compoundTriangles = new List<int>(); foreach (Mesh m in meshes) { if (compoundVertices.Count + m.vertices.Length > 65534) { break; } compoundVertices.AddRange(m.vertices); compoundNormals.AddRange(m.normals); compoundColors.AddRange(m.colors); compoundTriangles.AddRange(m.triangles); if (compoundTriangles.Count - m.triangles.Length != 0) { for (int t = 1; t <= m.triangles.Length; t++) { compoundTriangles[compoundTriangles.Count - t] += compoundVertices.Count - m.vertices.Length; } } } compoundMesh.SetVertices(compoundVertices); compoundMesh.SetNormals(compoundNormals); compoundMesh.SetColors(compoundColors); compoundMesh.SetTriangles(compoundTriangles, 0); compoundMesh.RecalculateBounds(); compoundMesh.RecalculateNormals(); return compoundMesh; } //public static List<Mesh> MergeMeshesWithOverflow(List<Mesh> meshes, int vertexMax) { } }
apache-2.0
C#
57274a4ad2132f34357afe7eb958a0acde49a4b1
Remove CIV.Ccs reference from CIV.Hml
lou1306/CIV,lou1306/CIV
CIV.Hml/HmlFormula/BoxFormula.cs
CIV.Hml/HmlFormula/BoxFormula.cs
using System; using System.Collections.Generic; using System.Linq; using CIV.Common; namespace CIV.Hml { class BoxFormula : HmlLabelFormula { protected override string BuildRepr() => $"[{String.Join(",", Label)}]{Inner}"; protected override bool CheckStrategy(IEnumerable<IProcess> processes) => processes.All(Inner.Check); protected override IEnumerable<Transition> TransitionStrategy(IProcess process) { return process.GetTransitions(); } public override bool Check(IProcess process) { var grouped = MatchedTransitions(process).GroupBy(x => x.Label); return grouped.All(procs => procs.All(p => Inner.Check(p.Process))); } } }
using System; using System.Collections.Generic; using System.Linq; using CIV.Ccs; using CIV.Common; namespace CIV.Hml { class BoxFormula : HmlLabelFormula { protected override string BuildRepr() => $"[{String.Join(",", Label)}]{Inner}"; protected override bool CheckStrategy(IEnumerable<IProcess> processes) => processes.All(Inner.Check); protected override IEnumerable<Transition> TransitionStrategy(IProcess process) { return process.GetTransitions(); } public override bool Check(IProcess process) { var grouped = MatchedTransitions(process).GroupBy(x => x.Label); return grouped.All(procs => procs.All(p => Inner.Check(p.Process))); } } }
mit
C#
ae15e77ed59f71fbeb206404479cdabc17242e51
Fix Cut Dependencies
rusergeev/DynamicProperty
DynamicProperty/DependencyNode.cs
DynamicProperty/DependencyNode.cs
using System; using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; namespace DynamicProperty { public abstract class DependencyNode { public void AddLink([NotNull] DependencyNode to) { if (to == this) throw new InvalidOperationException("Don't set itself as link"); _to.Add(to); to._from.Add(this); } public void CutDependency() { foreach (var from in _from) from._to.Remove(this); _from.Clear(); } public void Invalidate() { foreach (var to in _to.ToList()) to.BurnUp(); _to.Clear(); } private void BurnUp(){ Eval(); foreach (var to in _to) to.BurnUp(); _to.Clear(); _from.Clear(); } protected abstract void Eval(); private readonly ICollection<DependencyNode> _to = new HashSet<DependencyNode>(); private readonly ICollection<DependencyNode> _from = new HashSet<DependencyNode>(); } }
using System; using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; namespace DynamicProperty { public abstract class DependencyNode { public void AddLink([NotNull] DependencyNode to) { if (to == this) throw new InvalidOperationException("Don't set itself as link"); _to.Add(to); to._from.Add(this); } public void CutDependency() { foreach (var from in _from) from._to.Remove(this); } public void Invalidate() { foreach (var to in _to.ToList()) to.BurnUp(); _to.Clear(); } private void BurnUp(){ Eval(); foreach (var to in _to) to.BurnUp(); _to.Clear(); _from.Clear(); } protected abstract void Eval(); private readonly ICollection<DependencyNode> _to = new HashSet<DependencyNode>(); private readonly ICollection<DependencyNode> _from = new HashSet<DependencyNode>(); } }
bsd-3-clause
C#
71b4f5ebf355243061a7bdd3d0ac4bf1f9cbc04a
Remove call to _set#Update from VerifiedUserRepository.
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
src/MitternachtBot/Services/Database/Repositories/Impl/VerifiedUserRepository.cs
src/MitternachtBot/Services/Database/Repositories/Impl/VerifiedUserRepository.cs
using System.Linq; using Microsoft.EntityFrameworkCore; using Mitternacht.Services.Database.Models; namespace Mitternacht.Services.Database.Repositories.Impl { public class VerifiedUserRepository : Repository<VerifiedUser>, IVerifiedUserRepository { public VerifiedUserRepository(DbContext context) : base(context) { } public VerifiedUser GetVerifiedUser(ulong guildId, ulong userId) => _set.FirstOrDefault(v => v.GuildId == guildId && v.UserId == userId); public VerifiedUser GetVerifiedUser(ulong guildId, long forumUserId) => _set.FirstOrDefault(v => v.GuildId == guildId && v.ForumUserId == forumUserId); public bool SetVerified(ulong guildId, ulong userId, long forumUserId) { if(CanVerifyForumAccount(guildId, userId, forumUserId)) { var vu = GetVerifiedUser(guildId, userId); if(vu == null) { _set.Add(new VerifiedUser { GuildId = guildId, UserId = userId, ForumUserId = forumUserId, }); } else { vu.ForumUserId = forumUserId; } return true; } else { return false; } } public bool IsVerified(ulong guildId, ulong userId) => _set.Any(v => v.GuildId == guildId && v.UserId == userId); public bool IsVerified(ulong guildId, long forumUserId) => _set.Any(v => v.GuildId == guildId && v.ForumUserId == forumUserId); public bool IsVerified(ulong guildId, ulong userId, long forumUserId) => _set.Any(v => v.GuildId == guildId && v.UserId == userId && v.ForumUserId == forumUserId); public bool CanVerifyForumAccount(ulong guildId, ulong userId, long forumUserId) => !IsVerified(guildId, forumUserId) && !IsVerified(guildId, userId, forumUserId) || !IsVerified(guildId, userId); public bool RemoveVerification(ulong guildId, ulong userId) { var vu = GetVerifiedUser(guildId, userId); if(vu != null) { _set.Remove(vu); return true; } else { return false; } } public bool RemoveVerification(ulong guildId, long forumUserId) { var vu = GetVerifiedUser(guildId, forumUserId); if(vu != null) { _set.Remove(vu); return true; } else { return false; } } public IQueryable<VerifiedUser> GetVerifiedUsers(ulong guildId) => _set.AsQueryable().Where(v => v.GuildId == guildId); public int GetNumberOfVerificationsInGuild(ulong guildId) => _set.Count(v => v.GuildId == guildId); public IQueryable<VerifiedUser> GetVerificationsOfUser(ulong userId) => _set.AsQueryable().Where(v => v.UserId == userId); } }
using System.Linq; using Microsoft.EntityFrameworkCore; using Mitternacht.Services.Database.Models; namespace Mitternacht.Services.Database.Repositories.Impl { public class VerifiedUserRepository : Repository<VerifiedUser>, IVerifiedUserRepository { public VerifiedUserRepository(DbContext context) : base(context) { } public VerifiedUser GetVerifiedUser(ulong guildId, ulong userId) => _set.FirstOrDefault(v => v.GuildId == guildId && v.UserId == userId); public VerifiedUser GetVerifiedUser(ulong guildId, long forumUserId) => _set.FirstOrDefault(v => v.GuildId == guildId && v.ForumUserId == forumUserId); public bool SetVerified(ulong guildId, ulong userId, long forumUserId) { if(CanVerifyForumAccount(guildId, userId, forumUserId)) { var vu = GetVerifiedUser(guildId, userId); if(vu == null) { _set.Add(new VerifiedUser { GuildId = guildId, UserId = userId, ForumUserId = forumUserId, }); } else { vu.ForumUserId = forumUserId; _set.Update(vu); } return true; } else { return false; } } public bool IsVerified(ulong guildId, ulong userId) => _set.Any(v => v.GuildId == guildId && v.UserId == userId); public bool IsVerified(ulong guildId, long forumUserId) => _set.Any(v => v.GuildId == guildId && v.ForumUserId == forumUserId); public bool IsVerified(ulong guildId, ulong userId, long forumUserId) => _set.Any(v => v.GuildId == guildId && v.UserId == userId && v.ForumUserId == forumUserId); public bool CanVerifyForumAccount(ulong guildId, ulong userId, long forumUserId) => !IsVerified(guildId, forumUserId) && !IsVerified(guildId, userId, forumUserId) || !IsVerified(guildId, userId); public bool RemoveVerification(ulong guildId, ulong userId) { var vu = GetVerifiedUser(guildId, userId); if(vu != null) { _set.Remove(vu); return true; } else { return false; } } public bool RemoveVerification(ulong guildId, long forumUserId) { var vu = GetVerifiedUser(guildId, forumUserId); if(vu != null) { _set.Remove(vu); return true; } else { return false; } } public IQueryable<VerifiedUser> GetVerifiedUsers(ulong guildId) => _set.AsQueryable().Where(v => v.GuildId == guildId); public int GetNumberOfVerificationsInGuild(ulong guildId) => _set.Count(v => v.GuildId == guildId); public IQueryable<VerifiedUser> GetVerificationsOfUser(ulong userId) => _set.AsQueryable().Where(v => v.UserId == userId); } }
mit
C#
d5e48510b2108b016fa3327736e9a697e023b707
Update AssemblyInfo.cs
mikhail-barg/NLog.Windows.Forms,NLog/NLog.Windows.Forms
NLog.Windows.Forms/Properties/AssemblyInfo.cs
NLog.Windows.Forms/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("NLog.Windows.Forms")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("NLog")] [assembly: AssemblyProduct("NLog.Windows.Forms")] [assembly: AssemblyCopyright("Copyright © NLog 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("311cbf4d-0b45-49bc-ad1b-fd113f152066")] // 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")]
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("NLog.Windows.Forms")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("NLog.Windows.Forms")] [assembly: AssemblyCopyright("Copyright © Kim Christensen 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("311cbf4d-0b45-49bc-ad1b-fd113f152066")] // 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")]
bsd-3-clause
C#
b6ab6b305982fe22e0d3032b4aa10c2c1cae42b6
Update DependencyBuilder to inject ReflectionMetadataDependencyFinder
JJVertical/dotnet-apiport,mjrousos/dotnet-apiport,mjrousos/dotnet-apiport,twsouthwick/dotnet-apiport,Microsoft/dotnet-apiport,conniey/dotnet-apiport,mjrousos/dotnet-apiport-old,Microsoft/dotnet-apiport,conniey/dotnet-apiport,JJVertical/dotnet-apiport,twsouthwick/dotnet-apiport,conniey/dotnet-apiport,Microsoft/dotnet-apiport
src/ApiPort/DependencyBuilder.cs
src/ApiPort/DependencyBuilder.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.Fx.Portability; using Microsoft.Fx.Portability.Analyzer; using Microsoft.Fx.Portability.Reporting; using Microsoft.Practices.Unity; using System; namespace ApiPort { internal static class DependencyBuilder { public static IUnityContainer Build(ICommandLineOptions options, ProductInformation productInformation) { var container = new UnityContainer(); var targetMapper = new TargetMapper(); targetMapper.LoadFromConfig(); container.RegisterInstance(options); container.RegisterInstance<ITargetMapper>(targetMapper); container.RegisterInstance<IApiPortService>(new ApiPortService(options.ServiceEndpoint, productInformation)); container.RegisterType<IDependencyFinder, ReflectionMetadataDependencyFinder>(new ContainerControlledLifetimeManager()); container.RegisterType<IReportGenerator, ReportGenerator>(new ContainerControlledLifetimeManager()); container.RegisterType<ApiPortService>(new ContainerControlledLifetimeManager()); container.RegisterType<IFileSystem, WindowsFileSystem>(new ContainerControlledLifetimeManager()); container.RegisterType<IFileWriter, ReportFileWriter>(new ContainerControlledLifetimeManager()); if (Console.IsOutputRedirected) { container.RegisterInstance<IProgressReporter>(new TextWriterProgressReporter(Console.Out)); } else { container.RegisterType<IProgressReporter, ConsoleProgressReporter>(new ContainerControlledLifetimeManager()); } return container; } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.Fx.Portability; using Microsoft.Fx.Portability.Analyzer; using Microsoft.Fx.Portability.Reporting; using Microsoft.Practices.Unity; using System; namespace ApiPort { internal static class DependencyBuilder { public static IUnityContainer Build(ICommandLineOptions options, ProductInformation productInformation) { var container = new UnityContainer(); var targetMapper = new TargetMapper(); targetMapper.LoadFromConfig(); container.RegisterInstance(options); container.RegisterInstance<ITargetMapper>(targetMapper); container.RegisterInstance<IApiPortService>(new ApiPortService(options.ServiceEndpoint, productInformation)); container.RegisterType<IDependencyFinder, EmptyDependendencyFinder>(new ContainerControlledLifetimeManager()); container.RegisterType<IReportGenerator, ReportGenerator>(new ContainerControlledLifetimeManager()); container.RegisterType<ApiPortService>(new ContainerControlledLifetimeManager()); container.RegisterType<IFileSystem, WindowsFileSystem>(new ContainerControlledLifetimeManager()); container.RegisterType<IFileWriter, ReportFileWriter>(new ContainerControlledLifetimeManager()); if (Console.IsOutputRedirected) { container.RegisterInstance<IProgressReporter>(new TextWriterProgressReporter(Console.Out)); } else { container.RegisterType<IProgressReporter, ConsoleProgressReporter>(new ContainerControlledLifetimeManager()); } return container; } } }
mit
C#
e0628cfd54851c3ec12d1a3c5bfd39f9edb3d177
Fix to Issue #217
anthonylangsworth/commandline,kshanafelt/commandline,nausley/commandline,Thilas/commandline,huoxudong125/commandline,huoxudong125/commandline,Emergensys/commandline,anthonylangsworth/commandline,Emergensys/commandline,Thilas/commandline,kshanafelt/commandline,rmboggs/commandline,nausley/commandline,rmboggs/commandline
src/CommandLine/VerbAttribute.cs
src/CommandLine/VerbAttribute.cs
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information. using System; namespace CommandLine { /// <summary> /// Models a verb command specification. /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)] public sealed class VerbAttribute : Attribute { private readonly string name; private string helpText; /// <summary> /// Initializes a new instance of the <see cref="CommandLine.VerbAttribute"/> class. /// </summary> /// <param name="name">The long name of the verb command.</param> /// <exception cref="System.ArgumentException">Thrown if <paramref name="name"/> is null, empty or whitespace.</exception> public VerbAttribute(string name) { if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("name"); this.name = name; this.helpText = string.Empty; } /// <summary> /// Gets the verb name. /// </summary> public string Name { get { return name; } } /// <summary> /// Gets or sets a short description of this command line option. Usually a sentence summary. /// </summary> public string HelpText { get { return helpText; } set { if (value == null) { throw new ArgumentNullException("value"); } helpText = value; } } } }
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information. using System; namespace CommandLine { /// <summary> /// Models a verb command specification. /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)] public sealed class VerbAttribute : Attribute { private readonly string name; private string helpText; /// <summary> /// Initializes a new instance of the <see cref="CommandLine.VerbAttribute"/> class. /// </summary> /// <param name="name">The long name of the verb command.</param> /// <exception cref="System.ArgumentException">Thrown if <paramref name="name"/> is null, empty or whitespace.</exception> public VerbAttribute(string name) { if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("name"); this.name = name; } /// <summary> /// Gets the verb name. /// </summary> public string Name { get { return name; } } /// <summary> /// Gets or sets a short description of this command line option. Usually a sentence summary. /// </summary> public string HelpText { get { return helpText; } set { if (value == null) { throw new ArgumentNullException("value"); } helpText = value; } } } }
mit
C#
e110a17bc8627a01bd31d1377850a287c1b5bc32
Change window title in example project.
nitrocaster/xrConsole
Example/ConsoleWindow.Designer.cs
Example/ConsoleWindow.Designer.cs
namespace xr { partial class ConsoleWindow { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.xrConsole = new xr.Console(); this.SuspendLayout(); // // xrConsole // this.xrConsole.Dock = System.Windows.Forms.DockStyle.Fill; this.xrConsole.Font = new System.Drawing.Font("Arial", 9F); this.xrConsole.Location = new System.Drawing.Point(0, 0); this.xrConsole.Name = "xrConsole"; this.xrConsole.Size = new System.Drawing.Size(624, 282); this.xrConsole.TabIndex = 0; // // ConsoleWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(624, 282); this.Controls.Add(this.xrConsole); this.Name = "ConsoleWindow"; this.Text = "xrConsole"; this.ResumeLayout(false); } #endregion private Console xrConsole; } }
namespace xr { partial class ConsoleWindow { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.xrConsole = new xr.Console(); this.SuspendLayout(); // // xrConsole // this.xrConsole.Dock = System.Windows.Forms.DockStyle.Fill; this.xrConsole.Font = new System.Drawing.Font("Arial", 9F); this.xrConsole.Location = new System.Drawing.Point(0, 0); this.xrConsole.Name = "xrConsole"; this.xrConsole.Size = new System.Drawing.Size(624, 282); this.xrConsole.TabIndex = 0; // // ConsoleWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(624, 282); this.Controls.Add(this.xrConsole); this.Name = "ConsoleWindow"; this.Text = "ConsoleWindow"; this.ResumeLayout(false); } #endregion private Console xrConsole; } }
mit
C#
0cc005bc7bb2bddc1b12dc3fde9996828735ddf1
Format CSV values using invariant culture
andreaspada/EDDiscovery,klightspeed/EDDiscovery,EDDiscovery/EDDiscovery,klightspeed/EDDiscovery,EDDiscovery/EDDiscovery,klightspeed/EDDiscovery,EDDiscovery/EDDiscovery,andreaspada/EDDiscovery
EDDiscovery/Export/ExportBase.cs
EDDiscovery/Export/ExportBase.cs
using EDDiscovery.EliteDangerous; using System; using System.Collections.Generic; using System.Data.SqlTypes; using System.Globalization; using System.Linq; using System.Text; namespace EDDiscovery.Export { public enum CSVFormat { USA_UK = 0, EU = 1, } public abstract class ExportBase { protected string delimiter = ","; protected CultureInfo formatculture; private CSVFormat csvformat; public bool IncludeHeader; public CSVFormat Csvformat { get { return csvformat; } set { csvformat = value; if (csvformat == CSVFormat.EU) { delimiter = ";"; formatculture = new System.Globalization.CultureInfo("sv"); } else { delimiter = ","; formatculture = new System.Globalization.CultureInfo("en-US"); } } } abstract public bool ToCSV(string filename); abstract public bool GetData(EDDiscoveryForm _discoveryForm); protected string MakeValueCsvFriendly(object value) { if (value == null) return delimiter; if (value is INullable && ((INullable)value).IsNull) return delimiter; if (value is DateTime) { if (((DateTime)value).TimeOfDay.TotalSeconds == 0) return ((DateTime)value).ToString("yyyy-MM-dd") + delimiter; ; return ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss") + delimiter; ; } string output = Convert.ToString(value, CultureInfo.InvariantCulture); if (output.Contains(",") || output.Contains("\"")) output = '"' + output.Replace("\"", "\"\"") + '"'; return output + delimiter; } } }
using EDDiscovery.EliteDangerous; using System; using System.Collections.Generic; using System.Data.SqlTypes; using System.Globalization; using System.Linq; using System.Text; namespace EDDiscovery.Export { public enum CSVFormat { USA_UK = 0, EU = 1, } public abstract class ExportBase { protected string delimiter = ","; protected CultureInfo formatculture; private CSVFormat csvformat; public bool IncludeHeader; public CSVFormat Csvformat { get { return csvformat; } set { csvformat = value; if (csvformat == CSVFormat.EU) { delimiter = ";"; formatculture = new System.Globalization.CultureInfo("sv"); } else { delimiter = ","; formatculture = new System.Globalization.CultureInfo("en-US"); } } } abstract public bool ToCSV(string filename); abstract public bool GetData(EDDiscoveryForm _discoveryForm); protected string MakeValueCsvFriendly(object value) { if (value == null) return delimiter; if (value is INullable && ((INullable)value).IsNull) return delimiter; if (value is DateTime) { if (((DateTime)value).TimeOfDay.TotalSeconds == 0) return ((DateTime)value).ToString("yyyy-MM-dd") + delimiter; ; return ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss") + delimiter; ; } string output = value.ToString(); if (output.Contains(",") || output.Contains("\"")) output = '"' + output.Replace("\"", "\"\"") + '"'; return output + delimiter; } } }
apache-2.0
C#