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
36baeb06159c0f087ad48b0cfbe36c9400ab39ea
Update src/Umbraco.Core/Persistence/Repositories/IKeyValueRepository.cs
abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS,abjerner/Umbraco-CMS,umbraco/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS
src/Umbraco.Core/Persistence/Repositories/IKeyValueRepository.cs
src/Umbraco.Core/Persistence/Repositories/IKeyValueRepository.cs
using System.Collections.Generic; using Umbraco.Cms.Core.Models; namespace Umbraco.Cms.Core.Persistence.Repositories { public interface IKeyValueRepository : IReadRepository<string, IKeyValue>, IWriteRepository<IKeyValue> { /// <summary> /// Returns key/value pairs for all keys with the specified prefix. /// </summary> /// <param name="keyPrefix"></param> /// <returns></returns> IReadOnlyDictionary<string, string> FindByKeyPrefix(string keyPrefix); } }
using System.Collections.Generic; using Umbraco.Cms.Core.Models; namespace Umbraco.Cms.Core.Persistence.Repositories { public interface IKeyValueRepository : IReadRepository<string, IKeyValue>, IWriteRepository<IKeyValue> { /// <summary> /// Returns key/value pairs for all keys with the specified prefix. /// </summary> /// <param name="keyPrefix"></param> /// <returns></returns> IReadOnlyDictionary<string, string> Find(string keyPrefix); } }
mit
C#
0f52a3499d4e348f59fe93f44f48feca7dae919d
Bump copyright year
rackerlabs/RackspaceCloudOfficeApiClient
Rackspace.CloudOffice/Properties/AssemblyInfo.cs
Rackspace.CloudOffice/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("Rackspace.CloudOffice")] [assembly: AssemblyDescription("Client for the Rackspace Cloud Office API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rackspace US, Inc.")] [assembly: AssemblyProduct("Rackspace.CloudOffice")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e78c86f9-94e5-48ac-aabb-f999f0362da6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.6.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("Rackspace.CloudOffice")] [assembly: AssemblyDescription("Client for the Rackspace Cloud Office API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rackspace US, Inc.")] [assembly: AssemblyProduct("Rackspace.CloudOffice")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e78c86f9-94e5-48ac-aabb-f999f0362da6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.6.0.0")]
mit
C#
d0bf8e124b2de19f6fb618d2ca807217c3575089
Fix comments
sharpdx/Toolkit,tomba/Toolkit,sharpdx/Toolkit
Source/Toolkit/SharpDX.Toolkit.Game/IDrawable.cs
Source/Toolkit/SharpDX.Toolkit.Game/IDrawable.cs
// Copyright (c) 2010-2012 SharpDX - Alexandre Mutel // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace SharpDX.Toolkit { /// <summary> /// An interface for a drawable game component that is called by the <see cref="Game"/> class. /// </summary> public interface IDrawable { /// <summary> /// Occurs when the <see cref="DrawOrder"/> property changes. /// </summary> event EventHandler<EventArgs> DrawOrderChanged; /// <summary> /// Occurs when the <see cref="Visible"/> property changes. /// </summary> event EventHandler<EventArgs> VisibleChanged; /// <summary> /// Starts the drawing of a frame. This method is followed by calls to Draw and EndDraw. /// </summary> /// <returns><c>true</c> if Draw should occur, <c>false</c> otherwise</returns> bool BeginDraw(); /// <summary> /// Draws this instance. /// </summary> /// <param name="gameTime">The current timing.</param> void Draw(GameTime gameTime); /// <summary> /// Ends the drawing of a frame. This method is preceeded by calls to Draw and BeginDraw. /// </summary> void EndDraw(); /// <summary> /// Gets a value indicating whether the <see cref="Draw"/> method should be called by <see cref="Game.Draw"/>. /// </summary> /// <value><c>true</c> if this drawable component is visible; otherwise, <c>false</c>.</value> bool Visible { get; } /// <summary> /// Gets the draw order relative to other objects. <see cref="IDrawable"/> objects with a lower value are drawn first. /// </summary> /// <value>The draw order.</value> int DrawOrder { get; } } }
// Copyright (c) 2010-2012 SharpDX - Alexandre Mutel // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace SharpDX.Toolkit { /// <summary> /// An interface for a drawable game component that is called by the <see cref="Game"/> class. /// </summary> public interface IDrawable { /// <summary> /// Occurs when the <see cref="DrawOrder"/> property changes. /// </summary> event EventHandler<EventArgs> DrawOrderChanged; /// <summary> /// Occurs when the <see cref="DrawOrder"/> property changes. /// </summary> event EventHandler<EventArgs> VisibleChanged; /// <summary> /// Starts the drawing of a frame. This method is followed by calls to Draw and EndDraw. /// </summary> /// <returns><c>true</c> if Draw should occur, <c>false</c> otherwise</returns> bool BeginDraw(); /// <summary> /// Draws this instance. /// </summary> /// <param name="gameTime">The current timing.</param> void Draw(GameTime gameTime); /// <summary> /// Ends the drawing of a frame. This method is preceeded by calls to Draw and BeginDraw. /// </summary> void EndDraw(); /// <summary> /// Gets a value indicating whether the <see cref="Draw"/> method should be called by <see cref="Game.Draw"/>. /// </summary> /// <value><c>true</c> if this drawable component is visible; otherwise, <c>false</c>.</value> bool Visible { get; } /// <summary> /// The order in which to draw this object relative to other objects. Objects with a lower value are drawn first. /// </summary> /// <value>The draw order.</value> /// <summary> /// Gets the draw order relative to other objects. <see cref="IDrawable"/> objects with a lower value are drawn first. /// </summary> /// <value>The draw order.</value> int DrawOrder { get; } } }
mit
C#
6740750e0a1ce90593e3c5a85e4a125f7b342597
Add missing permissions
osmdroid/OsmdroidXamarin,osmdroid/OsmdroidXamarin
OsmdroidAndroidSample/Properties/AssemblyInfo.cs
OsmdroidAndroidSample/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using Android; using Android.App; // 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("OsmdroidAndroidSample")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OsmdroidAndroidSample")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // 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: UsesPermission(Manifest.Permission.AccessFineLocation)] [assembly: UsesPermission(Manifest.Permission.AccessCoarseLocation)] [assembly: UsesPermission(Manifest.Permission.AccessWifiState)] [assembly: UsesPermission(Manifest.Permission.AccessNetworkState)] [assembly: UsesPermission(Manifest.Permission.Internet)] [assembly: UsesPermission(Manifest.Permission.WriteExternalStorage)]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Android.App; // 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("OsmdroidAndroidSample")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OsmdroidAndroidSample")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // 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")] // Add some common permissions, these can be removed if not needed [assembly: UsesPermission(Android.Manifest.Permission.Internet)] [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
apache-2.0
C#
727575f8d84c503674363715cf72b84d7461c40f
Use block body for methods
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Crypto/ZeroKnowledge/ProofSystem.cs
WalletWasabi/Crypto/ZeroKnowledge/ProofSystem.cs
using NBitcoin.Secp256k1; using System.Linq; using System.Collections.Generic; using WalletWasabi.Crypto.Groups; using WalletWasabi.Crypto.Randomness; using WalletWasabi.Crypto.ZeroKnowledge.LinearRelation; using WalletWasabi.Crypto.ZeroKnowledge.NonInteractive; using System.Diagnostics.CodeAnalysis; namespace WalletWasabi.Crypto.ZeroKnowledge { public static class ProofSystem { private static GroupElement O = GroupElement.Infinity; public static bool Verify(LinearRelation.Statement statement, Proof proof) { return NonInteractive.Verifier.Verify(new Transcript(new byte[0]), new[] { statement }, new[] { proof }); } public static Proof Prove(Knowledge knowledge, WasabiRandom random) { return NonInteractive.Prover.Prove(new Transcript(new byte[0]), new[] { knowledge }, random).First(); } // Syntactic sugar used in tests public static Proof Prove(LinearRelation.Statement statement, Scalar witness, WasabiRandom random) => Prove(statement, new ScalarVector(witness), random); public static Proof Prove(LinearRelation.Statement statement, ScalarVector witness, WasabiRandom random) => Prove(new Knowledge(statement, witness), random); public static Knowledge IssuerParameters(MAC mac, GroupElement ma, CoordinatorSecretKey sk) => new Knowledge(IssuerParameters(sk.ComputeCoordinatorParameters(), mac, ma), new ScalarVector(sk.W, sk.Wp, sk.X0, sk.X1, sk.Ya)); public static LinearRelation.Statement IssuerParameters(CoordinatorParameters iparams, MAC mac, GroupElement ma) => new LinearRelation.Statement(new GroupElement[,] { // public Witness terms: // point w, wp, x0, x1, ya { mac.V, Generators.Gw, O, mac.U, mac.T * mac.U, ma }, { Generators.GV - iparams.I, O, O, Generators.Gx0, Generators.Gx1, Generators.Ga }, { iparams.Cw, Generators.Gw, Generators.Gwp, O, O, O }, }); } }
using NBitcoin.Secp256k1; using System.Linq; using System.Collections.Generic; using WalletWasabi.Crypto.Groups; using WalletWasabi.Crypto.Randomness; using WalletWasabi.Crypto.ZeroKnowledge.LinearRelation; using WalletWasabi.Crypto.ZeroKnowledge.NonInteractive; using System.Diagnostics.CodeAnalysis; namespace WalletWasabi.Crypto.ZeroKnowledge { public static class ProofSystem { private static GroupElement O = GroupElement.Infinity; #pragma warning disable SA1502 // ElementMustNotBeOnSingleLine public static bool Verify(LinearRelation.Statement statement, Proof proof) => NonInteractive.Verifier.Verify(new Transcript(new byte[0]), new[] { statement }, new[] { proof }); public static Proof Prove(Knowledge knowledge, WasabiRandom random) => NonInteractive.Prover.Prove(new Transcript(new byte[0]), new[] { knowledge }, random).First(); #pragma warning restore SA1502 // ElementMustNotBeOnSingleLine // Syntactic sugar used in tests public static Proof Prove(LinearRelation.Statement statement, Scalar witness, WasabiRandom random) => Prove(statement, new ScalarVector(witness), random); public static Proof Prove(LinearRelation.Statement statement, ScalarVector witness, WasabiRandom random) => Prove(new Knowledge(statement, witness), random); public static Knowledge IssuerParameters(MAC mac, GroupElement ma, CoordinatorSecretKey sk) => new Knowledge(IssuerParameters(sk.ComputeCoordinatorParameters(), mac, ma), new ScalarVector(sk.W, sk.Wp, sk.X0, sk.X1, sk.Ya)); public static LinearRelation.Statement IssuerParameters(CoordinatorParameters iparams, MAC mac, GroupElement ma) => new LinearRelation.Statement(new GroupElement[,] { // public Witness terms: // point w, wp, x0, x1, ya { mac.V, Generators.Gw, O, mac.U, mac.T * mac.U, ma }, { Generators.GV - iparams.I, O, O, Generators.Gx0, Generators.Gx1, Generators.Ga }, { iparams.Cw, Generators.Gw, Generators.Gwp, O, O, O }, }); } }
mit
C#
77a4b5287f3b99abe9dd8b92098a0859b3b9ba42
Add some common methods
Mimalef/repop
src/App_Code/BasePage.cs
src/App_Code/BasePage.cs
using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; public class BasePage : System.Web.UI.Page { private string connectionString = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString; private string currentUrl = HttpContext.Current.Request.Url.AbsolutePath; private void sqlError() { Response.Cookies["error_message"].Value = "خطای پایگاه داده."; Response.Cookies["error_redirect"].Value = this.currentUrl; Response.Redirect("PublicError.aspx"); } public void insertQuery(string sql) { SqlConnection cnn; SqlCommand cmd; cnn = new SqlConnection(this.connectionString); try { cnn.Open(); cmd = new SqlCommand(sql, cnn); cmd.ExecuteNonQuery(); } catch { sqlError(); } finally { cnn.Close(); } } public DataTable selectQuery(string sql) { DataTable table = new DataTable(); SqlDataAdapter adpr; SqlConnection cnn; SqlCommand cmd; cnn = new SqlConnection(this.connectionString); try { cnn.Open(); cmd = new SqlCommand(sql, cnn); adpr = new SqlDataAdapter(cmd); adpr.Fill(table); } catch { sqlError(); } finally { cnn.Close(); } return table; } public void fillTable(string sql, ref Table table) { DataTable dataTable = selectQuery(sql); foreach (DataRow row in dataTable.Rows) { TableRow trow = new TableRow(); for (int i = 0; i < dataTable.Columns.Count; i++) { TableCell cell = new TableCell(); cell.Text = row[i].ToString(); trow.Cells.Add(cell); } if (table.ID == "TableEquip") { TableCell cell = new TableCell(); LinkButton edit = new LinkButton(); edit.PostBackUrl = "~/PersonnelEditEquip.aspx?equip="; edit.PostBackUrl += row["id"].ToString(); edit.Text = "ویرایش"; cell.Controls.Add(edit); trow.Cells.Add(cell); } table.Rows.Add(trow); } } }
using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; public class BasePage : System.Web.UI.Page { public string ConnectionString = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString; public DataTable doQuery(string sql) { DataTable table = new DataTable(); SqlDataAdapter adpr; SqlConnection cnn; SqlCommand cmd; cnn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand(sql, cnn); using (adpr = new SqlDataAdapter(cmd)) { adpr.Fill(table); } return table; } }
mit
C#
9567101ddc2c681b7ed1b40f879122ab62de8da5
Fix DefaultEntityRangeBuilder.
SilkStack/Silk.Data.SQL.ORM
Silk.Data.SQL.ORM/Queries/DefaultRangeBuilder.cs
Silk.Data.SQL.ORM/Queries/DefaultRangeBuilder.cs
using System; using System.Linq; using Silk.Data.SQL.Expressions; using Silk.Data.SQL.ORM.Expressions; using Silk.Data.SQL.ORM.Schema; namespace Silk.Data.SQL.ORM.Queries { public class DefaultRangeBuilder : IRangeBuilder { private QueryExpression _limitExpression; private QueryExpression _offsetExpression; private readonly JoinCollection _requiredJoins = new JoinCollection(); public ExpressionResult BuildLimit() => new ExpressionResult(_limitExpression, _requiredJoins.ToArray()); public ExpressionResult BuildOffset() => new ExpressionResult(_offsetExpression, _requiredJoins.ToArray()); public void Limit(int limit) => _limitExpression = ORMQueryExpressions.Value(limit); public void Limit(QueryExpression queryExpression) => _limitExpression = queryExpression; public void Limit(ExpressionResult expressionResult) { _limitExpression = expressionResult.QueryExpression; _requiredJoins.AddJoins(expressionResult.RequiredJoins); } public void Offset(int offset) => _offsetExpression = ORMQueryExpressions.Value(offset); public void Offset(QueryExpression queryExpression) => _offsetExpression = queryExpression; public void Offset(ExpressionResult expressionResult) { _offsetExpression = expressionResult.QueryExpression; _requiredJoins.AddJoins(expressionResult.RequiredJoins); } } public class DefaultEntityRangeBuilder<T> : DefaultRangeBuilder, IEntityRangeBuilder<T> where T : class { private EntityExpressionConverter<T> _expressionConverter; public EntityExpressionConverter<T> ExpressionConverter { get { if (_expressionConverter == null) _expressionConverter = new EntityExpressionConverter<T>(Schema); return _expressionConverter; } } public Schema.Schema Schema { get; } public EntityModel<T> EntitySchema { get; } public DefaultEntityRangeBuilder(Schema.Schema schema, EntityModel<T> entitySchema, EntityExpressionConverter<T> expressionConverter = null) { Schema = schema; EntitySchema = entitySchema; _expressionConverter = expressionConverter; } public DefaultEntityRangeBuilder(Schema.Schema schema, EntityExpressionConverter<T> expressionConverter = null) : this(schema, schema.GetEntityModel<T>(), expressionConverter) { } public void Limit(System.Linq.Expressions.Expression<Func<T, int>> expression) => Limit(ExpressionConverter.Convert(expression)); public void Offset(System.Linq.Expressions.Expression<Func<T, int>> expression) => Offset(ExpressionConverter.Convert(expression)); } }
using System; using System.Linq; using Silk.Data.SQL.Expressions; using Silk.Data.SQL.ORM.Expressions; using Silk.Data.SQL.ORM.Schema; namespace Silk.Data.SQL.ORM.Queries { public class DefaultRangeBuilder : IRangeBuilder { private QueryExpression _limitExpression; private QueryExpression _offsetExpression; private readonly JoinCollection _requiredJoins = new JoinCollection(); public ExpressionResult BuildLimit() => new ExpressionResult(_limitExpression, _requiredJoins.ToArray()); public ExpressionResult BuildOffset() => new ExpressionResult(_offsetExpression, _requiredJoins.ToArray()); public void Limit(int limit) => ORMQueryExpressions.Value(limit); public void Limit(QueryExpression queryExpression) => _limitExpression = queryExpression; public void Limit(ExpressionResult expressionResult) { _limitExpression = expressionResult.QueryExpression; _requiredJoins.AddJoins(expressionResult.RequiredJoins); } public void Offset(int offset) => _offsetExpression = ORMQueryExpressions.Value(offset); public void Offset(QueryExpression queryExpression) => _offsetExpression = queryExpression; public void Offset(ExpressionResult expressionResult) { _offsetExpression = expressionResult.QueryExpression; _requiredJoins.AddJoins(expressionResult.RequiredJoins); } } public class DefaultEntityRangeBuilder<T> : DefaultRangeBuilder, IEntityRangeBuilder<T> where T : class { private EntityExpressionConverter<T> _expressionConverter; public EntityExpressionConverter<T> ExpressionConverter { get { if (_expressionConverter == null) _expressionConverter = new EntityExpressionConverter<T>(Schema); return _expressionConverter; } } public Schema.Schema Schema { get; } public EntityModel<T> EntitySchema { get; } public DefaultEntityRangeBuilder(Schema.Schema schema, EntityModel<T> entitySchema, EntityExpressionConverter<T> expressionConverter = null) { Schema = schema; EntitySchema = entitySchema; _expressionConverter = expressionConverter; } public DefaultEntityRangeBuilder(Schema.Schema schema, EntityExpressionConverter<T> expressionConverter = null) : this(schema, schema.GetEntityModel<T>(), expressionConverter) { } public void Limit(System.Linq.Expressions.Expression<Func<T, int>> expression) => Limit(ExpressionConverter.Convert(expression)); public void Offset(System.Linq.Expressions.Expression<Func<T, int>> expression) => Offset(ExpressionConverter.Convert(expression)); } }
mit
C#
738c92f1a23b73eebd58d8cd128459d60b284283
Fix encounter url not opening
neowutran/ShinraMeter,neowutran/TeraDamageMeter,Seyuna/ShinraMeter,radasuka/ShinraMeter
DamageMeter.UI/HistoryLink.xaml.cs
DamageMeter.UI/HistoryLink.xaml.cs
using System; using System.Diagnostics; using System.Windows; using System.Windows.Input; using System.Windows.Media; using Data; using Tera.Game; namespace DamageMeter.UI { /// <summary> /// Logique d'interaction pour HistoryLink.xaml /// </summary> public partial class HistoryLink { public HistoryLink(string link, NpcEntity boss) { InitializeComponent(); Boss.Content = boss.Info.Name; Boss.Tag = link; if (link.StartsWith("!")) { Boss.Foreground = Brushes.Red; Boss.ToolTip = link; return; } Link.Source = BasicTeraData.Instance.ImageDatabase.Link.Source; } private void Click_Link(object sender, MouseButtonEventArgs e) { if (Boss.Tag.ToString().StartsWith("http://")) Process.Start("explorer.exe", "\""+Boss.Tag+"\""); } private void Sender_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var w = Window.GetWindow(this); try { w?.DragMove(); } catch { Console.WriteLine(@"Exception move"); } } } }
using System; using System.Diagnostics; using System.Windows; using System.Windows.Input; using System.Windows.Media; using Data; using Tera.Game; namespace DamageMeter.UI { /// <summary> /// Logique d'interaction pour HistoryLink.xaml /// </summary> public partial class HistoryLink { public HistoryLink(string link, NpcEntity boss) { InitializeComponent(); Boss.Content = boss.Info.Name; Boss.Tag = link; if (link.StartsWith("!")) { Boss.Foreground = Brushes.Red; Boss.ToolTip = link; return; } Link.Source = BasicTeraData.Instance.ImageDatabase.Link.Source; } private void Click_Link(object sender, MouseButtonEventArgs e) { if (Boss.Tag.ToString().StartsWith("http://")) Process.Start("explorer.exe", Boss.Tag.ToString()); } private void Sender_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var w = Window.GetWindow(this); try { w?.DragMove(); } catch { Console.WriteLine(@"Exception move"); } } } }
mit
C#
47182168c085e5819d0f74b074c8eb9e4d6a70ac
Fix codefactor
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Fluent/ViewModels/AboutViewModel.cs
WalletWasabi.Fluent/ViewModels/AboutViewModel.cs
using System; using System.IO; using System.Reactive; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Windows.Input; using Avalonia; using ReactiveUI; using WalletWasabi.Fluent.ViewModels.Dialogs; using WalletWasabi.Fluent.ViewModels.Navigation; using WalletWasabi.Helpers; using WalletWasabi.Logging; namespace WalletWasabi.Fluent.ViewModels { [NavigationMetaData( Title = "About Wasabi", Caption = "Displays all the current info about the app", IconName = "info_regular", Order = 4, Category = "Help & Support", Keywords = new[] { "About", "Software", "Version", "Source", "Code", "Github", "Status", "Stats", "Tor", "Onion", "Bug", "Report", "FAQ", "Questions,", "Docs", "Documentation", "Link", "Links", "Help" }, NavBarPosition = NavBarPosition.None, NavigationTarget = NavigationTarget.DialogScreen)] public partial class AboutViewModel : RoutableViewModel { public AboutViewModel() { OpenBrowserCommand = ReactiveCommand.CreateFromTask<string>(IoHelpers.OpenBrowserAsync); var interaction = new Interaction<Unit, Unit>(); interaction.RegisterHandler( async x => x.SetOutput(await new AboutAdvancedInfoViewModel().ShowDialogAsync())); AboutAdvancedInfoDialogCommand = ReactiveCommand.CreateFromTask( execute: async () => await interaction.Handle(Unit.Default).ToTask()); OpenBrowserCommand = ReactiveCommand.CreateFromTask<string>( async (link) => await IoHelpers.OpenBrowserAsync(link)); CopyLinkCommand = ReactiveCommand.CreateFromTask<string>( async (link) => await Application.Current.Clipboard.SetTextAsync(link)); } public ICommand AboutAdvancedInfoDialogCommand { get; } public ICommand OpenBrowserCommand { get; } public ICommand CopyLinkCommand { get; } public Version ClientVersion => Constants.ClientVersion; public static string ClearnetLink => "https://wasabiwallet.io/"; public static string TorLink => "http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion"; public static string SourceCodeLink => "https://github.com/zkSNACKs/WalletWasabi/"; public static string StatusPageLink => "https://stats.uptimerobot.com/YQqGyUL8A7"; public static string UserSupportLink => "https://www.reddit.com/r/WasabiWallet/"; public static string BugReportLink => "https://github.com/zkSNACKs/WalletWasabi/issues/"; public static string FAQLink => "https://docs.wasabiwallet.io/FAQ/"; public static string DocsLink => "https://docs.wasabiwallet.io/"; public static string LicenseLink => "https://github.com/zkSNACKs/WalletWasabi/blob/master/LICENSE.md"; } }
using System; using System.IO; using System.Reactive; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Windows.Input; using Avalonia; using ReactiveUI; using WalletWasabi.Fluent.ViewModels.Dialogs; using WalletWasabi.Fluent.ViewModels.Navigation; using WalletWasabi.Helpers; using WalletWasabi.Logging; namespace WalletWasabi.Fluent.ViewModels { [NavigationMetaData( Title = "About Wasabi", Caption = "Displays all the current info about the app", IconName = "info_regular", Order = 4, Category = "Help & Support", Keywords = new[] { "About", "Software", "Version", "Source", "Code", "Github", "Status", "Stats", "Tor", "Onion", "Bug", "Report", "FAQ", "Questions,", "Docs", "Documentation", "Link", "Links", "Help" }, NavBarPosition = NavBarPosition.None, NavigationTarget = NavigationTarget.DialogScreen)] public partial class AboutViewModel : RoutableViewModel { public AboutViewModel() { OpenBrowserCommand = ReactiveCommand.CreateFromTask<string>(IoHelpers.OpenBrowserAsync); var interaction = new Interaction<Unit, Unit>(); interaction.RegisterHandler( async x => x.SetOutput(await new AboutAdvancedInfoViewModel().ShowDialogAsync())); AboutAdvancedInfoDialogCommand = ReactiveCommand.CreateFromTask( execute: async () => await interaction.Handle(Unit.Default).ToTask()); OpenBrowserCommand= ReactiveCommand.CreateFromTask<string>( async (link) => await IoHelpers.OpenBrowserAsync(link)); CopyLinkCommand = ReactiveCommand.CreateFromTask<string>( async (link) => await Application.Current.Clipboard.SetTextAsync(link)); } public ICommand AboutAdvancedInfoDialogCommand { get; } public ICommand OpenBrowserCommand { get; } public ICommand CopyLinkCommand { get; } public Version ClientVersion => Constants.ClientVersion; public static string ClearnetLink => "https://wasabiwallet.io/"; public static string TorLink => "http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion"; public static string SourceCodeLink => "https://github.com/zkSNACKs/WalletWasabi/"; public static string StatusPageLink => "https://stats.uptimerobot.com/YQqGyUL8A7"; public static string UserSupportLink => "https://www.reddit.com/r/WasabiWallet/"; public static string BugReportLink => "https://github.com/zkSNACKs/WalletWasabi/issues/"; public static string FAQLink => "https://docs.wasabiwallet.io/FAQ/"; public static string DocsLink => "https://docs.wasabiwallet.io/"; public static string LicenseLink => "https://github.com/zkSNACKs/WalletWasabi/blob/master/LICENSE.md"; } }
mit
C#
3adb94264036eabb47f5c8a581ffdfdf024e4e01
Switch to version 1.1.6
Abc-Arbitrage/Zebus,Abc-Arbitrage/Zebus.Directory
src/SharedVersionInfo.cs
src/SharedVersionInfo.cs
using System.Reflection; [assembly: AssemblyVersion("1.1.6")] [assembly: AssemblyFileVersion("1.1.6")] [assembly: AssemblyInformationalVersion("1.1.6")]
using System.Reflection; [assembly: AssemblyVersion("1.1.6")] [assembly: AssemblyFileVersion("1.1.6")] [assembly: AssemblyInformationalVersion("1.1.6-cssandra-updt2")]
mit
C#
4ff74cde88ac39a5d78ae90f4dd1f83fd692d96c
Fix single core batch processing
Thealexbarney/VGAudio,Thealexbarney/LibDspAdpcm,Thealexbarney/LibDspAdpcm,Thealexbarney/VGAudio
src/VGAudio.Cli/Batch.cs
src/VGAudio.Cli/Batch.cs
using System; using System.IO; using System.Linq; using System.Threading.Tasks; // ReSharper disable AccessToDisposedClosure namespace VGAudio.Cli { internal static class Batch { public static bool BatchConvert(Options options) { if (options.Job != JobType.Batch) return false; SearchOption searchOption = options.Recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; string[] files = ContainerTypes.ExtensionList .SelectMany(x => Directory.GetFiles(options.InDir, $"*.{x}", searchOption)) .ToArray(); using (var progress = new ProgressBar()) { progress.SetTotal(files.Length); Parallel.ForEach(files, new ParallelOptions { MaxDegreeOfParallelism = Math.Max(Environment.ProcessorCount - 1, 1) }, inPath => { string relativePath = inPath.Substring(options.InDir.Length).TrimStart('\\'); string outPath = Path.ChangeExtension(Path.Combine(options.OutDir, relativePath), options.OutTypeName); var jobFiles = new JobFiles(); jobFiles.InFiles.Add(new AudioFile(inPath)); jobFiles.OutFiles.Add(new AudioFile(outPath)); try { progress.LogMessage(Path.GetFileName(inPath)); Convert.ConvertFile(options, jobFiles, false); } catch (Exception ex) { progress.LogMessage($"Error converting {Path.GetFileName(inPath)}"); progress.LogMessage(ex.ToString()); } progress.ReportAdd(1); }); } return true; } } }
using System; using System.IO; using System.Linq; using System.Threading.Tasks; // ReSharper disable AccessToDisposedClosure namespace VGAudio.Cli { internal static class Batch { public static bool BatchConvert(Options options) { if (options.Job != JobType.Batch) return false; SearchOption searchOption = options.Recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; string[] files = ContainerTypes.ExtensionList .SelectMany(x => Directory.GetFiles(options.InDir, $"*.{x}", searchOption)) .ToArray(); using (var progress = new ProgressBar()) { progress.SetTotal(files.Length); Parallel.ForEach(files, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount - 1 }, inPath => { string relativePath = inPath.Substring(options.InDir.Length).TrimStart('\\'); string outPath = Path.ChangeExtension(Path.Combine(options.OutDir, relativePath), options.OutTypeName); var jobFiles = new JobFiles(); jobFiles.InFiles.Add(new AudioFile(inPath)); jobFiles.OutFiles.Add(new AudioFile(outPath)); try { progress.LogMessage(Path.GetFileName(inPath)); Convert.ConvertFile(options, jobFiles, false); } catch (Exception ex) { progress.LogMessage($"Error converting {Path.GetFileName(inPath)}"); progress.LogMessage(ex.ToString()); } progress.ReportAdd(1); }); } return true; } } }
mit
C#
e7e7c43e08aa9545ca192b6b565e5ea0ab2ecdc6
Fix bug in ServicesOnlyAttribute
Brightspace/D2L.Security.OAuth2
D2L.Security.OAuth2.WebApi/Authorization/ServicesOnlyAttribute.cs
D2L.Security.OAuth2.WebApi/Authorization/ServicesOnlyAttribute.cs
using System.Net; using System.Net.Http; using System.Web.Http; using System.Web.Http.Controllers; using D2L.Security.OAuth2.Principal; namespace D2L.Security.OAuth2.Authorization { public sealed class ServicesOnlyAttribute : AuthorizeAttribute { protected override bool IsAuthorized( HttpActionContext context ) { var principal = context.RequestContext.Principal as ID2LPrincipal; if( principal == null ) { return false; } return principal.Type == PrincipalType.Service; } internal bool IsAuthorizedHelper( HttpActionContext context ) { return this.IsAuthorized( context ); } protected override void HandleUnauthorizedRequest( HttpActionContext actionContext ) { var response = actionContext.Request.CreateErrorResponse( HttpStatusCode.Forbidden, "services_only" ); response.Headers.Add( "WWW-Authenticate", "Bearer error=\"services_only\"" ); actionContext.Response = response; } } }
using System.Web.Http; using System.Web.Http.Controllers; using D2L.Security.OAuth2.Principal; namespace D2L.Security.OAuth2.Authorization { public sealed class ServicesOnlyAttribute : AuthorizeAttribute { protected override bool IsAuthorized( HttpActionContext context ) { var principal = context.RequestContext.Principal as ID2LPrincipal; if( principal == null ) { return false; } // Sigh... long userId; if( long.TryParse( principal.UserId, out userId ) ) { return false; } return true; } internal bool IsAuthorizedHelper( HttpActionContext context ) { return this.IsAuthorized( context ); } } }
apache-2.0
C#
e3a0a68b2c86e7a136c5ea6e79d4e94766c881c7
Check value before executing Contains - fixes #75
icelty/LiteDB,RytisLT/LiteDB,prepare/LiteDB,masterdidoo/LiteDB,RytisLT/LiteDB,falahati/LiteDB,89sos98/LiteDB,mbdavid/LiteDB,falahati/LiteDB,prepare/LiteDB,prepare/LiteDB,89sos98/LiteDB,Xicy/LiteDB,prepare/LiteDB,masterdidoo/LiteDB,Skysper/LiteDB
LiteDB/Query/Impl/QueryContains.cs
LiteDB/Query/Impl/QueryContains.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace LiteDB { /// <summary> /// Contains query do not work with index, only full scan /// </summary> internal class QueryContains : Query { private BsonValue _value; public QueryContains(string field, BsonValue value) : base(field) { _value = value; } internal override IEnumerable<IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { var v = _value.Normalize(index.Options); return indexer .FindAll(index, Query.Ascending) .Where(x => x.Key.IsString && x.Key.AsString.Contains(v)); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace LiteDB { /// <summary> /// Contains query do not work with index, only full scan /// </summary> internal class QueryContains : Query { private BsonValue _value; public QueryContains(string field, BsonValue value) : base(field) { _value = value; } internal override IEnumerable<IndexNode> ExecuteIndex(IndexService indexer, CollectionIndex index) { var v = _value.Normalize(index.Options); return indexer.FindAll(index, Query.Ascending).Where(x => x.Key.AsString.Contains(v)); } } }
mit
C#
4708cb7317f21287ab7448d9209d6c7eedf4681a
Fix enumerable not being consumed
smoogipoo/osu,NeoAdonis/osu,peppy/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu-new,peppy/osu,ppy/osu,ppy/osu
osu.Game.Benchmarks/BenchmarkRuleset.cs
osu.Game.Benchmarks/BenchmarkRuleset.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Engines; using osu.Game.Online.API; using osu.Game.Rulesets.Osu; namespace osu.Game.Benchmarks { public class BenchmarkRuleset : BenchmarkTest { private OsuRuleset ruleset; private APIMod apiModDoubleTime; private APIMod apiModDifficultyAdjust; public override void SetUp() { base.SetUp(); ruleset = new OsuRuleset(); apiModDoubleTime = new APIMod { Acronym = "DT" }; apiModDifficultyAdjust = new APIMod { Acronym = "DA" }; } [Benchmark] public void BenchmarkToModDoubleTime() { apiModDoubleTime.ToMod(ruleset); } [Benchmark] public void BenchmarkToModDifficultyAdjust() { apiModDifficultyAdjust.ToMod(ruleset); } [Benchmark] public void BenchmarkGetAllMods() { ruleset.GetAllMods().Consume(new Consumer()); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using BenchmarkDotNet.Attributes; using osu.Game.Online.API; using osu.Game.Rulesets.Osu; namespace osu.Game.Benchmarks { public class BenchmarkRuleset : BenchmarkTest { private OsuRuleset ruleset; private APIMod apiModDoubleTime; private APIMod apiModDifficultyAdjust; public override void SetUp() { base.SetUp(); ruleset = new OsuRuleset(); apiModDoubleTime = new APIMod { Acronym = "DT" }; apiModDifficultyAdjust = new APIMod { Acronym = "DA" }; } [Benchmark] public void BenchmarkToModDoubleTime() { apiModDoubleTime.ToMod(ruleset); } [Benchmark] public void BenchmarkToModDifficultyAdjust() { apiModDifficultyAdjust.ToMod(ruleset); } [Benchmark] public void BenchmarkGetAllMods() { ruleset.GetAllMods(); } } }
mit
C#
113e1b4e9d8b7ebfcb6564f6f97a676f36618e5f
update CastleFluentAspectInterceptor MethodBase
WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common
src/WeihanLi.Common.Aspect.Castle/FluentAspectInterceptor.cs
src/WeihanLi.Common.Aspect.Castle/FluentAspectInterceptor.cs
using System; using System.Linq; using System.Threading.Tasks; using WeihanLi.Common.Helpers; namespace WeihanLi.Common.Aspect.Castle { public sealed class CastleFluentAspectInterceptor : global::Castle.DynamicProxy.IInterceptor { public void Intercept(global::Castle.DynamicProxy.IInvocation invocation) { var proxyMethod = invocation.GetConcreteMethod(); var methodBase = invocation.GetConcreteMethodInvocationTarget(); var aspectInvocation = new AspectInvocation( proxyMethod, methodBase, invocation.Proxy, invocation.InvocationTarget, invocation.Arguments ); var hasTarget = null != invocation.InvocationTarget && null != invocation.MethodInvocationTarget && null != invocation.TargetType; if (FluentAspects.AspectOptions.NoInterceptionConfigurations .Any(x => x.Invoke(aspectInvocation))) { invocation.Proceed(); } else { Func<IInvocation, Task> completeFunc; if (hasTarget) { completeFunc = c => { invocation.Proceed(); c.ReturnValue = invocation.ReturnValue; return TaskHelper.CompletedTask; }; } else { completeFunc = c => TaskHelper.CompletedTask; } AspectDelegate.InvokeWithCompleteFunc(aspectInvocation, completeFunc); } } } }
using System; using System.Linq; using System.Threading.Tasks; using WeihanLi.Common.Helpers; namespace WeihanLi.Common.Aspect.Castle { public sealed class CastleFluentAspectInterceptor : global::Castle.DynamicProxy.IInterceptor { public void Intercept(global::Castle.DynamicProxy.IInvocation invocation) { var proxyMethod = invocation.GetConcreteMethod(); var parameterTypes = proxyMethod.GetParameters() .Select(p => p.ParameterType) .ToArray(); var methodBase = invocation.TargetType?.GetMethod(invocation.Method.Name, parameterTypes); if (null != methodBase && methodBase.IsGenericMethodDefinition) { methodBase = methodBase.MakeGenericMethod(proxyMethod.GetGenericArguments()); } var aspectInvocation = new AspectInvocation( proxyMethod, methodBase, invocation.Proxy, invocation.InvocationTarget, invocation.Arguments ); var hasTarget = null != invocation.InvocationTarget && null != invocation.MethodInvocationTarget && null != invocation.TargetType; if (FluentAspects.AspectOptions.NoInterceptionConfigurations .Any(x => x.Invoke(aspectInvocation))) { invocation.Proceed(); } else { Func<IInvocation, Task> completeFunc; if (hasTarget) { completeFunc = c => { invocation.Proceed(); c.ReturnValue = invocation.ReturnValue; return TaskHelper.CompletedTask; }; } else { completeFunc = c => TaskHelper.CompletedTask; } AspectDelegate.InvokeWithCompleteFunc(aspectInvocation, completeFunc); } } } }
mit
C#
2a6e3f0fc462c371128ea79d99ce70ea46aef326
Comment everything out
Kerbas-ad-astra/KSP_Contract_Window,DMagic1/KSP_Contract_Window
QuickStart.cs
QuickStart.cs
//#if DEBUG //using System; //using System.Collections.Generic; //using System.Linq; //using UnityEngine; //namespace QuickStart //{ // //This will kick us into the save called default and set the first vessel active // [KSPAddon(KSPAddon.Startup.MainMenu, false)] // public class Debug_AutoLoadPersistentSaveOnStartup : MonoBehaviour { // public static bool first = true; // public static int vId = 0; // public void Start () { // if (first) { // first = false; // HighLogic.SaveFolder = "Contracts Ahoy"; // var game = GamePersistence.LoadGame ("persistent" , HighLogic.SaveFolder , true , false); // if (game != null && game.flightState != null && game.compatible) { // List<ProtoVessel> allVessels = game.flightState.protoVessels; // int suitableVessel = 0; // for (vId = 0; vId < allVessels.Count; vId++) { // switch (allVessels [vId].vesselType) { // case VesselType.SpaceObject: continue; // asteroids // case VesselType.Unknown: continue; // asteroids in facepaint // case VesselType.EVA: continue; // default: suitableVessel = vId; // break; // this one will do // } // /* If you want a more stringent filter than // * "vessel is not inert ball of space dirt", then you // * will want to do it here. // */ // } // HighLogic.LoadScene(GameScenes.SPACECENTER); // //FlightDriver.StartAndFocusVessel (game , suitableVessel); // CheatOptions.InfiniteFuel = true; // } // } // } //} //} //#endif
#if DEBUG using System; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace QuickStart { //This will kick us into the save called default and set the first vessel active [KSPAddon(KSPAddon.Startup.MainMenu, false)] public class Debug_AutoLoadPersistentSaveOnStartup : MonoBehaviour { public static bool first = true; public static int vId = 0; public void Start () { if (first) { first = false; HighLogic.SaveFolder = "Contracts Ahoy"; var game = GamePersistence.LoadGame ("persistent" , HighLogic.SaveFolder , true , false); if (game != null && game.flightState != null && game.compatible) { List<ProtoVessel> allVessels = game.flightState.protoVessels; int suitableVessel = 0; for (vId = 0; vId < allVessels.Count; vId++) { switch (allVessels [vId].vesselType) { case VesselType.SpaceObject: continue; // asteroids case VesselType.Unknown: continue; // asteroids in facepaint case VesselType.EVA: continue; default: suitableVessel = vId; break; // this one will do } /* If you want a more stringent filter than * "vessel is not inert ball of space dirt", then you * will want to do it here. */ } HighLogic.LoadScene(GameScenes.SPACECENTER); //FlightDriver.StartAndFocusVessel (game , suitableVessel); CheatOptions.InfiniteFuel = true; } } } } } #endif
mit
C#
75f6eb65c77a3206864973e3f55883b25ac3cdbc
Add missing accessibility modifier
tabrath/libsodium-core
src/Sodium.Core/Exceptions/InvalidArgonPasswordString.cs
src/Sodium.Core/Exceptions/InvalidArgonPasswordString.cs
using System; namespace Sodium.Exceptions { internal class InvalidArgonPasswordString : Exception { public InvalidArgonPasswordString() : base("Invalid Password string for Argon 2") { } } }
using System; namespace Sodium.Exceptions { class InvalidArgonPasswordString : Exception { public InvalidArgonPasswordString() : base("Invalid Password string for Argon 2") { } } }
mit
C#
13970713d1dedadd380e4d3386003d966818d456
Fix target file name generation
devtyr/gullap
DevTyr.Gullap/Model/MetaContentExtensions.cs
DevTyr.Gullap/Model/MetaContentExtensions.cs
using System.IO; namespace DevTyr.Gullap.Model { public static class MetaContentExtensions { public static string GetTargetFileName(this MetaContent content, SitePaths paths) { var isPage = content.Page != null; string userDefinedFileName = content.GetOverriddenFileName(); string targetFileName = string.IsNullOrWhiteSpace(userDefinedFileName) ? Path.GetFileNameWithoutExtension(content.FileName) + ".html" : userDefinedFileName; string targetDirectory; if (isPage) { targetDirectory = Path.GetDirectoryName(content.FileName.Replace(paths.PagesPath, paths.OutputPath)); } else { targetDirectory = Path.GetDirectoryName(content.FileName.Replace(paths.PostsPath, Path.Combine(paths.OutputPath, SitePaths.PostsDirectoryName))); } var targetPath = Path.Combine(targetDirectory, targetFileName); return targetPath; } } }
using System.IO; namespace DevTyr.Gullap.Model { public static class MetaContentExtensions { public static string GetTargetFileName(this MetaContent content, SitePaths paths) { var isPage = content.Page != null; string userDefinedFileName = content.GetOverriddenFileName(); string targetFileName = string.IsNullOrWhiteSpace(userDefinedFileName) ? Path.GetFileNameWithoutExtension(content.FileName) + ".html" : userDefinedFileName; string targetDirectory; if (isPage) { targetDirectory = Path.GetDirectoryName(targetFileName.Replace(paths.PagesPath, paths.OutputPath)); } else { targetDirectory = Path.GetDirectoryName(content.FileName.Replace(paths.PostsPath, Path.Combine(paths.OutputPath, SitePaths.PostsDirectoryName))); } var targetPath = Path.Combine(targetDirectory, targetFileName); return targetPath; } } }
mit
C#
064062687f2b6fe5b0bbaf0cc3507c5024d77641
Make Leg configuration readonly
dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo,dmweis/DynamixelServo
DynamixelServo.Quadruped/LegConfiguration.cs
DynamixelServo.Quadruped/LegConfiguration.cs
namespace DynamixelServo.Quadruped { public class LegConfiguration { public byte CoxaId { get; } public byte FemurId { get; } public byte TibiaId { get; } public float AngleOffset { get; } public Vector3 CoxaPosition { get; } public float FemurCorrection { get; } public float TibiaCorrection { get; } public LegConfiguration(byte coxaId, byte femurId, byte tibiaId, float angleOffset, Vector3 coxaPosition, float femurCorrection, float tibiaCorrection) { CoxaId = coxaId; FemurId = femurId; TibiaId = tibiaId; AngleOffset = angleOffset; CoxaPosition = coxaPosition; FemurCorrection = femurCorrection; TibiaCorrection = tibiaCorrection; } } }
namespace DynamixelServo.Quadruped { public class LegConfiguration { public byte CoxaId { get; set; } public byte FemurId { get; set; } public byte TibiaId { get; set; } public float AngleOffset { get; set; } public Vector3 CoxaPosition { get; set; } public float FemurCorrection { get; set; } public float TibiaCorrection { get; set; } public LegConfiguration(byte coxaId, byte femurId, byte tibiaId, float angleOffset, Vector3 coxaPosition, float femurCorrection, float tibiaCorrection) { CoxaId = coxaId; FemurId = femurId; TibiaId = tibiaId; AngleOffset = angleOffset; CoxaPosition = coxaPosition; FemurCorrection = femurCorrection; TibiaCorrection = tibiaCorrection; } } }
apache-2.0
C#
22a85d633f3458cf1eaa32ab67cf2cfe47ebe7b9
Add example of using fixed provider
peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype
src/Glimpse.Agent.AspNet.Sample/Startup.cs
src/Glimpse.Agent.AspNet.Sample/Startup.cs
using System.Collections.Generic; using System.Reflection; using System.Text.RegularExpressions; using Glimpse.Agent.Web; using Glimpse.Agent.Web.Framework; using Glimpse.Agent.Web.Options; using Microsoft.AspNet.Builder; using Glimpse.Host.Web.AspNet; using Microsoft.Framework.DependencyInjection; namespace Glimpse.Agent.AspNet.Sample { public class Startup { public void ConfigureServices(IServiceCollection services) { /* Example of how to use fixed provider TODO: This should be cleanned up with help of extenion methods services.AddSingleton<IIgnoredRequestProvider>(x => { var activator = x.GetService<ITypeActivator>(); var urlPolicy = activator.CreateInstances<IIgnoredRequestPolicy>(new [] { typeof(UriIgnoredRequestPolicy).GetTypeInfo(), typeof(ContentTypeIgnoredRequestPolicy).GetTypeInfo() }); var provider = new FixedIgnoredRequestProvider(urlPolicy); return provider; }); */ services.AddGlimpse() .RunningAgent() .ForWeb() .Configure<GlimpseAgentWebOptions>(options => { //options.IgnoredStatusCodes.Add(200); }) .WithRemoteStreamAgent(); //.WithRemoteHttpAgent(); } public void Configure(IApplicationBuilder app) { app.UseGlimpse(); app.UseWelcomePage(); } } }
using Glimpse.Agent.Web; using Microsoft.AspNet.Builder; using Glimpse.Host.Web.AspNet; using Microsoft.Framework.DependencyInjection; namespace Glimpse.Agent.AspNet.Sample { public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddGlimpse() .RunningAgent() .ForWeb() .Configure<GlimpseAgentWebOptions>(options => { //options.IgnoredStatusCodes.Add(200); }) .WithRemoteStreamAgent(); //.WithRemoteHttpAgent(); } public void Configure(IApplicationBuilder app) { app.UseGlimpse(); app.UseWelcomePage(); } } }
mit
C#
250a72f4bc61649e079e1f0e98b6a8f633b264d6
Update AssemblyInfo minor version.
sirkirby/hipchat.net,sirkirby/hipchat.net
src/HipChat.Net/Properties/AssemblyInfo.cs
src/HipChat.Net/Properties/AssemblyInfo.cs
using System.Resources; using System.Reflection; // 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("HipChat.Net")] [assembly: AssemblyDescription("HipChat API v2 library for .NET")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Chris Kirby")] [assembly: AssemblyProduct("HipChat.Net")] [assembly: AssemblyCopyright("Copyright © Chris Kirby 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.3")] [assembly: AssemblyFileVersion("0.1.3")] [assembly: AssemblyInformationalVersion("0.1.3")]
using System.Resources; using System.Reflection; // 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("HipChat.Net")] [assembly: AssemblyDescription("HipChat API v2 library for .NET")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Chris Kirby")] [assembly: AssemblyProduct("HipChat.Net")] [assembly: AssemblyCopyright("Copyright © Chris Kirby 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.2")] [assembly: AssemblyFileVersion("0.1.2")] [assembly: AssemblyInformationalVersion("0.1.2")]
mit
C#
7142581ac01c92c27774549c85347cef52658273
add Althash
dgarage/NBXplorer,dgarage/NBXplorer
NBXplorer.Client/NBXplorerNetworkProvider.cs
NBXplorer.Client/NBXplorerNetworkProvider.cs
using NBitcoin; using System.Collections.Generic; namespace NBXplorer { public partial class NBXplorerNetworkProvider { public NBXplorerNetworkProvider(ChainName networkType) { NetworkType = networkType; InitArgoneum(networkType); InitBitcoin(networkType); InitBitcore(networkType); InitLitecoin(networkType); InitDogecoin(networkType); InitBCash(networkType); InitGroestlcoin(networkType); InitBGold(networkType); InitDash(networkType); InitTerracoin(networkType); InitPolis(networkType); InitMonacoin(networkType); InitFeathercoin(networkType); InitUfo(networkType); InitViacoin(networkType); InitMonoeci(networkType); InitGobyte(networkType); InitColossus(networkType); InitChaincoin(networkType); InitLiquid(networkType); InitQtum(networkType); InitAlthash(networkType); InitMonetaryUnit(networkType); foreach (var chain in _Networks.Values) { chain.DerivationStrategyFactory ??= chain.CreateStrategyFactory(); } } public ChainName NetworkType { get; private set; } public NBXplorerNetwork GetFromCryptoCode(string cryptoCode) { _Networks.TryGetValue(cryptoCode.ToUpperInvariant(), out NBXplorerNetwork network); return network; } public IEnumerable<NBXplorerNetwork> GetAll() { return _Networks.Values; } Dictionary<string, NBXplorerNetwork> _Networks = new Dictionary<string, NBXplorerNetwork>(); private void Add(NBXplorerNetwork network) { if (network.NBitcoinNetwork == null) return; _Networks.Add(network.CryptoCode, network); } } }
using NBitcoin; using System.Collections.Generic; namespace NBXplorer { public partial class NBXplorerNetworkProvider { public NBXplorerNetworkProvider(ChainName networkType) { NetworkType = networkType; InitArgoneum(networkType); InitBitcoin(networkType); InitBitcore(networkType); InitLitecoin(networkType); InitDogecoin(networkType); InitBCash(networkType); InitGroestlcoin(networkType); InitBGold(networkType); InitDash(networkType); InitTerracoin(networkType); InitPolis(networkType); InitMonacoin(networkType); InitFeathercoin(networkType); InitUfo(networkType); InitViacoin(networkType); InitMonoeci(networkType); InitGobyte(networkType); InitColossus(networkType); InitChaincoin(networkType); InitLiquid(networkType); InitQtum(networkType); InitMonetaryUnit(networkType); foreach (var chain in _Networks.Values) { chain.DerivationStrategyFactory ??= chain.CreateStrategyFactory(); } } public ChainName NetworkType { get; private set; } public NBXplorerNetwork GetFromCryptoCode(string cryptoCode) { _Networks.TryGetValue(cryptoCode.ToUpperInvariant(), out NBXplorerNetwork network); return network; } public IEnumerable<NBXplorerNetwork> GetAll() { return _Networks.Values; } Dictionary<string, NBXplorerNetwork> _Networks = new Dictionary<string, NBXplorerNetwork>(); private void Add(NBXplorerNetwork network) { if (network.NBitcoinNetwork == null) return; _Networks.Add(network.CryptoCode, network); } } }
mit
C#
19664060e29af6b81b2c3fd4811c7719d0140bab
remove unused usings
restsharp/RestSharp,PKRoma/RestSharp
RestSharp.Tests/SimpleJsonTests.cs
RestSharp.Tests/SimpleJsonTests.cs
using NUnit.Framework; using System.Linq; namespace RestSharp.Tests { [TestFixture] public class SimpleJsonTests { [Test] public void SerializeObject_should_not_assume_strings_wrapped_in_curly_braces_are_json() { var objectWithCurlyString = new { Name = "{value}" }; string result = SimpleJson.SerializeObject(objectWithCurlyString); Assert.AreEqual("{\"Name\":\"{value}\"}", result); } [Test] public void EscapeToJavascriptString_should_not_double_escape() { string preformattedString = "{ \"name\" : \"value\" }"; int expectedSlashCount = preformattedString.Count(x => x == '\\'); string result = SimpleJson.EscapeToJavascriptString(preformattedString); int actualSlashCount = result.Count(x => x == '\\'); Assert.AreEqual(expectedSlashCount, actualSlashCount); } } }
using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RestSharp.Tests { [TestFixture] public class SimpleJsonTests { [Test] public void SerializeObject_should_not_assume_strings_wrapped_in_curly_braces_are_json() { var objectWithCurlyString = new { Name = "{value}" }; string result = SimpleJson.SerializeObject(objectWithCurlyString); Assert.AreEqual("{\"Name\":\"{value}\"}", result); } [Test] public void EscapeToJavascriptString_should_not_double_escape() { string preformattedString = "{ \"name\" : \"value\" }"; int expectedSlashCount = preformattedString.Count(x => x == '\\'); string result = SimpleJson.EscapeToJavascriptString(preformattedString); int actualSlashCount = result.Count(x => x == '\\'); Assert.AreEqual(expectedSlashCount, actualSlashCount); } } }
apache-2.0
C#
288f04c17b7f4fef2b233d96055fec0da113067a
Fix unit test
andrewdavey/postal,andrewdavey/postal,ajbeaven/postal,hermanho/postal,Lybecker/postal,vip32/postal
src/Postal.Tests/EmailViewRendererTests.cs
src/Postal.Tests/EmailViewRendererTests.cs
using System; using System.IO; using System.Web.Mvc; using Moq; using Should; using Xunit; namespace Postal { public class EmailViewRendererTests { [Fact] public void Render_returns_email_string_created_by_view() { var viewEngines = new Mock<ViewEngineCollection>(); var view = new FakeView(); viewEngines.Setup(e => e.FindView(It.IsAny<ControllerContext>(), "Test", null)) .Returns(new ViewEngineResult(view, Mock.Of<IViewEngine>())); var renderer = new EmailViewRenderer(viewEngines.Object, "test.com"); var actualEmailString = renderer.Render(new Email("Test")); actualEmailString.ShouldEqual("Fake"); } class FakeView : IView { public void Render(ViewContext viewContext, TextWriter writer) { writer.Write("Fake"); } } [Fact] public void Render_throws_exception_when_email_view_not_found() { var viewEngines = new Mock<ViewEngineCollection>(); viewEngines.Setup(e => e.FindView(It.IsAny<ControllerContext>(), "Test", It.IsAny<string>())) .Returns(new ViewEngineResult(new[] { "Test" })); var renderer = new EmailViewRenderer(viewEngines.Object, "test.com"); Assert.Throws<Exception>(delegate { renderer.Render(new Email("Test")); }); } } }
using System; using System.IO; using System.Web.Mvc; using Moq; using Should; using Xunit; namespace Postal { public class EmailViewRendererTests { [Fact] public void Render_returns_email_string_created_by_view() { var viewEngines = new Mock<ViewEngineCollection>(); var view = new FakeView(); viewEngines.Setup(e => e.FindPartialView(It.IsAny<ControllerContext>(), "Test")) .Returns(new ViewEngineResult(view, Mock.Of<IViewEngine>())); var renderer = new EmailViewRenderer(viewEngines.Object, "test.com"); var actualEmailString = renderer.Render(new Email("Test")); actualEmailString.ShouldEqual("Fake"); } class FakeView : IView { public void Render(ViewContext viewContext, TextWriter writer) { writer.Write("Fake"); } } [Fact] public void Render_throws_exception_when_email_view_not_found() { var viewEngines = new Mock<ViewEngineCollection>(); viewEngines.Setup(e => e.FindView(It.IsAny<ControllerContext>(), "Test", It.IsAny<string>())) .Returns(new ViewEngineResult(new[] { "Test" })); var renderer = new EmailViewRenderer(viewEngines.Object, "test.com"); Assert.Throws<Exception>(delegate { renderer.Render(new Email("Test")); }); } } }
mit
C#
b67767c68d5280d46ca75e9a1dced03dab97e6b5
add paragragh timeout to 2 min.
dotnet/docfx,dotnet/docfx,pascalberger/docfx,dotnet/docfx,hellosnow/docfx,superyyrrzz/docfx,superyyrrzz/docfx,pascalberger/docfx,pascalberger/docfx,hellosnow/docfx,superyyrrzz/docfx,LordZoltan/docfx,hellosnow/docfx,LordZoltan/docfx,LordZoltan/docfx,928PJY/docfx,DuncanmaMSFT/docfx,928PJY/docfx,DuncanmaMSFT/docfx,LordZoltan/docfx,928PJY/docfx
src/Microsoft.DocAsCode.Dfm/Rules/DfmParagraphBlockRule.cs
src/Microsoft.DocAsCode.Dfm/Rules/DfmParagraphBlockRule.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.Dfm { using System; using System.Text.RegularExpressions; using Microsoft.DocAsCode.MarkdownLite; public class DfmParagraphBlockRule : GfmParagraphBlockRule { private static readonly Regex _paragraph = new Regex(@"^((?:[^\n]+\n?(?! *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\2 *(?:\n+|$)| *\[\!(NOTE|WARNING|TIP|IMPORTANT|CAUTION)\] *\n?.*(?:\n|$)| *\[\!Video +https?\:\/\/.+? *\] *(?:\n|$)| *\[\!div( +(`?)(.*?)\7)?\]\s*(?:\n|$)| *\[!(code(-((\w|-)+))?)\[((?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*)\]\(\s*<?([^\n]*?)>?(?:\s+(['""])([\s\S]*?)\15)?\s*\)\]\s*(\n|$)|( *)((?:[*+-]|\d+\.)) [\s\S]+?(?:\n+(?=\18?(?:[-*_] *){3,}(?:\n+|$))|\n+(?= *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +[""(]([^\n]+)["")])? *(?:\n+|$))|\n{2,}(?! )(?!\18(?:[*+-]|\d+\.) )\n*|\s*$)|( *[-*_]){3,} *(?:\n+|$)| *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)|([^\n]+)\n *(=|-){2,} *(?:\n+|$)|( *>[^\n]+(\n(?! *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +[""(]([^\n]+)["")])? *(?:\n+|$))[^\n]+)*\n*)+|<(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\b)\w+(?!:\/|[^\w\s@]*@)\b| *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +[""(]([^\n]+)["")])? *(?:\n+|$)))+)\n*", RegexOptions.Compiled | RegexOptions.IgnoreCase, TimeSpan.FromMinutes(2)); public override Regex Paragraph => _paragraph; } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.Dfm { using System; using System.Text.RegularExpressions; using Microsoft.DocAsCode.MarkdownLite; public class DfmParagraphBlockRule : GfmParagraphBlockRule { private static readonly Regex _paragraph = new Regex(@"^((?:[^\n]+\n?(?! *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\2 *(?:\n+|$)| *\[\!(NOTE|WARNING|TIP|IMPORTANT|CAUTION)\] *\n?.*(?:\n|$)| *\[\!Video +https?\:\/\/.+? *\] *(?:\n|$)| *\[\!div( +(`?)(.*?)\7)?\]\s*(?:\n|$)| *\[!(code(-((\w|-)+))?)\[((?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*)\]\(\s*<?([^\n]*?)>?(?:\s+(['""])([\s\S]*?)\15)?\s*\)\]\s*(\n|$)|( *)((?:[*+-]|\d+\.)) [\s\S]+?(?:\n+(?=\18?(?:[-*_] *){3,}(?:\n+|$))|\n+(?= *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +[""(]([^\n]+)["")])? *(?:\n+|$))|\n{2,}(?! )(?!\18(?:[*+-]|\d+\.) )\n*|\s*$)|( *[-*_]){3,} *(?:\n+|$)| *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)|([^\n]+)\n *(=|-){2,} *(?:\n+|$)|( *>[^\n]+(\n(?! *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +[""(]([^\n]+)["")])? *(?:\n+|$))[^\n]+)*\n*)+|<(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\b)\w+(?!:\/|[^\w\s@]*@)\b| *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +[""(]([^\n]+)["")])? *(?:\n+|$)))+)\n*", RegexOptions.Compiled | RegexOptions.IgnoreCase, TimeSpan.FromSeconds(10)); public override Regex Paragraph => _paragraph; } }
mit
C#
a339579534ff8dd9eae41e758893bb37588259be
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.12.0")] [assembly: AssemblyFileVersion("1.0.12.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.11.0")] [assembly: AssemblyFileVersion("1.0.11.0")]
mit
C#
7b2b2ebe4a72efcec0e8900f98137d60f6f23a31
Fix empty filter
Cybermaxs/PackageVerifier
PackageVerifier/Core/Scanners/BaseScanner.cs
PackageVerifier/Core/Scanners/BaseScanner.cs
using PackageVerifier.Core; using PackageVerifier.Models; using PackageVerifier.Utils; using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using System.Xml.Linq; namespace PackageVerifier.Core.Scanners { abstract class BaseScanner { protected readonly IAnalytics analytics; protected readonly Settings settings; protected readonly ILogger logger; public BaseScanner(ILogger logger, IAnalytics analytics, Settings settings) { this.analytics = analytics; this.settings = settings; this.logger = logger; } protected async Task<List<Package>> ParseConfig(Stream packageStream) { var res = new List<Package>(); try { using (var reader = new StreamReader(packageStream)) { var contents = await reader.ReadToEndAsync().ConfigureAwait(false); var root = XElement.Parse(contents); foreach (var xpkg in root.Elements("package")) { Package pkg = new Package(); pkg.Id = xpkg.Attribute("id").Value; pkg.Version = xpkg.Attribute("version").Value; //pkg.TargetFramework = xpkg.Attribute("targetFramework")!=null ? xpkg.Attribute("targetFramework").Value; res.Add(pkg); } } } catch(Exception ex) { this.logger.Error(ex.Message); } return res; } protected bool IsAllowed(string path) { if (string.IsNullOrEmpty(settings.Filter)) return true; return path.Contains(settings.Filter); } } }
using PackageVerifier.Core; using PackageVerifier.Models; using PackageVerifier.Utils; using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using System.Xml.Linq; namespace PackageVerifier.Core.Scanners { abstract class BaseScanner { protected readonly IAnalytics analytics; protected readonly Settings settings; protected readonly ILogger logger; public BaseScanner(ILogger logger, IAnalytics analytics, Settings settings) { this.analytics = analytics; this.settings = settings; this.logger = logger; } protected async Task<List<Package>> ParseConfig(Stream packageStream) { var res = new List<Package>(); try { using (var reader = new StreamReader(packageStream)) { var contents = await reader.ReadToEndAsync().ConfigureAwait(false); var root = XElement.Parse(contents); foreach (var xpkg in root.Elements("package")) { Package pkg = new Package(); pkg.Id = xpkg.Attribute("id").Value; pkg.Version = xpkg.Attribute("version").Value; //pkg.TargetFramework = xpkg.Attribute("targetFramework")!=null ? xpkg.Attribute("targetFramework").Value; res.Add(pkg); } } } catch(Exception ex) { this.logger.Error(ex.Message); } return res; } protected bool IsAllowed(string path) { return path.Contains(settings.Filter); } } }
mit
C#
915e2d615341fea38e2711617e5fd4fb4c1c6a9b
Fix case-sensitivity of exclude paths
MacDennis76/Unicorn,rmwatson5/Unicorn,kamsar/Unicorn,kamsar/Unicorn,PetersonDave/Unicorn,PetersonDave/Unicorn,MacDennis76/Unicorn,GuitarRich/Unicorn,GuitarRich/Unicorn,rmwatson5/Unicorn,bllue78/Unicorn,bllue78/Unicorn
Source/Unicorn/PresetExtensions.cs
Source/Unicorn/PresetExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using Sitecore.Data.Serialization.Presets; using Sitecore.Data.Items; using Sitecore.Data.Serialization; namespace Unicorn { /// <summary> /// Extension methods on Serialization Preset API classes to make checks easier /// </summary> internal static class PresetExtensions { /// <summary> /// Checks if a list of presets includes a given item /// </summary> public static bool Includes(this IList<IncludeEntry> entries, Item item) { // no entries = include everything if (entries.FirstOrDefault() == null) return true; return entries.Any(entry => entry.Includes(item)); } /// <summary> /// Checks if a preset includes a given item /// </summary> public static bool Includes(this IncludeEntry entry, Item item) { // check for db match if (item.Database.Name != entry.Database) return false; // check for path match if (!item.Paths.Path.StartsWith(entry.Path, StringComparison.OrdinalIgnoreCase)) return false; // check excluded paths (*our* path exclusions are case-insensitive, whereas Sitecore's are case-sensitive - this can result in unexpected deletions) if (entry.Exclude.Any(x => x.Type == "path" && x.Value.Equals(item.Paths.FullPath, StringComparison.OrdinalIgnoreCase))) return false; // check excludes if (entry.Exclude.Any(exclude => exclude.Matches(item))) return false; // we passed all the checks - we're included by the current rule return true; } /// <summary> /// Checks if a given list of presets matches a specific Sitecore path /// </summary> public static bool MatchesPath(this IEnumerable<ExcludeEntry> entries, string path) { var itemPath = "/" + string.Join("/", PathUtils.MakeItemPath(path).Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).Skip(1)); return entries.Any(entry => entry.Type == "path" && entry.Value.Equals(itemPath, StringComparison.OrdinalIgnoreCase)); } /// <summary> /// Checks if a given list of presets matches a specific item ID. Use ID.ToString() format eg {A9F4...} /// </summary> public static bool MatchesId(this IEnumerable<ExcludeEntry> entries, string id) { return entries.Any(entry => entry.Type == "id" && entry.Value.Equals(id, StringComparison.OrdinalIgnoreCase)); } /// <summary> /// Checks if a given list of presets matches a specific template name /// </summary> public static bool MatchesTemplate(this IEnumerable<ExcludeEntry> entries, string templateName) { return entries.Any(entry => entry.Type == "template" && entry.Value.Equals(templateName, StringComparison.OrdinalIgnoreCase)); } /// <summary> /// Checks if a given list of presets matches a specific template ID /// </summary> public static bool MatchesTemplateId(this IEnumerable<ExcludeEntry> entries, string templateId) { return entries.Any(entry => entry.Type == "templateid" && entry.Value.Equals(templateId, StringComparison.OrdinalIgnoreCase)); } } }
using System; using System.Collections.Generic; using System.Linq; using Sitecore.Data.Serialization.Presets; using Sitecore.Data.Items; using Sitecore.Data.Serialization; namespace Unicorn { /// <summary> /// Extension methods on Serialization Preset API classes to make checks easier /// </summary> internal static class PresetExtensions { /// <summary> /// Checks if a list of presets includes a given item /// </summary> public static bool Includes(this IList<IncludeEntry> entries, Item item) { // no entries = include everything if (entries.FirstOrDefault() == null) return true; return entries.Any(entry => entry.Includes(item)); } /// <summary> /// Checks if a preset includes a given item /// </summary> public static bool Includes(this IncludeEntry entry, Item item) { // check for db match if (item.Database.Name != entry.Database) return false; // check for path match if (!item.Paths.Path.StartsWith(entry.Path, StringComparison.OrdinalIgnoreCase)) return false; // check excludes if (entry.Exclude.Any(exclude => exclude.Matches(item))) return false; // we passed all the checks - we're included by the current rule return true; } /// <summary> /// Checks if a given list of presets matches a specific Sitecore path /// </summary> public static bool MatchesPath(this IEnumerable<ExcludeEntry> entries, string path) { var itemPath = "/" + string.Join("/", PathUtils.MakeItemPath(path).Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).Skip(1)); return entries.Any(entry => entry.Type == "path" && entry.Value.Equals(itemPath, StringComparison.OrdinalIgnoreCase)); } /// <summary> /// Checks if a given list of presets matches a specific item ID. Use ID.ToString() format eg {A9F4...} /// </summary> public static bool MatchesId(this IEnumerable<ExcludeEntry> entries, string id) { return entries.Any(entry => entry.Type == "id" && entry.Value.Equals(id, StringComparison.OrdinalIgnoreCase)); } /// <summary> /// Checks if a given list of presets matches a specific template name /// </summary> public static bool MatchesTemplate(this IEnumerable<ExcludeEntry> entries, string templateName) { return entries.Any(entry => entry.Type == "template" && entry.Value.Equals(templateName, StringComparison.OrdinalIgnoreCase)); } /// <summary> /// Checks if a given list of presets matches a specific template ID /// </summary> public static bool MatchesTemplateId(this IEnumerable<ExcludeEntry> entries, string templateId) { return entries.Any(entry => entry.Type == "templateid" && entry.Value.Equals(templateId, StringComparison.OrdinalIgnoreCase)); } } }
mit
C#
391e28ad590117bfe6da080d366610c274aa4553
Add migrate commandline support
mycroes/SupportManager,mycroes/SupportManager,mycroes/SupportManager
SupportManager.Telegram/Program.cs
SupportManager.Telegram/Program.cs
using System; using System.Diagnostics; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Internal; using SupportManager.Telegram.DAL; using Topshelf; namespace SupportManager.Telegram { class Program { static void Main(string[] args) { if (args.Any() && args[0].EndsWith("migrate", StringComparison.InvariantCultureIgnoreCase)) { var db = new UserDbContext(); db.Database.Migrate(); return; } var config = new Configuration(); var exitCode = HostFactory.Run(cfg => { cfg.AddCommandLineDefinition("botkey", v => config.BotKey = v); cfg.AddCommandLineDefinition("url", v => config.SupportManagerUri = new Uri(v)); cfg.Service<Service>(svc => { svc.ConstructUsing(() => new Service(config)); svc.WhenStarted((s, h) => s.Start(h)); svc.WhenStopped((s, h) => s.Stop(h)); }); cfg.SetServiceName("SupportManager.Telegram"); cfg.SetDisplayName("SupportManager.Telegram"); cfg.SetDescription("SupportManager Telegram bot"); cfg.RunAsNetworkService(); cfg.StartAutomatically(); }); Debugger.Break(); } } }
using System; using System.Diagnostics; using Topshelf; namespace SupportManager.Telegram { class Program { static void Main(string[] args) { var config = new Configuration(); var exitCode = HostFactory.Run(cfg => { cfg.AddCommandLineDefinition("botkey", v => config.BotKey = v); cfg.AddCommandLineDefinition("url", v => config.SupportManagerUri = new Uri(v)); cfg.Service<Service>(svc => { svc.ConstructUsing(() => new Service(config)); svc.WhenStarted((s, h) => s.Start(h)); svc.WhenStopped((s, h) => s.Stop(h)); }); cfg.SetServiceName("SupportManager.Telegram"); cfg.SetDisplayName("SupportManager.Telegram"); cfg.SetDescription("SupportManager Telegram bot"); cfg.RunAsNetworkService(); cfg.StartAutomatically(); }); Debugger.Break(); } } }
mit
C#
a71151839da396ffee8aade634cb3f634eb6a801
Revert changes in AppBuilder.cs
grokys/Perspex,jkoritzinsky/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,akrisiun/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia
src/Avalonia.DotNetCoreRuntime/AppBuilder.cs
src/Avalonia.DotNetCoreRuntime/AppBuilder.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Platform; using Avalonia.Shared.PlatformSupport; namespace Avalonia { /// <summary> /// Initializes platform-specific services for an <see cref="Application"/>. /// </summary> public sealed class AppBuilder : AppBuilderBase<AppBuilder> { /// <summary> /// Initializes a new instance of the <see cref="AppBuilder"/> class. /// </summary> public AppBuilder() : base(new StandardRuntimePlatform(), builder => StandardRuntimePlatformServices.Register(builder.Instance?.GetType() ?.GetTypeInfo().Assembly)) { } /// <summary> /// Initializes a new instance of the <see cref="AppBuilder"/> class. /// </summary> /// <param name="app">The <see cref="Application"/> instance.</param> public AppBuilder(Application app) : this() { Instance = app; } /// <summary> /// Instructs the <see cref="AppBuilder"/> to use the best settings for the platform. /// </summary> /// <returns>An <see cref="AppBuilder"/> instance.</returns> public AppBuilder UsePlatformDetect() { var os = RuntimePlatform.GetRuntimeInfo().OperatingSystem; //We don't have the ability to load every assembly right now, so we are //stuck with manual configuration here //Helpers are extracted to separate methods to take the advantage of the fact //that CLR doesn't try to load dependencies before referencing method is jitted if (os == OperatingSystemType.WinNT) LoadWin32(); else if(os==OperatingSystemType.OSX) LoadMonoMac(); else LoadGtk3(); this.UseSkia(); return this; } void LoadMonoMac() => this.UseMonoMac(); void LoadWin32() => this.UseWin32(); void LoadGtk3() => this.UseGtk3(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Platform; using Avalonia.Shared.PlatformSupport; namespace Avalonia { /// <summary> /// Initializes platform-specific services for an <see cref="Application"/>. /// </summary> public sealed class AppBuilder : AppBuilderBase<AppBuilder> { /// <summary> /// Initializes a new instance of the <see cref="AppBuilder"/> class. /// </summary> public AppBuilder() : base(new StandardRuntimePlatform(), builder => StandardRuntimePlatformServices.Register(builder.Instance?.GetType() ?.GetTypeInfo().Assembly)) { } /// <summary> /// Initializes a new instance of the <see cref="AppBuilder"/> class. /// </summary> /// <param name="app">The <see cref="Application"/> instance.</param> public AppBuilder(Application app) : this() { Instance = app; } /// <summary> /// Instructs the <see cref="AppBuilder"/> to use the best settings for the platform. /// </summary> /// <returns>An <see cref="AppBuilder"/> instance.</returns> public AppBuilder UsePlatformDetect() { var os = RuntimePlatform.GetRuntimeInfo().OperatingSystem; //We don't have the ability to load every assembly right now, so we are //stuck with manual configuration here //Helpers are extracted to separate methods to take the advantage of the fact //that CLR doesn't try to load dependencies before referencing method is jitted if (os == OperatingSystemType.WinNT) LoadWin32(); else LoadGtk3(); this.UseSkia(); return this; } void LoadWin32() => this.UseWin32(); void LoadGtk3() => this.UseGtk3(); } }
mit
C#
c43c470f02b6650c8cba6125e846e104c0996967
Update Export-CurrentContainer-Multi.csx
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D
scripts/Export-CurrentContainer-Multi.csx
scripts/Export-CurrentContainer-Multi.csx
#r "System.Linq" #r "Core2D" using System; using System.IO; using System.Linq; using Core2D.FileWriter.Dxf; using Core2D.FileWriter.PdfSharp; using Core2D.FileWriter.SkiaSharpPng; using Core2D.FileWriter.SkiaSharpSvg; using Core2D.FileWriter.Emf; var dir = "D:\\"; var page = Editor.Project.CurrentContainer; var dxf = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(DxfWriter)); using (var dxfStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + dxf.Extension))) { dxf.Save(dxfStream, page, Editor.Project); } var pdf = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(PdfSharpWriter)); using (var pdfStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + pdf.Extension))) { pdf.Save(pdfStream, page, Editor.Project); } var png = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(PngSkiaSharpWriter)); using (var pngStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + png.Extension))) { png.Save(pngStream, page, Editor.Project); } var svg = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(SvgSkiaSharpWriter)); using (var svgStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + svg.Extension))) { svg.Save(svgStream, page, Editor.Project); } var emf = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(EmfWriter)); using (var emfStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + emf.Extension))) { emf.Save(emfStream, page, Editor.Project); }
#r "System.Linq" #r "Core2D" using System; using System.IO; using System.Linq; using Core2D.FileWriter.Dxf; using Core2D.FileWriter.PdfSharp; using Core2D.FileWriter.SkiaSharpPng; using Core2D.FileWriter.SkiaSharpSvg; var dir = "D:\\"; var page = Editor.Project.CurrentContainer; var dxf = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(DxfWriter)); using (var dxfStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + dxf.Extension))) { dxf.Save(dxfStream, page, Editor.Project); } var pdf = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(PdfSharpWriter)); using (var pdfStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + pdf.Extension))) { pdf.Save(pdfStream, page, Editor.Project); } var png = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(PngSkiaSharpWriter)); using (var pngStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + png.Extension))) { png.Save(pngStream, page, Editor.Project); } var svg = Editor.FileWriters.FirstOrDefault(x => x.GetType() == typeof(SvgSkiaSharpWriter)); using (var svgStream = Editor.FileIO.Create(Path.Combine(dir, page.Name + "." + svg.Extension))) { svg.Save(svgStream, page, Editor.Project); }
mit
C#
23e169adb6e7b562d5a0922aa4688e0a0fead834
Fix og:image path for home page
PioneerCode/pioneer-blog,PioneerCode/pioneer-blog,PioneerCode/pioneer-blog,PioneerCode/pioneer-blog
src/Pioneer.Blog/Views/Home/_Template.cshtml
src/Pioneer.Blog/Views/Home/_Template.cshtml
@{ Layout = "~/Views/Shared/_LayoutPublic.cshtml"; } @section metaPage { <meta property="og:type" content="website"> <meta property="og:image" content="@(AppConfiguration.Value.SiteUrl + "/images/logo-og.jpg")"> } @RenderBody()
@{ Layout = "~/Views/Shared/_LayoutPublic.cshtml"; } @section metaPage { <meta property="og:type" content="website"> <meta property="og:image" content="@(AppConfiguration.Value.SiteUrl + "/content/images/logo-og.jpg")"> } @RenderBody()
mit
C#
7b59b764404cc9351ba393c448b9df89854c7c3b
Update version
EtienneLamoureux/TQVaultAE,Malgardian/TQVaultAE
src/TQVaultAE.GUI/Properties/AssemblyInfo.cs
src/TQVaultAE.GUI/Properties/AssemblyInfo.cs
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="None"> // Copyright (c) Brandon Wallace and Jesse Calhoun. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; using System.Reflection; using System.Resources; 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("TQVaultAE")] [assembly: AssemblyDescription("Extra bank space for Titan Quest Anniversary Edition")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("titanquest.net community")] [assembly: AssemblyProduct("TQVaultAE")] [assembly: AssemblyCopyright("Copyright © 2006-2012 by Brandon Wallace")] [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("40473eaa-06cd-4833-898d-0793c3d1b755")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision [assembly: AssemblyVersion("2.6.0")] [assembly: AssemblyFileVersion("2.6.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] // CLS compliant attribute [assembly: CLSCompliant(true)]
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="None"> // Copyright (c) Brandon Wallace and Jesse Calhoun. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; using System.Reflection; using System.Resources; 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("TQVaultAE")] [assembly: AssemblyDescription("Extra bank space for Titan Quest Anniversary Edition")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("titanquest.net community")] [assembly: AssemblyProduct("TQVaultAE")] [assembly: AssemblyCopyright("Copyright © 2006-2012 by Brandon Wallace")] [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("40473eaa-06cd-4833-898d-0793c3d1b755")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision [assembly: AssemblyVersion("2.5.7")] [assembly: AssemblyFileVersion("2.5.7")] [assembly: NeutralResourcesLanguageAttribute("en-US")] // CLS compliant attribute [assembly: CLSCompliant(true)]
mit
C#
6021d60f000a374ddd876de53400dc3d9e593adc
Fix copyright notice & remove owners nuget element
Simution/NServiceBus.Recoverability.RetrySuccessNotification
src/RetrySuccessNotification/AssemblyInfo.cs
src/RetrySuccessNotification/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("NServiceBus.Recoverability.RetrySuccessNotification")] [assembly: AssemblyCopyright("Copyright Simution, Inc. All rights reserved")] [assembly: AssemblyProduct("NServiceBus.Recoverability.RetrySucessNotification")] [assembly: ComVisible(false)] [assembly: InternalsVisibleTo("NServiceBus.Recoverability.RetrySucessNotification.ComponentTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("NServiceBus.Recoverability.RetrySuccessNotification")] [assembly: AssemblyCopyright("Copyright Bob Langley. All rights reserved")] [assembly: AssemblyProduct("NServiceBus.Recoverability.RetrySucessNotification")] [assembly: ComVisible(false)] [assembly: InternalsVisibleTo("NServiceBus.Recoverability.RetrySucessNotification.ComponentTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92")]
mit
C#
d472d794b7a57ffff7d701992465e3c8416d13eb
Reorganize forms into project subfolder
msorens/SqlDiffFramework
SqlDiffFramework/SqlDiffFramework/Program.cs
SqlDiffFramework/SqlDiffFramework/Program.cs
using System; using System.Collections.Generic; using System.Windows.Forms; using SqlDiffFramework.Forms; namespace SqlDiffFramework { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } } }
using System; using System.Collections.Generic; using System.Windows.Forms; namespace SqlDiffFramework { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } } }
mit
C#
5d50316ae7565979ecb40604c74c7da0649b632c
Add xmldoc
ZLima12/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,EVAST9919/osu,ppy/osu,ppy/osu,johnneijzen/osu,peppy/osu,2yangk23/osu,2yangk23/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,ZLima12/osu,peppy/osu,EVAST9919/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu-new,johnneijzen/osu,smoogipooo/osu,UselessToucan/osu,peppy/osu
osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs
osu.Game/Rulesets/Mods/IApplicableToScoreProcessor.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; namespace osu.Game.Rulesets.Mods { /// <summary> /// An interface for mods that make general adjustments to score processor. /// </summary> public interface IApplicableToScoreProcessor : IApplicableMod { void ApplyToScoreProcessor(ScoreProcessor scoreProcessor); /// <summary> /// Adjusts a rank value passed by <see cref="ScoreProcessor"> and returns it. /// </summary> ScoreRank AdjustRank(ScoreRank rank, double accuracy); } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; namespace osu.Game.Rulesets.Mods { /// <summary> /// An interface for mods that make general adjustments to score processor. /// </summary> public interface IApplicableToScoreProcessor : IApplicableMod { void ApplyToScoreProcessor(ScoreProcessor scoreProcessor); ScoreRank AdjustRank(ScoreRank rank, double accuracy); } }
mit
C#
a5a9a6398966d4f9f61e6cee3ed49ca26425f0a5
Read querystring instead of using route patterns
DeepakChoudhari/WeatherData-AzureFunction
WeatherDataFunctionApp/WeatherDataService.cs
WeatherDataFunctionApp/WeatherDataService.cs
namespace WeatherDataFunctionApp { using System; using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Azure.WebJobs.Host; public static class WeatherDataService { private static readonly HttpClient WeatherDataHttpClient = new HttpClient(); private static readonly string ApiUrl; static WeatherDataService() { string apiKey = System.Configuration.ConfigurationManager.AppSettings["ApiKey"]; ApiUrl = $"https://api.apixu.com/v1/current.json?key={apiKey}&q={{0}}"; } [FunctionName("WeatherDataService")] public static async Task<HttpResponseMessage> RunAsync([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)]HttpRequestMessage req, TraceWriter log) { log.Info("C# HTTP trigger function processed a request."); var queryNameValuePairs = req.GetQueryNameValuePairs(); var location = queryNameValuePairs.Where(pair => pair.Key.Equals("location", StringComparison.InvariantCultureIgnoreCase)).Select(queryParam => queryParam.Value).FirstOrDefault(); HttpResponseMessage responseMessage = await GetCurrentWeatherDataForLocation(location); if (responseMessage.IsSuccessStatusCode) return req.CreateResponse(HttpStatusCode.OK, responseMessage.Content.ReadAsAsync(typeof(object)).Result); log.Error($"Error occurred while trying to retrieve weather data for {req.Content.ReadAsStringAsync().Result}"); return req.CreateErrorResponse(HttpStatusCode.InternalServerError, "Internal Server Error."); } private static async Task<HttpResponseMessage> GetCurrentWeatherDataForLocation(string location) { return await WeatherDataHttpClient.GetAsync(String.Format(ApiUrl, location)); } } }
namespace WeatherDataFunctionApp { using System; using System.Net; using System.Net.Http; using System.Threading.Tasks; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Azure.WebJobs.Host; public static class WeatherDataService { private static readonly HttpClient WeatherDataHttpClient = new HttpClient(); private static readonly string ApiUrl; static WeatherDataService() { string apiKey = System.Configuration.ConfigurationManager.AppSettings["ApiKey"]; ApiUrl = $"https://api.apixu.com/v1/current.json?key={apiKey}&q={{0}}"; } [FunctionName("WeatherDataService")] public static async Task<HttpResponseMessage> RunAsync([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "WeatherDataService/Current/{location}")]HttpRequestMessage req, string location, TraceWriter log) { log.Info("C# HTTP trigger function processed a request."); HttpResponseMessage responseMessage = await GetCurrentWeatherDataForLocation(location); if (responseMessage.IsSuccessStatusCode) return req.CreateResponse(HttpStatusCode.OK, responseMessage.Content.ReadAsAsync(typeof(object)).Result); log.Error($"Error occurred while trying to retrieve weather data for {req.Content.ReadAsStringAsync().Result}"); return req.CreateErrorResponse(HttpStatusCode.InternalServerError, "Internal Server Error."); } private static async Task<HttpResponseMessage> GetCurrentWeatherDataForLocation(string location) { return await WeatherDataHttpClient.GetAsync(String.Format(ApiUrl, location)); } } }
mit
C#
ce60186784848751cb5ad07c32ea8e33fda4cd00
Remove dead code
ilovepi/Compiler,ilovepi/Compiler
compiler/Program/Program.cs
compiler/Program/Program.cs
using System.IO; using compiler.frontend; namespace Program { internal class Program { //TODO: adjust main to use the parser when it is complete private static void Main(string[] args) { using (var p = new Parser(@"../../testdata/test003.txt")) { p.Parse(); p.FlowCfg.GenerateDOTOutput(); using (var file = new StreamWriter("graph.txt")) { file.WriteLine(p.FlowCfg.DOTOutput); } } } } }
using System.IO; using compiler.frontend; namespace Program { internal class Program { //TODO: adjust main to use the parser when it is complete private static void Main(string[] args) { // using (Lexer l = new Lexer(@"../../testdata/big.txt")) // { // Token t; // do // { // t = l.GetNextToken(); // Console.WriteLine(TokenHelper.PrintToken(t)); // // } while (t != Token.EOF); // // // necessary when testing on windows with visual studio // //Console.WriteLine("Press 'enter' to exit ...."); // //Console.ReadLine(); // } using (var p = new Parser(@"../../testdata/test003.txt")) { p.Parse(); p.FlowCfg.GenerateDOTOutput(); using (var file = new StreamWriter("graph.txt")) { file.WriteLine(p.FlowCfg.DOTOutput); } } } } }
mit
C#
a0ad82374475349a9bc04dbde7c5ffb565ece941
Add comment as to why the AssemblyVersion and AssemblyFileVersion are different.
sillsdev/icu-dotnet,conniey/icu-dotnet,ermshiperete/icu-dotnet,ermshiperete/icu-dotnet,sillsdev/icu-dotnet,conniey/icu-dotnet
source/icu.net/Properties/AssemblyInfo.cs
source/icu.net/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("icu.net")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("SIL International")] [assembly: AssemblyProduct("icu.net")] [assembly: AssemblyCopyright("Copyright © SIL International 2007")] [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("3439151b-347b-4321-9f2f-d5fa28b46477")] // 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 Revision and Build Numbers // by using the '*' as shown below: // (The AssemblyVersion needs to match the version that Palaso builds against.) // (The AssemblyFileVersion matches the ICU version number we're building against.) [assembly: AssemblyVersion("4.2.1.0")] [assembly: AssemblyFileVersion("4.8.1.1")] //Location of the public/private key pair for strong naming this assembly --TA 7 Oct 2008 [assembly: AssemblyKeyFile("icu.net.snk")]
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("icu.net")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("SIL International")] [assembly: AssemblyProduct("icu.net")] [assembly: AssemblyCopyright("Copyright © SIL International 2007")] [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("3439151b-347b-4321-9f2f-d5fa28b46477")] // 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 Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("4.2.1.0")] [assembly: AssemblyFileVersion("4.8.1.1")] //Location of the public/private key pair for strong naming this assembly --TA 7 Oct 2008 [assembly: AssemblyKeyFile("icu.net.snk")]
mit
C#
4c5f4c51713c1fe6fe7fceb1c224165792668d4e
Bump required overlay plugin version to 0.13.0
quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot
plugin/CactbotOverlay/PluginLoader.cs
plugin/CactbotOverlay/PluginLoader.cs
using System.Windows.Forms; using RainbowMage.OverlayPlugin; using Advanced_Combat_Tracker; using System.Collections.Generic; using System.IO; using System.Linq; using System; namespace Cactbot { public class PluginLoader : IActPluginV1, IOverlayAddonV2 { private static AssemblyResolver asmResolver; private static Version kMinOverlayPluginVersion = new Version(0, 13, 0); public void DeInitPlugin() { } public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) { if (asmResolver == null) { asmResolver = new AssemblyResolver(new List<string>{GetPluginDirectory()}); } pluginStatusText.Text = "Ready."; // We don't need a tab here. ((TabControl)pluginScreenSpace.Parent).TabPages.Remove(pluginScreenSpace); if (GetOverlayPluginVersion() < kMinOverlayPluginVersion) { throw new Exception($"Cactbot requires OverlayPlugin {GetOverlayPluginVersion().ToString()}, " + $"found {kMinOverlayPluginVersion.ToString()}"); } } public void Init() { Registry.RegisterEventSource<CactbotEventSource>(); } private string GetPluginDirectory() { var plugin = ActGlobals.oFormActMain.ActPlugins.Where(x => x.pluginObj == this).FirstOrDefault(); if (plugin != null) { return Path.GetDirectoryName(plugin.pluginFile.FullName); } else { throw new Exception("Could not find ourselves in the plugin list!"); } } private Version GetOverlayPluginVersion() { return System.Reflection.Assembly.GetAssembly(typeof(IOverlay)).GetName().Version; } } }
using System.Windows.Forms; using RainbowMage.OverlayPlugin; using Advanced_Combat_Tracker; using System.Collections.Generic; using System.IO; using System.Linq; using System; namespace Cactbot { public class PluginLoader : IActPluginV1, IOverlayAddonV2 { private static AssemblyResolver asmResolver; private static Version kMinOverlayPluginVersion = new Version(0, 12, 2); public void DeInitPlugin() { } public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) { if (asmResolver == null) { asmResolver = new AssemblyResolver(new List<string>{GetPluginDirectory()}); } pluginStatusText.Text = "Ready."; // We don't need a tab here. ((TabControl)pluginScreenSpace.Parent).TabPages.Remove(pluginScreenSpace); if (GetOverlayPluginVersion() < kMinOverlayPluginVersion) { throw new Exception($"Cactbot requires OverlayPlugin {GetOverlayPluginVersion().ToString()}, " + $"found {kMinOverlayPluginVersion.ToString()}"); } } public void Init() { Registry.RegisterEventSource<CactbotEventSource>(); } private string GetPluginDirectory() { var plugin = ActGlobals.oFormActMain.ActPlugins.Where(x => x.pluginObj == this).FirstOrDefault(); if (plugin != null) { return Path.GetDirectoryName(plugin.pluginFile.FullName); } else { throw new Exception("Could not find ourselves in the plugin list!"); } } private Version GetOverlayPluginVersion() { return System.Reflection.Assembly.GetAssembly(typeof(IOverlay)).GetName().Version; } } }
apache-2.0
C#
16a85fb7f36a108b4d9f0bb1a5a823803210a858
Update GravatarHash
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/RoberthStrand.cs
src/Firehose.Web/Authors/RoberthStrand.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class RoberthStrand : IAmACommunityMember { public string FirstName => "Roberth"; public string LastName => "Strand"; public string ShortBioOrTagLine => "PowerShell, Azure, Security and other fun stuff!"; public string StateOrRegion => "Tromsø, Norway"; public string EmailAddress => "[email protected]"; public string TwitterHandle => "RoberthTweets"; public string GravatarHash => "b82b95a9133d614b90ef718572959d47"; public string GitHubHandle => "roberthstrand"; public GeoPosition Position => new GeoPosition(69.648491, 18.983705); public Uri WebSite => new Uri("https://robstr.dev"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://robstr.dev/powershell"); } } public string FeedLanguageCode => "en"; } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class RoberthStrand : IAmACommunityMember { public string FirstName => "Roberth"; public string LastName => "Strand"; public string ShortBioOrTagLine => "PowerShell, Azure, Security and other fun stuff!"; public string StateOrRegion => "Tromsø, Norway"; public string EmailAddress => "[email protected]"; public string TwitterHandle => "RoberthTweets"; public string GravatarHash => "0f8d0c1b68924de4beed584aefd30e20"; public string GitHubHandle => "roberthstrand"; public GeoPosition Position => new GeoPosition(69.648491, 18.983705); public Uri WebSite => new Uri("https://robstr.dev"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://robstr.dev/powershell"); } } public string FeedLanguageCode => "en"; } }
mit
C#
a056b67bdc8f2924f7c71fbfc83130f7a6f47e21
Fix build
aelij/roslynpad
src/RoslynPad.NetCore/PlatformsFactory.cs
src/RoslynPad.NetCore/PlatformsFactory.cs
using System.Composition; using System.Collections.Generic; using RoslynPad.UI; using System; using System.IO; using System.Runtime.InteropServices; using System.Diagnostics; using System.Collections.Immutable; namespace RoslynPad { [Export(typeof(IPlatformsFactory))] internal class PlatformsFactory : IPlatformsFactory { public IEnumerable<ExecutionPlatform> GetExecutionPlatforms() { var platform = IntPtr.Size == 8 ? "x64" : "x86"; var architecture = IntPtr.Size == 8 ? Architecture.X64 : Architecture.X86; var processExe = Process.GetCurrentProcess().MainModule.FileName; if (Path.GetFileNameWithoutExtension(processExe).Equals("dotnet", StringComparison.InvariantCultureIgnoreCase)) { // TODO: get all versions on non-Windows platforms yield return new ExecutionPlatform("Core " + platform, "netcoreapp", ImmutableArray.Create( new PlatformVersion("netcoreapp2.2", "Microsoft.NETCore.App", "2.2.0")), architecture, processExe, hostArguments: string.Empty); } } } }
using System.Composition; using System.Collections.Generic; using RoslynPad.UI; using System; using System.IO; using System.Runtime.InteropServices; using System.Diagnostics; namespace RoslynPad { [Export(typeof(IPlatformsFactory))] internal class PlatformsFactory : IPlatformsFactory { public IEnumerable<ExecutionPlatform> GetExecutionPlatforms() { var platform = IntPtr.Size == 8 ? "x64" : "x86"; var architecture = IntPtr.Size == 8 ? Architecture.X64 : Architecture.X86; var processExe = Process.GetCurrentProcess().MainModule.FileName; if (Path.GetFileNameWithoutExtension(processExe).Equals("dotnet", StringComparison.InvariantCultureIgnoreCase)) { yield return new ExecutionPlatform("Core " + platform, "netcoreapp2.2", architecture, processExe, string.Empty); } } } }
apache-2.0
C#
d448ef3196f004728f145dc6d0d4e1ce802f4560
Fix assembly copyright
AdtecSoftware/SagePayMvc,AdtecSoftware/Adtec.SagePayMvc,IntegratedArts/SagePayMvc,JeremySkinner/SagePayMvc,cergis-robert/SagePayMvc
src/SagePayMvc/Properties/AssemblyInfo.cs
src/SagePayMvc/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("SagePayMvc")] [assembly: AssemblyDescription("SagePay integration for ASP.NET MVC")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("The Sixth Form College Farnborough")] [assembly: AssemblyProduct("SagePayMvc")] [assembly: AssemblyCopyright("Copyright © The Sixth Form College Farnborough")] [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("e4ae6ce2-795a-4018-a081-44cdf4aba537")] // 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")]
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("SagePayMvc")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("SagePayMvc")] [assembly: AssemblyCopyright("Copyright © Microsoft 2009")] [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("e4ae6ce2-795a-4018-a081-44cdf4aba537")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
7e524032841f5f9b43b6170a70d125a68c074647
Fix account editing - error if account has a balance.
grae22/BoozeHoundCloud,grae22/BoozeHoundCloud,grae22/BoozeHoundCloud
BoozeHoundCloud/Areas/Core/Views/Account/AccountForm.cshtml
BoozeHoundCloud/Areas/Core/Views/Account/AccountForm.cshtml
@model BoozeHoundCloud.Areas.Core.ViewModels.AccountFormViewModel @{ bool isNewAccount = (Model.Id == 0); var formTitle = ""; if (isNewAccount) { formTitle = "Create Account"; } else { formTitle = "Edit Account"; } ViewBag.Title = formTitle; } <h2>@formTitle</h2> @using (Html.BeginForm("Save", "Account")) { <div class="form-group"> @Html.LabelFor(m => m.Name) @Html.TextBoxFor(m => m.Name, new { @class="form-control" }) @Html.ValidationMessageFor(m => m.Name) </div> <div class="form-group"> @Html.LabelFor(m => m.AccountTypeId) @if (isNewAccount) { @Html.DropDownListFor( m => m.AccountTypeId, new SelectList( Model.AccountTypes, "Id", "Name"), "Select one...", new { @class = "form-control" }) @Html.ValidationMessageFor(m => m.AccountTypeId) } else { @Html.TextBoxFor( m => m.AccountTypes.First(x => x.Id == Model.AccountTypeId).Name, new { @class = "form-control", @readonly = "true" } ) } </div> @Html.HiddenFor(m => m.Id) @Html.HiddenFor(m => m.AccountTypeId) @Html.HiddenFor(m => m.Balance) @Html.AntiForgeryToken() <button type="submit" class="btn btn-primary">Save</button> <button type="button" class="btn btn-default" onclick="history.go(-1);">Cancel</button> } @section scripts { @Scripts.Render( "~/bundles/jqueryval" ) }
@model BoozeHoundCloud.Areas.Core.ViewModels.AccountFormViewModel @{ bool isNewAccount = (Model.Id == 0); var formTitle = ""; if (isNewAccount) { formTitle = "Create Account"; } else { formTitle = "Edit Account"; } ViewBag.Title = formTitle; } <h2>@formTitle</h2> @using (Html.BeginForm("Save", "Account")) { <div class="form-group"> @Html.LabelFor(m => m.Name) @Html.TextBoxFor(m => m.Name, new { @class="form-control" }) @Html.ValidationMessageFor(m => m.Name) </div> <div class="form-group"> @Html.LabelFor(m => m.AccountTypeId) @if (isNewAccount) { @Html.DropDownListFor( m => m.AccountTypeId, new SelectList( Model.AccountTypes, "Id", "Name"), "Select one...", new { @class = "form-control" }) @Html.ValidationMessageFor(m => m.AccountTypeId) } else { @Html.TextBoxFor( m => m.AccountTypes.First(x => x.Id == Model.AccountTypeId).Name, new { @class = "form-control", @readonly = "true" } ) } </div> @Html.HiddenFor(m => m.Id); @Html.HiddenFor(m => m.AccountTypeId); @Html.AntiForgeryToken() <button type="submit" class="btn btn-primary">Save</button> <button type="button" class="btn btn-default" onclick="history.go(-1);">Cancel</button> } @section scripts { @Scripts.Render( "~/bundles/jqueryval" ) }
mit
C#
5b00546e146bab20b56662d66130664ed90cb8aa
Update AssemblyInfo.cs
BlarghLabs/MoarUtils
commands/reflection/AssemblyInfo.cs
commands/reflection/AssemblyInfo.cs
using System; using System.Reflection; namespace MoarUtils.Utils { public class AssemblyInfo { /// <summary> /// Gets the assembly product. /// </summary> /// <value>The assembly product.</value> public static string AssemblyProduct { get { // Get all Product attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); // If there aren't any Product attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Product attribute, return its value return ((AssemblyProductAttribute)attributes[0]).Product; } } public static string AssemblyCompany { get { // Get all Product attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); // If there aren't any Product attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Product attribute, return its value return ((AssemblyCompanyAttribute)attributes[0]).Company; } } public static string AssemblyName { get { //made this lame return Assembly.GetExecutingAssembly().GetName().Name.Trim().Replace(" ", ""); } } public static string ExecutingAssemblyPath { get { //made this lame return Assembly.GetExecutingAssembly().CodeBase.ToLower().Replace("\\", "/"); } } public static Version AssemblyVersion { get { //made this lame return Assembly.GetExecutingAssembly().GetName().Version; } } public static string VersionBuildNumber { get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } } }
using System; using System.Reflection; namespace MoarUtils.Utils { public class AssemblyInfo { /// <summary> /// Gets the assembly product. /// </summary> /// <value>The assembly product.</value> public static string AssemblyProduct { get { // Get all Product attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); // If there aren't any Product attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Product attribute, return its value return ((AssemblyProductAttribute)attributes[0]).Product; } } public static string AssemblyCompany { get { // Get all Product attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); // If there aren't any Product attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Product attribute, return its value return ((AssemblyCompanyAttribute)attributes[0]).Company; } } public static string AssemblyName { get { //made this lame return Assembly.GetExecutingAssembly().GetName().Name.Trim().Replace(" ", ""); } } public static string ExecutingAssemblyPath { get { //made this lame return Assembly.GetExecutingAssembly().CodeBase.ToLower().Replace("\\", "/"); } } public static Version AssemblyVersion { get { //made this lame return Assembly.GetExecutingAssembly().GetName().Version; } } } }
mit
C#
9ad3c0dbabead906282bc0c68f50598560e4e63e
Fix a camera problem
robnils/Samples
Graphics/TiledMap/TiledMap/TiledMapProject/JoystickScene.cs
Graphics/TiledMap/TiledMap/TiledMapProject/JoystickScene.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TiledMapProject.Entities; using WaveEngine.Common.Math; using WaveEngine.Components.Cameras; using WaveEngine.Framework; using WaveEngine.Framework.Services; namespace TiledMapProject { public class JoystickScene : Scene { public Joystick Joystick { get; private set; } public JumpButton JumpButton { get; private set; } protected override void CreateScene() { FixedCamera2D camera = new FixedCamera2D("camera") { ClearFlags = WaveEngine.Common.Graphics.ClearFlags.DepthAndStencil }; this.EntityManager.Add(camera); ViewportManager vm = WaveServices.ViewportManager; float width = vm.RightEdge - vm.LeftEdge; float halfWidth = width / 2; float height = vm.BottomEdge - vm.TopEdge; this.Joystick = new Joystick("joystick", new RectangleF(vm.LeftEdge, vm.TopEdge, halfWidth, height)); this.EntityManager.Add(this.Joystick); this.JumpButton = new JumpButton("jumpButton", new RectangleF(vm.LeftEdge + (halfWidth), vm.TopEdge, halfWidth, height)); this.EntityManager.Add(this.JumpButton); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TiledMapProject.Entities; using WaveEngine.Common.Math; using WaveEngine.Components.Cameras; using WaveEngine.Framework; using WaveEngine.Framework.Services; namespace TiledMapProject { public class JoystickScene : Scene { public Joystick Joystick { get; private set; } public JumpButton JumpButton { get; private set; } protected override void CreateScene() { FreeCamera2D camera = new FreeCamera2D("camera") { ClearFlags = WaveEngine.Common.Graphics.ClearFlags.DepthAndStencil }; this.EntityManager.Add(camera); ViewportManager vm = WaveServices.ViewportManager; float width = vm.RightEdge - vm.LeftEdge; float halfWidth = width / 2; float height = vm.BottomEdge - vm.TopEdge; this.Joystick = new Joystick("joystick", new RectangleF(vm.LeftEdge, vm.TopEdge, halfWidth, height)); this.EntityManager.Add(this.Joystick); this.JumpButton = new JumpButton("jumpButton", new RectangleF(vm.LeftEdge + (halfWidth), vm.TopEdge, halfWidth, height)); this.EntityManager.Add(this.JumpButton); } } }
mit
C#
c228f598823e4c78931e1b7f5c4a35ca98319b6d
Rename field.
Zakkgard/Moonfire
Moonfire/Core/Moonfire.Core/Networking/IncomingRealmPacket.cs
Moonfire/Core/Moonfire.Core/Networking/IncomingRealmPacket.cs
using Moonfire.Core.Constants; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Moonfire.Core.Networking { public class IncomingRealmPacket : IncomingPacket { public IncomingRealmPacket(byte[] packet, int length) : base(packet, 0, length) { this.Lenght = base.ReadUInt16(); this.PacketId = (WorldOpCode)base.ReadUInt16(); } public WorldOpCode PacketId { get; set; } public uint Lenght { get; set; } } }
using Moonfire.Core.Constants; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Moonfire.Core.Networking { public class IncomingRealmPacket : IncomingPacket { public IncomingRealmPacket(byte[] packet, int length) : base(packet, 0, length) { this.Length = base.ReadUInt16(); this.PacketId = (WorldOpCode)base.ReadUInt16(); } public WorldOpCode PacketId { get; set; } public uint Length { get; set; } } }
mit
C#
607094c25dbf74438d76a31702e1590349aeb233
Fix newlines for windows
Jaywd/binary.fail.project.haumea
haumea.desktopgl/Parsing/Parser/Parser.Shared.cs
haumea.desktopgl/Parsing/Parser/Parser.Shared.cs
using System; using System.Collections.Generic; using System.Text.RegularExpressions; using Microsoft.Xna.Framework; namespace Haumea.Parsing { internal static partial class Parser { // Parses this vector notation: (x, y) private static Regex VectorRgx { get; } = new Regex(@" *\( *(-?\d+) *, *(-?\d+) *\) *"); private static IEnumerable<string> Lines(string text) { if (text.Length == 0) yield break; foreach (string line in text.Split(new [] { Environment.NewLine })) { if (line.Length > 0) yield return line; } } private static bool TryParseHexColor(string hexString, out Color color) { if (hexString.StartsWith("#")) hexString = hexString.Substring(1); uint hex = Convert.ToUInt32(hexString, 16); if (hexString.Length != 6) { color = default(Color); return false; } byte r = (byte)(hex >> 16); byte g = (byte)(hex >> 8); byte b = (byte)(hex); color = new Color(r, g, b); return true; } } }
using System; using System.Collections.Generic; using System.Text.RegularExpressions; using Microsoft.Xna.Framework; namespace Haumea.Parsing { internal static partial class Parser { // Parses this vector notation: (x, y) private static Regex VectorRgx { get; } = new Regex(@" *\( *(-?\d+) *, *(-?\d+) *\) *"); private static IEnumerable<string> Lines(string text) { if (text.Length == 0) yield break; foreach (string line in text.Split('\n')) { if (line.Length > 0) yield return line; } } private static bool TryParseHexColor(string hexString, out Color color) { if (hexString.StartsWith("#")) hexString = hexString.Substring(1); uint hex = Convert.ToUInt32(hexString, 16); if (hexString.Length != 6) { color = default(Color); return false; } byte r = (byte)(hex >> 16); byte g = (byte)(hex >> 8); byte b = (byte)(hex); color = new Color(r, g, b); return true; } } }
mit
C#
bf041379c832c324ea0e006bfc1b042cd8a8c90d
Add null check to FilterDescriptorExtensions (#25)
ASP-NET-Core-Boilerplate/Framework,ASP-NET-Core-Boilerplate/Framework,ASP-NET-Core-Boilerplate/Framework,ASP-NET-MVC-Boilerplate/Framework,ASP-NET-Core-Boilerplate/Framework,ASP-NET-MVC-Boilerplate/Framework
Source/Boxed.AspNetCore.Swagger/FilterDescriptorExtensions.cs
Source/Boxed.AspNetCore.Swagger/FilterDescriptorExtensions.cs
namespace Boxed.AspNetCore.Swagger { using System.Collections.Generic; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.AspNetCore.Mvc.Filters; internal static class FilterDescriptorExtensions { public static IList<IAuthorizationRequirement> GetPolicyRequirements( this IList<FilterDescriptor> filterDescriptors) { var policyRequirements = new List<IAuthorizationRequirement>(); for (var i = filterDescriptors.Count - 1; i >= 0; --i) { var filterDescriptor = filterDescriptors[i]; if (filterDescriptor.Filter is AllowAnonymousFilter) { break; } if (filterDescriptor.Filter is AuthorizeFilter authorizeFilter) { if (authorizeFilter.Policy != null) { policyRequirements.AddRange(authorizeFilter.Policy.Requirements); } } } return policyRequirements; } } }
namespace Boxed.AspNetCore.Swagger { using System.Collections.Generic; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.Authorization; using Microsoft.AspNetCore.Mvc.Filters; internal static class FilterDescriptorExtensions { public static IList<IAuthorizationRequirement> GetPolicyRequirements( this IList<FilterDescriptor> filterDescriptors) { var policyRequirements = new List<IAuthorizationRequirement>(); for (var i = filterDescriptors.Count - 1; i >= 0; --i) { var filterDescriptor = filterDescriptors[i]; if (filterDescriptor.Filter is AllowAnonymousFilter) { break; } if (filterDescriptor.Filter is AuthorizeFilter authorizeFilter) { policyRequirements.AddRange(authorizeFilter.Policy.Requirements); } } return policyRequirements; } } }
mit
C#
8aab8adc9f42392cdf74711bf3cd4dec03957da7
Fix for issue #14 (difference between protocol description and server implementation in TickUpdate message)
andrii1812/galcon-server,andrii1812/galcon-server,andrii1812/galcon-server,andrii1812/galcon-server
src/Model/Flight.cs
src/Model/Flight.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace GalconServer.Model { using System.Threading; using Newtonsoft.Json; public class Flight { private int _currentPosition; public int ID { get; private set; } [JsonProperty("owner")] public int OwnerID { get; private set; } [JsonProperty("from")] public int FromPlanet { get; private set; } [JsonProperty("to")] public int ToPlanet { get; private set; } public int Population { get; private set; } public int TotalPath { get; private set; } public int CurrentPosition { get { return _currentPosition; } private set { _currentPosition = value; } } public Flight(int id, int ownerID, int fromPlanet, int toPlanet, int population, int totalPath) { ID = id; OwnerID = ownerID; FromPlanet = fromPlanet; ToPlanet = toPlanet; Population = population; TotalPath = totalPath; CurrentPosition = 0; } public void Move() { Interlocked.Increment(ref _currentPosition); } public bool HasArrived() { return CurrentPosition >= TotalPath; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace GalconServer.Model { using System.Threading; public class Flight { private int _currentPosition; public int ID { get; private set; } public int OwnerID { get; private set; } public int FromPlanet { get; private set; } public int ToPlanet { get; private set; } public int Population { get; private set; } public int TotalPath { get; private set; } public int CurrentPosition { get { return _currentPosition; } private set { _currentPosition = value; } } public Flight(int id, int ownerID, int fromPlanet, int toPlanet, int population, int totalPath) { ID = id; OwnerID = ownerID; FromPlanet = fromPlanet; ToPlanet = toPlanet; Population = population; TotalPath = totalPath; CurrentPosition = 0; } public void Move() { Interlocked.Increment(ref _currentPosition); } public bool HasArrived() { return CurrentPosition >= TotalPath; } } }
apache-2.0
C#
29dd66762de326207c01fe21d02fe7f852f3a3fd
Remove potential recursive method call in string.Format overload
scottrippey/SmartFormat.NET
src/SmartFormat/Smart.cs
src/SmartFormat/Smart.cs
using System; using SmartFormat.Core.Extensions; using SmartFormat.Extensions; namespace SmartFormat { /// <summary> /// This class holds a Default instance of the SmartFormatter. /// The default instance has all extensions registered. /// </summary> public static class Smart { #region: Smart.Format : public static string Format(string format, params object[] args) { return Default.Format(format, args); } public static string Format(IFormatProvider provider, string format, params object[] args) { return Default.Format(provider, format, args); } #endregion #region: Overloads - Just to match the signature of String.Format, and allow support for programming languages that don't support "params" : public static string Format(string format, object arg0, object arg1, object arg2) { return Format(format, new object[] { arg0, arg1, arg2 }); } public static string Format(string format, object arg0, object arg1) { return Format(format, new object[] { arg0, arg1 }); } public static string Format(string format, object arg0) { return Default.Format(format, new object[] { arg0 }); // call Default.Format in order to avoid infinite recursive method call } #endregion #region: Default formatter : private static SmartFormatter _default; public static SmartFormatter Default { get { if (_default == null) _default = CreateDefaultSmartFormat(); return _default; } set { _default = value; } } public static SmartFormatter CreateDefaultSmartFormat() { // Register all default extensions here: var result = new SmartFormatter(); // Add all extensions: // Note, the order is important; the extensions // will be executed in this order: var listFormatter = new ListFormatter(result); result.AddExtensions( (ISource)listFormatter, new ReflectionSource(result), new DictionarySource(result), new XmlSource(result), // These default extensions reproduce the String.Format behavior: new DefaultSource(result) ); result.AddExtensions( (IFormatter)listFormatter, new PluralLocalizationFormatter("en"), new ConditionalFormatter(), new TimeFormatter("en"), new XElementFormatter(), new ChooseFormatter(), new DefaultFormatter() ); return result; } #endregion } }
using System; using SmartFormat.Core.Extensions; using SmartFormat.Extensions; namespace SmartFormat { /// <summary> /// This class holds a Default instance of the SmartFormatter. /// The default instance has all extensions registered. /// </summary> public static class Smart { #region: Smart.Format : public static string Format(string format, params object[] args) { return Default.Format(format, args); } public static string Format(IFormatProvider provider, string format, params object[] args) { return Default.Format(provider, format, args); } #endregion #region: Overloads - Just to match the signature of String.Format, and allow support for programming languages that don't support "params" : public static string Format(string format, object arg0, object arg1, object arg2) { return Format(format, new object[] { arg0, arg1, arg2 }); } public static string Format(string format, object arg0, object arg1) { return Format(format, new object[] { arg0, arg1 }); } public static string Format(string format, object arg0) { return Format(format, new object[] { arg0 }); } #endregion #region: Default formatter : private static SmartFormatter _default; public static SmartFormatter Default { get { if (_default == null) _default = CreateDefaultSmartFormat(); return _default; } set { _default = value; } } public static SmartFormatter CreateDefaultSmartFormat() { // Register all default extensions here: var result = new SmartFormatter(); // Add all extensions: // Note, the order is important; the extensions // will be executed in this order: var listFormatter = new ListFormatter(result); result.AddExtensions( (ISource)listFormatter, new ReflectionSource(result), new DictionarySource(result), new XmlSource(result), // These default extensions reproduce the String.Format behavior: new DefaultSource(result) ); result.AddExtensions( (IFormatter)listFormatter, new PluralLocalizationFormatter("en"), new ConditionalFormatter(), new TimeFormatter("en"), new XElementFormatter(), new ChooseFormatter(), new DefaultFormatter() ); return result; } #endregion } }
mit
C#
ff7fbcac2c090632d598bedfb80967cf286dbda3
update DfmNoteBlockRule. (#1491)
hellosnow/docfx,dotnet/docfx,superyyrrzz/docfx,hellosnow/docfx,pascalberger/docfx,DuncanmaMSFT/docfx,dotnet/docfx,928PJY/docfx,hellosnow/docfx,DuncanmaMSFT/docfx,pascalberger/docfx,928PJY/docfx,pascalberger/docfx,dotnet/docfx,928PJY/docfx,superyyrrzz/docfx,superyyrrzz/docfx
src/Microsoft.DocAsCode.Dfm/Rules/DfmNoteBlockRule.cs
src/Microsoft.DocAsCode.Dfm/Rules/DfmNoteBlockRule.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.Dfm { using System; using System.Text.RegularExpressions; using Microsoft.DocAsCode.MarkdownLite; using Microsoft.DocAsCode.MarkdownLite.Matchers; public class DfmNoteBlockRule : IMarkdownRule { private static readonly Matcher _NoteMatcher = Matcher.WhiteSpacesOrEmpty + "[!" + ( Matcher.CaseInsensitiveString("note") | Matcher.CaseInsensitiveString("warning") | Matcher.CaseInsensitiveString("tip") | Matcher.CaseInsensitiveString("important") | Matcher.CaseInsensitiveString("caution") ).ToGroup("notetype") + ']' + Matcher.WhiteSpacesOrEmpty + Matcher.NewLine.RepeatAtLeast(0); private static readonly Regex _dfmNoteRegex = new Regex(@"^(?<rawmarkdown> *\[\!(?<notetype>(NOTE|WARNING|TIP|IMPORTANT|CAUTION))\] *\n?)(?<text>.*)(?:\n|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase, TimeSpan.FromSeconds(10)); public virtual string Name => "DfmNote"; [Obsolete] public virtual Regex DfmNoteRegex => _dfmNoteRegex; public virtual Matcher NoteMatcher => _NoteMatcher; public virtual IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context) { if (!parser.Context.Variables.ContainsKey(MarkdownBlockContext.IsBlockQuote) || !(bool)parser.Context.Variables[MarkdownBlockContext.IsBlockQuote]) { return null; } if (DfmNoteRegex != _dfmNoteRegex) { return TryMatchOld(parser, context); } var match = context.Match(NoteMatcher); if (match?.Length > 0) { var sourceInfo = context.Consume(match.Length); return new DfmNoteBlockToken(this, parser.Context, match["notetype"].GetValue(), sourceInfo.Markdown, sourceInfo); } return null; } private IMarkdownToken TryMatchOld(IMarkdownParser parser, IMarkdownParsingContext context) { var match = DfmNoteRegex.Match(context.CurrentMarkdown); if (match.Length == 0) { return null; } var sourceInfo = context.Consume(match.Groups["rawmarkdown"].Length); return new DfmNoteBlockToken(this, parser.Context, match.Groups["notetype"].Value, match.Groups["rawmarkdown"].Value, sourceInfo); } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.Dfm { using System; using System.Text.RegularExpressions; using Microsoft.DocAsCode.MarkdownLite; public class DfmNoteBlockRule : IMarkdownRule { private static readonly Regex _dfmNoteRegex = new Regex(@"^(?<rawmarkdown> *\[\!(?<notetype>(NOTE|WARNING|TIP|IMPORTANT|CAUTION))\] *\n?)(?<text>.*)(?:\n|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase, TimeSpan.FromSeconds(10)); public virtual string Name => "DfmNote"; public virtual Regex DfmNoteRegex => _dfmNoteRegex; public virtual IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context) { if (!parser.Context.Variables.ContainsKey(MarkdownBlockContext.IsBlockQuote) || !(bool)parser.Context.Variables[MarkdownBlockContext.IsBlockQuote]) { return null; } var match = DfmNoteRegex.Match(context.CurrentMarkdown); if (match.Length == 0) { return null; } var sourceInfo = context.Consume(match.Groups["rawmarkdown"].Length); return new DfmNoteBlockToken(this, parser.Context, match.Groups["notetype"].Value, match.Groups["rawmarkdown"].Value, sourceInfo); } } }
mit
C#
03addc3270a596e8df5c9a7965e6f2c982c42c71
Add informational logging to launcher
cloudfoundry-incubator/windows_app_lifecycle,cloudfoundry/windows_app_lifecycle,stefanschneider/windows_app_lifecycle
Launcher/Program.cs
Launcher/Program.cs
using Microsoft.Web.Administration; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json.Linq; namespace Launcher { public class ExecutionMetadata { [JsonProperty("start_command")] public string DetectedStartCommand { get; set; } [JsonProperty("start_command_args")] public string[] StartCommandArgs { get; set; } } class Program { static int Main(string[] args) { if (args.Length < 3) { Console.Error.WriteLine("Launcher was run with insufficient arguments. The arguments were: {0}", String.Join(" ", args)); return 1; } ExecutionMetadata executionMetadata = null; try { executionMetadata = JsonConvert.DeserializeObject<ExecutionMetadata>(args[2]); } catch (Exception ex) { Console.Error.WriteLine( "Launcher was run with invalid JSON for the metadata argument. The JSON was: {0}", args[2]); return 1; } var startInfo = new ProcessStartInfo { UseShellExecute = false, FileName = executionMetadata.DetectedStartCommand, Arguments = ArgumentEscaper.Escape(executionMetadata.StartCommandArgs), }; Console.Out.WriteLine("Run {0} :with: {1}", startInfo.FileName, startInfo.Arguments); var process = Process.Start(startInfo); process.WaitForExit(); return process.ExitCode; } } }
using Microsoft.Web.Administration; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json.Linq; namespace Launcher { public class ExecutionMetadata { [JsonProperty("start_command")] public string DetectedStartCommand { get; set; } [JsonProperty("start_command_args")] public string[] StartCommandArgs { get; set; } } class Program { static int Main(string[] args) { if (args.Length < 3) { Console.Error.WriteLine("Launcher was run with insufficient arguments. The arguments were: {0}", String.Join(" ", args)); return 1; } ExecutionMetadata executionMetadata = null; try { executionMetadata = JsonConvert.DeserializeObject<ExecutionMetadata>(args[2]); } catch (Exception ex) { Console.Error.WriteLine( "Launcher was run with invalid JSON for the metadata argument. The JSON was: {0}", args[2]); return 1; } var startInfo = new ProcessStartInfo { UseShellExecute = false, FileName = executionMetadata.DetectedStartCommand, Arguments = ArgumentEscaper.Escape(executionMetadata.StartCommandArgs), }; var process = Process.Start(startInfo); process.WaitForExit(); return process.ExitCode; } } }
apache-2.0
C#
bbb7bcb79701b33a8ffd1c27ef5a3ecc76fcfca2
use ienumerable instead of list
carterjones/beaengine-cs,carterjones/beaengine-cs,carterjones/bunseki,carterjones/bunseki
Bunseki/Disassembler.cs
Bunseki/Disassembler.cs
// This is free and unencumbered software released into the public domain. namespace Bunseki { using System; using System.Collections.Generic; using System.Linq; using System.Text; using BeaEngineCS; public class Disassembler { public enum Architecture { x86_32 = 1, x86_64, } public enum InternalDisassembler { BeaEngine = 1, } public Architecture TargetArchitecture { get; set; } public InternalDisassembler Engine { get; set; } public IEnumerable<Instruction> DisassembleInstructions(byte[] data) { return this.DisassembleInstructions(data, IntPtr.Zero); } public IEnumerable<Instruction> DisassembleInstructions(byte[] data, IntPtr virtualAddress) { if (this.Engine == InternalDisassembler.BeaEngine) { BeaEngine.Architecture architecture; if (this.TargetArchitecture == Architecture.x86_32) { architecture = BeaEngine.Architecture.x86_32; } else if (this.TargetArchitecture == Architecture.x86_64) { architecture = BeaEngine.Architecture.x86_64; } else { architecture = BeaEngine.Architecture.x86_32; } foreach (BeaEngine._Disasm inst in BeaEngine.Disassemble(data, virtualAddress, architecture)) { yield return new Instruction(inst); } } else { yield break; } } } }
// This is free and unencumbered software released into the public domain. namespace Bunseki { using System; using System.Collections.Generic; using System.Linq; using System.Text; using BeaEngineCS; public class Disassembler { public enum Architecture { x86_32 = 1, x86_64, } public enum InternalDisassembler { BeaEngine = 1, } public Architecture TargetArchitecture { get; set; } public InternalDisassembler Engine { get; set; } public List<Instruction> DisassembleInstructions(byte[] data) { return this.DisassembleInstructions(data, IntPtr.Zero); } public List<Instruction> DisassembleInstructions(byte[] data, IntPtr virtualAddress) { if (this.Engine == InternalDisassembler.BeaEngine) { BeaEngine.Architecture architecture; if (this.TargetArchitecture == Architecture.x86_32) { architecture = BeaEngine.Architecture.x86_32; } else if (this.TargetArchitecture == Architecture.x86_64) { architecture = BeaEngine.Architecture.x86_64; } else { architecture = BeaEngine.Architecture.x86_32; } List<BeaEngine._Disasm> beaInstructions = BeaEngine.Disassemble(ref data, virtualAddress, architecture); List<Instruction> instructions = new List<Instruction>(); foreach (BeaEngine._Disasm inst in beaInstructions) { instructions.Add(new Instruction(inst)); } return instructions; } else { return new List<Instruction>(); } } } }
bsd-2-clause
C#
53ea6fb1a844e8fd665f9f1e32be8125102a9fce
Refactor verbose log of SingleThreadScheduler.
rubyu/CreviceApp,rubyu/CreviceApp
CreviceApp/Threading.cs
CreviceApp/Threading.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace CreviceApp.Threading { // http://www.codeguru.com/csharp/article.php/c18931/Understanding-the-NET-Task-Parallel-Library-TaskScheduler.htm public class SingleThreadScheduler : TaskScheduler, IDisposable { private readonly BlockingCollection<Task> tasks = new BlockingCollection<Task>(); private readonly Thread thread; public SingleThreadScheduler() : this(ThreadPriority.Normal) { } public SingleThreadScheduler(ThreadPriority priority) { this.thread = new Thread(new ThreadStart(Main)); this.thread.Priority = priority; this.thread.Start(); } private void Main() { Verbose.Print("SingleThreadScheduler(ThreadID: 0x{0:X}) was started.", Thread.CurrentThread.ManagedThreadId); foreach (var t in tasks.GetConsumingEnumerable()) { TryExecuteTask(t); } } protected override IEnumerable<Task> GetScheduledTasks() { return tasks.ToArray(); } protected override void QueueTask(Task task) { tasks.Add(task); } protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued) { return false; } public void Dispose() { GC.SuppressFinalize(this); tasks.CompleteAdding(); } ~SingleThreadScheduler() { Dispose(); } } }
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace CreviceApp.Threading { // http://www.codeguru.com/csharp/article.php/c18931/Understanding-the-NET-Task-Parallel-Library-TaskScheduler.htm public class SingleThreadScheduler : TaskScheduler, IDisposable { private readonly BlockingCollection<Task> tasks = new BlockingCollection<Task>(); private readonly Thread thread; public SingleThreadScheduler() : this(ThreadPriority.Normal) { } public SingleThreadScheduler(ThreadPriority priority) { this.thread = new Thread(new ThreadStart(Main)); this.thread.Priority = priority; this.thread.Start(); } private void Main() { Verbose.Print("SingleThreadScheduler was started; Thread ID: 0x{0:X}", Thread.CurrentThread.ManagedThreadId); foreach (var t in tasks.GetConsumingEnumerable()) { TryExecuteTask(t); } } protected override IEnumerable<Task> GetScheduledTasks() { return tasks.ToArray(); } protected override void QueueTask(Task task) { tasks.Add(task); } protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued) { return false; } public void Dispose() { GC.SuppressFinalize(this); tasks.CompleteAdding(); } ~SingleThreadScheduler() { Dispose(); } } }
mit
C#
08a7172eb2a43d018627de9ad591a76c43b10a2c
Update Assembly Properties.
GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,jsimonweb/csharp-docs-samples,jsimonweb/csharp-docs-samples,jsimonweb/csharp-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,GoogleCloudPlatform/dotnet-docs-samples,jsimonweb/csharp-docs-samples
auth/Properties/AssemblyInfo.cs
auth/Properties/AssemblyInfo.cs
 using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Auth")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Auth")] [assembly: AssemblyCopyright("Copyright \u00A9 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("a0c89840-bc5c-4ec6-913c-f8a8c6b7f525")] // 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")]
 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("BigQuery")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BigQuery")] [assembly: AssemblyCopyright("Copyright \u00A9 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("a0c89840-bc5c-4ec6-913c-f8a8c6b7f525")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
82671c2d839ad7d273b63866ab623b8cd103fc4d
Test case includes string with quotes.
ecologylab/simplCSharp
ecologylabFundamentalTestCases/Polymorphic/Configuration.cs
ecologylabFundamentalTestCases/Polymorphic/Configuration.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using ecologylab.serialization; using ecologylab.attributes; namespace ecologylabFundamentalTestCases.Polymorphic { /** * * <configuration> <pref_double name="index_thumb_dist" value="200"/> </configuration> * */ public class Configuration : ElementState { [simpl_nowrap] [simpl_scope("testScope")] //[simpl_classes(new Type[] { typeof(Pref), typeof(PrefDouble) })] [simpl_map] public Dictionary<String, Pref> prefs = new Dictionary<string, Pref>(); #region GetterSetters public Dictionary<String, Pref> Preferences { get { return prefs; } set { prefs = value; } } #endregion internal void fillDictionary() { PrefDouble prefDouble = new PrefDouble(); prefDouble.Name = "index_thumb_dist \"now with a double quote\" and a 'single quote' "; prefDouble.Value = 200; Pref pref = new Pref(); pref.Name = "test_name"; prefs.Add(prefDouble.Name, prefDouble); prefs.Add(pref.Name, pref); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using ecologylab.serialization; using ecologylab.attributes; namespace ecologylabFundamentalTestCases.Polymorphic { /** * * <configuration> <pref_double name="index_thumb_dist" value="200"/> </configuration> * */ public class Configuration : ElementState { [simpl_nowrap] [simpl_scope("testScope")] //[simpl_classes(new Type[] { typeof(Pref), typeof(PrefDouble) })] [simpl_map] public Dictionary<String, Pref> prefs = new Dictionary<string, Pref>(); #region GetterSetters public Dictionary<String, Pref> Preferences { get { return prefs; } set { prefs = value; } } #endregion internal void fillDictionary() { PrefDouble prefDouble = new PrefDouble(); prefDouble.Name = "index_thumb_dist"; prefDouble.Value = 200; Pref pref = new Pref(); pref.Name = "test_name"; prefs.Add(prefDouble.Name, prefDouble); prefs.Add(pref.Name, pref); } } }
apache-2.0
C#
904d258dc34c343d75bfd1fb544af9c759565f09
Fix checkbox not updating correctly.
smoogipoo/osu,peppy/osu,nyaamara/osu,peppy/osu,johnneijzen/osu,smoogipooo/osu,ppy/osu,peppy/osu,UselessToucan/osu,default0/osu,EVAST9919/osu,RedNesto/osu,UselessToucan/osu,theguii/osu,UselessToucan/osu,2yangk23/osu,ppy/osu,DrabWeb/osu,ppy/osu,peppy/osu-new,naoey/osu,johnneijzen/osu,smoogipoo/osu,NeoAdonis/osu,Nabile-Rahmani/osu,Frontear/osuKyzer,smoogipoo/osu,ZLima12/osu,osu-RP/osu-RP,Drezi126/osu,NeoAdonis/osu,EVAST9919/osu,NotKyon/lolisu,DrabWeb/osu,NeoAdonis/osu,Damnae/osu,naoey/osu,2yangk23/osu,DrabWeb/osu,ZLima12/osu,naoey/osu,tacchinotacchi/osu
osu.Game/Overlays/Options/CheckBoxOption.cs
osu.Game/Overlays/Options/CheckBoxOption.cs
using System; using osu.Framework.Configuration; using osu.Framework.Graphics.UserInterface; namespace osu.Game.Overlays.Options { public class CheckBoxOption : BasicCheckBox { private Bindable<bool> bindable; public Bindable<bool> Bindable { set { if (bindable != null) bindable.ValueChanged -= bindableValueChanged; bindable = value; if (bindable != null) { bool state = State == CheckBoxState.Checked; if (state != bindable.Value) State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; bindable.ValueChanged += bindableValueChanged; } } } private void bindableValueChanged(object sender, EventArgs e) { State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; } protected override void Dispose(bool isDisposing) { if (bindable != null) bindable.ValueChanged -= bindableValueChanged; base.Dispose(isDisposing); } protected override void OnChecked() { if (bindable != null) bindable.Value = true; base.OnChecked(); } protected override void OnUnchecked() { if (bindable != null) bindable.Value = false; base.OnUnchecked(); } } }
using System; using osu.Framework.Configuration; using osu.Framework.Graphics.UserInterface; namespace osu.Game.Overlays.Options { public class CheckBoxOption : BasicCheckBox { private Bindable<bool> bindable; public Bindable<bool> Bindable { set { if (bindable != null) bindable.ValueChanged -= bindableValueChanged; bindable = value; if (bindable != null) { bool state = State == CheckBoxState.Checked; if (state != bindable.Value) State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; bindable.ValueChanged += bindableValueChanged; } } } private void bindableValueChanged(object sender, EventArgs e) { State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; } protected override void Dispose(bool isDisposing) { if (bindable != null) bindable.ValueChanged -= bindableValueChanged; base.Dispose(isDisposing); } protected override void OnChecked() { if (bindable != null) bindable.Value = true; base.OnChecked(); } protected override void OnUnchecked() { if (bindable != null) bindable.Value = false; base.OnChecked(); } } }
mit
C#
8b113ab8678e27f621ba7b69d2eb57758fafae08
Add summary Hasher :octocat:
lPinchol/Launcher-AutoUpdate
Launcher/SharpUpdate/SharpUpdate/Hasher.cs
Launcher/SharpUpdate/SharpUpdate/Hasher.cs
using System.IO; using System.Security.Cryptography; using System.Text; namespace SharpUpdate { /// <summary> /// The type of hash to create /// </summary> internal enum HashType { MD5, SHA1, SHA512 } /// <summary> /// Class used to generate hash sums of files /// </summary> internal class Hasher { /// <summary> /// Generate a hash sum of a file /// </summary> /// <param name="filePath">The file to hash</param> /// <param name="algo">The type of hash</param> /// <returns>The computed hash</returns> internal static string HashFile(string filePath, HashType algo) { switch (algo) { case HashType.MD5: return MakeHashString(MD5.Create().ComputeHash(new FileStream(filePath, FileMode.Open))); case HashType.SHA1: return MakeHashString(MD5.Create().ComputeHash(new FileStream(filePath, FileMode.Open))); case HashType.SHA512: return MakeHashString(MD5.Create().ComputeHash(new FileStream(filePath, FileMode.Open))); default: return ""; } } /// <summary> /// Convert byte[] to string /// </summary> /// <param name="hash">The hash tp convert</param> /// <returns>Hash as string</returns> private static string MakeHashString(byte[] hash) { StringBuilder s = new StringBuilder(hash.Length * 2); foreach (byte b in hash) s.Append(b.ToString("X2").ToLower()); return s.ToString(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SharpUpdate { class Hasher { } }
apache-2.0
C#
d7aadfd25ada4488d6ee8feb38b19a2651e0bf02
Update TransformPlus.cs
xxmon/unity
Editor/TransformPlus.cs
Editor/TransformPlus.cs
using UnityEngine; using System.Collections; using UnityEditor; [CustomEditor (typeof(Transform))] public class TransformPlus : Editor { Transform myTarget; float inch = 2.54f / 100.0f; float foot = 30.48f / 100.0f; bool showPosition = true; bool showRotation = true; bool showScale = true; public override void OnInspectorGUI () { myTarget = (Transform)target; showPosition = EditorGUILayout.Foldout (showPosition, "Position"); if (showPosition) { myTarget.localPosition = EditorGUILayout.Vector3Field ("Meter", myTarget.localPosition); myTarget.localPosition = EditorGUILayout.Vector3Field ("Inch", myTarget.localPosition / inch) * inch; myTarget.localPosition = EditorGUILayout.Vector3Field ("Foot", myTarget.localPosition / foot) * foot; } showRotation = EditorGUILayout.Foldout (showRotation, "Rotation"); if (showRotation) { myTarget.localEulerAngles = EditorGUILayout.Vector3Field ("Rotation", myTarget.localEulerAngles); } showScale = EditorGUILayout.Foldout (showScale, "Scale"); if (showScale) { myTarget.localScale = EditorGUILayout.Vector3Field ("Meter", myTarget.localScale); myTarget.localScale = EditorGUILayout.Vector3Field ("Inch", myTarget.localScale / inch) * inch; myTarget.localScale = EditorGUILayout.Vector3Field ("Foot", myTarget.localScale / foot) * foot; } } }
using UnityEngine; using System.Collections; using UnityEditor; [CustomEditor (typeof(Transform))] public class TransformPlus : Editor { Transform myTarget; float inch = 2.54f / 100.0f; float foot = 30.48f / 100.0f; bool showPosition; bool showRotation; bool showScale; public override void OnInspectorGUI () { myTarget = (Transform)target; showPosition = EditorGUILayout.Foldout (showPosition, "Position"); if (showPosition) { myTarget.localPosition = EditorGUILayout.Vector3Field ("Meter", myTarget.localPosition); myTarget.localPosition = EditorGUILayout.Vector3Field ("Inch", myTarget.localPosition / inch) * inch; myTarget.localPosition = EditorGUILayout.Vector3Field ("Foot", myTarget.localPosition / foot) * foot; } showRotation = EditorGUILayout.Foldout (showRotation, "Rotation"); if (showRotation) { myTarget.localEulerAngles = EditorGUILayout.Vector3Field ("Rotation", myTarget.localEulerAngles); } showScale = EditorGUILayout.Foldout (showScale, "Scale"); if (showScale) { myTarget.localScale = EditorGUILayout.Vector3Field ("Meter", myTarget.localScale); myTarget.localScale = EditorGUILayout.Vector3Field ("Inch", myTarget.localScale / inch) * inch; myTarget.localScale = EditorGUILayout.Vector3Field ("Foot", myTarget.localScale / foot) * foot; } } }
mit
C#
e9036f592181efe30f130a0b345275b6b67d9877
Use GtkEngine.ReplaceChild when setting multiple time .Content on a custom widget
antmicro/xwt,iainx/xwt,residuum/xwt,steffenWi/xwt,akrisiun/xwt,mminns/xwt,TheBrainTech/xwt,hamekoz/xwt,mono/xwt,directhex/xwt,cra0zy/xwt,mminns/xwt,lytico/xwt,sevoku/xwt,hwthomas/xwt
Xwt.Gtk/Xwt.GtkBackend/CustomWidgetBackend.cs
Xwt.Gtk/Xwt.GtkBackend/CustomWidgetBackend.cs
// // CustomWidgetBackend.cs // // Author: // Lluis Sanchez <[email protected]> // // Copyright (c) 2011 Xamarin Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Xwt.Backends; namespace Xwt.GtkBackend { public class CustomWidgetBackend: WidgetBackend, ICustomWidgetBackend { public CustomWidgetBackend () { } public override void Initialize () { Widget = new Gtk.EventBox (); Widget.Show (); } protected new Gtk.EventBox Widget { get { return (Gtk.EventBox)base.Widget; } set { base.Widget = value; } } public void SetContent (IWidgetBackend widget) { var newWidget = GetWidget (widget); var oldWidget = Widget.Child; if (oldWidget == null) Widget.Child = newWidget; else GtkEngine.ReplaceChild (oldWidget, newWidget); } } }
// // CustomWidgetBackend.cs // // Author: // Lluis Sanchez <[email protected]> // // Copyright (c) 2011 Xamarin Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Xwt.Backends; namespace Xwt.GtkBackend { public class CustomWidgetBackend: WidgetBackend, ICustomWidgetBackend { public CustomWidgetBackend () { } public override void Initialize () { Widget = new Gtk.EventBox (); Widget.Show (); } protected new Gtk.EventBox Widget { get { return (Gtk.EventBox)base.Widget; } set { base.Widget = value; } } public void SetContent (IWidgetBackend widget) { Widget.Child = GetWidget (widget); } } }
mit
C#
4fbc87e5444ab13218917062f7a57b9efaa93b9b
Fix and optimize properties file provider
nbarbettini/FlexibleConfiguration
src/FlexibleConfiguration/Providers/PropertiesFileProvider.cs
src/FlexibleConfiguration/Providers/PropertiesFileProvider.cs
// Copyright (c) Nate Barbettini. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using FlexibleConfiguration.Internal; namespace FlexibleConfiguration.Providers { /// <summary> /// A .properties file-based <see cref="ConfigurationProvider"/>. /// </summary> /// <seealso href="https://en.wikipedia.org/wiki/.properties"/> public class PropertiesFileProvider : ConfigurationProvider { private readonly string contents; private readonly string root; /// <summary> /// Initializes a new instance of <see cref="PropertiesConfigurationProvider"/>. /// </summary> /// <param name="contents">The contents of the .properties configuration file.</param> public PropertiesFileProvider(string contents) : this(contents, root: null) { } /// <summary> /// Initializes a new instance of <see cref="PropertiesConfigurationProvider"/>. /// </summary> /// <param name="contents">The contents of the .properties configuration file.</param> /// <param name="root">A root element to prepend to any discovered key.</param> public PropertiesFileProvider(string contents, string root) { this.contents = contents; this.root = root; } public override void Load() { if (string.IsNullOrEmpty(this.contents)) { return; } var data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); var parser = new PropertiesFileParser(this.contents, this.root); foreach (var pair in parser.GetItems()) { if (data.ContainsKey(pair.Key)) { throw new FormatException($"The key '{pair.Key}' is duplicated."); } data[pair.Key] = pair.Value; } Data = data; } } }
// Copyright (c) Nate Barbettini. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using FlexibleConfiguration.Internal; namespace FlexibleConfiguration.Providers { /// <summary> /// A .properties file-based <see cref="ConfigurationProvider"/>. /// </summary> /// <seealso href="https://en.wikipedia.org/wiki/.properties"/> public class PropertiesFileProvider : ConfigurationProvider { private readonly string contents; private readonly string root; /// <summary> /// Initializes a new instance of <see cref="PropertiesConfigurationProvider"/>. /// </summary> /// <param name="contents">The contents of the .properties configuration file.</param> public PropertiesFileProvider(string contents) : this(contents, root: null) { } /// <summary> /// Initializes a new instance of <see cref="PropertiesConfigurationProvider"/>. /// </summary> /// <param name="contents">The contents of the .properties configuration file.</param> /// <param name="root">A root element to prepend to any discovered key.</param> public PropertiesFileProvider(string contents, string root) { if (string.IsNullOrEmpty(contents)) { throw new ArgumentException("Invalid file path", nameof(contents)); } this.contents = contents; this.root = root; } public override void Load() { var data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); var parser = new PropertiesFileParser(this.contents, this.root); foreach (var pair in parser.GetItems()) { if (data.ContainsKey(pair.Key)) { throw new FormatException($"The key '{pair.Key}' is duplicated."); } data[pair.Key] = pair.Value; } Data = data; } } }
apache-2.0
C#
e1c66282033fd806938e9cc54167d7cd3e2707d8
Increase toleranceSeconds in SafeWait_PollingInterval_GreaterThanTimeout test
atata-framework/atata-webdriverextras,atata-framework/atata-webdriverextras
src/Atata.WebDriverExtras.Tests/SafeWaitTests.cs
src/Atata.WebDriverExtras.Tests/SafeWaitTests.cs
using System; using System.Threading; using NUnit.Framework; namespace Atata.WebDriverExtras.Tests { [TestFixture] [Parallelizable(ParallelScope.None)] public class SafeWaitTests { private SafeWait<object> wait; [SetUp] public void SetUp() { wait = new SafeWait<object>(new object()) { Timeout = TimeSpan.FromSeconds(.3), PollingInterval = TimeSpan.FromSeconds(.05) }; } [Test] public void SafeWait_Success_Immediate() { using (StopwatchAsserter.Within(0, .01)) wait.Until(_ => { return true; }); } [Test] public void SafeWait_Timeout() { using (StopwatchAsserter.Within(.3, .015)) wait.Until(_ => { return false; }); } [Test] public void SafeWait_PollingInterval() { using (StopwatchAsserter.Within(.3, .2)) wait.Until(_ => { Thread.Sleep(TimeSpan.FromSeconds(.1)); return false; }); } [Test] public void SafeWait_PollingInterval_GreaterThanTimeout() { wait.PollingInterval = TimeSpan.FromSeconds(1); using (StopwatchAsserter.Within(.3, .02)) wait.Until(_ => { return false; }); } } }
using System; using System.Threading; using NUnit.Framework; namespace Atata.WebDriverExtras.Tests { [TestFixture] [Parallelizable(ParallelScope.None)] public class SafeWaitTests { private SafeWait<object> wait; [SetUp] public void SetUp() { wait = new SafeWait<object>(new object()) { Timeout = TimeSpan.FromSeconds(.3), PollingInterval = TimeSpan.FromSeconds(.05) }; } [Test] public void SafeWait_Success_Immediate() { using (StopwatchAsserter.Within(0, .01)) wait.Until(_ => { return true; }); } [Test] public void SafeWait_Timeout() { using (StopwatchAsserter.Within(.3, .015)) wait.Until(_ => { return false; }); } [Test] public void SafeWait_PollingInterval() { using (StopwatchAsserter.Within(.3, .2)) wait.Until(_ => { Thread.Sleep(TimeSpan.FromSeconds(.1)); return false; }); } [Test] public void SafeWait_PollingInterval_GreaterThanTimeout() { wait.PollingInterval = TimeSpan.FromSeconds(1); using (StopwatchAsserter.Within(.3, .015)) wait.Until(_ => { return false; }); } } }
apache-2.0
C#
c38dc815351616ff14ce3b7941ab736d9df18c94
Remove unnecessary using
peppy/osu,smoogipoo/osu,2yangk23/osu,peppy/osu,2yangk23/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,johnneijzen/osu,johnneijzen/osu,peppy/osu-new,smoogipoo/osu,peppy/osu,smoogipoo/osu,EVAST9919/osu,EVAST9919/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu,NeoAdonis/osu,NeoAdonis/osu,ppy/osu
osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs
osu.Game/Overlays/Profile/Header/Components/ProfileHeaderButton.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Profile.Header.Components { public abstract class ProfileHeaderButton : OsuHoverContainer { private readonly Box background; private readonly Container content; protected override Container<Drawable> Content => content; protected override IEnumerable<Drawable> EffectTargets => new[] { background }; protected ProfileHeaderButton() { AutoSizeAxes = Axes.X; base.Content.Add(new CircularContainer { Masking = true, AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Children = new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both, }, content = new Container { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Padding = new MarginPadding { Horizontal = 10 }, } } }); } [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { IdleColour = colourProvider.Background6; HoverColour = colourProvider.Background5; } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { public abstract class ProfileHeaderButton : OsuHoverContainer { private readonly Box background; private readonly Container content; protected override Container<Drawable> Content => content; protected override IEnumerable<Drawable> EffectTargets => new[] { background }; protected ProfileHeaderButton() { AutoSizeAxes = Axes.X; base.Content.Add(new CircularContainer { Masking = true, AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Children = new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both, }, content = new Container { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Padding = new MarginPadding { Horizontal = 10 }, } } }); } [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) { IdleColour = colourProvider.Background6; HoverColour = colourProvider.Background5; } } }
mit
C#
4f889f39938c6400531e106163d3354ce7f60a45
Bump version to 0.0.3.1
queueRAM/BlastCorpsEditor
BlastCorpsEditor/Properties/AssemblyInfo.cs
BlastCorpsEditor/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("Blast Corps Editor")] [assembly: AssemblyDescription("Blast Corps Level Editor")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("queueRAM")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("Copyright ©queueRAM 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ce279bd5-c8bb-4e2a-bfbe-8b7afe57cc33")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.3.1")] [assembly: AssemblyFileVersion("0.0.3.1")]
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("Blast Corps Editor")] [assembly: AssemblyDescription("Blast Corps Level Editor")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("queueRAM")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("Copyright ©queueRAM 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ce279bd5-c8bb-4e2a-bfbe-8b7afe57cc33")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.3.0")] [assembly: AssemblyFileVersion("0.0.3.0")]
mit
C#
7230040a6a608c8388b307063e07bea0a0ac8a47
Remove duplicate code
vyzvam/SolrNet,SolrNet/SolrNet,vmanral/SolrNet,chang892886597/SolrNet,vladen/SolrNet,doss78/SolrNet,MetSystem/SolrNet,vyzvam/SolrNet,Laoujin/SolrNet,yonglehou/SolrNet,vmanral/SolrNet,18098924759/SolrNet,vmanral/SolrNet,yonglehou/SolrNet,yonglehou/SolrNet,drakeh/SolrNet,drakeh/SolrNet,MetSystem/SolrNet,drakeh/SolrNet,erandr/SolrNet,vladen/SolrNet,18098924759/SolrNet,doss78/SolrNet,erandr/SolrNet,Laoujin/SolrNet,MetSystem/SolrNet,chang892886597/SolrNet,tombeany/SolrNet,erandr/SolrNet,18098924759/SolrNet,mausch/SolrNet,vladen/SolrNet,mausch/SolrNet,SolrNet/SolrNet,vladen/SolrNet,erandr/SolrNet,Laoujin/SolrNet,chang892886597/SolrNet,tombeany/SolrNet,doss78/SolrNet,tombeany/SolrNet,mausch/SolrNet,vyzvam/SolrNet
HttpWebAdapters/Impl/BasicAuthHttpWebRequestFactory.cs
HttpWebAdapters/Impl/BasicAuthHttpWebRequestFactory.cs
using System; using System.Net; using System.Text; using HttpWebAdapters.Adapters; namespace HttpWebAdapters { public class BasicAuthHttpWebRequestFactory : IHttpWebRequestFactory { private readonly string username; private readonly string password; public BasicAuthHttpWebRequestFactory(string username, string password) { this.username = username; this.password = password; } public IHttpWebRequest Create(string url) { return Create(new Uri(url)); } public IHttpWebRequest Create(Uri url) { var req = (HttpWebRequest) WebRequest.Create(url); var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password)); req.Headers.Add("Authorization", "Basic " + credentials); return new HttpWebRequestAdapter(req); } } }
using System; using System.Net; using System.Text; using HttpWebAdapters.Adapters; namespace HttpWebAdapters { public class BasicAuthHttpWebRequestFactory : IHttpWebRequestFactory { private readonly string username; private readonly string password; public BasicAuthHttpWebRequestFactory(string username, string password) { this.username = username; this.password = password; } public IHttpWebRequest Create(string url) { var req = (HttpWebRequest) WebRequest.Create(url); var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password)); req.Headers.Add("Authorization", "Basic " + credentials); return new HttpWebRequestAdapter(req); } public IHttpWebRequest Create(Uri url) { var req = (HttpWebRequest) WebRequest.Create(url); var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password)); req.Headers.Add("Authorization", "Basic " + credentials); return new HttpWebRequestAdapter(req); } } }
apache-2.0
C#
8eef2303297a36eac07f51378d4afb3dc41bbd96
Use locale's decimal separator instead of hardcoding period.
jrick/Paymetheus,decred/Paymetheus
Paymetheus/Send.xaml.cs
Paymetheus/Send.xaml.cs
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace Paymetheus { /// <summary> /// Interaction logic for Send.xaml /// </summary> public partial class Send : Page { string decimalSep = CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator; public Send() { InitializeComponent(); } private void OutputAmountTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e) { e.Handled = e.Text.All(ch => !((ch >= '0' && ch <= '9') || decimalSep.Contains(ch))); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace Paymetheus { /// <summary> /// Interaction logic for Send.xaml /// </summary> public partial class Send : Page { public Send() { InitializeComponent(); } private void OutputAmountTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e) { e.Handled = e.Text.All(ch => !((ch >= '0' && ch <= '9') || ch == '.')); } } }
isc
C#
fb0d7d1ff26103d5da0147d6e6fed54487022120
Fix humanized string concatenation
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/Utilities/String.Join.cs
source/Nuke.Common/Utilities/String.Join.cs
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; namespace Nuke.Common.Utilities { public static partial class StringExtensions { [Pure] public static string Join(this IEnumerable<string> enumerable, string separator) { return string.Join(separator, enumerable); } [Pure] public static string Join(this IEnumerable<string> enumerable, char separator) { return enumerable.Join(separator.ToString()); } [Pure] public static string JoinSpace(this IEnumerable<string> values) { return values.Join(" "); } [Pure] public static string JoinComma(this IEnumerable<string> values) { return values.Join(", "); } [Pure] public static string JoinCommaOr(this IEnumerable<string> values) { var valuesList = values.ToArray(); return valuesList.Length >= 2 ? valuesList.Reverse().Skip(1).Reverse().JoinComma() + $"{(valuesList.Length > 2 ? "," : string.Empty)} or " + valuesList.Last() : valuesList.JoinComma(); } [Pure] public static string JoinCommaAnd(this IEnumerable<string> values) { var valuesList = values.ToArray(); return valuesList.Length >= 2 ? valuesList.Reverse().Skip(1).Reverse().JoinComma() + $"{(valuesList.Length > 2 ? "," : string.Empty)} and " + valuesList.Last() : valuesList.JoinComma(); } [Pure] public static string JoinNewLine(this IEnumerable<string> values, PlatformFamily? platformFamily = null) { var newLine = !platformFamily.HasValue ? Environment.NewLine : platformFamily.Value == PlatformFamily.Windows ? "\r\n" : "\n"; return values.Join(newLine); } } }
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; namespace Nuke.Common.Utilities { public static partial class StringExtensions { [Pure] public static string Join(this IEnumerable<string> enumerable, string separator) { return string.Join(separator, enumerable); } [Pure] public static string Join(this IEnumerable<string> enumerable, char separator) { return enumerable.Join(separator.ToString()); } [Pure] public static string JoinSpace(this IEnumerable<string> values) { return values.Join(" "); } [Pure] public static string JoinComma(this IEnumerable<string> values) { return values.Join(", "); } [Pure] public static string JoinCommaOr(this IEnumerable<string> values) { var valuesList = values.ToArray(); return valuesList.Length >= 2 ? valuesList.Reverse().Skip(1).Reverse().JoinComma() + ", or " + valuesList.Last() : valuesList.JoinComma(); } [Pure] public static string JoinCommaAnd(this IEnumerable<string> values) { var valuesList = values.ToArray(); return valuesList.Length >= 2 ? valuesList.Reverse().Skip(1).Reverse().JoinComma() + ", and " + valuesList.Last() : valuesList.JoinComma(); } [Pure] public static string JoinNewLine(this IEnumerable<string> values, PlatformFamily? platformFamily = null) { var newLine = !platformFamily.HasValue ? Environment.NewLine : platformFamily.Value == PlatformFamily.Windows ? "\r\n" : "\n"; return values.Join(newLine); } } }
mit
C#
1aa1a3a9e7ecee7d47942fb565ef28ecaedd13c0
Bump version for next development cycle.
johanv/dotnet-cas-client,MetSystem/dotnet-cas-client,apereo/dotnet-cas-client,Jasig/dotnet-cas-client,apereo/dotnet-cas-client,tcalvert/dotnet-cas-client
DotNetCasClient/Properties/AssemblyInfo.cs
DotNetCasClient/Properties/AssemblyInfo.cs
/* * Licensed to Jasig under one or more contributor license * agreements. See the NOTICE file distributed with this work * for additional information regarding copyright ownership. * Jasig 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.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("DotNetCasClient")] [assembly: AssemblyDescription("CAS client integration library for the .NET Framework.")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: AssemblyCompany("Jasig")] [assembly: AssemblyProduct("DotNetCasClient")] [assembly: AssemblyCopyright("Copyright © 2007-2010 Jasig. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("112fbe82-5287-411f-96c7-cfd3bab1ebd3")] [assembly: AssemblyVersion("1.0.3.*")] [assembly: AssemblyFileVersion("1.0.3.*")]
/* * Licensed to Jasig under one or more contributor license * agreements. See the NOTICE file distributed with this work * for additional information regarding copyright ownership. * Jasig 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.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("DotNetCasClient")] [assembly: AssemblyDescription("CAS client integration library for the .NET Framework.")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: AssemblyCompany("Jasig")] [assembly: AssemblyProduct("DotNetCasClient")] [assembly: AssemblyCopyright("Copyright © 2007-2010 Jasig. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("112fbe82-5287-411f-96c7-cfd3bab1ebd3")] [assembly: AssemblyVersion("1.0.2.0")] [assembly: AssemblyFileVersion("1.0.2.0")]
apache-2.0
C#
e154fa9b2c795fe5a27be170fe32c07f0417df8e
prepare for release of 3.13.9
AzureAD/azure-activedirectory-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet
src/ADAL.Common/CommonAssemblyInfo.cs
src/ADAL.Common/CommonAssemblyInfo.cs
//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT License. // // 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.Reflection; [assembly: AssemblyProduct("Active Directory Authentication Library")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyMetadata("Serviceable", "True")] [assembly: AssemblyFileVersion("3.13.9.0")] // On official build, attribute AssemblyInformationalVersionAttribute is added as well // with its value equal to the hash of the last commit to the git branch. // e.g.: [assembly: AssemblyInformationalVersionAttribute("4392c9835a38c27516fc0cd7bad7bccdcaeab161")] [assembly: CLSCompliant(false)]
//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT License. // // 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.Reflection; [assembly: AssemblyProduct("Active Directory Authentication Library")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyMetadata("Serviceable", "True")] [assembly: AssemblyFileVersion("3.13.8.0")] // On official build, attribute AssemblyInformationalVersionAttribute is added as well // with its value equal to the hash of the last commit to the git branch. // e.g.: [assembly: AssemblyInformationalVersionAttribute("4392c9835a38c27516fc0cd7bad7bccdcaeab161")] [assembly: CLSCompliant(false)]
mit
C#
7cb438a4cb1c7571b05d92214b798e8c9ff501e9
fix bug disease model
nguyenmanhphuc93/healthcare-social-network,nguyenmanhphuc93/healthcare-social-network,nguyenmanhphuc93/healthcare-social-network
src/HeathcareSystem/Models/Disease.cs
src/HeathcareSystem/Models/Disease.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace HeathcareSystem.Models { public class Disease { public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace HeathcareSystem.Models { public class Disease { public long Id { get; set; } public string Name { get; set; } public string Description { get; set; } } }
apache-2.0
C#
3b66a248a1ef37b36e17e01474933208dd1a98e0
Fix wrong sql type
gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,fredericDelaporte/nhibernate-core,lnu/nhibernate-core,nkreipke/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core,nkreipke/nhibernate-core,lnu/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,gliljas/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,livioc/nhibernate-core,livioc/nhibernate-core,nhibernate/nhibernate-core,livioc/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,RogerKratz/nhibernate-core,RogerKratz/nhibernate-core,hazzik/nhibernate-core,hazzik/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,fredericDelaporte/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,gliljas/nhibernate-core,alobakov/nhibernate-core,RogerKratz/nhibernate-core,RogerKratz/nhibernate-core,alobakov/nhibernate-core,fredericDelaporte/nhibernate-core,nkreipke/nhibernate-core,lnu/nhibernate-core
src/NHibernate/Type/BinaryBlobType.cs
src/NHibernate/Type/BinaryBlobType.cs
using System; using NHibernate.SqlTypes; namespace NHibernate.Type { /// <summary> /// Maps a System.Byte[] Property to an column that can store a BLOB. /// </summary> /// <remarks> /// This is only needed by DataProviders (SqlClient) that need to specify a Size for the /// IDbDataParameter. Most DataProvider(Oralce) don't need to set the Size so a BinaryType /// would work just fine. /// </remarks> [Serializable] public class BinaryBlobType : BinaryType { internal BinaryBlobType(): base(new BinaryBlobSqlType()) {} /// <summary></summary> public override string Name { get { return "BinaryBlob"; } } } }
using System; namespace NHibernate.Type { /// <summary> /// Maps a System.Byte[] Property to an column that can store a BLOB. /// </summary> /// <remarks> /// This is only needed by DataProviders (SqlClient) that need to specify a Size for the /// IDbDataParameter. Most DataProvider(Oralce) don't need to set the Size so a BinaryType /// would work just fine. /// </remarks> [Serializable] public class BinaryBlobType : BinaryType { /// <summary></summary> public override string Name { get { return "BinaryBlob"; } } } }
lgpl-2.1
C#
b73e7003d531a2ea4504caba93997d88469986c9
Add forgotten copyright header.
dga711/CefSharp,ruisebastiao/CefSharp,Livit/CefSharp,haozhouxu/CefSharp,illfang/CefSharp,NumbersInternational/CefSharp,ruisebastiao/CefSharp,Livit/CefSharp,Haraguroicha/CefSharp,haozhouxu/CefSharp,battewr/CefSharp,joshvera/CefSharp,ITGlobal/CefSharp,jamespearce2006/CefSharp,twxstar/CefSharp,battewr/CefSharp,joshvera/CefSharp,rlmcneary2/CefSharp,Haraguroicha/CefSharp,Livit/CefSharp,NumbersInternational/CefSharp,twxstar/CefSharp,VioletLife/CefSharp,wangzheng888520/CefSharp,jamespearce2006/CefSharp,joshvera/CefSharp,illfang/CefSharp,illfang/CefSharp,VioletLife/CefSharp,ITGlobal/CefSharp,zhangjingpu/CefSharp,joshvera/CefSharp,NumbersInternational/CefSharp,dga711/CefSharp,rlmcneary2/CefSharp,ruisebastiao/CefSharp,Haraguroicha/CefSharp,NumbersInternational/CefSharp,jamespearce2006/CefSharp,ITGlobal/CefSharp,yoder/CefSharp,wangzheng888520/CefSharp,haozhouxu/CefSharp,yoder/CefSharp,dga711/CefSharp,gregmartinhtc/CefSharp,illfang/CefSharp,AJDev77/CefSharp,rlmcneary2/CefSharp,gregmartinhtc/CefSharp,AJDev77/CefSharp,yoder/CefSharp,ruisebastiao/CefSharp,wangzheng888520/CefSharp,zhangjingpu/CefSharp,windygu/CefSharp,Haraguroicha/CefSharp,haozhouxu/CefSharp,rlmcneary2/CefSharp,Livit/CefSharp,zhangjingpu/CefSharp,jamespearce2006/CefSharp,ITGlobal/CefSharp,VioletLife/CefSharp,wangzheng888520/CefSharp,VioletLife/CefSharp,gregmartinhtc/CefSharp,dga711/CefSharp,AJDev77/CefSharp,yoder/CefSharp,gregmartinhtc/CefSharp,zhangjingpu/CefSharp,windygu/CefSharp,jamespearce2006/CefSharp,windygu/CefSharp,battewr/CefSharp,AJDev77/CefSharp,twxstar/CefSharp,windygu/CefSharp,twxstar/CefSharp,Haraguroicha/CefSharp,battewr/CefSharp
CefSharp.WinForms/Internals/MovingListener.cs
CefSharp.WinForms/Internals/MovingListener.cs
// Copyright © 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; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace CefSharp.WinForms.Internals { internal class MovingListener : NativeWindow { public event EventHandler<EventArgs> Moving; private Form ParentForm { get; set; } public MovingListener(Form parent) { ParentForm = parent; if (ParentForm.IsHandleCreated) { OnHandleCreated(ParentForm, null); } else { ParentForm.HandleCreated += OnHandleCreated; } ParentForm.HandleDestroyed += OnHandleDestroyed; } private void OnHandleCreated(object sender, EventArgs e) { AssignHandle(((Form)sender).Handle); } private void OnHandleDestroyed(object sender, EventArgs e) { ReleaseHandle(); } protected override void WndProc(ref Message m) { // Listen for operating system messages switch (m.Msg) { // WM_MOVE case 0x3: // WM_MOVING: case 0x0216: OnMoving(); break; } base.WndProc(ref m); } protected virtual void OnMoving() { if (Moving != null) { Moving(this, null); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace CefSharp.WinForms.Internals { internal class MovingListener : NativeWindow { public event EventHandler<EventArgs> Moving; private Form ParentForm { get; set; } public MovingListener(Form parent) { ParentForm = parent; if (ParentForm.IsHandleCreated) { OnHandleCreated(ParentForm, null); } else { ParentForm.HandleCreated += OnHandleCreated; } ParentForm.HandleDestroyed += OnHandleDestroyed; } private void OnHandleCreated(object sender, EventArgs e) { AssignHandle(((Form)sender).Handle); } private void OnHandleDestroyed(object sender, EventArgs e) { ReleaseHandle(); } protected override void WndProc(ref Message m) { // Listen for operating system messages switch (m.Msg) { // WM_MOVE case 0x3: // WM_MOVING: case 0x0216: OnMoving(); break; } base.WndProc(ref m); } protected virtual void OnMoving() { if (Moving != null) { Moving(this, null); } } } }
bsd-3-clause
C#
8353af192a1b2f322d845db12c72a6200bc77350
Update BrowserView.cs
wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D
src/Core2D/UI/Avalonia/Dock/Views/BrowserView.cs
src/Core2D/UI/Avalonia/Dock/Views/BrowserView.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using DM = Dock.Model; namespace Core2D.UI.Avalonia.Dock.Views { /// <summary> /// Browser view. /// </summary> public class BrowserView : DM.DockBase { public override DM.IDockable Clone() { var browserView = new BrowserView(); DM.CloneHelper.CloneDockProperties(this, browserView); return browserView; } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using DM=Dock.Model; namespace Core2D.UI.Avalonia.Dock.Views { /// <summary> /// Browser view. /// </summary> public class BrowserView : DM.DockBase { public override DM.IDockable Clone() { var browserView = new BrowserView(); DM.CloneHelper.CloneDockProperties(this, browserView); return browserView; } } }
mit
C#
ad21b7bf6b751d5f94a9ac5a3af71474ec6d0008
fix word spacing.
jwChung/Experimentalism,jwChung/Experimentalism
src/Experiment.AutoFixture/TestFixtureAdapter.cs
src/Experiment.AutoFixture/TestFixtureAdapter.cs
using System; using Ploeh.AutoFixture; using Ploeh.AutoFixture.Kernel; namespace Jwc.Experiment { /// <summary> /// <see cref="ISpecimenContext"/>를 <see cref="ITestFixture"/>에 맞춘다. /// auto data기능을 AutoFixture library로부터 채용하게 된다. /// </summary> public class TestFixtureAdapter : ITestFixture { private readonly ISpecimenContext _specimenContext; /// <summary> /// Initializes a new instance of the <see cref="TestFixtureAdapter"/> class. /// </summary> public TestFixtureAdapter() : this( new SpecimenContext(new Fixture())) { } /// <summary> /// Initializes a new instance of the <see cref="TestFixtureAdapter"/> class. /// </summary> /// <param name="specimenContext">The specimen context.</param> /// <exception cref="System.ArgumentNullException">specimenContext</exception> public TestFixtureAdapter(ISpecimenContext specimenContext) { if (specimenContext == null) { throw new ArgumentNullException("specimenContext"); } _specimenContext = specimenContext; } /// <summary> /// Gets the specimen context. /// </summary> /// <value> /// The specimen context. /// </value> public ISpecimenContext SpecimenContext { get { return _specimenContext; } } /// <summary> /// request를 통해 테스트에 필요한 specimen를 만듦. /// </summary> /// <param name="request">specimen을 만들기 위해 필요한 정보를 제공. /// 일반적으로 /// <see cref="Type" />을 많이 활용.</param> /// <returns> /// 만들어진 specimen 객체. /// </returns> public object Create(object request) { return SpecimenContext.Resolve(request); } } }
using System; using Ploeh.AutoFixture; using Ploeh.AutoFixture.Kernel; namespace Jwc.Experiment { /// <summary> /// <see cref="ISpecimenContext"/>를 <see cref="ITestFixture"/>에 맞춘다. /// auto data기능을 AutoFixture library로 부터 채용하게 된다. /// </summary> public class TestFixtureAdapter : ITestFixture { private readonly ISpecimenContext _specimenContext; /// <summary> /// Initializes a new instance of the <see cref="TestFixtureAdapter"/> class. /// </summary> public TestFixtureAdapter() : this( new SpecimenContext(new Fixture())) { } /// <summary> /// Initializes a new instance of the <see cref="TestFixtureAdapter"/> class. /// </summary> /// <param name="specimenContext">The specimen context.</param> /// <exception cref="System.ArgumentNullException">specimenContext</exception> public TestFixtureAdapter(ISpecimenContext specimenContext) { if (specimenContext == null) { throw new ArgumentNullException("specimenContext"); } _specimenContext = specimenContext; } /// <summary> /// Gets the specimen context. /// </summary> /// <value> /// The specimen context. /// </value> public ISpecimenContext SpecimenContext { get { return _specimenContext; } } /// <summary> /// request를 통해 테스트에 필요한 specimen를 만듦. /// </summary> /// <param name="request">specimen을 만들기 위해 필요한 정보를 제공. /// 일반적으로 /// <see cref="Type" />을 많이 활용.</param> /// <returns> /// 만들어진 specimen 객체. /// </returns> public object Create(object request) { return SpecimenContext.Resolve(request); } } }
mit
C#
f30099f539b63da32ffdac6145a328b4d7ae9530
improve array serialization
mongodb-csharp/mongodb-csharp
source/MongoDB/Serialization/Descriptors/ArrayDescriptor.cs
source/MongoDB/Serialization/Descriptors/ArrayDescriptor.cs
using System; using System.Collections.Generic; using System.Collections; using System.Globalization; using MongoDB.Bson; namespace MongoDB.Serialization.Descriptors { internal class ArrayDescriptor : IPropertyDescriptor { private const int MaxIntCache = 100; private static readonly NumberFormatInfo NumberFormat = CultureInfo.InvariantCulture.NumberFormat; private readonly Type _elementType; private readonly IEnumerable _enumerable; private static readonly string[] IntStringCache; static ArrayDescriptor() { IntStringCache = new string[MaxIntCache]; for(int i=0; i<MaxIntCache; i++) { IntStringCache[i] = i.ToString(NumberFormat); } } private static string ToString(int num) { if (num >= 0 && num < IntStringCache.Length) return IntStringCache[num]; return num.ToString(NumberFormat); } /// <summary> /// Initializes a new instance of the <see cref="ArrayDescriptor"/> class. /// </summary> /// <param name="enumerable">The enumerable.</param> /// <param name="elementType">Type of the element.</param> public ArrayDescriptor(IEnumerable enumerable, Type elementType) { if (enumerable == null) throw new ArgumentNullException("enumerable"); if (elementType == null) throw new ArgumentNullException("elementType"); _elementType = elementType; _enumerable = enumerable; } /// <summary> /// Gets the properties. /// </summary> /// <returns></returns> public IEnumerable<BsonProperty> GetProperties() { int i = 0; foreach (var element in _enumerable) { yield return new BsonProperty(ToString(i)) { Value = GetValue(element) }; i++; } } /// <summary> /// Gets the value. /// </summary> /// <param name="value">The value.</param> /// <returns></returns> private BsonPropertyValue GetValue(object value) { var type = _elementType ?? (value == null ? null : value.GetType()); return new BsonPropertyValue(type, value, false); } } }
using System; using System.Collections.Generic; using System.Collections; using MongoDB.Bson; namespace MongoDB.Serialization.Descriptors { internal class ArrayDescriptor : IPropertyDescriptor { private readonly Type _elementType; private readonly IEnumerable _enumerable; /// <summary> /// Initializes a new instance of the <see cref="ArrayDescriptor"/> class. /// </summary> /// <param name="enumerable">The enumerable.</param> /// <param name="elementType">Type of the element.</param> public ArrayDescriptor(IEnumerable enumerable, Type elementType) { if (enumerable == null) throw new ArgumentNullException("enumerable"); if (elementType == null) throw new ArgumentNullException("elementType"); _elementType = elementType; _enumerable = enumerable; } /// <summary> /// Gets the properties. /// </summary> /// <returns></returns> public IEnumerable<BsonProperty> GetProperties() { int i = 0; foreach (var element in _enumerable) { yield return new BsonProperty(i.ToString()) { Value = GetValue(element) }; i++; } } /// <summary> /// Gets the value. /// </summary> /// <param name="value">The value.</param> /// <returns></returns> private BsonPropertyValue GetValue(object value) { var type = _elementType ?? (value == null ? null : value.GetType()); return new BsonPropertyValue(type, value, false); } } }
apache-2.0
C#
b94cd7ffb4a2ad5f38c317f71e980444086a704a
Add /api/round/current which gets the first non-final round. Fixes #18
Jaecen/Peregrine,Jaecen/Peregrine,Jaecen/Peregrine
src/Peregrine.Web/Controllers/RoundController.cs
src/Peregrine.Web/Controllers/RoundController.cs
using System; using System.Linq; using System.Web.Http; using Peregrine.Data; using Peregrine.Web.Services; namespace Peregrine.Web.Controllers { [RoutePrefix("api/tournaments/{tournamentKey}/rounds")] public class RoundController : ApiController { readonly RoundManager RoundManager; public RoundController() { RoundManager = new RoundManager(); } [Route("{roundNumber:min(1)}")] public IHttpActionResult Get(Guid tournamentKey, int roundNumber) { using(var dataContext = new DataContext()) { var tournament = dataContext .GetTournament(tournamentKey); if(tournament == null) return NotFound(); if(roundNumber > RoundManager.GetMaxRoundsForTournament(tournament)) return NotFound(); var roundState = RoundManager.DetermineRoundState(tournament, roundNumber); if(roundState == RoundState.Invalid) return NotFound(); Round round; if(roundState == RoundState.Projected) round = new Round { Number = roundNumber, Matches = RoundManager.CreateMatches(tournament, roundNumber), }; else round = tournament .Rounds .Where(r => r.Number == roundNumber) .FirstOrDefault(); return Ok(RoundManager.RenderRound(round, roundState)); } } [Route("current")] public IHttpActionResult Get(Guid tournamentKey) { int currentRoundNumber; using(var dataContext = new DataContext()) { var tournament = dataContext .GetTournament(tournamentKey); if(tournament == null) return NotFound(); var roundStatus = Enumerable .Range(1, RoundManager.GetMaxRoundsForTournament(tournament)) .Select(roundNumber => new { Number = roundNumber, State = RoundManager.DetermineRoundState(tournament, roundNumber) }); if(!roundStatus.Any()) return NotFound(); var currentRound = roundStatus .SkipWhile(o => o.State >= RoundState.Final) .FirstOrDefault(); if(currentRound == null || currentRound.State == RoundState.Invalid) return NotFound(); currentRoundNumber = currentRound.Number; } return Get(tournamentKey, currentRoundNumber); } } }
using System; using System.Linq; using System.Web.Http; using Peregrine.Data; using Peregrine.Web.Services; namespace Peregrine.Web.Controllers { [RoutePrefix("api/tournaments/{tournamentKey}/rounds/{roundNumber:min(1)}")] public class RoundController : ApiController { readonly RoundManager RoundManager; public RoundController() { RoundManager = new RoundManager(); } [Route] public IHttpActionResult Get(Guid tournamentKey, int roundNumber) { using(var dataContext = new DataContext()) { var tournament = dataContext .GetTournament(tournamentKey); if(tournament == null) return NotFound(); if(roundNumber > RoundManager.GetMaxRoundsForTournament(tournament)) return NotFound(); var roundState = RoundManager.DetermineRoundState(tournament, roundNumber); if(roundState == RoundState.Invalid) return NotFound(); Round round; if(roundState == RoundState.Projected) round = new Round { Number = roundNumber, Matches = RoundManager.CreateMatches(tournament, roundNumber), }; else round = tournament .Rounds .Where(r => r.Number == roundNumber) .FirstOrDefault(); return Ok(RoundManager.RenderRound(round, roundState)); } } } }
mit
C#
d15cee81427a4026bd4d7f0c43f1289f3cf58aec
Fix deserialization of Fields
elastic/elasticsearch-net,elastic/elasticsearch-net
src/Nest/CommonAbstractions/Infer/Fields/FieldsFormatter.cs
src/Nest/CommonAbstractions/Infer/Fields/FieldsFormatter.cs
using System.Collections.Generic; using Utf8Json; namespace Nest { internal class FieldsFormatter : IJsonFormatter<Fields> { public Fields Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver) { var token = reader.GetCurrentJsonToken(); if (token != JsonToken.BeginArray) { reader.ReadNext(); return null; } var fields = new Fields(); var count = 0; while (reader.ReadIsInArray(ref count)) { token = reader.GetCurrentJsonToken(); switch (token) { case JsonToken.String: fields.And(reader.ReadString()); break; case JsonToken.BeginObject: /// TODO 6.4 this is temporary until we add proper support for doc_values format var innerCount = 0; while (reader.ReadIsInObject(ref innerCount)) { if (reader.ReadPropertyName() == "field") fields.And(reader.ReadString()); } break; } } return fields; } public void Serialize(ref JsonWriter writer, Fields value, IJsonFormatterResolver formatterResolver) { if (value == null) { writer.WriteNull(); return; } var formatter = formatterResolver.GetFormatter<List<Field>>(); formatter.Serialize(ref writer, value.ListOfFields, formatterResolver); } } }
using System.Collections.Generic; using Utf8Json; namespace Nest { internal class FieldsFormatter : IJsonFormatter<Fields> { public Fields Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver) { var token = reader.GetCurrentJsonToken(); if (token != JsonToken.BeginArray) { reader.ReadNext(); return null; } var fields = new Fields(); var count = 0; while (reader.ReadIsInArray(ref count)) { reader.ReadNext(); token = reader.GetCurrentJsonToken(); switch (token) { case JsonToken.String: fields.And(reader.ReadString()); break; case JsonToken.BeginObject: /// TODO 6.4 this is temporary until we add proper support for doc_values format var innerCount = 0; while (reader.ReadIsInObject(ref innerCount)) { if (reader.ReadPropertyName() == "field") fields.And(reader.ReadString()); } break; } } return fields; } public void Serialize(ref JsonWriter writer, Fields value, IJsonFormatterResolver formatterResolver) { if (value == null) { writer.WriteNull(); return; } var formatter = formatterResolver.GetFormatter<List<Field>>(); formatter.Serialize(ref writer, value.ListOfFields, formatterResolver); } } }
apache-2.0
C#
76261213ded347e7e521f953400cf0482e04f920
Update FieldRegistry.cs
Squidex/squidex,pushrbx/squidex,Squidex/squidex,Squidex/squidex,pushrbx/squidex,Squidex/squidex,pushrbx/squidex,Squidex/squidex,pushrbx/squidex,pushrbx/squidex
src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRegistry.cs
src/Squidex.Domain.Apps.Core.Model/Schemas/FieldRegistry.cs
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschränkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System; using System.Collections.Generic; using System.Linq; using Squidex.Infrastructure; namespace Squidex.Domain.Apps.Core.Schemas { public sealed class FieldRegistry { private readonly TypeNameRegistry typeNameRegistry; private readonly HashSet<Type> supportedFields = new HashSet<Type>(); public FieldRegistry(TypeNameRegistry typeNameRegistry) { Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry)); this.typeNameRegistry = typeNameRegistry; var types = typeof(FieldRegistry).Assembly.GetTypes().Where(x => x.BaseType == typeof(FieldProperties)); foreach (var type in types) { RegisterField(type); } typeNameRegistry.MapObsolete(typeof(ReferencesFieldProperties), "References"); typeNameRegistry.MapObsolete(typeof(DateTimeFieldProperties), "DateTime"); } private void RegisterField(Type type) { if (supportedFields.Add(type)) { typeNameRegistry.Map(type); } } public RootField CreateRootField(long id, string name, Partitioning partitioning, FieldProperties properties) { CheckProperties(properties); return properties.CreateRootField(id, name, partitioning); } public NestedField CreateNestedField(long id, string name, FieldProperties properties) { CheckProperties(properties); return properties.CreateNestedField(id, name); } private void CheckProperties(FieldProperties properties) { Guard.NotNull(properties, nameof(properties)); if (!supportedFields.Contains(properties.GetType())) { throw new InvalidOperationException($"The field property '{properties.GetType()}' is not supported."); } } } }
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschränkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System; using System.Collections.Generic; using System.Linq; using Squidex.Infrastructure; namespace Squidex.Domain.Apps.Core.Schemas { public sealed class FieldRegistry { private readonly TypeNameRegistry typeNameRegistry; private readonly HashSet<Type> supportedFields = new HashSet<Type>(); public FieldRegistry(TypeNameRegistry typeNameRegistry) { Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry)); this.typeNameRegistry = typeNameRegistry; var types = typeof(FieldRegistry).Assembly.GetTypes().Where(x => x.BaseType == typeof(FieldProperties)); foreach (var type in types) { RegisterField(type); } typeNameRegistry.MapObsolete(typeof(ReferencesFieldProperties), "DateTime"); typeNameRegistry.MapObsolete(typeof(DateTimeFieldProperties), "References"); } private void RegisterField(Type type) { if (supportedFields.Add(type)) { typeNameRegistry.Map(type); } } public RootField CreateRootField(long id, string name, Partitioning partitioning, FieldProperties properties) { CheckProperties(properties); return properties.CreateRootField(id, name, partitioning); } public NestedField CreateNestedField(long id, string name, FieldProperties properties) { CheckProperties(properties); return properties.CreateNestedField(id, name); } private void CheckProperties(FieldProperties properties) { Guard.NotNull(properties, nameof(properties)); if (!supportedFields.Contains(properties.GetType())) { throw new InvalidOperationException($"The field property '{properties.GetType()}' is not supported."); } } } }
mit
C#
6d813cde941f7c0cd62773704f96373918c285b4
Test version 1.101.0
koliva8245/HeroesMatchTracker,koliva8245/HeroesParserData
HeroesMatchTracker/Properties/AssemblyInfo.cs
HeroesMatchTracker/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; 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("HeroesMatchTracker")] [assembly: AssemblyDescription("Heroes of the Storm match tracker, replay parser, and data viewer")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HeroesMatchTracker")] [assembly: AssemblyCopyright("Copyright © 2017 Kevin Oliva")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] // 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)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] // by using the '*' as shown below: [assembly: AssemblyVersion("1.101.0")] [assembly: AssemblyFileVersion("1.101.0")]
using System.Reflection; using System.Resources; 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("HeroesMatchTracker")] [assembly: AssemblyDescription("Heroes of the Storm match tracker, replay parser, and data viewer")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HeroesMatchTracker")] [assembly: AssemblyCopyright("Copyright © 2017 Kevin Oliva")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en-US")] // 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)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] // by using the '*' as shown below: [assembly: AssemblyVersion("1.100.0")] [assembly: AssemblyFileVersion("1.100.0")]
mit
C#
c7c4ab94cec2f9f30a3cc86dd4ef7d1522b5b8a8
Update ICssStyleSheet.cs
AngleSharp/AngleSharp.Css,AngleSharp/AngleSharp.Css,AngleSharp/AngleSharp.Css
src/AngleSharp.Css/Dom/ICssStyleSheet.cs
src/AngleSharp.Css/Dom/ICssStyleSheet.cs
namespace AngleSharp.Css.Dom { using AngleSharp.Attributes; using AngleSharp.Dom; using System; /// <summary> /// Represents the CSS style sheet for storing CSS styles. /// </summary> [DomName("CSSStyleSheet")] public interface ICssStyleSheet : IStyleSheet { /// <summary> /// Gets the @import rule if the stylesheet was imported otherwise it /// returns null. /// </summary> [DomName("ownerRule")] ICssRule OwnerRule { get; } /// <summary> /// Gets a CSSRuleList of the CSS rules in the style sheet. /// </summary> [DomName("cssRules")] [DomName("rules")] ICssRuleList Rules { get; } /// <summary> /// Gets the parent stylesheet for of the current sheet. /// </summary> [DomName("parentStyleSheet")] ICssStyleSheet Parent { get; } /// <summary> /// Inserts a new style rule into the current style sheet. /// </summary> /// <param name="rule"> /// A string containing the rule to be inserted. /// </param> /// <param name="index"> /// The index representing the position to be inserted. /// </param> /// <returns>The index of insertion.</returns> [DomName("insertRule")] Int32 Insert(String rule, Int32 index); /// <summary> /// Removes a style rule from the current style sheet object. /// </summary> /// <param name="index"> /// The index representing the position to be removed. /// </param> [DomName("deleteRule")] void RemoveAt(Int32 index); /// <summary> /// Sets the owner of the sheet. /// </summary> /// <param name="rule">The owning rule.</param> void SetOwner(ICssRule rule); /// <summary> /// Sets the parent of the sheet. /// </summary> /// <param name="parent">The parent sheet.</param> void SetParent(ICssStyleSheet parent); } }
namespace AngleSharp.Css.Dom { using AngleSharp.Attributes; using AngleSharp.Dom; using System; /// <summary> /// Represents the CSS style sheet for storing CSS styles. /// </summary> [DomName("CSSStyleSheet")] public interface ICssStyleSheet : IStyleSheet { /// <summary> /// Gets the @import rule if the stylesheet was imported otherwise it /// returns null. /// </summary> [DomName("ownerRule")] ICssRule OwnerRule { get; } /// <summary> /// Gets a CSSRuleList of the CSS rules in the style sheet. /// </summary> [DomName("cssRules")] [DomName("rules")] ICssRuleList Rules { get; } /// <summary> /// Gets the parent stylesheet for of the current sheet. /// </summary> [DomName("parentStyleSheet")] ICssStyleSheet Parent { get; } /// <summary> /// Inserts a new style rule into the current style sheet. /// </summary> /// <param name="rule"> /// A string containing the rule to be inserted. /// </param> /// <param name="index"> /// The index representing the position to be inserted. /// </param> /// <returns>The index of insertation.</returns> [DomName("insertRule")] Int32 Insert(String rule, Int32 index); /// <summary> /// Removes a style rule from the current style sheet object. /// </summary> /// <param name="index"> /// The index representing the position to be removed. /// </param> [DomName("deleteRule")] void RemoveAt(Int32 index); /// <summary> /// Sets the owner of the sheet. /// </summary> /// <param name="rule">The owning rule.</param> void SetOwner(ICssRule rule); /// <summary> /// Sets the parent of the sheet. /// </summary> /// <param name="parent">The parent sheet.</param> void SetParent(ICssStyleSheet parent); } }
mit
C#
e4764b58223f2adb0477c728a4eef8b9a948f8c5
Add assert
terrajobst/apiporter
src/ApiPorter.Patterns/PatternCapture.cs
src/ApiPorter.Patterns/PatternCapture.cs
using System; using System.Diagnostics; using Microsoft.CodeAnalysis; namespace ApiPorter.Patterns { public sealed class PatternCapture { private PatternCapture(PatternVariable variable, SyntaxNodeOrToken startNodeOrToken, SyntaxNodeOrToken endNodeOrToken) { Variable = variable; StartNodeOrToken = startNodeOrToken; EndNodeOrToken = endNodeOrToken; } public static PatternCapture Create(PatternVariable variable, SyntaxNodeOrToken nodeOrToken) { return new PatternCapture(variable, nodeOrToken, nodeOrToken); } public static PatternCapture Create(PatternVariable variable, SyntaxNodeOrToken startNodeOrToken, SyntaxNodeOrToken endNodeOrToken) { Debug.Assert(endNodeOrToken.Parent != startNodeOrToken.Parent, $"{nameof(endNodeOrToken)}.{nameof(endNodeOrToken.Parent)} must match {nameof(startNodeOrToken)}", nameof(endNodeOrToken)); return new PatternCapture(variable, startNodeOrToken, endNodeOrToken); } public PatternVariable Variable { get; } public SyntaxNodeOrToken StartNodeOrToken { get; } public SyntaxNodeOrToken EndNodeOrToken { get; } } }
using System; using Microsoft.CodeAnalysis; namespace ApiPorter.Patterns { public sealed class PatternCapture { private PatternCapture(PatternVariable variable, SyntaxNodeOrToken startNodeOrToken, SyntaxNodeOrToken endNodeOrToken) { Variable = variable; StartNodeOrToken = startNodeOrToken; EndNodeOrToken = endNodeOrToken; } public static PatternCapture Create(PatternVariable variable, SyntaxNodeOrToken nodeOrToken) { return new PatternCapture(variable, nodeOrToken, nodeOrToken); } public static PatternCapture Create(PatternVariable variable, SyntaxNodeOrToken startNodeOrToken, SyntaxNodeOrToken endNodeOrToken) { return new PatternCapture(variable, startNodeOrToken, endNodeOrToken); } public PatternVariable Variable { get; } public SyntaxNodeOrToken StartNodeOrToken { get; } public SyntaxNodeOrToken EndNodeOrToken { get; } } }
mit
C#
44c0574d165cfb931c71d5d2d9e2cb3be271a064
Make ByteSizeTypeConverter internal
omar/ByteSize
src/ByteSizeLib/ByteSizeTypeConverter.cs
src/ByteSizeLib/ByteSizeTypeConverter.cs
using System; using System.ComponentModel; using System.Globalization; namespace ByteSizeLib { /// <summary> /// Provides a type converter to convert <see cref="ByteSize"/> objects to and from <see cref="string"/> objects. /// </summary> internal class ByteSizeTypeConverter : TypeConverter { /// <inheritdoc/> public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) => sourceType == typeof(string); /// <inheritdoc/> public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) => destinationType == typeof(string); /// <inheritdoc/> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return value is string s ? ByteSize.Parse(s) : base.ConvertFrom(context, culture, value); } /// <inheritdoc/> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { return destinationType == typeof(string) && value is ByteSize bs ? bs.ToBinaryString() : base.ConvertTo(context, culture, value, destinationType); } } }
using System; using System.ComponentModel; using System.Globalization; namespace ByteSizeLib { /// <summary> /// Provides a type converter to convert <see cref="ByteSize"/> objects to and from <see cref="string"/> objects. /// </summary> public class ByteSizeTypeConverter : TypeConverter { /// <inheritdoc/> public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) => sourceType == typeof(string); /// <inheritdoc/> public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) => destinationType == typeof(string); /// <inheritdoc/> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return value is string s ? ByteSize.Parse(s) : base.ConvertFrom(context, culture, value); } /// <inheritdoc/> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { return destinationType == typeof(string) && value is ByteSize bs ? bs.ToBinaryString() : base.ConvertTo(context, culture, value, destinationType); } } }
mit
C#
cc5e5ee5ad542428e64cb997a9d142d47d5ec05a
add xml comments
christianacca/Cache-Abstraction,christianacca/Cache-Abstraction
src/CcAcca.CacheAbstraction/CacheBase.cs
src/CcAcca.CacheAbstraction/CacheBase.cs
// Copyright (c) 2014 Christian Crowhurst. All rights reserved. // see LICENSE using System; namespace CcAcca.CacheAbstraction { /// <summary> /// Convenience base class that provide some base functionality for implementors of the <see cref="ICache" /> /// interface /// </summary> public abstract class CacheBase { private readonly object _lock = new object(); protected CacheBase(CacheIdentity id) { if (id == null) throw new ArgumentNullException("id"); Id = id; PartionKeyPrefix = String.Format("{0}:", Id); } /// <summary> /// see <see cref="ICache.Id"/> /// </summary> public CacheIdentity Id { get; private set; } /// <summary> /// A qualifying prefix to be added to an item to disambiguate items /// with the same key stored in different logical partitions of the /// same backing store /// </summary> protected string PartionKeyPrefix { get; set; } /// <summary> /// see <see cref="ICache.LockKey"/> /// </summary> public virtual object LockKey { get { return _lock; } } /// <summary> /// see <see cref="ICache.As{T}"/> /// </summary> public virtual T As<T>() where T : class, ICache { return null; } /// <summary> /// Gets the key qualified by the name of the partition /// </summary> /// <param name="key">The non-qualified key.</param> protected string GetFullKey(string key) { return string.Concat(PartionKeyPrefix, key); } } }
// Copyright (c) 2014 Christian Crowhurst. All rights reserved. // see LICENSE using System; namespace CcAcca.CacheAbstraction { /// <summary> /// Convenience base class that provide some base functionality for implementors of the <see cref="ICache" /> /// interface /// </summary> public abstract class CacheBase { private readonly object _lock = new object(); protected CacheBase(CacheIdentity id) { if (id == null) throw new ArgumentNullException("id"); Id = id; PartionKeyPrefix = String.Format("{0}:", Id); } public CacheIdentity Id { get; private set; } protected string PartionKeyPrefix { get; set; } public virtual object LockKey { get { return _lock; } } public virtual T As<T>() where T : class, ICache { return null; } /// <summary> /// Gets the key qualified by the name of the partition /// </summary> /// <param name="key">The non-qualified key.</param> protected string GetFullKey(string key) { return string.Concat(PartionKeyPrefix, key); } } }
mit
C#
6e0e163a248166e04cb57b63e6a8d3ba0545b612
Fix compile bug
Red-Folder/WebCrawl-Functions
WebCrawlProcess/run.csx
WebCrawlProcess/run.csx
#r "Newtonsoft.Json" using System; using Red_Folder.WebCrawl; using Red_Folder.WebCrawl.Data; using Red_Folder.Logging; using Newtonsoft.Json; public static void Run(string request, out object outputDocument, TraceWriter log) { log.Info($"C# Queue trigger function processed: {crawlRequest.Id}"); var azureLogger = new AzureLogger(log); var crawlRequest = JsonConvert.DeserializeObject<CrawlRequest>(request); var crawler = new Crawler(crawlRequest, azureLogger); crawler.AddUrl("https://www.red-folder.com/sitemap.xml"); var crawlResult = crawler.Crawl(); outputDocument = crawlResult; } public class AzureLogger : ILogger { private TraceWriter _log; public AzureLogger(TraceWriter log) { _log = log; } public void Info(string message) { _log.Info(message); } }
#r "Newtonsoft.Json" using System; using Red_Folder.WebCrawl; using Red_Folder.WebCrawl.Data; using Red_Folder.Logging; using Newtonsoft.Json; public static void Run(string request, out object outputDocument, TraceWriter log) { log.Info($"C# Queue trigger function processed: {crawlRequest.Id}"); var azureLogger = new AzureLogger(log); var crawlRequest = JsonConvert.DeserializeObject<CrawlRequest>(request) var crawler = new Crawler(crawlRequest, azureLogger); crawler.AddUrl("https://www.red-folder.com/sitemap.xml"); var crawlResult = crawler.Crawl(); outputDocument = crawlResult; } public class AzureLogger : ILogger { private TraceWriter _log; public AzureLogger(TraceWriter log) { _log = log; } public void Info(string message) { _log.Info(message); } }
mit
C#
28f3084da9d1d0997e89cd7fc6fbfe2ec1e3f2d3
Change to download results
Red-Folder/WebCrawl-Functions
WebCrawlResults/run.csx
WebCrawlResults/run.csx
//#r "Newtonsoft.Json" using System.Net; using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Net.Http.Headers; public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) { log.Info($"C# HTTP trigger function processed a request. RequestUri={req.RequestUri}"); // parse query parameter string id = req.GetQueryNameValuePairs() .FirstOrDefault(q => string.Compare(q.Key, "id", true) == 0) .Value; // Get request body dynamic data = await req.Content.ReadAsAsync<object>(); // Set id to query string or body data id = id ?? data?.id; // Convert from connection string to uri & key // Doesn't currently appear to be a vary to create a DocumentClient from a connection string string documentDbEndpoint = System.Environment.GetEnvironmentVariable("APPSETTING_rfcwebcrawl_DOCUMENTDB"); string endpointUri = documentDbEndpoint.Split(';')[0].Split('=')[1]; string primaryKey = documentDbEndpoint.Split(';')[1].Split('=')[1]; string databaseName = "crawlOutput"; string collectionName = "WebCrawl"; DocumentClient client; log.Info($"Creating client for: {endpointUri}"); client = new DocumentClient(new Uri(endpointUri), primaryKey); await client.ReadDatabaseAsync(UriFactory.CreateDatabaseUri(databaseName)); await client.ReadDocumentCollectionAsync(UriFactory.CreateDocumentCollectionUri(databaseName, collectionName)); // Set some common query options FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1 }; IQueryable query; if (id == null || id.Length == 0) { query = client.CreateDocumentQuery(UriFactory .CreateDocumentCollectionUri(databaseName, collectionName), queryOptions) .OrderByDescending(f => f.timestamp) .FirstOrDefault(); } else { query = client.CreateDocumentQuery(UriFactory .CreateDocumentCollectionUri(databaseName, collectionName), queryOptions) .Where(f => f.id == id) .FirstOrDefault(); } // The query is executed synchronously here, but can also be executed asynchronously via the IDocumentQuery<T> interface log.Info("Running LINQ query..."); dynamic result = query; string message = JsonConvert.SerializeObject(result); var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(message) }; return response; }
//#r "Newtonsoft.Json" using System.Net; using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Net.Http.Headers; public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) { // Hello World - integration test log.Info($"C# HTTP trigger function processed a request. RequestUri={req.RequestUri}"); // parse query parameter string name = req.GetQueryNameValuePairs() .FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0) .Value; // Get request body dynamic data = await req.Content.ReadAsAsync<object>(); // Set name to query string or body data name = name ?? data?.name; // Convert from connection string to uri & key // Doesn't currently appear to be a vary to create a DocumentClient from a connection string string documentDbEndpoint = System.Environment.GetEnvironmentVariable("APPSETTING_rfcwebcrawl_DOCUMENTDB"); string endpointUri = documentDbEndpoint.Split(';')[0].Split('=')[1]; string primaryKey = documentDbEndpoint.Split(';')[1].Split('=')[1]; string databaseName = "crawlOutput"; string collectionName = "WebCrawl"; DocumentClient client; log.Info($"Creating client for: {endpointUri}"); client = new DocumentClient(new Uri(endpointUri), primaryKey); await client.ReadDatabaseAsync(UriFactory.CreateDatabaseUri(databaseName)); await client.ReadDocumentCollectionAsync(UriFactory.CreateDocumentCollectionUri(databaseName, collectionName)); // Set some common query options FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1 }; IQueryable query = client.CreateDocumentQuery( UriFactory.CreateDocumentCollectionUri(databaseName, collectionName), queryOptions); //.Where(f => f.LastName == "Andersen"); // The query is executed synchronously here, but can also be executed asynchronously via the IDocumentQuery<T> interface log.Info("Running LINQ query..."); dynamic result = null; foreach (var rec in query) { log.Info("Rec found"); log.Info(rec.ToString()); result = rec; } var result2 = new { id = 12, message = "Hello World" }; string message = JsonConvert.SerializeObject(result2); var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(message) }; return response; }
mit
C#
70b06c608c1f6f0c8a68060116e65b3196771776
format formatter code
khellang/omnisharp-roslyn,sreal/omnisharp-roslyn,filipw/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,haled/omnisharp-roslyn,fishg/omnisharp-roslyn,jtbm37/omnisharp-roslyn,nabychan/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,sriramgd/omnisharp-roslyn,hach-que/omnisharp-roslyn,nabychan/omnisharp-roslyn,ChrisHel/omnisharp-roslyn,sreal/omnisharp-roslyn,ianbattersby/omnisharp-roslyn,hach-que/omnisharp-roslyn,filipw/omnisharp-roslyn,haled/omnisharp-roslyn,hal-ler/omnisharp-roslyn,ChrisHel/omnisharp-roslyn,RichiCoder1/omnisharp-roslyn,hitesh97/omnisharp-roslyn,david-driscoll/omnisharp-roslyn,xdegtyarev/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,sriramgd/omnisharp-roslyn,fishg/omnisharp-roslyn,hitesh97/omnisharp-roslyn,khellang/omnisharp-roslyn,jtbm37/omnisharp-roslyn,david-driscoll/omnisharp-roslyn,hal-ler/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,RichiCoder1/omnisharp-roslyn,ianbattersby/omnisharp-roslyn,xdegtyarev/omnisharp-roslyn
src/OmniSharp/Api/Formatting/OmnisharpController.FormatDocument.cs
src/OmniSharp/Api/Formatting/OmnisharpController.FormatDocument.cs
using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Formatting; using OmniSharp.Models; namespace OmniSharp { public partial class OmnisharpController { [HttpPost("codeformat")] public async Task<IActionResult> CodeFormat([FromBody]Request request) { _workspace.EnsureBufferUpdated(request); var options = _workspace.Options .WithChangedOption(FormattingOptions.NewLine, LanguageNames.CSharp, _options.FormattingOptions.NewLine) .WithChangedOption(FormattingOptions.UseTabs, LanguageNames.CSharp, _options.FormattingOptions.UseTabs) .WithChangedOption(FormattingOptions.TabSize, LanguageNames.CSharp, _options.FormattingOptions.TabSize); var response = new CodeFormatResponse(); var documentId = _workspace.GetDocumentId(request.FileName); if (documentId != null) { var document = _workspace.CurrentSolution.GetDocument(documentId); document = await Formatter.FormatAsync(document, options); response.Buffer = (await document.GetTextAsync()).ToString(); // workaround: https://roslyn.codeplex.com/workitem/484 if (_options.FormattingOptions.NewLine == "\n") { response.Buffer = response.Buffer.Replace("\r\n", "\n"); } } else { return new HttpNotFoundResult(); } return new ObjectResult(response); } } }
using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Formatting; using OmniSharp.Models; namespace OmniSharp { public partial class OmnisharpController { [HttpPost("codeformat")] public async Task<IActionResult> CodeFormat([FromBody]Request request) { _workspace.EnsureBufferUpdated(request); var options = _workspace.Options .WithChangedOption(FormattingOptions.NewLine, LanguageNames.CSharp, _options.FormattingOptions.NewLine) .WithChangedOption(FormattingOptions.UseTabs, LanguageNames.CSharp, _options.FormattingOptions.UseTabs) .WithChangedOption(FormattingOptions.TabSize, LanguageNames.CSharp, _options.FormattingOptions.TabSize); var response = new CodeFormatResponse(); var documentId = _workspace.GetDocumentId(request.FileName); if (documentId != null) { var document = _workspace.CurrentSolution.GetDocument(documentId); document = await Formatter.FormatAsync(document, options); response.Buffer = (await document.GetTextAsync()).ToString(); // workaround: https://roslyn.codeplex.com/workitem/484 if(_options.FormattingOptions.NewLine == "\n") { response.Buffer = response.Buffer.Replace("\r\n", "\n"); } } else { return new HttpNotFoundResult(); } return new ObjectResult(response); } } }
mit
C#
6c870eef9f7d0f02b8fed365c6988c129e9f4962
更新.net 4.5项目的版本号
JeffreySu/Senparc.WebSocket
src/Senparc.WebSocket/Senparc.WebSocket/Properties/AssemblyInfo.cs
src/Senparc.WebSocket/Senparc.WebSocket/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 //[assembly: AssemblyTitle("Senparc.WebSocket")] //[assembly: AssemblyDescription("")] //[assembly: AssemblyConfiguration("")] //[assembly: AssemblyCompany("")] //[assembly: AssemblyProduct("Senparc.WebSocket")] //[assembly: AssemblyCopyright("Copyright © 2018")] //[assembly: AssemblyTrademark("")] //[assembly: AssemblyCulture("")] //将 ComVisible 设置为 false 将使此程序集中的类型 //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("b745f5f5-9120-4d56-a86d-ed34eadb703c")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.7.2.*")] //[assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 //[assembly: AssemblyTitle("Senparc.WebSocket")] //[assembly: AssemblyDescription("")] //[assembly: AssemblyConfiguration("")] //[assembly: AssemblyCompany("")] //[assembly: AssemblyProduct("Senparc.WebSocket")] //[assembly: AssemblyCopyright("Copyright © 2018")] //[assembly: AssemblyTrademark("")] //[assembly: AssemblyCulture("")] //将 ComVisible 设置为 false 将使此程序集中的类型 //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("b745f5f5-9120-4d56-a86d-ed34eadb703c")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.7.1.*")] //[assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
940c2427db74e711595d6b56f52378131f40515e
Mark Utilities class as static
ProgramFOX/Chess.NET
ChessDotNet/Utilities.cs
ChessDotNet/Utilities.cs
using System; namespace ChessDotNet { public static class Utilities { public static void ThrowIfNull(object value, string parameterName) { if (value == null) { throw new ArgumentNullException(parameterName); } } public static Player GetOpponentOf(Player player) { if (player == Player.None) throw new ArgumentException("`player` cannot be Player.None."); return player == Player.White ? Player.Black : Player.White; } } }
using System; namespace ChessDotNet { public class Utilities { public static void ThrowIfNull(object value, string parameterName) { if (value == null) { throw new ArgumentNullException(parameterName); } } public static Player GetOpponentOf(Player player) { if (player == Player.None) throw new ArgumentException("`player` cannot be Player.None."); return player == Player.White ? Player.Black : Player.White; } } }
mit
C#
1b1b431eb6df6fb21e6a31c690efc9977e0e282f
Remove reference to obsolete `searchHighlight()` javascript function from ClearSilver footer template.
dafrito/trac-mirror,moreati/trac-gitsvn,dafrito/trac-mirror,exocad/exotrac,dafrito/trac-mirror,moreati/trac-gitsvn,dafrito/trac-mirror,dokipen/trac,exocad/exotrac,dokipen/trac,dokipen/trac,moreati/trac-gitsvn,exocad/exotrac,exocad/exotrac,moreati/trac-gitsvn
templates/footer.cs
templates/footer.cs
<?cs if:len(chrome.links.alternate) ?> <div id="altlinks"><h3>Download in other formats:</h3><ul><?cs each:link = chrome.links.alternate ?><?cs set:isfirst = name(link) == 0 ?><?cs set:islast = name(link) == len(chrome.links.alternate) - 1?><li<?cs if:isfirst || islast ?> class="<?cs if:isfirst ?>first<?cs /if ?><?cs if:isfirst && islast ?> <?cs /if ?><?cs if:islast ?>last<?cs /if ?>"<?cs /if ?>><a href="<?cs var:link.href ?>"<?cs if:link.class ?> class="<?cs var:link.class ?>"<?cs /if ?>><?cs var:link.title ?></a></li><?cs /each ?></ul></div><?cs /if ?> </div> <div id="footer"> <hr /> <a id="tracpowered" href="http://trac.edgewall.org/"><img src="<?cs var:htdocs_location ?>trac_logo_mini.png" height="30" width="107" alt="Trac Powered"/></a> <p class="left"> Powered by <a href="<?cs var:trac.href.about ?>"><strong>Trac <?cs var:trac.version ?></strong></a><br /> By <a href="http://www.edgewall.org/">Edgewall Software</a>. </p> <p class="right"> <?cs var:project.footer ?> </p> </div> <?cs include "site_footer.cs" ?> </body> </html>
<script type="text/javascript">searchHighlight()</script><?cs if:len(chrome.links.alternate) ?> <div id="altlinks"><h3>Download in other formats:</h3><ul><?cs each:link = chrome.links.alternate ?><?cs set:isfirst = name(link) == 0 ?><?cs set:islast = name(link) == len(chrome.links.alternate) - 1?><li<?cs if:isfirst || islast ?> class="<?cs if:isfirst ?>first<?cs /if ?><?cs if:isfirst && islast ?> <?cs /if ?><?cs if:islast ?>last<?cs /if ?>"<?cs /if ?>><a href="<?cs var:link.href ?>"<?cs if:link.class ?> class="<?cs var:link.class ?>"<?cs /if ?>><?cs var:link.title ?></a></li><?cs /each ?></ul></div><?cs /if ?> </div> <div id="footer"> <hr /> <a id="tracpowered" href="http://trac.edgewall.org/"><img src="<?cs var:htdocs_location ?>trac_logo_mini.png" height="30" width="107" alt="Trac Powered"/></a> <p class="left"> Powered by <a href="<?cs var:trac.href.about ?>"><strong>Trac <?cs var:trac.version ?></strong></a><br /> By <a href="http://www.edgewall.org/">Edgewall Software</a>. </p> <p class="right"> <?cs var:project.footer ?> </p> </div> <?cs include "site_footer.cs" ?> </body> </html>
bsd-3-clause
C#
dc548705ba80297403cd593dd106ff83625ec69f
Update KentBoogaart.cs
planetxamarin/planetxamarin,MabroukENG/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin,MabroukENG/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin
src/Firehose.Web/Authors/KentBoogaart.cs
src/Firehose.Web/Authors/KentBoogaart.cs
using System; using System.Collections.Generic; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class KentBoogaart : IAmAMicrosoftMVP { public string FirstName => "Kent"; public string LastName => "Boogaart"; public string StateOrRegion => "Australia"; public string EmailAddress => "[email protected]"; public string ShortBioOrTagLine => "is a kick-a** freelance software engineer"; public Uri WebSite => new Uri("http://kent-boogaart.com/"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("http://kent-boogaart.com/atom.xml"); } } public string TwitterHandle => "kent_boogaart"; public string GravatarHash => ""; public string GitHubHandle => string.Empty; public GeoPosition Position => new GeoPosition(-35.0004451, 138.3309978); } }
using System; using System.Collections.Generic; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class KentBoogaart : IAmAMicrosoftMVP { public string FirstName => "Kent"; public string LastName => "Boogaart"; public string StateOrRegion => "Australia"; public string EmailAddress => "[email protected]"; public string ShortBioOrTagLine => "is a kick-a** software engineer"; public Uri WebSite => new Uri("http://kent-boogaart.com/"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("http://kent-boogaart.com/atom.xml"); } } public string TwitterHandle => "kent_boogaart"; public string GravatarHash => ""; public string GitHubHandle => string.Empty; public GeoPosition Position => new GeoPosition(-35.0004451, 138.3309978); } }
mit
C#
d70ac96ecaafec0fa06a89599573877f01bf84b2
Test added
bradyholt/cron-expression-descriptor,bradyholt/cron-expression-descriptor
test/TestParsing.cs
test/TestParsing.cs
using Xunit; namespace CronExpressionDescriptor.Test { public class TestParsing { [Fact] public void TestWeekDayAndMonthParsing() { var expression = "0 59 23 31 dEc frI *"; var options = new Options { Locale = "en" }; var res = ExpressionDescriptor.GetDescription(expression, options); Assert.Equal("At 11:59 PM, on day 31 of the month, only on Friday, only in December", res); } } }
namespace CronExpressionDescriptor.Test { public class TestParsing { } }
mit
C#
92cb5b37f427c4e9ea238467e534e5a735a89989
Throw exception
mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard,mvno/Okanshi.Dashboard
src/Okanshi.Dashboard/GetHealthChecks.cs
src/Okanshi.Dashboard/GetHealthChecks.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Okanshi.Dashboard.Models; namespace Okanshi.Dashboard { public interface IGetHealthChecks { IEnumerable<HealthCheck> Execute(string instanceName); } public class GetHealthChecks : IGetHealthChecks { private readonly IConfiguration _configuration; public GetHealthChecks(IConfiguration configuration) { _configuration = configuration; } public IEnumerable<HealthCheck> Execute(string instanceName) { var webClient = new WebClient(); var url = _configuration.GetAll().Single(x => x.Name.Equals(instanceName, StringComparison.OrdinalIgnoreCase)).Url; var response = webClient.DownloadString(string.Format("{0}/healthchecks", url)); var jObject = JObject.Parse(response); var version = jObject.GetValueOrDefault("Version", "-1"); if (version.Equals("-1", StringComparison.OrdinalIgnoreCase)) { var deserializeObject = JsonConvert.DeserializeObject<IDictionary<string, bool>>(response); return deserializeObject .Select(x => new HealthCheck { Name = x.Key, Success = x.Value, }); } if (version.Equals("0", StringComparison.OrdinalIgnoreCase)) { var deserializeObject = jObject.GetValue("Data").ToObject<IDictionary<string, bool>>(); return deserializeObject .Select(x => new HealthCheck { Name = x.Key, Success = x.Value, }); } throw new InvalidOperationException("Not supported version"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Okanshi.Dashboard.Models; namespace Okanshi.Dashboard { public interface IGetHealthChecks { IEnumerable<HealthCheck> Execute(string instanceName); } public class GetHealthChecks : IGetHealthChecks { private readonly IConfiguration _configuration; public GetHealthChecks(IConfiguration configuration) { _configuration = configuration; } public IEnumerable<HealthCheck> Execute(string instanceName) { var webClient = new WebClient(); var url = _configuration.GetAll().Single(x => x.Name.Equals(instanceName, StringComparison.OrdinalIgnoreCase)).Url; var response = webClient.DownloadString(string.Format("{0}/healthchecks", url)); var jObject = JObject.Parse(response); var version = jObject.GetValueOrDefault("Version", "-1"); if (version.Equals("-1", StringComparison.OrdinalIgnoreCase)) { var deserializeObject = JsonConvert.DeserializeObject<IDictionary<string, bool>>(response); return deserializeObject .Select(x => new HealthCheck { Name = x.Key, Success = x.Value, }); } if (version.Equals("0", StringComparison.OrdinalIgnoreCase)) { var deserializeObject = jObject.GetValue("Data").ToObject<IDictionary<string, bool>>(); return deserializeObject .Select(x => new HealthCheck { Name = x.Key, Success = x.Value, }); } return Enumerable.Empty<HealthCheck>(); } } }
mit
C#
d83b24a62a1f760084c3d61e31a7817a30bea951
update Model.cs
grokify/ringcentral-sdk-csharp-simple
src/RingCentralSimple.Api/Model/Model.cs
src/RingCentralSimple.Api/Model/Model.cs
using System; using System.Collections.Generic; using Newtonsoft.Json; namespace RingCentralSimple.Model { public class Base { public string ToJson() { return JsonConvert.SerializeObject(this); } } } namespace RingCentralSimple.Model { public class Caller { public string phoneNumber { get; set; } } } namespace RingCentralSimple.Model.Request { public class SMS : Base { public Caller from { get; set; } public List<Caller> to { get; set; } public string text { get; set; } } }
using System; using System.Collections.Generic; using Newtonsoft.Json; namespace RingCentralSimple.Model { public class Base { public string ToJson() { string json = JsonConvert.SerializeObject(this); return json; } } } namespace RingCentralSimple.Model { public class Caller { public string phoneNumber { get; set; } } } namespace RingCentralSimple.Model.Request { public class SMS : Base { public Caller from { get; set; } public List<Caller> to { get; set; } public string text { get; set; } } }
mit
C#
fe494447ea2b1e276e04c8ab4accfd3bdbf44e23
Set WinApiNet assembly as CLS-compliant
MpDzik/winapinet,MpDzik/winapinet
src/WinApiNet/Properties/AssemblyInfo.cs
src/WinApiNet/Properties/AssemblyInfo.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="WinAPI.NET"> // Copyright (c) Marek Dzikiewicz, 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("WinApiNet")] [assembly: AssemblyDescription("")] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("01efe7d3-2f81-420a-9ba7-290c1d5554e4")] // Assembly is CLS-compliant [assembly: CLSCompliant(true)]
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="WinAPI.NET"> // Copyright (c) Marek Dzikiewicz, All Rights Reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- 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("WinApiNet")] [assembly: AssemblyDescription("")] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("01efe7d3-2f81-420a-9ba7-290c1d5554e4")]
mit
C#
2148fb160bbb2130194ed17208232282f8acec57
Fix missing this
sharper-library/Sharper.C.Enumerable
Sharper.C.Enumerable/Data/EnumerableModule.cs
Sharper.C.Enumerable/Data/EnumerableModule.cs
using System; using System.Collections.Generic; using System.Linq; using Sharper.C.Control; namespace Sharper.C.Data { using static TrampolineModule; public static class EnumerableModule { public static B FoldLeft<A, B>(this IEnumerable<A> e, B x, Func<B, A, B> f) => e.Aggregate(x, f); public static B FoldRight<A, B>(this IEnumerable<A> e, B x, Func<A, B, B> f) => e.Reverse().Aggregate(x, (b, a) => f(a, b)); public static B LazyFoldRight<A, B> ( this IEnumerable<A> e , B x , Func<A, Trampoline<B>, Trampoline<B>> f ) => LazyFoldRight(e.GetEnumerator(), x, f).Eval(); private static Trampoline<B> LazyFoldRight<A, B> ( IEnumerator<A> e , B x , Func<A, Trampoline<B>, Trampoline<B>> f ) => e.MoveNext() ? f(e.Current, Suspend(() => LazyFoldRight(e, x, f))) : Done(x); } }
using System; using System.Collections.Generic; using System.Linq; using Sharper.C.Control; namespace Sharper.C.Data { using static TrampolineModule; public static class EnumerableModule { public static B FoldLeft<A, B>(this IEnumerable<A> e, B x, Func<B, A, B> f) => e.Aggregate(x, f); public static B FoldRight<A, B>(this IEnumerable<A> e, B x, Func<A, B, B> f) => e.Reverse().Aggregate(x, (b, a) => f(a, b)); public static B LazyFoldRight<A, B> ( IEnumerable<A> e , B x , Func<A, Trampoline<B>, Trampoline<B>> f ) => LazyFoldRight(e.GetEnumerator(), x, f).Eval(); private static Trampoline<B> LazyFoldRight<A, B> ( this IEnumerator<A> e , B x , Func<A, Trampoline<B>, Trampoline<B>> f ) => e.MoveNext() ? f(e.Current, Suspend(() => LazyFoldRight(e, x, f))) : Done(x); } }
mit
C#
bae91e339defcc1c3a7c2136f98f4eb5ea18793c
Add an API for getting the result of an operation without knowing it's type.
SilkStack/Silk.Data.SQL.ORM
Silk.Data.SQL.ORM/Operations/DataOperation.cs
Silk.Data.SQL.ORM/Operations/DataOperation.cs
using Silk.Data.SQL.Expressions; using Silk.Data.SQL.Queries; using System.Threading.Tasks; namespace Silk.Data.SQL.ORM.Operations { public abstract class DataOperation { /// <summary> /// Gets a value indicating if the operation can be executed as part of a batch operation. /// </summary> public abstract bool CanBeBatched { get; } /// <summary> /// Gets the SQL query needed to run the DataOperation. /// </summary> /// <returns></returns> public abstract QueryExpression GetQuery(); /// <summary> /// Process the result QueryResult set to the correct result set. /// </summary> public abstract void ProcessResult(QueryResult queryResult); /// <summary> /// Process the result QueryResult set to the correct result set. /// </summary> public abstract Task ProcessResultAsync(QueryResult queryResult); } public abstract class DataOperationWithResult : DataOperation { /// <summary> /// Gets the result of the data operation without a known static type. /// </summary> public abstract object UntypedResult { get; } } public abstract class DataOperationWithResult<T> : DataOperationWithResult { /// <summary> /// Gets the result of the data operation. /// </summary> public abstract T Result { get; } public override object UntypedResult => Result; } }
using Silk.Data.SQL.Expressions; using Silk.Data.SQL.Queries; using System.Threading.Tasks; namespace Silk.Data.SQL.ORM.Operations { public abstract class DataOperation { /// <summary> /// Gets a value indicating if the operation can be executed as part of a batch operation. /// </summary> public abstract bool CanBeBatched { get; } /// <summary> /// Gets the SQL query needed to run the DataOperation. /// </summary> /// <returns></returns> public abstract QueryExpression GetQuery(); /// <summary> /// Process the result QueryResult set to the correct result set. /// </summary> public abstract void ProcessResult(QueryResult queryResult); /// <summary> /// Process the result QueryResult set to the correct result set. /// </summary> public abstract Task ProcessResultAsync(QueryResult queryResult); } public abstract class DataOperationWithResult<T> : DataOperation { /// <summary> /// Gets the result of the data operation. /// </summary> public abstract T Result { get; } } }
mit
C#
1a516f282c24ba3c35cfa835589d9912afce0c63
Remove xml encoding in reports.
tronelius/simplereport,tronelius/simplereport,tronelius/simplereport
SimpleReport.Model/Replacers/ValueReplacer.cs
SimpleReport.Model/Replacers/ValueReplacer.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Xml; using System.Xml.Linq; namespace SimpleReport.Model.Replacers { /// <summary> /// Used to replace xml code and remove styling from rtf text /// </summary> public class ValueReplacer : IValueReplacer { public string Replace(string inputstring) { var value = IsRtf(inputstring) ? RtfToText(inputstring) : inputstring; return value; } private static bool IsRtf(string text) { return text.TrimStart().StartsWith("{\\rtf1", StringComparison.Ordinal); } private static string RtfToText(string text) { try { var rtBox = new System.Windows.Forms.RichTextBox {Rtf = text}; text = rtBox.Text; } catch (Exception ex) { // do nothing, just return faulty rtf } return text; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Xml; using System.Xml.Linq; namespace SimpleReport.Model.Replacers { /// <summary> /// Used to replace xml code and remove styling from rtf text /// </summary> public class ValueReplacer : IValueReplacer { public string Replace(string inputstring) { var value = IsRtf(inputstring) ? RtfToText(inputstring) : inputstring; value = XmlTextEncoder.Encode(value); return value; } private static bool IsRtf(string text) { return text.TrimStart().StartsWith("{\\rtf1", StringComparison.Ordinal); } private static string RtfToText(string text) { try { var rtBox = new System.Windows.Forms.RichTextBox {Rtf = text}; text = rtBox.Text; } catch (Exception ex) { // do nothing, just return faulty rtf } return text; } } }
apache-2.0
C#
9b6068be7bf6dd9b9923e18521feae8cc27a6701
Check if the specified path is a physical or a virtual path
mdavid/nuget,mdavid/nuget
src/Server/Infrastructure/PackageUtility.cs
src/Server/Infrastructure/PackageUtility.cs
using System; using System.Web; using System.Web.Hosting; using System.Configuration; using System.IO; namespace NuGet.Server.Infrastructure { public class PackageUtility { internal static string PackagePhysicalPath; private static string DefaultPackagePhysicalPath = HostingEnvironment.MapPath("~/Packages"); static PackageUtility() { string packagePath = ConfigurationManager.AppSettings["NuGetPackagePath"]; if (string.IsNullOrEmpty(packagePath)) { PackagePhysicalPath = DefaultPackagePhysicalPath; } else { if (Path.IsPathRooted(packagePath)) { PackagePhysicalPath = packagePath; } else { PackagePhysicalPath = HostingEnvironment.MapPath(packagePath); } } } public static Uri GetPackageUrl(string path, Uri baseUri) { return new Uri(baseUri, GetPackageDownloadUrl(path)); } private static string GetPackageDownloadUrl(string path) { return VirtualPathUtility.ToAbsolute("~/Packages/" + path); } } }
using System; using System.Web; using System.Web.Hosting; using System.Configuration; namespace NuGet.Server.Infrastructure { public class PackageUtility { internal static string PackagePhysicalPath; private static string DefaultPackagePhysicalPath = HostingEnvironment.MapPath("~/Packages"); static PackageUtility() { string packagePath = ConfigurationManager.AppSettings["NuGetPackagePath"]; if (string.IsNullOrEmpty(packagePath)) { PackagePhysicalPath = DefaultPackagePhysicalPath; } else { PackagePhysicalPath = packagePath; } } public static Uri GetPackageUrl(string path, Uri baseUri) { return new Uri(baseUri, GetPackageDownloadUrl(path)); } private static string GetPackageDownloadUrl(string path) { return VirtualPathUtility.ToAbsolute("~/Packages/" + path); } } }
apache-2.0
C#
da83203035cc4eba745e05c76a241f060ec60f5b
Update ElementCollectionBase.cs
inickvel/linq2db,linq2db/linq2db,sdanyliv/linq2db,MaceWindu/linq2db,jogibear9988/linq2db,sdanyliv/linq2db,rechkalov/linq2db,ronnyek/linq2db,enginekit/linq2db,AK107/linq2db,LinqToDB4iSeries/linq2db,jogibear9988/linq2db,giuliohome/linq2db,genusP/linq2db,barsgroup/bars2db,linq2db/linq2db,MaceWindu/linq2db,LinqToDB4iSeries/linq2db,barsgroup/linq2db,genusP/linq2db,lvaleriu/linq2db,lvaleriu/linq2db,AK107/linq2db
Source/Configuration/ElementCollectionBase.cs
Source/Configuration/ElementCollectionBase.cs
using System; using System.Configuration; namespace LinqToDB.Configuration { public abstract class ElementCollectionBase<T>: ConfigurationElementCollection where T : ConfigurationElement, new() { protected override ConfigurationElement CreateNewElement() { return new T(); } protected abstract object GetElementKey(T element); protected override sealed object GetElementKey(ConfigurationElement element) { return GetElementKey((T)element); } public new T this[string name] { get { return (T)BaseGet(name); } } public T this[int index] { get { return (T)BaseGet(index); } } } }
using System; using System.Configuration; namespace LinqToDB.Configuration { internal abstract class ElementCollectionBase<T>: ConfigurationElementCollection where T : ConfigurationElement, new() { protected override ConfigurationElement CreateNewElement() { return new T(); } protected abstract object GetElementKey(T element); protected override sealed object GetElementKey(ConfigurationElement element) { return GetElementKey((T)element); } public new T this[string name] { get { return (T)BaseGet(name); } } public T this[int index] { get { return (T)BaseGet(index); } } } }
mit
C#