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
c04462ff6f8bac339862f315437fc6a34cf50d86
Make changing the Uniform.Value update HasChanged
smoogipooo/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework
osu.Framework/Graphics/Shaders/Uniform.cs
osu.Framework/Graphics/Shaders/Uniform.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.OpenGL; namespace osu.Framework.Graphics.Shaders { public class Uniform<T> : IUniformWithValue<T> where T : struct { public Shader Owner { get; } public string Name { get; } public int Location { get; } public bool HasChanged { get; private set; } = true; private T _value; public T Value { get => _value; set { _value = value; HasChanged = true; } } public Uniform(Shader owner, string name, int uniformLocation) { Owner = owner; Name = name; Location = uniformLocation; } public void UpdateValue(ref T newValue) { if (newValue.Equals(Value)) return; Value = newValue; HasChanged = true; if (Owner.IsBound) Update(); } public void Update() { if (!HasChanged) return; GLWrapper.SetUniform(this); HasChanged = false; } ref T IUniformWithValue<T>.GetValueByRef() => ref _value; T IUniformWithValue<T>.GetValue() => Value; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.OpenGL; namespace osu.Framework.Graphics.Shaders { public class Uniform<T> : IUniformWithValue<T> where T : struct { public Shader Owner { get; } public string Name { get; } public int Location { get; } public bool HasChanged { get; private set; } = true; public T Value; public Uniform(Shader owner, string name, int uniformLocation) { Owner = owner; Name = name; Location = uniformLocation; } public void UpdateValue(ref T newValue) { if (newValue.Equals(Value)) return; Value = newValue; HasChanged = true; if (Owner.IsBound) Update(); } public void Update() { if (!HasChanged) return; GLWrapper.SetUniform(this); HasChanged = false; } ref T IUniformWithValue<T>.GetValueByRef() => ref Value; T IUniformWithValue<T>.GetValue() => Value; } }
mit
C#
8efad1a0d214cbd620a05195ab9b9415c02df607
Remove unused references
OlsonDev/PersonalWebApp,OlsonDev/PersonalWebApp
TagHelpers/IconTagHelper.cs
TagHelpers/IconTagHelper.cs
using System.IO; using System.Xml.Linq; using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.Extensions.PlatformAbstractions; namespace PersonalWebApp.TagHelpers { [HtmlTargetElement("icon", TagStructure = TagStructure.WithoutEndTag, Attributes = "name")] public class IconTagHelper : TagHelper { private readonly IApplicationEnvironment _appEnvironment; public string Name { get; set; } = "alert"; public string Size { get; set; } = "24"; public IconTagHelper(IApplicationEnvironment appEnvironment) { _appEnvironment = appEnvironment; } public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "svg"; output.TagMode = TagMode.StartTagAndEndTag; output.Attributes["width"] = Size; output.Attributes["height"] = Size; output.Attributes["viewBox"] = output.Attributes["viewBox"]?.Value?.ToString() ?? "0 0 24 24"; var classPostfix = (" " + output.Attributes["class"]?.Value).TrimEnd(); output.Attributes["class"] = "icon-" + Name.Replace(";", " icon-") + classPostfix; var names = Name.Split(';'); foreach (var name in names) { output.Content.AppendHtml(GetSvgContent(name)); } } private string GetSvgContent(string name) { XDocument doc; try { doc = GetSvgDocument(name); } catch (FileNotFoundException) { try { doc = GetSvgDocument("alert"); } catch (FileNotFoundException) { return $"<!-- File not found: {name} -->"; } } using (var reader = doc.CreateReader()) { reader.MoveToContent(); return reader.ReadInnerXml(); } } private XDocument GetSvgDocument(string name) { var basePath = _appEnvironment.ApplicationBasePath; return XDocument.Load(Path.Combine(basePath, $"Client/svg/{name}.svg")); } } }
using System; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; using System.Xml.Linq; using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Server.Kestrel; using Microsoft.Extensions.PlatformAbstractions; namespace PersonalWebApp.TagHelpers { [HtmlTargetElement("icon", TagStructure = TagStructure.WithoutEndTag, Attributes = "name")] public class IconTagHelper : TagHelper { private readonly IApplicationEnvironment _appEnvironment; public string Name { get; set; } = "alert"; public string Size { get; set; } = "24"; public IconTagHelper(IApplicationEnvironment appEnvironment) { _appEnvironment = appEnvironment; } public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "svg"; output.TagMode = TagMode.StartTagAndEndTag; output.Attributes["width"] = Size; output.Attributes["height"] = Size; output.Attributes["viewBox"] = output.Attributes["viewBox"]?.Value?.ToString() ?? "0 0 24 24"; var classPostfix = (" " + output.Attributes["class"]?.Value).TrimEnd(); output.Attributes["class"] = "icon-" + Name.Replace(";", " icon-") + classPostfix; var names = Name.Split(';'); foreach (var name in names) { output.Content.AppendHtml(GetSvgContent(name)); } } private string GetSvgContent(string name) { XDocument doc; try { doc = GetSvgDocument(name); } catch (FileNotFoundException) { try { doc = GetSvgDocument("alert"); } catch (FileNotFoundException) { return $"<!-- File not found: {name} -->"; } } using (var reader = doc.CreateReader()) { reader.MoveToContent(); return reader.ReadInnerXml(); } } private XDocument GetSvgDocument(string name) { var basePath = _appEnvironment.ApplicationBasePath; return XDocument.Load(Path.Combine(basePath, $"Client/svg/{name}.svg")); } } }
mit
C#
f11ca38cf85fdf31b42e087d536a8c61cacbc2dc
Change short name of the extension
Azure/azure-iot-hub-vs-cs,Azure/azure-iot-hub-vs-cs,Azure/azure-iot-hub-vs-cs
AzureIoTHubConnectedServiceLibrary/Provider.cs
AzureIoTHubConnectedServiceLibrary/Provider.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See license.txt file in the project root for full license information. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Media.Imaging; using System.Threading.Tasks; using Microsoft.VisualStudio.ConnectedServices; using System.ComponentModel.Composition; using Microsoft.VisualStudio.Services.Client.AccountManagement; using System.Threading; namespace AzureIoTHubConnectedService { [ConnectedServiceProviderExport("Microsoft.AzureIoTHubService")] internal class AzureIoTHubProvider : ConnectedServiceProvider { [Import] private IAzureIoTHubAccountManager IoTHubAccountManager { get; set; } [Import(typeof(Microsoft.VisualStudio.Shell.SVsServiceProvider))] private IServiceProvider ServiceProvider { get; set; } [ImportingConstructor] public AzureIoTHubProvider() { this.Category = "Microsoft"; this.Name = "Azure IoT"; this.Description = "Communicate between IoT devices and the cloud."; this.Icon = new BitmapImage(new Uri("pack://application:,,/" + this.GetType().Assembly.ToString() + ";component/AzureIoTHubProviderIcon.png")); this.CreatedBy = "Microsoft"; this.Version = new Version(1, 0, 0); this.MoreInfoUri = new Uri("http://aka.ms/iothubgetstartedVSCS"); } public override Task<ConnectedServiceConfigurator> CreateConfiguratorAsync(ConnectedServiceProviderContext context) { ConnectedServiceConfigurator configurator = new AzureIoTHubAccountProviderGrid(this.IoTHubAccountManager, this.ServiceProvider); return Task.FromResult(configurator); } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See license.txt file in the project root for full license information. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Media.Imaging; using System.Threading.Tasks; using Microsoft.VisualStudio.ConnectedServices; using System.ComponentModel.Composition; using Microsoft.VisualStudio.Services.Client.AccountManagement; using System.Threading; namespace AzureIoTHubConnectedService { [ConnectedServiceProviderExport("Microsoft.AzureIoTHubService")] internal class AzureIoTHubProvider : ConnectedServiceProvider { [Import] private IAzureIoTHubAccountManager IoTHubAccountManager { get; set; } [Import(typeof(Microsoft.VisualStudio.Shell.SVsServiceProvider))] private IServiceProvider ServiceProvider { get; set; } [ImportingConstructor] public AzureIoTHubProvider() { this.Category = "Microsoft"; this.Name = "Microsoft Azure IoT Connected Service"; this.Description = "Communicate between IoT devices and the cloud."; this.Icon = new BitmapImage(new Uri("pack://application:,,/" + this.GetType().Assembly.ToString() + ";component/AzureIoTHubProviderIcon.png")); this.CreatedBy = "Microsoft"; this.Version = new Version(1, 0, 0); this.MoreInfoUri = new Uri("http://aka.ms/iothubgetstartedVSCS"); } public override Task<ConnectedServiceConfigurator> CreateConfiguratorAsync(ConnectedServiceProviderContext context) { ConnectedServiceConfigurator configurator = new AzureIoTHubAccountProviderGrid(this.IoTHubAccountManager, this.ServiceProvider); return Task.FromResult(configurator); } } }
mit
C#
4f872abf04064470c1d873c9050b2e721b3c2894
remove dead code
bradphelan/SketchSolve.NET,bradphelan/SketchSolve.NET,bradphelan/SketchSolve.NET
SketchSolveC#/Circle.cs
SketchSolveC#/Circle.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SketchSolve { public class Circle : IEnumerable<Parameter> { public Point center = new Point (0, 0); public Parameter rad = new Parameter (0); #region IEnumerable implementation public double TangentError(Line line) { var pCircCenter = center; var pLineP1 = line.p1; var vLine = line.Vector; var vLineStartToCircCenter = pCircCenter - pLineP1; var pProjection = pLineP1 + vLineStartToCircCenter.ProjectOnto(vLine); var vCircCenterToProjection = pProjection - pCircCenter; var temp = vCircCenterToProjection.LengthSquared - rad.Value*rad.Value; return temp * temp; } public IEnumerator<Parameter> GetEnumerator () { foreach (var p in center) { yield return p; } yield return rad; } #endregion #region IEnumerable implementation IEnumerator IEnumerable.GetEnumerator () { return this.GetEnumerator (); } #endregion } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SketchSolve { public class Circle : IEnumerable<Parameter> { public Point center = new Point (0, 0); public Parameter rad = new Parameter (0); #region IEnumerable implementation public double TangentError(Line line) { var lu = line.Vector.Unit; var pCircCenter = center; var pLineP1 = line.p1; var vLine = line.Vector; var vLineStartToCircCenter = pCircCenter - pLineP1; var pProjection = pLineP1 + vLineStartToCircCenter.ProjectOnto(vLine); var vCircCenterToProjection = pProjection - pCircCenter; var temp = vCircCenterToProjection.LengthSquared - rad.Value*rad.Value; return temp * temp; } public IEnumerator<Parameter> GetEnumerator () { foreach (var p in center) { yield return p; } yield return rad; } #endregion #region IEnumerable implementation IEnumerator IEnumerable.GetEnumerator () { return this.GetEnumerator (); } #endregion } }
bsd-3-clause
C#
fcbac431148b8f0e538cfae330dd49bc898e0c03
correct the assembly information for SQLiteNG
N3X15/VoxelSim,OpenSimian/opensimulator,ft-/opensim-optimizations-wip-extras,ft-/opensim-optimizations-wip-tests,QuillLittlefeather/opensim-1,AlexRa/opensim-mods-Alex,ft-/arribasim-dev-extras,bravelittlescientist/opensim-performance,TomDataworks/opensim,N3X15/VoxelSim,rryk/omp-server,QuillLittlefeather/opensim-1,OpenSimian/opensimulator,OpenSimian/opensimulator,justinccdev/opensim,ft-/arribasim-dev-tests,bravelittlescientist/opensim-performance,ft-/opensim-optimizations-wip,BogusCurry/arribasim-dev,BogusCurry/arribasim-dev,TomDataworks/opensim,QuillLittlefeather/opensim-1,ft-/opensim-optimizations-wip-tests,AlexRa/opensim-mods-Alex,cdbean/CySim,rryk/omp-server,ft-/opensim-optimizations-wip-extras,M-O-S-E-S/opensim,allquixotic/opensim-autobackup,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,QuillLittlefeather/opensim-1,N3X15/VoxelSim,N3X15/VoxelSim,Michelle-Argus/ArribasimExtract,OpenSimian/opensimulator,allquixotic/opensim-autobackup,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip-tests,OpenSimian/opensimulator,QuillLittlefeather/opensim-1,Michelle-Argus/ArribasimExtract,ft-/arribasim-dev-tests,M-O-S-E-S/opensim,cdbean/CySim,TomDataworks/opensim,ft-/opensim-optimizations-wip-tests,QuillLittlefeather/opensim-1,TechplexEngineer/Aurora-Sim,ft-/opensim-optimizations-wip,Michelle-Argus/ArribasimExtract,Michelle-Argus/ArribasimExtract,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,rryk/omp-server,N3X15/VoxelSim,TechplexEngineer/Aurora-Sim,cdbean/CySim,M-O-S-E-S/opensim,ft-/arribasim-dev-extras,allquixotic/opensim-autobackup,AlexRa/opensim-mods-Alex,BogusCurry/arribasim-dev,TomDataworks/opensim,rryk/omp-server,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,BogusCurry/arribasim-dev,bravelittlescientist/opensim-performance,ft-/opensim-optimizations-wip-extras,ft-/opensim-optimizations-wip,bravelittlescientist/opensim-performance,cdbean/CySim,allquixotic/opensim-autobackup,justinccdev/opensim,N3X15/VoxelSim,ft-/opensim-optimizations-wip-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,cdbean/CySim,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,allquixotic/opensim-autobackup,TechplexEngineer/Aurora-Sim,justinccdev/opensim,ft-/arribasim-dev-tests,QuillLittlefeather/opensim-1,BogusCurry/arribasim-dev,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,justinccdev/opensim,N3X15/VoxelSim,bravelittlescientist/opensim-performance,M-O-S-E-S/opensim,TomDataworks/opensim,RavenB/opensim,N3X15/VoxelSim,OpenSimian/opensimulator,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip,RavenB/opensim,ft-/arribasim-dev-tests,AlexRa/opensim-mods-Alex,OpenSimian/opensimulator,rryk/omp-server,ft-/arribasim-dev-tests,AlexRa/opensim-mods-Alex,ft-/arribasim-dev-extras,bravelittlescientist/opensim-performance,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim,RavenB/opensim,ft-/arribasim-dev-extras,TomDataworks/opensim,Michelle-Argus/ArribasimExtract,RavenB/opensim,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-extras,justinccdev/opensim,allquixotic/opensim-autobackup,justinccdev/opensim,RavenB/opensim,TechplexEngineer/Aurora-Sim,ft-/opensim-optimizations-wip-tests,TomDataworks/opensim,rryk/omp-server,AlexRa/opensim-mods-Alex,cdbean/CySim,RavenB/opensim,BogusCurry/arribasim-dev,M-O-S-E-S/opensim,Michelle-Argus/ArribasimExtract,M-O-S-E-S/opensim
OpenSim/Data/SQLiteNG/Properties/AssemblyInfo.cs
OpenSim/Data/SQLiteNG/Properties/AssemblyInfo.cs
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 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("OpenSim.Data.SQLiteNG")] [assembly : AssemblyDescription("")] [assembly : AssemblyConfiguration("")] [assembly : AssemblyCompany("http://opensimulator.org")] [assembly : AssemblyProduct("OpenSim.Data.SQLiteNG")] [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-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("6113d5ce-4547-49f4-9236-0dcc503457b1")] // 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("0.6.5.*")] [assembly : AssemblyFileVersion("0.6.5.0")]
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 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("OpenSim.Data.SQLite")] [assembly : AssemblyDescription("")] [assembly : AssemblyConfiguration("")] [assembly : AssemblyCompany("http://opensimulator.org")] [assembly : AssemblyProduct("OpenSim.Data.SQLite")] [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-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("6113d5ce-4547-49f4-9236-0dcc503457b1")] // 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("0.6.5.*")] [assembly : AssemblyFileVersion("0.6.5.0")]
bsd-3-clause
C#
45571fd2475781a2d04bc4cd90cc43be4717a887
Write test to ensure characters are normalized.
boumenot/Grobid.NET
test/Grobid.PdfToXml.Test/TokenBlockFactoryTest.cs
test/Grobid.PdfToXml.Test/TokenBlockFactoryTest.cs
using System; using FluentAssertions; using iTextSharp.text.pdf.parser; using Xunit; namespace Grobid.PdfToXml.Test { public class TokenBlockFactoryTest { [Fact] public void FactoryShouldNormalizeUnicodeStrings() { var stub = new TextRenderInfoStub { AscentLine = new LineSegment(new Vector(0, 0, 0), new Vector(1, 1, 1)), Baseline = new LineSegment(new Vector(0, 0, 0), new Vector(1, 1, 1)), DescentLine = new LineSegment(new Vector(0, 0, 0), new Vector(1, 1, 1)), PostscriptFontName = "CHUFSU+NimbusRomNo9L-Medi", Text = "abcd\u0065\u0301fgh", }; var testSubject = new TokenBlockFactory(100, 100); var tokenBlock = testSubject.Create(stub); stub.Text.ToCharArray().Should().HaveCount(9); tokenBlock.Text.ToCharArray().Should().HaveCount(8); } } }
using System; using FluentAssertions; using Xunit; namespace Grobid.PdfToXml.Test { public class TokenBlockFactoryTest { [Fact] public void TestA() { var stub = new TextRenderInfoStub(); var testSubject = new TokenBlockFactory(100, 100); Action test = () => testSubject.Create(stub); test.ShouldThrow<NullReferenceException>("I am still implementing the code."); } } }
apache-2.0
C#
5f70ac64967c1fd80618c58647f76d9201679a25
add token for token email request
dhawalharsora/connectedcare-sdk,SnapMD/connectedcare-sdk
SnapMD.VirtualCare.ApiModels/EmailUserRequest.cs
SnapMD.VirtualCare.ApiModels/EmailUserRequest.cs
using SnapMD.VirtualCare.ApiModels.Enums; namespace SnapMD.VirtualCare.ApiModels { /// <summary> /// Request Model for sending email to user. /// </summary> public class EmailUserRequest { /// <summary> /// Gets or sets the email. /// </summary> /// <value> /// The email. /// </value> public string Email { get; set; } /// <summary> /// Gets or sets the hospital identifier. /// </summary> /// <value> /// The hospital identifier. /// </value> public int HospitalId { get; set; } /// <summary> /// Gets or sets the user type identifier. /// </summary> /// <value> /// The user type identifier. /// </value> public UserType? UserTypeId { get; set; } /// <summary> /// The token for the email request. /// </summary> public string Token { get; set; } } }
using SnapMD.VirtualCare.ApiModels.Enums; namespace SnapMD.VirtualCare.ApiModels { /// <summary> /// Request Model for sending email to user. /// </summary> public class EmailUserRequest { /// <summary> /// Gets or sets the email. /// </summary> /// <value> /// The email. /// </value> public string Email { get; set; } /// <summary> /// Gets or sets the hospital identifier. /// </summary> /// <value> /// The hospital identifier. /// </value> public int HospitalId { get; set; } /// <summary> /// Gets or sets the user type identifier. /// </summary> /// <value> /// The user type identifier. /// </value> public UserType? UserTypeId { get; set; } } }
apache-2.0
C#
9b8810717224b6778aaf890c47bc5fe6a3f325a1
change resolution to 1024x768
tekkenfreak3/Apphack6
Jump.cs
Jump.cs
using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace JumpGame { public class Jump : Game { GraphicsDeviceManager graphics; public Jump() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1024; graphics.PreferredBackBufferHeight = 768; Content.RootDirectory = "Content"; } protected override void Initialize() { base.Initialize(); } protected override void Update(GameTime gt) { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } base.Update(gt); } protected override void Draw(GameTime gt) { GraphicsDevice.Clear(Color.HotPink); base.Draw(gt); } public static void Main() { System.Console.WriteLine("Test"); try { using (Jump game = new Jump()) game.Run(); }catch (EntryPointNotFoundException e) { Console.WriteLine("The fuck is an entry point?"); } } } }
using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace JumpGame { public class Jump : Game { GraphicsDeviceManager graphics; public Jump() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } protected override void Initialize() { base.Initialize(); } protected override void Update(GameTime gt) { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } base.Update(gt); } protected override void Draw(GameTime gt) { GraphicsDevice.Clear(Color.HotPink); base.Draw(gt); } public static void Main() { System.Console.WriteLine("Test"); try { using (Jump game = new Jump()) game.Run(); }catch (EntryPointNotFoundException e) { Console.WriteLine("The fuck is an entry point?"); } } } }
isc
C#
b8f2db7941e3562076bf314888b230066d78a71f
Add Dustin to Contact page.
jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox
ZirMed.TrainingSandbox/Views/Home/Contact.cshtml
ZirMed.TrainingSandbox/Views/Home/Contact.cshtml
@{ ViewBag.Title = "Contact"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <address> One Microsoft Way<br /> Redmond, WA 98052-6399<br /> <abbr title="Phone">P:</abbr> 425.555.0100 </address> <address> <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br /> <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a> <strong>Pat:</strong> <a href="mailto:patrick.fulton@zirmed.com">patrick.fulton@zirmed.com</a> <strong>Dustin:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> </address>
@{ ViewBag.Title = "Contact"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <address> One Microsoft Way<br /> Redmond, WA 98052-6399<br /> <abbr title="Phone">P:</abbr> 425.555.0100 </address> <address> <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br /> <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a> <strong>Pat:</strong> <a href="mailto:patrick.fulton@zirmed.com">patrick.fulton@zirmed.com</a> </address>
mit
C#
bccb7be389234410c0501ee3794f5a59fa27268d
Fix property
fredatgithub/WinFormTemplate
WinFormTemplate/FormOptions.cs
WinFormTemplate/FormOptions.cs
/* The MIT License(MIT) Copyright(c) 2015 Freddy Juhel 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.Windows.Forms; namespace WinFormTemplate { internal partial class FormOptions : Form { private readonly ConfigurationOptions _configurationOptions2; internal FormOptions(ConfigurationOptions configurationOptions) { if (configurationOptions == null) { //throw new ArgumentNullException(nameof(configurationOptions)); _configurationOptions2 = new ConfigurationOptions(); } else { _configurationOptions2 = configurationOptions; } InitializeComponent(); checkBoxOption1.Checked = ConfigurationOptions2.Option1Name; checkBoxOption2.Checked = ConfigurationOptions2.Option2Name; } internal ConfigurationOptions ConfigurationOptions2 { get { return _configurationOptions2; } } private void buttonOptionsOK_Click(object sender, EventArgs e) { ConfigurationOptions2.Option1Name = checkBoxOption1.Checked; ConfigurationOptions2.Option2Name = checkBoxOption2.Checked; Close(); } private void buttonOptionsCancel_Click(object sender, EventArgs e) { Close(); } private void FormOptions_Load(object sender, EventArgs e) { // take care of language //buttonOptionsCancel.Text = _languageDicoEn["Cancel"]; } } }
/* The MIT License(MIT) Copyright(c) 2015 Freddy Juhel 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.Windows.Forms; namespace WinFormTemplate { internal partial class FormOptions : Form { internal FormOptions(ConfigurationOptions configurationOptions) { if (configurationOptions == null) { //throw new ArgumentNullException(nameof(configurationOptions)); ConfigurationOptions2 = new ConfigurationOptions(); } else { ConfigurationOptions2 = configurationOptions; } InitializeComponent(); checkBoxOption1.Checked = ConfigurationOptions2.Option1Name; checkBoxOption2.Checked = ConfigurationOptions2.Option2Name; } internal ConfigurationOptions ConfigurationOptions2 { get; } private void buttonOptionsOK_Click(object sender, EventArgs e) { ConfigurationOptions2.Option1Name = checkBoxOption1.Checked; ConfigurationOptions2.Option2Name = checkBoxOption2.Checked; Close(); } private void buttonOptionsCancel_Click(object sender, EventArgs e) { Close(); } private void FormOptions_Load(object sender, EventArgs e) { // take care of language //buttonOptionsCancel.Text = _languageDicoEn["Cancel"]; } } }
mit
C#
a46bd6bd999bc45087eb2bad592f129ab3fb329c
support for namespaces in argslist for xsd2codemirror.exe
q42jaap/xsd2codemirror
xsd2codemirror/Program.cs
xsd2codemirror/Program.cs
using SimpleSchemaParser; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace xsd2codemirror { public static class Program { public static void Usage() { Console.WriteLine("Usage:"); Console.WriteLine("xsd2codemirror.exe [-v] path-to-xsd"); } public static void Main(string[] args) { List<string> argsList = new List<string>(args); bool verbose = false; if (argsList.Contains("-v") || argsList.Contains("-verbose")) { verbose = true; argsList.RemoveAll(s => s == "-v" || s == "-verbose"); } Dictionary<string, string> namespacePrefixes = new Dictionary<string, string>(); int index; while ((index = argsList.IndexOf("-prefix")) != -1) { argsList.RemoveAt(index); if (argsList.Count <= index) { Usage(); return; } var prefix = argsList[index]; argsList.RemoveAt(index); if (argsList.Count <= index) { Usage(); return; } var @namespace = argsList[index]; argsList.RemoveAt(index); namespacePrefixes[@namespace] = prefix; } if (argsList.Count != 1) { Usage(); return; } try { var parser = new SchemaParser(argsList[0]); if (verbose) parser.Logger = new ConsoleLogger(); parser.Compile(); var elements = parser.GetXmlElements(); var serializer = new CodeMirrorSchemaInfoSerializer(elements); serializer.Pretty = true; foreach (var nsPr in namespacePrefixes) { serializer.SetPrefix(nsPr.Key, nsPr.Value); } var json = serializer.ToJsonString(); Console.WriteLine(json); } catch (Exception e) { Console.Error.WriteLine(e.GetType().Name); Console.Error.WriteLine(e.Message); Console.Error.WriteLine(e.StackTrace); System.Environment.Exit(1); } } } }
using SimpleSchemaParser; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace xsd2codemirror { public static class Program { public static void Usage() { Console.WriteLine("Usage:"); Console.WriteLine("xsd2codemirror.exe [-v] path-to-xsd"); } public static void Main(string[] args) { List<string> argsList = new List<string>(args); bool verbose = false; if (argsList.Contains("-v")) { verbose = true; argsList.RemoveAll(s => s == "-v"); } if (argsList.Count != 1) { Usage(); return; } try { var parser = new SchemaParser(argsList[0]); if (verbose) parser.Logger = new ConsoleLogger(); parser.Compile(); var elements = parser.GetXmlElements(); var serializer = new CodeMirrorSchemaInfoSerializer(elements); serializer.Pretty = true; var json = serializer.ToJsonString(); Console.WriteLine(json); } catch (Exception e) { Console.Error.WriteLine(e.GetType().Name); Console.Error.WriteLine(e.Message); Console.Error.WriteLine(e.StackTrace); System.Environment.Exit(1); } } } }
mit
C#
6f93df0b9dbd1317b072c61b124fb50b30017b41
Fix ticks causing hold note misses
smoogipoo/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu-new,peppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu
osu.Game.Rulesets.Mania/UI/OrderedHitPolicy.cs
osu.Game.Rulesets.Mania/UI/OrderedHitPolicy.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mania.UI { public class OrderedHitPolicy { private readonly HitObjectContainer hitObjectContainer; public OrderedHitPolicy(HitObjectContainer hitObjectContainer) { this.hitObjectContainer = hitObjectContainer; } public bool IsHittable(DrawableHitObject hitObject, double time) { var nextObject = hitObjectContainer.AliveObjects.GetNext(hitObject); return nextObject == null || time < nextObject.HitObject.StartTime; } /// <summary> /// Handles a <see cref="HitObject"/> being hit to potentially miss all earlier <see cref="HitObject"/>s. /// </summary> /// <param name="hitObject">The <see cref="HitObject"/> that was hit.</param> public void HandleHit(DrawableHitObject hitObject) { if (!IsHittable(hitObject, hitObject.HitObject.StartTime + hitObject.Result.TimeOffset)) throw new InvalidOperationException($"A {hitObject} was hit before it became hittable!"); foreach (var obj in enumerateHitObjectsUpTo(hitObject.HitObject.StartTime)) { if (obj.Judged) continue; ((DrawableManiaHitObject)obj).MissForcefully(); } } private IEnumerable<DrawableHitObject> enumerateHitObjectsUpTo(double targetTime) { foreach (var obj in hitObjectContainer.AliveObjects) { if (obj.HitObject.GetEndTime() >= targetTime) yield break; yield return obj; foreach (var nestedObj in obj.NestedHitObjects) { if (nestedObj.HitObject.GetEndTime() >= targetTime) break; yield return nestedObj; } } } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mania.UI { public class OrderedHitPolicy { private readonly HitObjectContainer hitObjectContainer; public OrderedHitPolicy(HitObjectContainer hitObjectContainer) { this.hitObjectContainer = hitObjectContainer; } public bool IsHittable(DrawableHitObject hitObject, double time) { var nextObject = hitObjectContainer.AliveObjects.GetNext(hitObject); return nextObject == null || time < nextObject.HitObject.StartTime; } /// <summary> /// Handles a <see cref="HitObject"/> being hit to potentially miss all earlier <see cref="HitObject"/>s. /// </summary> /// <param name="hitObject">The <see cref="HitObject"/> that was hit.</param> public void HandleHit(DrawableHitObject hitObject) { if (!IsHittable(hitObject, hitObject.HitObject.StartTime + hitObject.Result.TimeOffset)) throw new InvalidOperationException($"A {hitObject} was hit before it became hittable!"); foreach (var obj in enumerateHitObjectsUpTo(hitObject.HitObject.StartTime)) { if (obj.Judged) continue; ((DrawableManiaHitObject)obj).MissForcefully(); } } private IEnumerable<DrawableHitObject> enumerateHitObjectsUpTo(double targetTime) { foreach (var obj in hitObjectContainer.AliveObjects) { if (obj.HitObject.StartTime >= targetTime) yield break; yield return obj; foreach (var nestedObj in obj.NestedHitObjects) { if (nestedObj.HitObject.StartTime >= targetTime) break; yield return nestedObj; } } } } }
mit
C#
9d4a818e8165c24dda2f9462f8116eb51bd4a876
Update run.csx
vunvulear/Stuff,vunvulear/Stuff,vunvulear/Stuff
Azure/azure-function-extractgpslocation-onedrive-drawwatermark-git-ci-integration/Az.Function/PictureCSharp/run.csx
Azure/azure-function-extractgpslocation-onedrive-drawwatermark-git-ci-integration/Az.Function/PictureCSharp/run.csx
#r "Microsoft.Azure.WebJobs.Extensions.ApiHub" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ExifLib; using System.IO; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; public static void Run(Stream inputFile, Stream outputFile, TraceWriter log) { log.Info("Image Process Starts"); string locationText = GetCoordinate(inputFile, log); log.Info($"Text to be written: '{locationText}'"); // Reset position. After Exif operations to extract GPS data the cursor location is not on position 0 anymore; inputFile.Position = 0; WriteWatermark(locationText, inputFile, outputFile, log); log.Info("Image Process Ends"); } private static string GetCoordinate(Stream image, TraceWriter log) { log.Info("Extract location information"); ExifReader exifReader = new ExifReader(image); double[] latitudeComponents; exifReader.GetTagValue(ExifTags.GPSLatitude, out latitudeComponents); double[] longitudeComponents; exifReader.GetTagValue(ExifTags.GPSLongitude, out longitudeComponents); log.Info("Prepare string content"); string location = string.Empty; if (latitudeComponents == null || longitudeComponents == null) { location = "No GPS location"; } else { double latitude = 0; double longitude = 0; latitude = latitudeComponents[0] + latitudeComponents[1] / 60 + latitudeComponents[2] / 3600; longitude = longitudeComponents[0] + longitudeComponents[1] / 60 + longitudeComponents[2] / 3600; location = $"Latitude: '{latitude}' | Longitude: '{longitude}'"; } return location; } private static void WriteWatermark(string watermarkContent, Stream originalImage, Stream newImage, TraceWriter log) { log.Info("Write text to picture"); using (Image inputImage = Image.FromStream(originalImage, true)) { using (Graphics graphic = Graphics.FromImage(inputImage)) { graphic.SmoothingMode = SmoothingMode.HighQuality; graphic.InterpolationMode = InterpolationMode.HighQualityBicubic; graphic.PixelOffsetMode = PixelOffsetMode.HighQuality; graphic.DrawString(watermarkContent, new Font("Tahoma", 100, FontStyle.Bold), Brushes.Red, 200, 200); graphic.Flush(); log.Info("Write to the output stream"); inputImage.Save(newImage, ImageFormat.Jpeg); } } }
#r "Microsoft.Azure.WebJobs.Extensions.ApiHub" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ExifLib; using System.IO; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; public static void Run(Stream inputFile, Stream outputFile, TraceWriter log) { log.Info("Image Process Starts"); string locationText = GetCoordinate(inputFile, log); log.Info($"Text to be written: '{locationText}'"); // Reset position. After Exif operations the cursor location is not on position 0 anymore; inputFile.Position = 0; WriteWatermark(locationText, inputFile, outputFile, log); log.Info("Image Process Ends"); } private static string GetCoordinate(Stream image, TraceWriter log) { log.Info("Extract location information"); ExifReader exifReader = new ExifReader(image); double[] latitudeComponents; exifReader.GetTagValue(ExifTags.GPSLatitude, out latitudeComponents); double[] longitudeComponents; exifReader.GetTagValue(ExifTags.GPSLongitude, out longitudeComponents); log.Info("Prepare string content"); string location = string.Empty; if (latitudeComponents == null || longitudeComponents == null) { location = "No GPS location"; } else { double latitude = 0; double longitude = 0; latitude = latitudeComponents[0] + latitudeComponents[1] / 60 + latitudeComponents[2] / 3600; longitude = longitudeComponents[0] + longitudeComponents[1] / 60 + longitudeComponents[2] / 3600; location = $"Latitude: '{latitude}' | Longitude: '{longitude}'"; } return location; } private static void WriteWatermark(string watermarkContent, Stream originalImage, Stream newImage, TraceWriter log) { log.Info("Write text to picture"); using (Image inputImage = Image.FromStream(originalImage, true)) { using (Graphics graphic = Graphics.FromImage(inputImage)) { graphic.SmoothingMode = SmoothingMode.HighQuality; graphic.InterpolationMode = InterpolationMode.HighQualityBicubic; graphic.PixelOffsetMode = PixelOffsetMode.HighQuality; graphic.DrawString(watermarkContent, new Font("Tahoma", 100, FontStyle.Bold), Brushes.Red, 200, 200); graphic.Flush(); log.Info("Write to the output stream"); inputImage.Save(newImage, ImageFormat.Jpeg); } } }
apache-2.0
C#
835f9d3caefca607c291fe76e9a3e83fbb46e4c4
Fix formatting
eriawan/roslyn,diryboy/roslyn,weltkante/roslyn,bartdesmet/roslyn,wvdd007/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,weltkante/roslyn,dotnet/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,eriawan/roslyn,sharwell/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,sharwell/roslyn,weltkante/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,dotnet/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,diryboy/roslyn
src/Features/Core/Portable/SplitOrMergeIfStatements/Nested/AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider.cs
src/Features/Core/Portable/SplitOrMergeIfStatements/Nested/AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.SplitOrMergeIfStatements { internal abstract class AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider : AbstractSplitIfStatementCodeRefactoringProvider { // Converts: // if (a && b) // Console.WriteLine(); // // To: // if (a) // { // if (b) // Console.WriteLine(); // } protected sealed override int GetLogicalExpressionKind(ISyntaxKindsService syntaxKinds) => syntaxKinds.LogicalAndExpression; protected sealed override CodeAction CreateCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument, string ifKeywordText) => new MyCodeAction(string.Format(FeaturesResources.Split_into_nested_0_statements, ifKeywordText), createChangedDocument); protected sealed override Task<SyntaxNode> GetChangedRootAsync( Document document, SyntaxNode root, SyntaxNode ifOrElseIf, SyntaxNode leftCondition, SyntaxNode rightCondition, CancellationToken cancellationToken) { var ifGenerator = document.GetLanguageService<IIfLikeStatementGenerator>(); // If we have an else-if clause, we first convert it to an if statement. If there are any // else-if or else clauses following the outer if statement, they will be copied and placed inside too. var innerIfStatement = ifGenerator.WithCondition(ifGenerator.ToIfStatement(ifOrElseIf), rightCondition); var outerIfOrElseIf = ifGenerator.WithCondition(ifGenerator.WithStatementInBlock(ifOrElseIf, innerIfStatement), leftCondition); return Task.FromResult( root.ReplaceNode(ifOrElseIf, outerIfOrElseIf.WithAdditionalAnnotations(Formatter.Annotation))); } private sealed class MyCodeAction : CodeAction.DocumentChangeAction { public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument) : base(title, createChangedDocument, title) { } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.SplitOrMergeIfStatements { internal abstract class AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider : AbstractSplitIfStatementCodeRefactoringProvider { // Converts: // if (a && b) // Console.WriteLine(); // // To: // if (a) // { // if (b) // Console.WriteLine(); // } protected sealed override int GetLogicalExpressionKind(ISyntaxKindsService syntaxKinds) => syntaxKinds.LogicalAndExpression; protected sealed override CodeAction CreateCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument, string ifKeywordText) => new MyCodeAction(string.Format(FeaturesResources.Split_into_nested_0_statements, ifKeywordText), createChangedDocument); protected sealed override Task<SyntaxNode> GetChangedRootAsync( Document document, SyntaxNode root, SyntaxNode ifOrElseIf, SyntaxNode leftCondition, SyntaxNode rightCondition, CancellationToken cancellationToken) { var ifGenerator = document.GetLanguageService<IIfLikeStatementGenerator>(); // If we have an else-if clause, we first convert it to an if statement. If there are any // else-if or else clauses following the outer if statement, they will be copied and placed inside too. var innerIfStatement = ifGenerator.WithCondition(ifGenerator.ToIfStatement(ifOrElseIf), rightCondition); var outerIfOrElseIf = ifGenerator.WithCondition(ifGenerator.WithStatementInBlock(ifOrElseIf, innerIfStatement), leftCondition); return Task.FromResult( root.ReplaceNode(ifOrElseIf, outerIfOrElseIf.WithAdditionalAnnotations(Formatter.Annotation))); } private sealed class MyCodeAction : CodeAction.DocumentChangeAction { public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument) : base(title, createChangedDocument, title) { } } } }
mit
C#
6083f8dff055297b0df8f709883df7df5f3718aa
Add check for datetime min
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerApprenticeshipsService.Application/Queries/GetHMRCLevyDeclaration/GetHMRCLevyDeclarationQueryHandler.cs
src/SFA.DAS.EmployerApprenticeshipsService.Application/Queries/GetHMRCLevyDeclaration/GetHMRCLevyDeclarationQueryHandler.cs
using System; using System.Threading.Tasks; using MediatR; using SFA.DAS.EAS.Application.Queries.AccountTransactions.GetLastLevyDeclaration; using SFA.DAS.EAS.Application.Validation; using SFA.DAS.EAS.Domain.Interfaces; namespace SFA.DAS.EAS.Application.Queries.GetHMRCLevyDeclaration { public class GetHMRCLevyDeclarationQueryHandler : IAsyncRequestHandler<GetHMRCLevyDeclarationQuery,GetHMRCLevyDeclarationResponse> { private readonly IValidator<GetHMRCLevyDeclarationQuery> _validator; private readonly IHmrcService _hmrcService; private readonly IMediator _mediator; public GetHMRCLevyDeclarationQueryHandler(IValidator<GetHMRCLevyDeclarationQuery> validator, IHmrcService hmrcService, IMediator mediator) { _validator = validator; _hmrcService = hmrcService; _mediator = mediator; } public async Task<GetHMRCLevyDeclarationResponse> Handle(GetHMRCLevyDeclarationQuery message) { var validationResult = _validator.Validate(message); if (!validationResult.IsValid()) { throw new InvalidRequestException(validationResult.ValidationDictionary); } var existingDeclaration = await _mediator.SendAsync(new GetLastLevyDeclarationQuery {EmpRef = message.EmpRef}); DateTime? dateFrom = null; if (existingDeclaration?.Transaction?.Date != null && existingDeclaration.Transaction.Date != DateTime.MinValue) { dateFrom = existingDeclaration.Transaction?.Date.AddDays(-1); } var declarations = await _hmrcService.GetLevyDeclarations(message.EmpRef, dateFrom); var getLevyDeclarationResponse = new GetHMRCLevyDeclarationResponse { LevyDeclarations = declarations, Empref = message.EmpRef }; return getLevyDeclarationResponse; } } }
using System; using System.Threading.Tasks; using MediatR; using SFA.DAS.EAS.Application.Queries.AccountTransactions.GetLastLevyDeclaration; using SFA.DAS.EAS.Application.Validation; using SFA.DAS.EAS.Domain.Interfaces; namespace SFA.DAS.EAS.Application.Queries.GetHMRCLevyDeclaration { public class GetHMRCLevyDeclarationQueryHandler : IAsyncRequestHandler<GetHMRCLevyDeclarationQuery,GetHMRCLevyDeclarationResponse> { private readonly IValidator<GetHMRCLevyDeclarationQuery> _validator; private readonly IHmrcService _hmrcService; private readonly IMediator _mediator; public GetHMRCLevyDeclarationQueryHandler(IValidator<GetHMRCLevyDeclarationQuery> validator, IHmrcService hmrcService, IMediator mediator) { _validator = validator; _hmrcService = hmrcService; _mediator = mediator; } public async Task<GetHMRCLevyDeclarationResponse> Handle(GetHMRCLevyDeclarationQuery message) { var validationResult = _validator.Validate(message); if (!validationResult.IsValid()) { throw new InvalidRequestException(validationResult.ValidationDictionary); } var existingDeclaration = await _mediator.SendAsync(new GetLastLevyDeclarationQuery {EmpRef = message.EmpRef}); DateTime? dateFrom = null; if (existingDeclaration?.Transaction?.Date != null) { dateFrom = existingDeclaration.Transaction?.Date.AddDays(-1); } var declarations = await _hmrcService.GetLevyDeclarations(message.EmpRef, dateFrom); var getLevyDeclarationResponse = new GetHMRCLevyDeclarationResponse { LevyDeclarations = declarations, Empref = message.EmpRef }; return getLevyDeclarationResponse; } } }
mit
C#
56d666417406af4e9792756f68fbf6e84997130c
fix namespace
RapidScada/scada,RapidScada/scada,RapidScada/scada,RapidScada/scada
ScadaAgent/ScadaAgentCommon.UI/RemoteLogBox.cs
ScadaAgent/ScadaAgentCommon.UI/RemoteLogBox.cs
using Scada.UI; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Scada.Agent.UI { public class RemoteLogBox : LogBox { /// <summary> /// Initializes a new instance of the class. /// </summary> public RemoteLogBox(ListBox listBox, bool colorize = false) : base(listBox, colorize) { } } }
using Scada.UI; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ScadaAgentCommon.UI { public class RemoteLogBox : LogBox { /// <summary> /// Initializes a new instance of the class. /// </summary> public RemoteLogBox(ListBox listBox, bool colorize = false) : base(listBox, colorize) { } } }
apache-2.0
C#
720c9217121f2d8278de37ce6fe4c6d9e346337d
bump package version
simonpinn/Neo4jClient.Extension,profet23/Neo4jClient.Extension,CormacdeBarra/Neo4jClient.Extension,neutmute/Neo4jClient.Extension
SolutionItems/Properties/AssemblyInfoGlobal.cs
SolutionItems/Properties/AssemblyInfoGlobal.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyCopyright("Copyright 2014")] [assembly: AssemblyVersion("0.1.0.0")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyInformationalVersion("0.1.0.2-beta-tx")] // trigger pre release package #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: ComVisible(false)]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyCopyright("Copyright 2014")] [assembly: AssemblyVersion("0.1.0.0")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyInformationalVersion("0.1.0.1-beta-tx")] // trigger pre release package #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: ComVisible(false)]
mit
C#
7396f7b0c230abc6d0e1e7b87be87216c2722fe4
remove Tag in Post and Page model
csyntax/BlogSystem
Source/BlogSystem.Data/ApplicationDbContext.cs
Source/BlogSystem.Data/ApplicationDbContext.cs
namespace BlogSystem.Data { using System; using System.Linq; using System.Data.Entity; using Microsoft.AspNet.Identity.EntityFramework; using Contracts; using Models; public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext() : base(nameOrConnectionString: "DefaultConnection", throwIfV1Schema: false) { } public IDbSet<Page> Pages { get; set; } public IDbSet<Post> Posts { get; set; } public IDbSet<Comment> Comments { get; set; } public IDbSet<Setting> Settings { get; set; } public static ApplicationDbContext Create() { return new ApplicationDbContext(); } public override int SaveChanges() { this.ApplyAuditInfoRules(); return base.SaveChanges(); } private void ApplyAuditInfoRules() { var entitySet = this.ChangeTracker .Entries() .Where(e => e.Entity is IAuditInfo && (e.State == EntityState.Added || e.State == EntityState.Modified)); foreach (var entry in entitySet) { var entity = (IAuditInfo) entry.Entity; if (entry.State == EntityState.Added) { if (!entity.PreserveCreatedOn) { entity.CreatedOn = DateTime.Now; } } else { entity.ModifiedOn = DateTime.Now; } } } public new IDbSet<T> Set<T>() where T : class { return base.Set<T>(); } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); } } }
namespace BlogSystem.Data { using System; using System.Linq; using System.Data.Entity; using Microsoft.AspNet.Identity.EntityFramework; using Contracts; using Models; public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext() : base(nameOrConnectionString: "DefaultConnection", throwIfV1Schema: false) { } public IDbSet<Page> Pages { get; set; } public IDbSet<Post> Posts { get; set; } public IDbSet<Comment> Comments { get; set; } public IDbSet<Tag> Tags { get; set; } public IDbSet<Setting> Settings { get; set; } public static ApplicationDbContext Create() { return new ApplicationDbContext(); } public override int SaveChanges() { this.ApplyAuditInfoRules(); return base.SaveChanges(); } private void ApplyAuditInfoRules() { var entitySet = this.ChangeTracker .Entries() .Where(e => e.Entity is IAuditInfo && (e.State == EntityState.Added || e.State == EntityState.Modified)); foreach (var entry in entitySet) { var entity = (IAuditInfo) entry.Entity; if (entry.State == EntityState.Added) { if (!entity.PreserveCreatedOn) { entity.CreatedOn = DateTime.Now; } } else { entity.ModifiedOn = DateTime.Now; } } } public new IDbSet<T> Set<T>() where T : class { return base.Set<T>(); } protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); } } }
mit
C#
583c67e9105cbc67569e3ec39030a9170ea4fffc
bump to version 1.5.14
Terradue/DotNetOpenSearch
Terradue.OpenSearch/Properties/AssemblyInfo.cs
Terradue.OpenSearch/Properties/AssemblyInfo.cs
/* * Copyright (C) 2010-2014 Terradue S.r.l. * * This file is part of Terradue.OpenSearch. * * Foobar is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Terradue.OpenSearch. * If not, see http://www.gnu.org/licenses/. */ /*! \namespace Terradue.OpenSearch @{ Terradue.OpenSearch is a .Net library that provides an engine perform OpenSearch query from a class or an URL to multiple and custom types of results \xrefitem sw_version "Versions" "Software Package Version" 1.15.14 \xrefitem sw_link "Link" "Software Package Link" [DotNetOpenSearch](https://github.com/Terradue/DotNetOpenSearch) \xrefitem sw_license "License" "Software License" [AGPL](https://github.com/DotNetOpenSearch/Terradue.OpenSearch/blob/master/LICENSE) \xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication \ingroup OpenSearch @} */ using System.Reflection; using System.Runtime.CompilerServices; using NuGet4Mono.Extensions; [assembly: AssemblyTitle("Terradue.OpenSearch")] [assembly: AssemblyDescription("Terradue.OpenSearch is a library targeting .NET 4.0 and above that provides an easy way to perform OpenSearch query from a class or an URL to multiple and custom types of results (Atom, Rdf...)")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Terradue")] [assembly: AssemblyProduct("Terradue.OpenSearch")] [assembly: AssemblyCopyright("Terradue")] [assembly: AssemblyAuthors("Emmanuel Mathot")] [assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetOpenSearch")] [assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetOpenSearch/blob/master/LICENSE")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.15.14.*")] [assembly: AssemblyInformationalVersion("1.15.14")]
/* * Copyright (C) 2010-2014 Terradue S.r.l. * * This file is part of Terradue.OpenSearch. * * Foobar is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Terradue.OpenSearch. * If not, see http://www.gnu.org/licenses/. */ /*! \namespace Terradue.OpenSearch @{ Terradue.OpenSearch is a .Net library that provides an engine perform OpenSearch query from a class or an URL to multiple and custom types of results \xrefitem sw_version "Versions" "Software Package Version" 1.15.13 \xrefitem sw_link "Link" "Software Package Link" [DotNetOpenSearch](https://github.com/Terradue/DotNetOpenSearch) \xrefitem sw_license "License" "Software License" [AGPL](https://github.com/DotNetOpenSearch/Terradue.OpenSearch/blob/master/LICENSE) \xrefitem sw_req "Require" "Software Dependencies" \ref Terradue.ServiceModel.Syndication \ingroup OpenSearch @} */ using System.Reflection; using System.Runtime.CompilerServices; using NuGet4Mono.Extensions; [assembly: AssemblyTitle("Terradue.OpenSearch")] [assembly: AssemblyDescription("Terradue.OpenSearch is a library targeting .NET 4.0 and above that provides an easy way to perform OpenSearch query from a class or an URL to multiple and custom types of results (Atom, Rdf...)")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Terradue")] [assembly: AssemblyProduct("Terradue.OpenSearch")] [assembly: AssemblyCopyright("Terradue")] [assembly: AssemblyAuthors("Emmanuel Mathot")] [assembly: AssemblyProjectUrl("https://github.com/Terradue/DotNetOpenSearch")] [assembly: AssemblyLicenseUrl("https://github.com/Terradue/DotNetOpenSearch/blob/master/LICENSE")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.15.13.*")] [assembly: AssemblyInformationalVersion("1.15.13")]
agpl-3.0
C#
b611488e4af26376dd88fe5b22d125af3e6cebb7
Update LegendaryDroppedPopup.cs
prrovoss/THUD
plugins/Prrovoss/LegendaryDroppedPopup.cs
plugins/Prrovoss/LegendaryDroppedPopup.cs
using Turbo.Plugins.Default; namespace Turbo.Plugins.Prrovoss { public class LegendaryDroppedPopup : BasePlugin, ILootGeneratedHandler { public void OnLootGenerated(IItem item, bool gambled) { if (item.Quality >= ItemQuality.Legendary) Hud.RunOnPlugin<PopupNotifications>(plugin => { plugin.Show(item.SnoItem.NameLocalized + (item.AncientRank == 1 ? " (A)" : "") + (item.AncientRank == 2 ? " (P)" : ""), "Legendary dropped", 10000, "Hurray"); }); } public LegendaryDroppedPopup() { Enabled = true; } } }
using Turbo.Plugins.Default; namespace Turbo.Plugins.Prrovoss { public class LegendaryDroppedPopup : BasePlugin, ILootGeneratedHandler { public void OnLootGenerated(IItem item, bool gambled) { if (item.Quality >= ItemQuality.Legendary) Hud.RunOnPlugin<PopupNotifications>(plugin => { plugin.Show(item.SnoItem.NameLocalized + (item.AncientRank == 1 ? " (A)" : ""), "Legendary dropped", 10000, "Hurray"); }); } public LegendaryDroppedPopup() { Enabled = true; } } }
mit
C#
7e5f5f84f044444c906e80fda702b9d8dab93697
Update version number for future v2.2 release
Zeugma440/atldotnet
ATL/Properties/AssemblyInfo.cs
ATL/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Les informations générales relatives à un assembly dépendent de // l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations // associées à un assembly. [assembly: AssemblyTitle("ATL")] [assembly: AssemblyDescription("Audio Tools Library .NET")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ATL")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de // COM, affectez la valeur true à l'attribut ComVisible sur ce type. [assembly: ComVisible(false)] // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM [assembly: Guid("1597be31-1d62-45a6-8abb-380c406238e9")] // Les informations de version pour un assembly se composent des quatre valeurs suivantes : // // Version principale // Version secondaire // Numéro de build // Révision // // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut // en utilisant '*', comme indiqué ci-dessous : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.2.0.0")] [assembly: AssemblyFileVersion("2.2.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Les informations générales relatives à un assembly dépendent de // l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations // associées à un assembly. [assembly: AssemblyTitle("ATL")] [assembly: AssemblyDescription("Audio Tools Library .NET")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ATL")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de // COM, affectez la valeur true à l'attribut ComVisible sur ce type. [assembly: ComVisible(false)] // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM [assembly: Guid("1597be31-1d62-45a6-8abb-380c406238e9")] // Les informations de version pour un assembly se composent des quatre valeurs suivantes : // // Version principale // Version secondaire // Numéro de build // Révision // // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut // en utilisant '*', comme indiqué ci-dessous : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.1.0.0")] [assembly: AssemblyFileVersion("2.1.0.0")]
mit
C#
9b17dccfeb0046605c303c38cfdf9398b80dae07
Update version number.
Damnae/storybrew
editor/Properties/AssemblyInfo.cs
editor/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © Damnae 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.57.*")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © Damnae 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.56.*")]
mit
C#
2fbd26b4bfb57bde52dfe75ecc259b09e7628de5
Update version number.
Damnae/storybrew
editor/Properties/AssemblyInfo.cs
editor/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © Damnae 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.73.*")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("storybrew editor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("storybrew editor")] [assembly: AssemblyCopyright("Copyright © Damnae 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ff59aeea-c133-4bf8-8a0b-620a3c99022b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.72.*")]
mit
C#
eb18d3fdb5e0f41217146e895409bb822fadaa99
Add [Serializable] attribute
dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute
Source/NSubstitute/Exceptions/MissingSequenceNumberException.cs
Source/NSubstitute/Exceptions/MissingSequenceNumberException.cs
using System; using System.Runtime.Serialization; namespace NSubstitute.Exceptions { [Serializable] public class MissingSequenceNumberException : SubstituteException { public MissingSequenceNumberException() { } protected MissingSequenceNumberException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
using System.Runtime.Serialization; namespace NSubstitute.Exceptions { [Serializable] public class MissingSequenceNumberException : SubstituteException { public MissingSequenceNumberException() { } protected MissingSequenceNumberException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
bsd-3-clause
C#
c420d3d29b5010dec9203479b6f647ed26ff5876
Simplify Login() action - no explicit return necessary
GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet
aspnet/4-auth/Controllers/SessionController.cs
aspnet/4-auth/Controllers/SessionController.cs
// Copyright(c) 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. using System.Web; using System.Web.Mvc; using Microsoft.Owin.Security; namespace GoogleCloudSamples.Controllers { // [START login] public class SessionController : Controller { public void Login() { // Redirect to the Google OAuth 2.0 user consent screen HttpContext.GetOwinContext().Authentication.Challenge( new AuthenticationProperties { RedirectUri = "/" }, "Google" ); } // ... // [END login] // [START logout] public ActionResult Logout() { Request.GetOwinContext().Authentication.SignOut(); return Redirect("/"); } // [END logout] } }
// Copyright(c) 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy of // the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. using System.Web; using System.Web.Mvc; using Microsoft.Owin.Security; namespace GoogleCloudSamples.Controllers { // [START login] public class SessionController : Controller { public ActionResult Login() { // Redirect to the Google OAuth 2.0 user consent screen HttpContext.GetOwinContext().Authentication.Challenge( new AuthenticationProperties { RedirectUri = "/" }, "Google" ); return new HttpUnauthorizedResult(); } // ... // [END login] // [START logout] public ActionResult Logout() { Request.GetOwinContext().Authentication.SignOut(); return Redirect("/"); } // [END logout] } }
apache-2.0
C#
c8cebf88dc090bbcb9d6b74bdc77b78f84073a50
Update AssemblyInfo.cs
PanAndZoom/PanAndZoom,wieslawsoltes/PanAndZoom,wieslawsoltes/MatrixPanAndZoomDemo,PanAndZoom/PanAndZoom,wieslawsoltes/PanAndZoom
src/Wpf.Controls.PanAndZoom/Properties/AssemblyInfo.cs
src/Wpf.Controls.PanAndZoom/Properties/AssemblyInfo.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Reflection; using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Wpf.Controls.PanAndZoom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Wpf.Controls.PanAndZoom")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Reflection; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Markup; [assembly: AssemblyTitle("Wpf.Controls.PanAndZoom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Wpf.Controls.PanAndZoom")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: XmlnsPrefix("https://github.com/panandzoom", "paz")] [assembly: XmlnsDefinition("https://github.com/panandzoom", "Wpf.Controls.PanAndZoom")]
mit
C#
6e14e7cc482874361e489f7b2a8bff990e155d77
Update DoubleExceptionPreventionForLog.cs
maniero/SOpt,bigown/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,maniero/SOpt,bigown/SOpt,bigown/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,maniero/SOpt,bigown/SOpt,bigown/SOpt,bigown/SOpt,maniero/SOpt,maniero/SOpt
CSharp/Exception/DoubleExceptionPreventionForLog.cs
CSharp/Exception/DoubleExceptionPreventionForLog.cs
catch (Exception ex) when (!(ex is DbException) && !(ex is EntityException)) { //faz o que deseja aqui } //melhor catch (ex is DbException)) { //faz o que deseja aqui } catch (ex is EntityException) { //faz o que deseja aqui } catch (Exception ex) { //faz o que deseja aqui } //http://pt.stackoverflow.com/q/177913/101
catch (Exception ex) when (!(ex is SQLException) && !(ex is EntityException)) { //faz o que deseja aqui } //melhor catch (ex is SQLException)) { //faz o que deseja aqui } catch (ex is EntityException) { //faz o que deseja aqui } catch (Exception ex) { //faz o que deseja aqui } //http://pt.stackoverflow.com/q/177913/101
mit
C#
81280dfd257fe482e0baeab20c828849b26837a8
Use editable skin structure in combo colour picker
peppy/osu,NeoAdonis/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu-new,smoogipooo/osu,peppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,ppy/osu
osu.Game/Screens/Edit/Setup/ColoursSection.cs
osu.Game/Screens/Edit/Setup/ColoursSection.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterfaceV2; namespace osu.Game.Screens.Edit.Setup { internal class ColoursSection : SetupSection { public override LocalisableString Title => "Colours"; private LabelledColourPalette comboColours; [BackgroundDependencyLoader] private void load() { Children = new Drawable[] { comboColours = new LabelledColourPalette { Label = "Hitcircle / Slider Combos", FixedLabelWidth = LABEL_WIDTH, ColourNamePrefix = "Combo" } }; if (Beatmap.BeatmapSkin != null) comboColours.Colours.BindTo(Beatmap.BeatmapSkin.ComboColours); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Skinning; using osuTK.Graphics; namespace osu.Game.Screens.Edit.Setup { internal class ColoursSection : SetupSection { public override LocalisableString Title => "Colours"; private LabelledColourPalette comboColours; [BackgroundDependencyLoader] private void load() { Children = new Drawable[] { comboColours = new LabelledColourPalette { Label = "Hitcircle / Slider Combos", FixedLabelWidth = LABEL_WIDTH, ColourNamePrefix = "Combo" } }; var colours = Beatmap.BeatmapSkin?.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value; if (colours != null) comboColours.Colours.AddRange(colours.Select(c => (Colour4)c)); } } }
mit
C#
a0b7f07c8f1ff33baac4a60801c0dd70d816928c
update comment.
sassembla/Autoya,sassembla/Autoya,sassembla/Autoya
Assets/AutoyaSample/11_Resources/LoadResourcesSample.cs
Assets/AutoyaSample/11_Resources/LoadResourcesSample.cs
using System; using System.Collections; using AutoyaFramework; using AutoyaFramework.AssetBundles; using AutoyaFramework.Settings.AssetBundles; using UnityEngine; using UnityEngine.UI; public class LoadResourcesSample : MonoBehaviour { public Image image; private Sprite sprite; void Start() { /* Both AssetBundleLoadAsset method and Resources_LoadAsset method has same signature. you can replace load-source from Resources to AssetBundle easily. basically this method is async. */ Autoya.Resources_LoadAsset<Sprite>( "SampleResource/shisyamo", (assetName, sprite) => { Debug.Log("asset:" + assetName + " is successfully loaded as:" + sprite); image.sprite = sprite; }, (assetName, err, reason, autoyaStatus) => { Debug.LogError("failed to load assetName:" + assetName + " err:" + err + " reason:" + reason + " autoyaStatus:" + autoyaStatus); } ); } void OnApplicationQuit() { Autoya.Resources_Unload(sprite); } }
using System; using System.Collections; using AutoyaFramework; using AutoyaFramework.AssetBundles; using AutoyaFramework.Settings.AssetBundles; using UnityEngine; using UnityEngine.UI; public class LoadResourcesSample : MonoBehaviour { public Image image; private Sprite sprite; void Start() { Autoya.Resources_LoadAsset<Sprite>( "SampleResource/shisyamo", (assetName, sprite) => { Debug.Log("asset:" + assetName + " is successfully loaded as:" + sprite); image.sprite = sprite; }, (assetName, err, reason, autoyaStatus) => { Debug.LogError("failed to load assetName:" + assetName + " err:" + err + " reason:" + reason + " autoyaStatus:" + autoyaStatus); } ); } void OnApplicationQuit() { Autoya.Resources_Unload(sprite); } }
mit
C#
2fdfe5e667b92664f6e8a7d16d60871d450150ec
Update Custom field to the correct POCO representation
commercetools/commercetools-dotnet-sdk
commercetools.NET/Carts/CustomLineItemDraft.cs
commercetools.NET/Carts/CustomLineItemDraft.cs
using System.Collections.Generic; using commercetools.Common; using commercetools.CustomFields; using Newtonsoft.Json; namespace commercetools.Carts { /// <summary> /// API representation for creating a new CustomLineItem. /// </summary> /// <see href="http://dev.commercetools.com/http-api-projects-carts.html#customlineitemdraft"/> public class CustomLineItemDraft { #region Properties [JsonProperty(PropertyName = "name")] public LocalizedString Name { get; set; } [JsonProperty(PropertyName = "quantity")] public int? Quantity { get; set; } [JsonProperty(PropertyName = "money")] public Money Money { get; set; } [JsonProperty(PropertyName = "slug")] public string Slug { get; set; } [JsonProperty(PropertyName = "taxCategory")] public Reference TaxCategory { get; set; } [JsonProperty(PropertyName = "custom")] public CustomFieldsDraft Custom { get; set; } #endregion #region Constructors /// <summary> /// Constructor. /// </summary> public CustomLineItemDraft(LocalizedString name) { this.Name = name; } #endregion } }
using System.Collections.Generic; using commercetools.Common; using commercetools.CustomFields; using Newtonsoft.Json; namespace commercetools.Carts { /// <summary> /// API representation for creating a new CustomLineItem. /// </summary> /// <see href="http://dev.commercetools.com/http-api-projects-carts.html#customlineitemdraft"/> public class CustomLineItemDraft { #region Properties [JsonProperty(PropertyName = "name")] public LocalizedString Name { get; set; } [JsonProperty(PropertyName = "quantity")] public int? Quantity { get; set; } [JsonProperty(PropertyName = "money")] public Money Money { get; set; } [JsonProperty(PropertyName = "slug")] public string Slug { get; set; } [JsonProperty(PropertyName = "taxCategory")] public Reference TaxCategory { get; set; } [JsonProperty(PropertyName = "custom")] public List<CustomFieldsDraft> Custom { get; set; } #endregion #region Constructors /// <summary> /// Constructor. /// </summary> public CustomLineItemDraft(LocalizedString name) { this.Name = name; } #endregion } }
mit
C#
99e1d589c9fc5fd61ee215842d4c72cbd3add11d
Replace erroneous coopyright info
siwater/Cloudworks,siwater/Cloudworks,siwater/Cloudworks
Citrix.Cloudworks.Agent.Host/Properties/AssemblyInfo.cs
Citrix.Cloudworks.Agent.Host/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("Citrix Cloudworks Agent")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Citrix Systems, Inc.")] [assembly: AssemblyProduct("Citrix Cloudworks")] [assembly: AssemblyCopyright("Copyright © Citrix Systems, Inc. 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4e45a51e-0c4c-45bc-86fa-71491d4f8e81")] // 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("14.03.26")] [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("Citrix.SelfServiceDesktops.Agent.Host")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Hewlett-Packard Company")] [assembly: AssemblyProduct("Citrix.SelfServiceDesktops.Agent.Host")] [assembly: AssemblyCopyright("Copyright © Hewlett-Packard Company 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4e45a51e-0c4c-45bc-86fa-71491d4f8e81")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
114c71592c87809626beb354c73a6e3ef32a7ed1
Remove unnecessary argument exception documentation on user info
cronofy/cronofy-csharp
src/Cronofy/ICronofyUserInfoClient.cs
src/Cronofy/ICronofyUserInfoClient.cs
namespace Cronofy { using System; /// <summary> /// Interface for a Cronofy client base that manages the /// access token and any shared client methods. /// </summary> public interface ICronofyUserInfoClient { /// <summary> /// Gets the user info belonging to the account. /// </summary> /// <returns>The account's user info.</returns> /// <exception cref="CronofyException"> /// Thrown if an error is encountered whilst making the request. /// </exception> UserInfo GetUserInfo(); } }
namespace Cronofy { using System; /// <summary> /// Interface for a Cronofy client base that manages the /// access token and any shared client methods. /// </summary> public interface ICronofyUserInfoClient { /// <summary> /// Gets the user info belonging to the account. /// </summary> /// <returns>The account's user info.</returns> /// <exception cref="ArgumentException"> /// Thrown if <paramref name="request"/> is null. /// </exception> /// <exception cref="CronofyException"> /// Thrown if an error is encountered whilst making the request. /// </exception> UserInfo GetUserInfo(); } }
mit
C#
c1ac6a5c3ad934e719f3c83d5dc69f1023d8a222
remove conversationID from ExampleConversation
watson-developer-cloud/unity-sdk,watson-developer-cloud/unity-sdk,kimberlysiva/unity-sdk,watson-developer-cloud/unity-sdk,scottdangelo/unity-sdk,scottdangelo/unity-sdk,kimberlysiva/unity-sdk
Examples/ServiceExamples/Scripts/ExampleConversation.cs
Examples/ServiceExamples/Scripts/ExampleConversation.cs
/** * Copyright 2015 IBM Corp. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using UnityEngine; using IBM.Watson.DeveloperCloud.Services.Conversation.v1; using IBM.Watson.DeveloperCloud.Utilities; using IBM.Watson.DeveloperCloud.Logging; using System; public class ExampleConversation : MonoBehaviour { private Conversation m_Conversation = new Conversation(); private string m_WorkspaceID; private bool m_UseAlternateIntents = true; private string[] questionArray = { "can you turn up the AC", "can you turn on the wipers", "can you turn off the wipers", "can you turn down the ac", "can you unlock the door"}; void Start () { LogSystem.InstallDefaultReactors(); m_WorkspaceID = Config.Instance.GetVariableValue("ConversationV1_ID"); Debug.Log("**********User: Hello!"); MessageWithOnlyInput("Hello!"); } private void MessageWithOnlyInput(string input) { if (string.IsNullOrEmpty(input)) throw new ArgumentNullException("input"); m_Conversation.Message(OnMessageWithOnlyInput, m_WorkspaceID, input); } private void OnMessageWithOnlyInput(MessageResponse resp, string customData) { if (resp != null) { foreach (Intent mi in resp.intents) Debug.Log("intent: " + mi.intent + ", confidence: " + mi.confidence); if (resp.output != null && resp.output.text.Length > 0) foreach (string txt in resp.output.text) Debug.Log("output: " + txt); string questionStr = questionArray[UnityEngine.Random.Range(0, questionArray.Length - 1)]; Debug.Log(string.Format("**********User: {0}", questionStr)); MessageRequest messageRequest = new MessageRequest(); messageRequest.InputText = questionStr; messageRequest.alternate_intents = m_UseAlternateIntents; messageRequest.ContextData = resp.context; MessageWithFullMessageRequest(messageRequest); } else { Debug.Log("Failed to invoke Message();"); } } private void MessageWithFullMessageRequest(MessageRequest messageRequest) { if (messageRequest == null) throw new ArgumentNullException("messageRequest"); m_Conversation.Message(OnMessageWithOnlyInput, m_WorkspaceID, messageRequest); } }
/** * Copyright 2015 IBM Corp. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using UnityEngine; using IBM.Watson.DeveloperCloud.Services.Conversation.v1; using IBM.Watson.DeveloperCloud.Utilities; using IBM.Watson.DeveloperCloud.Logging; using System; public class ExampleConversation : MonoBehaviour { private Conversation m_Conversation = new Conversation(); private string m_WorkspaceID; private string m_ConversationID; private bool m_UseAlternateIntents = true; private string[] questionArray = { "can you turn up the AC", "can you turn on the wipers", "can you turn off the wipers", "can you turn down the ac", "can you unlock the door"}; void Start () { LogSystem.InstallDefaultReactors(); m_WorkspaceID = Config.Instance.GetVariableValue("ConversationV1_ID"); Debug.Log("**********User: Hello!"); MessageWithOnlyInput("Hello!"); } private void MessageWithOnlyInput(string input) { if (string.IsNullOrEmpty(input)) throw new ArgumentNullException("input"); m_Conversation.Message(OnMessageWithOnlyInput, m_WorkspaceID, input); } private void OnMessageWithOnlyInput(MessageResponse resp, string customData) { if (resp != null) { foreach (Intent mi in resp.intents) Debug.Log("intent: " + mi.intent + ", confidence: " + mi.confidence); if (resp.output != null && resp.output.text.Length > 0) foreach (string txt in resp.output.text) Debug.Log("output: " + txt); m_ConversationID = resp.context.conversation_id; string questionStr = questionArray[UnityEngine.Random.Range(0, questionArray.Length - 1)]; Debug.Log(string.Format("**********User: {0}", questionStr)); MessageRequest messageRequest = new MessageRequest(); messageRequest.InputText = questionStr; messageRequest.alternate_intents = m_UseAlternateIntents; messageRequest.ContextData = resp.context; MessageWithFullMessageRequest(messageRequest); } else { Debug.Log("Failed to invoke Message();"); } } private void MessageWithFullMessageRequest(MessageRequest messageRequest) { if (messageRequest == null) throw new ArgumentNullException("messageRequest"); m_Conversation.Message(OnMessageWithOnlyInput, m_WorkspaceID, messageRequest); } }
apache-2.0
C#
95e8ee2e1387423fd8b0db190214c966043fcedf
Fix to pass ThConverterEventArgsTests
y-iihoshi/ThScoreFileConverter,y-iihoshi/ThScoreFileConverter
ThScoreFileConverter/Models/ThConverterEventArgs.cs
ThScoreFileConverter/Models/ThConverterEventArgs.cs
//----------------------------------------------------------------------- // <copyright file="ThConverterEventArgs.cs" company="None"> // (c) 2014-2015 IIHOSHI Yoshinori // </copyright> //----------------------------------------------------------------------- namespace ThScoreFileConverter.Models { using System; /// <summary> /// Represents the event data issued by the <see cref="ThConverter"/> class. /// </summary> internal class ThConverterEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="ThConverterEventArgs"/> class. /// </summary> /// <param name="path">The path of the last output file.</param> /// <param name="current">The number of the files that have been output.</param> /// <param name="total">The total number of the files.</param> /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception> /// <exception cref="ArgumentException"><paramref name="path"/> is empty.</exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="current"/> is not positive or greater than <paramref name="total"/>. /// </exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="total"/> is not positive.</exception> public ThConverterEventArgs(string path, int current, int total) { if (path is null) throw new ArgumentNullException(nameof(path)); if (path == string.Empty) throw new ArgumentException(nameof(path)); if ((current <= 0) || (current > total)) throw new ArgumentOutOfRangeException(nameof(current)); if (total <= 0) throw new ArgumentOutOfRangeException(nameof(total)); this.Path = path; this.Current = current; this.Total = total; } /// <summary> /// Gets the path of the last output file. /// </summary> public string Path { get; private set; } /// <summary> /// Gets the number of the files that have been output. /// </summary> public int Current { get; private set; } /// <summary> /// Gets the total number of the files. /// </summary> public int Total { get; private set; } /// <summary> /// Gets a message string that represents the current instance. /// </summary> public string Message { get { return Utils.Format( "({0}/{1}) {2} ", this.Current, this.Total, System.IO.Path.GetFileName(this.Path)); } } } }
//----------------------------------------------------------------------- // <copyright file="ThConverterEventArgs.cs" company="None"> // (c) 2014-2015 IIHOSHI Yoshinori // </copyright> //----------------------------------------------------------------------- namespace ThScoreFileConverter.Models { using System; /// <summary> /// Represents the event data issued by the <see cref="ThConverter"/> class. /// </summary> internal class ThConverterEventArgs : EventArgs { /// <summary> /// Initializes a new instance of the <see cref="ThConverterEventArgs"/> class. /// </summary> /// <param name="path">The path of the last output file.</param> /// <param name="current">The number of the files that have been output.</param> /// <param name="total">The total number of the files.</param> public ThConverterEventArgs(string path, int current, int total) { this.Path = path; this.Current = current; this.Total = total; } /// <summary> /// Gets the path of the last output file. /// </summary> public string Path { get; private set; } /// <summary> /// Gets the number of the files that have been output. /// </summary> public int Current { get; private set; } /// <summary> /// Gets the total number of the files. /// </summary> public int Total { get; private set; } /// <summary> /// Gets a message string that represents the current instance. /// </summary> public string Message { get { return Utils.Format( "({0}/{1}) {2} ", this.Current, this.Total, System.IO.Path.GetFileName(this.Path)); } } } }
bsd-2-clause
C#
a6e95b8677825a9dde286e47da608ee26d5e79ad
Improve when there is no carrier
janssenr/MyParcelApi.Net
src/MyParcelApi.Net/Models/Carrier.cs
src/MyParcelApi.Net/Models/Carrier.cs
namespace MyParcelApi.Net.Models { public enum Carrier { None = 0, PostNl = 1, BPost = 2 } }
namespace MyParcelApi.Net.Models { public enum Carrier { PostNl = 1, BPost = 2 } }
mit
C#
19d8e79c819603ed1cb5b8caf09f7b2b864fa631
Update OWIN project
mvno/Okanshi,mvno/Okanshi,mvno/Okanshi
src/Okanshi.Owin/OkanshiMiddleware.cs
src/Okanshi.Owin/OkanshiMiddleware.cs
using System.Collections.Generic; using System.Threading.Tasks; using AppFunc = System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>; namespace Okanshi.Owin { /// <summary> /// The Okanshi middleware /// </summary> public class OkanshiMiddleware { private readonly AppFunc next; private readonly OkanshiOwinOptions options; private static readonly List<Tag> EmptyTagList = new List<Tag>(); /// <summary> /// Create a new instance. /// </summary> public OkanshiMiddleware(AppFunc next, OkanshiOwinOptions options) { this.next = next; this.options = options; } /// <summary> /// Invoke the middleware. /// </summary> public async Task Invoke(IDictionary<string, object> environment) { long elapsed = 0; var timer = new OkanshiTimer(x => elapsed = x, () => new SystemStopwatch()); timer.Start(); await next.Invoke(environment); timer.Stop(); var tags = EmptyTagList; if (options.AddStatusCodeTag) { object responseCode; var found = environment.TryGetValue("owin.ResponseStatusCode", out responseCode); if (found) { tags.Add(new Tag("responseCode", responseCode.ToString())); } } tags.Add(new Tag("path", environment["owin.RequestPath"].ToString())); tags.Add(new Tag("method", environment["owin.RequestMethod"].ToString())); var basicTimer = OkanshiMonitor.BasicTimer(options.MetricName, tags.ToArray()); basicTimer.Register(elapsed); } } }
using System.Collections.Generic; using System.Threading.Tasks; using AppFunc = System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>; namespace Okanshi.Owin { /// <summary> /// The Okanshi middleware /// </summary> public class OkanshiMiddleware { private readonly AppFunc next; private readonly OkanshiOwinOptions options; private static readonly List<Tag> EmptyTagList = new List<Tag>(); /// <summary> /// Create a new instance. /// </summary> public OkanshiMiddleware(AppFunc next, OkanshiOwinOptions options) { this.next = next; this.options = options; } /// <summary> /// Invoke the middleware. /// </summary> public async Task Invoke(IDictionary<string, object> environment) { long elapsed = 0; var timer = OkanshiTimer.StartNew(x => elapsed = x); await next.Invoke(environment); timer.Stop(); var tags = EmptyTagList; if (options.AddStatusCodeTag) { object responseCode; var found = environment.TryGetValue("owin.ResponseStatusCode", out responseCode); if (found) { tags.Add(new Tag("responseCode", responseCode.ToString())); } } tags.Add(new Tag("path", environment["owin.RequestPath"].ToString())); tags.Add(new Tag("method", environment["owin.RequestMethod"].ToString())); var basicTimer = OkanshiMonitor.BasicTimer(options.MetricName, tags.ToArray()); basicTimer.Register(elapsed); } } }
mit
C#
b25eb453d9b83ac80a16d351aef0dee338b861f8
Remove use of All()
martincostello/project-euler
src/ProjectEuler/Puzzles/Puzzle005.cs
src/ProjectEuler/Puzzles/Puzzle005.cs
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.ProjectEuler.Puzzles { using System; using System.Linq; /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=5</c>. This class cannot be inherited. /// </summary> public sealed class Puzzle005 : Puzzle { /// <inheritdoc /> public override string Question => "What is the smallest positive number that is evenly divisible by all of the numbers from 1 to the specified value?"; /// <inheritdoc /> protected override int MinimumArguments => 1; /// <inheritdoc /> protected override int SolveCore(string[] args) { if (!TryParseInt32(args[0], out int max) || max < 2) { Console.WriteLine("The specified maximum number is invalid."); return -1; } // Do not need to bother testing for divisibility by 1, plus the // for loop below only tests even numbers so can also exclude 2. int[] divisors = Enumerable.Range(3, max - 2).ToArray(); int divisorCount = divisors.Length; for (int n = max % 2 == 0 ? max : max - 1; ; n += 2) { if (max >= 10) { // Fast path for large numbers if (n % 3 != 0 || n % 5 != 0 || n % 10 != 0) { continue; } } bool found = true; for (int i = 0; i < divisorCount; i++) { if (n % divisors[i] != 0) { found = false; break; } } if (found) { Answer = n; break; } } return 0; } } }
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.ProjectEuler.Puzzles { using System; using System.Linq; /// <summary> /// A class representing the solution to <c>https://projecteuler.net/problem=5</c>. This class cannot be inherited. /// </summary> public sealed class Puzzle005 : Puzzle { /// <inheritdoc /> public override string Question => "What is the smallest positive number that is evenly divisible by all of the numbers from 1 to the specified value?"; /// <inheritdoc /> protected override int MinimumArguments => 1; /// <inheritdoc /> protected override int SolveCore(string[] args) { if (!TryParseInt32(args[0], out int max) || max < 2) { Console.WriteLine("The specified maximum number is invalid."); return -1; } // Do not need to bother testing for divisibility by 1, plus the // for loop below only tests even numbers so can also exclude 2. var divisors = Enumerable.Range(3, max - 2).ToList(); for (int n = max % 2 == 0 ? max : max - 1; ; n += 2) { if (max >= 10) { // Fast path for large numbers if (n % 3 != 0 || n % 5 != 0 || n % 10 != 0) { continue; } } if (divisors.All((p) => n % p == 0)) { Answer = n; break; } } return 0; } } }
apache-2.0
C#
42795d9f3ef6000b0da43d2864258574a9401921
add UpdateInfo()
yasokada/unity-160820-Inventory-UI
Assets/InventoryCS.cs
Assets/InventoryCS.cs
using UnityEngine; using System.Collections; using UnityEngine.UI; using NS_SampleData; using NS_MyStringUtil; /* * - add UpdateInfo() * - add [MyStringUtil.cs] * - add OpenURL() * v0.1 2016 Aug. 21 * - add MoveColumn() * - add MoveRow() * - add SampleData.cs * - add UI components (unique ID, Case No, Row, Column, About, DataSheet) */ public class InventoryCS : MonoBehaviour { public InputField ID_uniqueID; public Text T_caseNo; public Text T_row; public Text T_column; public InputField IF_name; public Text T_about; public Text T_datasheetURL; const int kIndex_caseNo = 0; const int kIndex_row = 1; const int kIndex_column = 2; const int kIndex_dataSheetURL = 5; // TODO: put other place to declare void Start () { T_about.text = NS_SampleData.SampleData.GetDataOfRow (0); } void Update () { } private void UpdateInfo(string datstr) { T_caseNo.text = MyStringUtil.ExtractCsvColumn (datstr, kIndex_caseNo); T_row.text = MyStringUtil.ExtractCsvColumn (datstr, kIndex_row); T_column.text = MyStringUtil.ExtractCsvColumn (datstr, kIndex_column); T_about.text = datstr; T_datasheetURL.text = MyStringUtil.ExtractCsvColumn (datstr, kIndex_dataSheetURL); } public void MoveRow(bool next) { if (next == false) { // previous string dtstr = NS_SampleData.SampleData.GetDataOfRow (0); UpdateInfo (dtstr); } else { string dtstr = NS_SampleData.SampleData.GetDataOfRow (1); UpdateInfo (dtstr); } } public void MoveColumn(bool next) { if (next == false) { // previous string dtstr = NS_SampleData.SampleData.GetDataOfColumn(0); UpdateInfo (dtstr); } else { string dtstr = NS_SampleData.SampleData.GetDataOfColumn (1); UpdateInfo (dtstr); T_caseNo.text = MyStringUtil.ExtractCsvColumn (dtstr, kIndex_caseNo); T_about.text = dtstr; } } public void OpenURL() { Application.OpenURL (T_datasheetURL.text); } }
using UnityEngine; using System.Collections; using UnityEngine.UI; using NS_SampleData; using NS_MyStringUtil; /* * - add [MyStringUtil.cs] * - add OpenURL() * v0.1 2016 Aug. 21 * - add MoveColumn() * - add MoveRow() * - add SampleData.cs * - add UI components (unique ID, Case No, Row, Column, About, DataSheet) */ public class InventoryCS : MonoBehaviour { public InputField ID_uniqueID; public Text T_caseNo; public Text T_row; public Text T_column; public InputField IF_name; public Text T_about; public Text T_datasheetURL; const int kIndex_dataSheetURL = 5; // TODO: put other place to declare void Start () { T_about.text = NS_SampleData.SampleData.GetDataOfRow (0); } void Update () { } public void MoveRow(bool next) { if (next == false) { // previous string dtstr = NS_SampleData.SampleData.GetDataOfRow (0); T_about.text = dtstr; T_datasheetURL.text = MyStringUtil.ExtractCsvColumn (dtstr, kIndex_dataSheetURL); T_about.text = T_datasheetURL.text; // test } else { string dtstr = NS_SampleData.SampleData.GetDataOfRow (1); T_about.text = dtstr; T_datasheetURL.text = MyStringUtil.ExtractCsvColumn (dtstr, kIndex_dataSheetURL); T_about.text = T_datasheetURL.text; // test } } public void MoveColumn(bool next) { if (next == false) { // previous string dtstr = NS_SampleData.SampleData.GetDataOfColumn(0); T_about.text = dtstr; T_datasheetURL.text = MyStringUtil.ExtractCsvColumn (dtstr, kIndex_dataSheetURL); T_about.text = T_datasheetURL.text; // test } else { string dtstr = NS_SampleData.SampleData.GetDataOfColumn (1); T_about.text = dtstr; T_datasheetURL.text = MyStringUtil.ExtractCsvColumn (dtstr, kIndex_dataSheetURL); T_about.text = T_datasheetURL.text; // test } } public void OpenURL() { Application.OpenURL (T_datasheetURL.text); } }
mit
C#
a6f151dd9e8300d8c6153beddf4883af76f4f678
Check for shots going out of bounds and kill them
mlepage/karmbat
Assets/Scripts/ShotControl.cs
Assets/Scripts/ShotControl.cs
using UnityEngine; using System.Collections; public class ShotControl : MonoBehaviour { public float speed = 0.2f; private bool inBlock; private int life = 3; void Start () { } void Update () { // Old position Vector3 position = transform.position; // Move transform.Translate(Vector3.up * speed); // Check for out of bounds if (100f <= Mathf.Abs(transform.position.magnitude)) { Destroy(gameObject); return; } // Check for collision Collider2D collider = Physics2D.OverlapCircle(transform.position, 0.15f); if (collider) { if (collider.name == "ArenaBlock") { if (!inBlock) { // Reduce life if (--life == 0) { Destroy(gameObject); return; } // Find vector to block center (normalized for stretched blocks) Vector3 v = collider.transform.position - position; v.x /= collider.transform.localScale.x; v.y /= collider.transform.localScale.y; Vector3 forward = transform.up; if (Mathf.Abs(v.x) < Mathf.Abs(v.y)) { forward.y = -forward.y; // bounce vertically } else { forward.x = -forward.x; // bounce horizontally } transform.up = forward; } inBlock = true; } } else { inBlock = false; } } }
using UnityEngine; using System.Collections; public class ShotControl : MonoBehaviour { public float speed = 0.2f; private bool inBlock; private int life = 3; void Start () { } void Update () { // Old position Vector3 position = transform.position; // Move transform.Translate(Vector3.up * speed); // Check for collision Collider2D collider = Physics2D.OverlapCircle(transform.position, 0.1f); if (collider) { if (collider.name == "ArenaBlock") { if (!inBlock) { // Reduce life if (--life == 0) { Destroy(gameObject); return; } // Find vector to block center (normalized for stretched blocks) Vector3 v = collider.transform.position - position; v.x /= collider.transform.localScale.x; v.y /= collider.transform.localScale.y; Vector3 forward = transform.up; if (Mathf.Abs(v.x) < Mathf.Abs(v.y)) { forward.y = -forward.y; // bounce vertically } else { forward.x = -forward.x; // bounce horizontally } transform.up = forward; } inBlock = true; } } else { inBlock = false; } } }
apache-2.0
C#
0938deebf88779c5161df8907867743b72423658
Fix build
WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common
src/WeihanLi.Common/Helpers/TaskHelper.cs
src/WeihanLi.Common/Helpers/TaskHelper.cs
// Copyright (c) Weihan Li. All rights reserved. // Licensed under the Apache license. namespace WeihanLi.Common.Helpers; public static class TaskHelper { #if ValueTaskSupport /// <summary> /// A cached completed value task /// </summary> public static ValueTask CompletedValueTask => #if NET6_0_OR_GREATER ValueTask.CompletedTask #else default #endif ; public static ValueTask ToTask(object? obj) { var task = obj switch { ValueTask vt => vt, Task t => new ValueTask(t), _ => CompletedValueTask }; return task; } #endif }
// Copyright (c) Weihan Li. All rights reserved. // Licensed under the Apache license. namespace WeihanLi.Common.Helpers; public static class TaskHelper { #if ValueTaskSupport /// <summary> /// A cached completed value task /// </summary> public static ValueTask CompletedValueTask => #if NET6_0_OR_GREATER ValueTask.CompletedTask #else default #endif ; public static ValueTask ToTask(object? object) { var task = object switch { ValueTask vt => vt, Task t => new ValueTask(t), _ => CompletedValueTask }; return task; } #endif }
mit
C#
c9b3ad32bcd678b6683ba5eb3b1b2c1fb6864ef7
更改version 描述文字
yozora-hitagi/Saber,yozora-hitagi/Saber
Saber/Helper/ErrorReporting.cs
Saber/Helper/ErrorReporting.cs
using System; using System.Windows.Threading; using NLog; using Saber.Infrastructure; using Saber.Infrastructure.Exception; namespace Saber.Helper { public static class ErrorReporting { private static void Report(Exception e) { var logger = LogManager.GetLogger("UnHandledException"); logger.Fatal(ExceptionFormatter.FormatExcpetion(e)); var reportWindow = new ReportWindow(e); reportWindow.Show(); } public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e) { //handle non-ui thread exceptions Report((Exception)e.ExceptionObject); } public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { //handle ui thread exceptions Report(e.Exception); //prevent application exist, so the user can copy prompted error info e.Handled = true; } public static string RuntimeInfo() { var info = $"\nSaber version: {Constant.Version}" + $"\nOS Version: {Environment.OSVersion.VersionString}" + $"\nIntPtr Length: {IntPtr.Size}" + $"\nx64: {Environment.Is64BitOperatingSystem}"; return info; } public static string DependenciesInfo() { var info = $"\nPython Path: {Constant.PythonPath}" + $"\nEverything SDK Path: {Constant.EverythingSDKPath}"; return info; } } }
using System; using System.Windows.Threading; using NLog; using Saber.Infrastructure; using Saber.Infrastructure.Exception; namespace Saber.Helper { public static class ErrorReporting { private static void Report(Exception e) { var logger = LogManager.GetLogger("UnHandledException"); logger.Fatal(ExceptionFormatter.FormatExcpetion(e)); var reportWindow = new ReportWindow(e); reportWindow.Show(); } public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e) { //handle non-ui thread exceptions Report((Exception)e.ExceptionObject); } public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { //handle ui thread exceptions Report(e.Exception); //prevent application exist, so the user can copy prompted error info e.Handled = true; } public static string RuntimeInfo() { var info = $"\nWox version: {Constant.Version}" + $"\nOS Version: {Environment.OSVersion.VersionString}" + $"\nIntPtr Length: {IntPtr.Size}" + $"\nx64: {Environment.Is64BitOperatingSystem}"; return info; } public static string DependenciesInfo() { var info = $"\nPython Path: {Constant.PythonPath}" + $"\nEverything SDK Path: {Constant.EverythingSDKPath}"; return info; } } }
mit
C#
5f05f95c45b3b36f10140a7307d4548396ab49d3
Add more style extension methods
kswoll/WootzJs,x335/WootzJs,x335/WootzJs,x335/WootzJs,kswoll/WootzJs,kswoll/WootzJs
WootzJs.Mvc/StyleExtensions.cs
WootzJs.Mvc/StyleExtensions.cs
using WootzJs.Mvc.Views; using WootzJs.Mvc.Views.Css; namespace WootzJs.Mvc { public static class StyleExtensions { public static T WithBold<T>(this T control) where T : Control { control.Style.Font.Weight = new CssFontWeight(CssFontWeightType.Bold); return control; } public static T WithPadding<T>(this T control, CssPadding padding) where T : Control { control.Style.Padding = padding; return control; } } }
using WootzJs.Mvc.Views; using WootzJs.Mvc.Views.Css; namespace WootzJs.Mvc { public static class StyleExtensions { public static T WithBold<T>(this T control) where T : Control { control.Style.Font.Weight = new CssFontWeight(CssFontWeightType.Bold); return control; } } }
mit
C#
46018f13a117471076ec77a4859f20975b98f411
Refactor AssemblyHelper and handle missing members
danielchalmers/WpfAboutView
WpfAboutView/AssemblyHelper.cs
WpfAboutView/AssemblyHelper.cs
using System; using System.IO; using System.Reflection; namespace WpfAboutView { internal static class AssemblyHelper { /// <summary> /// Returns the assembly's Company attribute, or <c>null</c> if one isn't supplied. /// </summary> internal static string GetCompany(this Assembly assembly) => assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.Company; /// <summary> /// Returns the assembly's Copyright attribute, or <c>null</c> if one isn't supplied. /// </summary> internal static string GetCopyright(this Assembly assembly) => assembly.GetCustomAttribute<AssemblyCopyrightAttribute>()?.Copyright; /// <summary> /// Returns the assembly's Description attribute, or <c>null</c> if one isn't supplied. /// </summary> internal static string GetDescription(this Assembly assembly) => assembly.GetCustomAttribute<AssemblyDescriptionAttribute>()?.Description; /// <summary> /// Returns info about the assembly's directory. /// </summary> internal static DirectoryInfo GetDirectoryInfo(this Assembly assembly) => assembly.GetFileInfo().Directory; /// <summary> /// Returns info about the assembly's file. /// </summary> internal static FileInfo GetFileInfo(this Assembly assembly) => new FileInfo(assembly.Location); /// <summary> /// Returns the assembly's Title attribute, or <c>null</c> if one isn't supplied. /// </summary> internal static string GetProduct(this Assembly assembly) => assembly.GetCustomAttribute<AssemblyProductAttribute>()?.Product; /// <summary> /// Returns the assembly's Title attribute, or <c>null</c> if one isn't supplied. /// </summary> internal static string GetTitle(this Assembly assembly) => assembly.GetCustomAttribute<AssemblyTitleAttribute>()?.Title; /// <summary> /// Returns the assembly's Version attribute, or <c>null</c> if one isn't supplied. /// </summary> internal static Version GetVersion(this Assembly assembly) => assembly.GetName()?.Version; } }
using System; using System.IO; using System.Reflection; namespace WpfAboutView { internal static class AssemblyHelper { internal static string GetCompany(this Assembly _assembly) => _assembly.GetCustomAttribute<AssemblyCompanyAttribute>().Company; internal static string GetCopyright(this Assembly _assembly) => _assembly.GetCustomAttribute<AssemblyCopyrightAttribute>().Copyright; internal static string GetDirectory(this Assembly _assembly) => Path.GetDirectoryName(_assembly.GetLocation()); internal static string GetLocation(this Assembly _assembly) => _assembly.Location; internal static string GetTitle(this Assembly _assembly) => _assembly.GetCustomAttribute<AssemblyTitleAttribute>().Title; internal static Version GetVersion(this Assembly _assembly) => _assembly.GetName().Version; } }
mit
C#
46e72fc838d0a728cb2d8420ae7895aa03dc80d7
Fix rule target
msawczyn/EFDesigner,msawczyn/EFDesigner,msawczyn/EFDesigner
src/Dsl/CustomCode/Rules/ModelAttributeAddRules.cs
src/Dsl/CustomCode/Rules/ModelAttributeAddRules.cs
using Microsoft.VisualStudio.Modeling; namespace Sawczyn.EFDesigner.EFModel { [RuleOn(typeof(ModelAttribute), FireTime = TimeToFire.TopLevelCommit)] internal class ModelAttributeAddRules : AddRule { public override void ElementAdded(ElementAddedEventArgs e) { base.ElementAdded(e); ModelAttribute element = (ModelAttribute)e.ModelElement; ModelClass modelClass = element.ModelClass; // set a new default value if we want to implement notify, to reduce the chance of forgetting to change it if (modelClass.ImplementNotify) element.AutoProperty = false; } } }
using Microsoft.VisualStudio.Modeling; namespace Sawczyn.EFDesigner.EFModel { [RuleOn(typeof(ModelClass), FireTime = TimeToFire.TopLevelCommit)] internal class ModelAttributeAddRules : AddRule { public override void ElementAdded(ElementAddedEventArgs e) { base.ElementAdded(e); ModelAttribute element = (ModelAttribute)e.ModelElement; ModelClass modelClass = element.ModelClass; // set a new default value if we want to implement notify, to reduce the chance of forgetting to change it if (modelClass.ImplementNotify) element.AutoProperty = false; } } }
mit
C#
d9270a297e87aada1ea1b8efc0d6ec9f4e3bb861
Add LogCallback to TAPNetTest
juhovh/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,eyecreate/tapcfg,eyecreate/tapcfg,juhovh/tapcfg,juhovh/tapcfg,eyecreate/tapcfg,eyecreate/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,zhanleewo/tapcfg,juhovh/tapcfg,zhanleewo/tapcfg,zhanleewo/tapcfg,eyecreate/tapcfg
src/demos/TAPNetTest.cs
src/demos/TAPNetTest.cs
/** * tapcfg - A cross-platform configuration utility for TAP driver * Copyright (C) 2008-2009 Juho Vähä-Herttua * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ using TAPNet; using System; using System.Net; using System.Threading; public class TAPNetTest { private static void Main(string[] args) { VirtualDevice dev = new VirtualDevice(); dev.LogCallback = new TAPLogCallback(LogCallback); dev.Start("Device name", true); Console.WriteLine("Got device name: {0}", dev.DeviceName); Console.WriteLine("Got device hwaddr: {0}", BitConverter.ToString(dev.HWAddress)); dev.HWAddress = new byte[] { 0x00, 0x01, 0x23, 0x45, 0x67, 0x89 }; dev.MTU = 1280; dev.SetAddress(IPAddress.Parse("192.168.10.1"), 16); dev.Enabled = true; while (true) { Thread.Sleep(1000); } } private static void LogCallback(string msg) { Console.WriteLine(msg); } }
/** * tapcfg - A cross-platform configuration utility for TAP driver * Copyright (C) 2008-2009 Juho Vähä-Herttua * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ using TAPNet; using System; using System.Net; using System.Threading; public class TAPNetTest { private static void Main(string[] args) { VirtualDevice dev = new VirtualDevice(); dev.Start("Device name", true); Console.WriteLine("Got device name: {0}", dev.DeviceName); Console.WriteLine("Got device hwaddr: {0}", BitConverter.ToString(dev.HWAddress)); dev.HWAddress = new byte[] { 0x00, 0x01, 0x23, 0x45, 0x67, 0x89 }; dev.MTU = 1280; dev.SetAddress(IPAddress.Parse("192.168.10.1"), 16); dev.Enabled = true; while (true) { Thread.Sleep(1000); } } }
lgpl-2.1
C#
70e0f6961642850e9a4d7d27988ceb9b1b8dd866
test cases
jefking/King.A-Trak
King.ATrak.Test/Windows/FileItemTests.cs
King.ATrak.Test/Windows/FileItemTests.cs
namespace King.ATrak.Test.Windows { using King.ATrak.Windows; using NUnit.Framework; using System; [TestFixture] public class FileItemTests { [Test] public void Constructor() { new FileItem("C:\\happy", "temp.csv"); } [Test] [ExpectedException(typeof(ArgumentException))] public void ConstructorRootNull() { new FileItem(null, "temp.csv"); } [Test] [ExpectedException(typeof(ArgumentException))] public void ConstructorPathNull() { new FileItem("C:\\happy", null); } [Test] public void IsIStorageItem() { Assert.IsNotNull(new FileItem("C:\\happy", "temp.csv") as IStorageItem); } [Test] public void RelativePath() { var f = new FileItem("C:\\happy", "C:\\happy\\temp.csv"); Assert.AreEqual("temp.csv", f.RelativePath); } [Test] public void RelativePathBackSlashes() { var f = new FileItem("C:\\happy\\", "C:\\happy\\temp.csv"); Assert.AreEqual("temp.csv", f.RelativePath); } } }
namespace King.ATrak.Test.Windows { using King.ATrak.Windows; using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; [TestFixture] public class FileItemTests { [Test] public void Constructor() { new FileItem("C:\\happy", "temp.csv"); } [Test] [ExpectedException(typeof(ArgumentException))] public void ConstructorRootNull() { new FileItem(null, "temp.csv"); } [Test] [ExpectedException(typeof(ArgumentException))] public void ConstructorPathNull() { new FileItem("C:\\happy", null); } [Test] public void IsIStorageItem() { Assert.IsNotNull(new FileItem("C:\\happy", "temp.csv") as IStorageItem); } } }
mit
C#
e64e4778d379bc1251d42a6d79d08863d5d7c163
Add ConfigureAwait false
martijn00/XamarinMediaManager,martijn00/XamarinMediaManager,mike-rowley/XamarinMediaManager,mike-rowley/XamarinMediaManager
MediaManager/Media/MediaExtractorBase.cs
MediaManager/Media/MediaExtractorBase.cs
using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Threading.Tasks; namespace MediaManager.Media { public abstract class MediaExtractorBase : IMediaExtractor { public virtual async Task<IMediaItem> CreateMediaItem(string url) { var mediaItem = new MediaItem(url); mediaItem.MediaLocation = GetMediaLocation(mediaItem); return await ExtractMetadata(mediaItem).ConfigureAwait(false); } public virtual async Task<IMediaItem> CreateMediaItem(FileInfo file) { var mediaItem = new MediaItem(file.FullName); mediaItem.MediaLocation = GetMediaLocation(mediaItem); return await ExtractMetadata(mediaItem).ConfigureAwait(false); } public virtual async Task<IMediaItem> CreateMediaItem(IMediaItem mediaItem) { mediaItem.MediaLocation = GetMediaLocation(mediaItem); return await ExtractMetadata(mediaItem).ConfigureAwait(false); } public virtual Task<object> RetrieveMediaItemArt(IMediaItem mediaItem) { return null; } public abstract Task<IMediaItem> ExtractMetadata(IMediaItem mediaItem); public virtual MediaLocation GetMediaLocation(IMediaItem mediaItem) { if (mediaItem.MediaUri.StartsWith("http")) { return MediaLocation.Remote; } if (mediaItem.MediaUri.StartsWith("file") || mediaItem.MediaUri.StartsWith("/") || (mediaItem.MediaUri.Length > 1 && mediaItem.MediaUri[1] == ':')) { return MediaLocation.FileSystem; } return MediaLocation.Unknown; } } }
using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Threading.Tasks; namespace MediaManager.Media { public abstract class MediaExtractorBase : IMediaExtractor { public virtual async Task<IMediaItem> CreateMediaItem(string url) { var mediaItem = new MediaItem(url); mediaItem.MediaLocation = GetMediaLocation(mediaItem); return await ExtractMetadata(mediaItem).ConfigureAwait(false); } public virtual async Task<IMediaItem> CreateMediaItem(FileInfo file) { var mediaItem = new MediaItem(file.FullName); mediaItem.MediaLocation = GetMediaLocation(mediaItem); return await ExtractMetadata(mediaItem); } public virtual async Task<IMediaItem> CreateMediaItem(IMediaItem mediaItem) { mediaItem.MediaLocation = GetMediaLocation(mediaItem); return await ExtractMetadata(mediaItem); } public virtual Task<object> RetrieveMediaItemArt(IMediaItem mediaItem) { return null; } public abstract Task<IMediaItem> ExtractMetadata(IMediaItem mediaItem); public virtual MediaLocation GetMediaLocation(IMediaItem mediaItem) { if (mediaItem.MediaUri.StartsWith("http")) { return MediaLocation.Remote; } if (mediaItem.MediaUri.StartsWith("file") || mediaItem.MediaUri.StartsWith("/") || (mediaItem.MediaUri.Length > 1 && mediaItem.MediaUri[1] == ':')) { return MediaLocation.FileSystem; } return MediaLocation.Unknown; } } }
mit
C#
b8b17f0999a1cc2e757a33f57ad3c3f6edd82609
Handle URL's with or without a / suffix
IWBWbiz/MultiMiner,IWBWbiz/MultiMiner,nwoolls/MultiMiner,nwoolls/MultiMiner
MultiMiner.MobileMiner.Api/ApiContext.cs
MultiMiner.MobileMiner.Api/ApiContext.cs
using System.Net; using System.Web.Script.Serialization; namespace MultiMiner.MobileMiner.Api { public class ApiContext { static public void SubmitMiningStatistics(string url, MiningStatistics miningStatistics) { if (!url.EndsWith("/")) url = url + "/"; string fullUrl = url + "api/MiningStatisticsInput"; using (WebClient client = new WebClient()) { JavaScriptSerializer serializer = new JavaScriptSerializer(); string jsonData = serializer.Serialize(miningStatistics); client.Headers[HttpRequestHeader.ContentType] = "application/json"; client.UploadString(fullUrl, jsonData); } } } }
using System.Net; using System.Web.Script.Serialization; namespace MultiMiner.MobileMiner.Api { public class ApiContext { static public void SubmitMiningStatistics(string url, MiningStatistics miningStatistics) { string fullUrl = url + "/api/MiningStatisticsInput"; using (WebClient client = new WebClient()) { JavaScriptSerializer serializer = new JavaScriptSerializer(); string jsonData = serializer.Serialize(miningStatistics); client.Headers[HttpRequestHeader.ContentType] = "application/json"; client.UploadString(fullUrl, jsonData); } } } }
mit
C#
d381da81d6bf57f05dd3f3430de6c8c936932292
Add method doc to IImproveAssetCache
EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,OpenSimian/opensimulator,ft-/arribasim-dev-extras,Michelle-Argus/ArribasimExtract,ft-/opensim-optimizations-wip-extras,RavenB/opensim,ft-/opensim-optimizations-wip,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-tests,Michelle-Argus/ArribasimExtract,QuillLittlefeather/opensim-1,ft-/opensim-optimizations-wip-tests,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/arribasim-dev-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,ft-/opensim-optimizations-wip,RavenB/opensim,RavenB/opensim,OpenSimian/opensimulator,ft-/arribasim-dev-tests,ft-/arribasim-dev-tests,BogusCurry/arribasim-dev,QuillLittlefeather/opensim-1,ft-/opensim-optimizations-wip-tests,TomDataworks/opensim,QuillLittlefeather/opensim-1,BogusCurry/arribasim-dev,ft-/arribasim-dev-tests,OpenSimian/opensimulator,M-O-S-E-S/opensim,OpenSimian/opensimulator,ft-/opensim-optimizations-wip-extras,RavenB/opensim,BogusCurry/arribasim-dev,TomDataworks/opensim,ft-/opensim-optimizations-wip,ft-/opensim-optimizations-wip-extras,ft-/opensim-optimizations-wip-extras,M-O-S-E-S/opensim,OpenSimian/opensimulator,Michelle-Argus/ArribasimExtract,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip,QuillLittlefeather/opensim-1,TomDataworks/opensim,M-O-S-E-S/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TomDataworks/opensim,ft-/arribasim-dev-tests,TomDataworks/opensim,QuillLittlefeather/opensim-1,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/arribasim-dev-extras,RavenB/opensim,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-tests,ft-/arribasim-dev-extras,RavenB/opensim,M-O-S-E-S/opensim,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-extras,QuillLittlefeather/opensim-1,TomDataworks/opensim,ft-/arribasim-dev-tests,BogusCurry/arribasim-dev,TomDataworks/opensim,QuillLittlefeather/opensim-1,Michelle-Argus/ArribasimExtract,OpenSimian/opensimulator,ft-/arribasim-dev-extras,Michelle-Argus/ArribasimExtract,ft-/opensim-optimizations-wip-tests,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,BogusCurry/arribasim-dev,BogusCurry/arribasim-dev,ft-/arribasim-dev-extras,Michelle-Argus/ArribasimExtract,ft-/arribasim-dev-tests,OpenSimian/opensimulator
OpenSim/Framework/IImprovedAssetCache.cs
OpenSim/Framework/IImprovedAssetCache.cs
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using OpenSim.Framework; namespace OpenSim.Framework { public interface IImprovedAssetCache { /// <summary> /// Cache the specified asset. /// </summary> /// <param name='asset'></param> void Cache(AssetBase asset); /// <summary> /// Get an asset by its id. /// </summary> /// <param name='id'></param> /// <returns>null if the asset does not exist.</returns> AssetBase Get(string id); /// <summary> /// Check whether an asset with the specified id exists in the cache. /// </summary> /// <param name='id'></param> bool Check(string id); /// <summary> /// Expire an asset from the cache. /// </summary> /// <param name='id'></param> void Expire(string id); /// <summary> /// Clear the cache. /// </summary> void Clear(); } }
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using OpenSim.Framework; namespace OpenSim.Framework { public interface IImprovedAssetCache { void Cache(AssetBase asset); AssetBase Get(string id); bool Check(string id); void Expire(string id); void Clear(); } }
bsd-3-clause
C#
bf6b5f1176977d1c3f5068c9a33f9c7f5681b1fe
bump version to 2.14.0
piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker
Piwik.Tracker/Properties/AssemblyInfo.cs
Piwik.Tracker/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("PiwikTracker")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Piwik")] [assembly: AssemblyProduct("PiwikTracker")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")] // 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("2.14.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("PiwikTracker")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Piwik")] [assembly: AssemblyProduct("PiwikTracker")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")] // 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("2.12.0")]
bsd-3-clause
C#
0346f2baa1967d0d01311d3fc6337e46b7388f13
Revert "Fix Throttler LocalCache Dependency"
rolembergfilho/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,dfaruque/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,rolembergfilho/Serenity
Serenity.Core/Authorization/Throttler.cs
Serenity.Core/Authorization/Throttler.cs
using Serenity.Abstractions; using System; namespace Serenity { public class Throttler { public Throttler(string key, TimeSpan duration, int limit) { Key = key; Duration = duration; Limit = limit; CacheKey = "Throttling:" + key + ":" + duration.Ticks.ToInvariant(); } public string Key { get; private set; } public TimeSpan Duration { get; private set; } public int Limit { get; private set; } public string CacheKey { get; private set; } private class HitInfo { public int Counter; } public bool Check() { var hit = Dependency.Resolve<ILocalCache>().Get<object>(this.CacheKey) as HitInfo; if (hit == null) { hit = new HitInfo { Counter = 1 }; LocalCache.Add(this.CacheKey, hit, this.Duration); } else { if (hit.Counter++ >= this.Limit) return false; } return true; } public void Reset() { Dependency.Resolve<ILocalCache>().Remove(CacheKey); } } }
using Serenity.Abstractions; using System; namespace Serenity { public class Throttler { public Throttler(string key, TimeSpan duration, int limit) { Key = key; Duration = duration; Limit = limit; CacheKey = "Throttling:" + key + ":" + duration.Ticks.ToInvariant(); } public string Key { get; private set; } public TimeSpan Duration { get; private set; } public int Limit { get; private set; } public string CacheKey { get; private set; } private class HitInfo { public int Counter; } public bool Check() { var hit = Dependency.Resolve<ILocalCache>().Get<object>(this.CacheKey) as HitInfo; if (hit == null) { hit = new HitInfo { Counter = 1 }; Dependency.Resolve<ILocalCache>().Add(this.CacheKey, hit, this.Duration); } else { if (hit.Counter++ >= this.Limit) return false; } return true; } public void Reset() { Dependency.Resolve<ILocalCache>().Remove(CacheKey); } } }
mit
C#
531d325142fc7e15e722bd27a3d2d1c23cb75f76
Fix test namespace (#1430)
open-telemetry/opentelemetry-dotnet,open-telemetry/opentelemetry-dotnet,open-telemetry/opentelemetry-dotnet
test/OpenTelemetry.Tests/Instrumentation/PropertyFetcherTest.cs
test/OpenTelemetry.Tests/Instrumentation/PropertyFetcherTest.cs
// <copyright file="PropertyFetcherTest.cs" company="OpenTelemetry Authors"> // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> using System.Diagnostics; using Xunit; namespace OpenTelemetry.Instrumentation.Tests { public class PropertyFetcherTest { [Fact] public void FetchValidProperty() { var activity = new Activity("test"); var fetch = new PropertyFetcher<string>("DisplayName"); Assert.True(fetch.TryFetch(activity, out string result)); Assert.Equal(activity.DisplayName, result); } [Fact] public void FetchInvalidProperty() { var activity = new Activity("test"); var fetch = new PropertyFetcher<string>("DisplayName2"); Assert.False(fetch.TryFetch(activity, out string result)); var fetchInt = new PropertyFetcher<int>("DisplayName2"); Assert.False(fetchInt.TryFetch(activity, out int resultInt)); Assert.Equal(default, result); Assert.Equal(default, resultInt); } [Fact] public void FetchNullProperty() { var fetch = new PropertyFetcher<string>("null"); Assert.False(fetch.TryFetch(null, out _)); } } }
// <copyright file="PropertyFetcherTest.cs" company="OpenTelemetry Authors"> // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> using System.Diagnostics; using OpenTelemetry.Instrumentation; using Xunit; namespace OpenTelemetry.Tests.Instrumentation { public class PropertyFetcherTest { [Fact] public void FetchValidProperty() { var activity = new Activity("test"); var fetch = new PropertyFetcher<string>("DisplayName"); Assert.True(fetch.TryFetch(activity, out string result)); Assert.Equal(activity.DisplayName, result); } [Fact] public void FetchInvalidProperty() { var activity = new Activity("test"); var fetch = new PropertyFetcher<string>("DisplayName2"); Assert.False(fetch.TryFetch(activity, out string result)); var fetchInt = new PropertyFetcher<int>("DisplayName2"); Assert.False(fetchInt.TryFetch(activity, out int resultInt)); Assert.Equal(default, result); Assert.Equal(default, resultInt); } [Fact] public void FetchNullProperty() { var fetch = new PropertyFetcher<string>("null"); Assert.False(fetch.TryFetch(null, out _)); } } }
apache-2.0
C#
e907c3e500d6f200dbeb331657b370ec8f46ddd4
Update logging.cs
AntiTcb/Discord.Net,LassieME/Discord.Net,Confruggy/Discord.Net,RogueException/Discord.Net
docs/guides/samples/logging.cs
docs/guides/samples/logging.cs
using Discord; using Discord.Rest; public class Program { private DiscordSocketClient _client; static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult(); public async Task Start() { _client = new DiscordSocketClient(new DiscordSocketConfig() { LogLevel = LogSeverity.Info }); _client.Log += (message) => { Console.WriteLine($"{message.ToString()}"); return Task.CompletedTask; }; await _client.LoginAsync(TokenType.Bot, "bot token"); await _client.ConnectAsync(); await Task.Delay(-1); } }
using Discord; using Discord.Rest; public class Program { // Note: This is the light client, it only supports REST calls. private DiscordSocketClient _client; static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult(); public async Task Start() { _client = new DiscordSocketClient(new DiscordSocketConfig() { LogLevel = LogSeverity.Info }); _client.Log += (message) => { Console.WriteLine($"{message.ToString()}"); return Task.CompletedTask; }; await _client.LoginAsync(TokenType.Bot, "bot token"); await _client.ConnectAsync(); await Task.Delay(-1); } }
mit
C#
74a5b9a7d3bd51eadb3372dd1ca002335fe400db
Disable dupfinder because of Hg.Net
vCipher/Cake.Hg
setup.cake
setup.cake
#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease Environment.SetVariableNames(); BuildParameters.SetParameters(context: Context, buildSystem: BuildSystem, sourceDirectoryPath: "./src", title: "Cake.Hg", repositoryOwner: "cake-contrib", repositoryName: "Cake.Hg", appVeyorAccountName: "cakecontrib", solutionFilePath: "./src/Cake.Hg.sln", shouldRunCodecov: false, shouldRunDupFinder: false, wyamSourceFiles: "../../src/**/{!bin,!obj,!packages,!*Tests,}/**/*.cs"); BuildParameters.PrintParameters(Context); ToolSettings.SetToolSettings(context: Context, dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/Cake.HgTests/**/*.cs", BuildParameters.RootDirectoryPath + "/src/Cake.Hg/**/*.AssemblyInfo.cs" }); Build.Run();
#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease Environment.SetVariableNames(); BuildParameters.SetParameters(context: Context, buildSystem: BuildSystem, sourceDirectoryPath: "./src", title: "Cake.Hg", repositoryOwner: "cake-contrib", repositoryName: "Cake.Hg", appVeyorAccountName: "cakecontrib", solutionFilePath: "./src/Cake.Hg.sln", shouldRunCodecov: false, wyamSourceFiles: "../../src/**/{!bin,!obj,!packages,!*Tests,}/**/*.cs"); BuildParameters.PrintParameters(Context); ToolSettings.SetToolSettings(context: Context, dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/Cake.HgTests/**/*.cs", BuildParameters.RootDirectoryPath + "/src/Cake.Hg/**/*.AssemblyInfo.cs" }); Build.Run();
mit
C#
b7451e8b563769c7b75c0df062ca76f607799e42
Bump shared version
thinktecture/relayserver,thinktecture/relayserver,thinktecture/relayserver
Shared/AssemblyInfo.shared.cs
Shared/AssemblyInfo.shared.cs
using System.Reflection; // WARNING: This file is shared between all RelayServer .NET projects [assembly: AssemblyCompany("Thinktecture AG")] [assembly: AssemblyProduct("Thinktecture RelayServer")] [assembly: AssemblyCopyright("Copyright © Thinktecture AG 2015 - 2020. All rights reserved.")] [assembly: AssemblyTrademark("Thinktecture RelayServer")] [assembly: AssemblyVersion("2.3.0.0")] [assembly: AssemblyFileVersion("2.3.0.0")] [assembly: AssemblyInformationalVersion("2.3.0.0-rc5")]
using System.Reflection; // WARNING: This file is shared between all RelayServer .NET projects [assembly: AssemblyCompany("Thinktecture AG")] [assembly: AssemblyProduct("Thinktecture RelayServer")] [assembly: AssemblyCopyright("Copyright © Thinktecture AG 2015 - 2020. All rights reserved.")] [assembly: AssemblyTrademark("Thinktecture RelayServer")] [assembly: AssemblyVersion("2.3.0.0")] [assembly: AssemblyFileVersion("2.3.0.0")] [assembly: AssemblyInformationalVersion("2.3.0.0-rc4")]
bsd-3-clause
C#
aa735a1ee3c6d709ad53c36df873d9ab1a8c6a23
Bump version
Naxiz/NFU
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("NFU")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NFU")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("537e6f56-11cb-461a-9983-634307543f5b")] // 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("2015.09.19.1")] [assembly: AssemblyFileVersion("2015.09.19.1")]
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("NFU")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NFU")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("537e6f56-11cb-461a-9983-634307543f5b")] // 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("2015.06.08.1")] [assembly: AssemblyFileVersion("2015.06.08.1")]
mit
C#
4610d8592feded4b7ea030bc7f5800695b4e3267
Increase version number & add 2014 copyright
MaartenStaa/mow-chat,MaartenStaa/mow-chat
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("MowChat")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MowChat")] [assembly: AssemblyCopyright("Copyright © 2013-2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("17fb5df9-452a-423d-925e-7b98ab9a5b02")] // 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.1.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("MowChat")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MowChat")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("17fb5df9-452a-423d-925e-7b98ab9a5b02")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
016dea5ada32defbf30b75760d2f9b16d44d9309
Bump version to 1.2.4.0
EliotVU/Unreal-Library
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle( "UELib" )] [assembly: AssemblyDescription( "UELib makes it possible to deserialize and decompile almost any Unreal package files." )] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany( "EliotVU" )] [assembly: AssemblyProduct( "UELib" )] [assembly: AssemblyCopyright( "© 2009-2013 Eliot van Uytfanghe. All rights reserved." )] [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( "0eb1c54e-8955-4c8d-98d3-16285f114f16" )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion( "1.2.4.0" )] [assembly: AssemblyFileVersion( "1.2.4.0" )]
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( "UELib" )] [assembly: AssemblyDescription( "UELib makes it possible to deserialize and decompile almost any Unreal package files." )] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany( "EliotVU" )] [assembly: AssemblyProduct( "UELib" )] [assembly: AssemblyCopyright( "© 2009-2013 Eliot van Uytfanghe. All rights reserved." )] [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( "0eb1c54e-8955-4c8d-98d3-16285f114f16" )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion( "1.2.3.0" )] [assembly: AssemblyFileVersion( "1.2.3.0" )]
mit
C#
b664fc2a65dc1cc95e24c56e6393a1375c29d983
Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.
autofac/Autofac.Extras.DomainServices
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Autofac.Extras.DomainServices")] [assembly: ComVisible(false)]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Autofac.Extras.DomainServices")] [assembly: AssemblyDescription("Autofac Integration for RIA Services")] [assembly: ComVisible(false)]
mit
C#
dd4ba3735a5ca695b09352451562c2b984ea4c6b
Bump version
o11c/WebMConverter,nixxquality/WebMConverter,Yuisbean/WebMConverter
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("WebM for Retards")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WebM for Retards")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")] // 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("2.16.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("WebM for Retards")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WebM for Retards")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")] // 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("2.15.0")]
mit
C#
882dd714fbdaa4085b96973902b75be34daf78fe
update nuget package
jjchiw/gelf4net,jjchiw/gelf4net
SharedAssemblyInfo.cs
SharedAssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("gelf4net")] [assembly: AssemblyFileVersion("2.0.3.11")] [assembly: AssemblyVersion("2.0.3.11")] [assembly: AssemblyCopyright("Copyright 2015")] [assembly: ComVisible(false)]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("gelf4net")] [assembly: AssemblyFileVersion("2.0.3.10")] [assembly: AssemblyVersion("2.0.3.10")] [assembly: AssemblyCopyright("Copyright 2015")] [assembly: ComVisible(false)]
mit
C#
9306dd5e30f8c1671606ef161d7235ceec133455
Apply changes from removal of GLWrapper
ppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu
osu.Game/Graphics/Sprites/LogoAnimation.cs
osu.Game/Graphics/Sprites/LogoAnimation.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Rendering; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Sprites; namespace osu.Game.Graphics.Sprites { public class LogoAnimation : Sprite { [BackgroundDependencyLoader] private void load(ShaderManager shaders) { TextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LogoAnimation"); RoundedTextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LogoAnimation"); // Masking isn't supported for now } private float animationProgress; public float AnimationProgress { get => animationProgress; set { if (animationProgress == value) return; animationProgress = value; Invalidate(Invalidation.DrawInfo); } } public override bool IsPresent => true; protected override DrawNode CreateDrawNode() => new LogoAnimationDrawNode(this); private class LogoAnimationDrawNode : SpriteDrawNode { private LogoAnimation source => (LogoAnimation)Source; private float progress; public LogoAnimationDrawNode(LogoAnimation source) : base(source) { } public override void ApplyState() { base.ApplyState(); progress = source.animationProgress; } protected override void Blit(IRenderer renderer) { GetAppropriateShader(renderer).GetUniform<float>("progress").UpdateValue(ref progress); base.Blit(renderer); } protected override bool CanDrawOpaqueInterior => false; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Rendering; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Sprites; namespace osu.Game.Graphics.Sprites { public class LogoAnimation : Sprite { [BackgroundDependencyLoader] private void load(ShaderManager shaders) { TextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LogoAnimation"); RoundedTextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LogoAnimation"); // Masking isn't supported for now } private float animationProgress; public float AnimationProgress { get => animationProgress; set { if (animationProgress == value) return; animationProgress = value; Invalidate(Invalidation.DrawInfo); } } public override bool IsPresent => true; protected override DrawNode CreateDrawNode() => new LogoAnimationDrawNode(this); private class LogoAnimationDrawNode : SpriteDrawNode { private LogoAnimation source => (LogoAnimation)Source; private float progress; public LogoAnimationDrawNode(LogoAnimation source) : base(source) { } public override void ApplyState() { base.ApplyState(); progress = source.animationProgress; } protected override void Blit(IRenderer renderer) { Shader.GetUniform<float>("progress").UpdateValue(ref progress); base.Blit(renderer); } protected override bool CanDrawOpaqueInterior => false; } } }
mit
C#
0ece5504f9ed92451ae532b723194293c7615146
Add comment.
RockFramework/Rock.Messaging,bfriesen/Rock.Messaging,peteraritchie/Rock.Messaging
Rock.Messaging/Rock.StaticDependencyInjection/ExportAttribute.cs
Rock.Messaging/Rock.StaticDependencyInjection/ExportAttribute.cs
// Leave this file blank. (Except, of course, for this comment.)
mit
C#
3c0d6088da262e1f407fea262a531a46bd41446d
fix problem resulting from the client terminating the connection abruptly without following the default protocol
PedDavid/qip,PedDavid/qip,PedDavid/qip
Server/WebSockets/StringWebSockets/StringWebSocketsOperations.cs
Server/WebSockets/StringWebSockets/StringWebSocketsOperations.cs
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Net.WebSockets; using System.Threading; using System.Threading.Tasks; using WebSockets.Models; using WebSockets.Operations; namespace WebSockets.StringWebSockets { public class StringWebSocketsOperations { private readonly StringWebSocket _stringWebSocket; private readonly Dictionary<Models.OperationType, Operation> _operations; private readonly IStringWebSocketSession _session; private readonly long _roomId; public StringWebSocketsOperations(long roomId, StringWebSocket stringWebSocket, IStringWebSocketSession session, Dictionary<Models.OperationType, Operation> operations) { // TODO(peddavid): Change this "hard constructor" _roomId = roomId; _stringWebSocket = stringWebSocket; _session = session; _operations = operations; } public async Task AcceptRequests() { try { do { string msg = await _stringWebSocket.ReceiveAsync(); if(string.IsNullOrWhiteSpace(msg)) { continue;//TODO REVER } WSMessage info = JsonConvert.DeserializeObject<WSMessage>(msg); var validationResults = new List<ValidationResult>(); if(!Validator.TryValidateObject(info, new ValidationContext(info), validationResults, true)) { continue;//TODO REVER } OperationType type = info.Type.Value; await _operations[type](_stringWebSocket, _session, info.Payload); } while(!_stringWebSocket.CloseStatus.HasValue); } catch(WebSocketException e) { ////TODO REVER } finally { _session.Exit(); await _stringWebSocket.CloseAsync(_stringWebSocket.CloseStatus.Value, _stringWebSocket.CloseStatusDescription, CancellationToken.None); } } } }
using Newtonsoft.Json; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Threading; using System.Threading.Tasks; using WebSockets.Models; using WebSockets.Operations; namespace WebSockets.StringWebSockets { public class StringWebSocketsOperations { private readonly StringWebSocket _stringWebSocket; private readonly Dictionary<Models.OperationType, Operation> _operations; private readonly IStringWebSocketSession _session; private readonly long _roomId; public StringWebSocketsOperations(long roomId, StringWebSocket stringWebSocket, IStringWebSocketSession session, Dictionary<Models.OperationType, Operation> operations) { // TODO(peddavid): Change this "hard constructor" _roomId = roomId; _stringWebSocket = stringWebSocket; _session = session; _operations = operations; } public async Task AcceptRequests() { do { string msg = await _stringWebSocket.ReceiveAsync(); if(string.IsNullOrWhiteSpace(msg)) { continue;//TODO REVER } WSMessage info = JsonConvert.DeserializeObject<WSMessage>(msg); var validationResults = new List<ValidationResult>(); if(!Validator.TryValidateObject(info, new ValidationContext(info), validationResults, true)) { return;//TODO REVER } OperationType type = info.Type.Value; await _operations[type](_stringWebSocket, _session, info.Payload); } while(!_stringWebSocket.CloseStatus.HasValue); _session.Exit(); await _stringWebSocket.CloseAsync(_stringWebSocket.CloseStatus.Value, _stringWebSocket.CloseStatusDescription, CancellationToken.None); } } }
mit
C#
400745c91792ca760f674cfa74764ef38200b497
Fix tests
tzachshabtay/MonoAGS
Source/Engine/AGS.Engine/Serialization/Contracts/ContractRoom.cs
Source/Engine/AGS.Engine/Serialization/Contracts/ContractRoom.cs
using System; using ProtoBuf; using AGS.API; using System.Collections.Generic; using Autofac; namespace AGS.Engine { [ProtoContract(AsReferenceDefault = true)] public class ContractRoom : IContract<IRoom> { public ContractRoom() { } [ProtoMember(1)] public string ID { get; set; } [ProtoMember(2)] public bool ShowPlayer { get; set; } [ProtoMember(3)] public IContract<IObject> Background { get; set; } [ProtoMember(4, AsReference = true)] public IList<IContract<IObject>> Objects { get; set; } [ProtoMember(5)] public IContract<ICustomProperties> Properties { get; set; } [ProtoMember(6)] public IList<IContract<IArea>> Areas { get; set; } [ProtoMember(7)] public IContract<IAGSEdges> Edges { get; set; } [ProtoMember(8)] public uint? BackgroundColor { get; set; } #region IContract implementation public IRoom ToItem(AGSSerializationContext context) { TypedParameter idParam = new TypedParameter (typeof(string), ID); TypedParameter edgesParam = new TypedParameter (typeof(IAGSEdges), Edges.ToItem(context)); IRoom room = context.Resolver.Container.Resolve<IRoom>(idParam, edgesParam); room.ShowPlayer = ShowPlayer; room.Background = Background.ToItem(context); foreach (var obj in Objects) { room.Objects.Add(obj.ToItem(context)); } room.Properties.CopyFrom(Properties.ToItem(context)); if (Areas != null) { foreach (var area in Areas) { room.Areas.Add(area.ToItem(context)); } } IAGSEdges edges = room.Edges as IAGSEdges; if (edges != null) { edges.FromEdges(Edges.ToItem(context)); } room.BackgroundColor = BackgroundColor == null ? (Color?)null : Color.FromHexa(BackgroundColor.Value); return room; } public void FromItem(AGSSerializationContext context, IRoom item) { ID = item.ID; ShowPlayer = item.ShowPlayer; Background = context.GetContract(item.Background); Objects = new List<IContract<IObject>> (item.Objects.Count); foreach (var obj in item.Objects) { Objects.Add(context.GetContract(obj)); } Properties = context.GetContract(item.Properties); Areas = new List<IContract<IArea>> (item.Areas.Count); foreach (var area in item.Areas) { Areas.Add(context.GetContract(area)); } Edges = context.GetContract((IAGSEdges)item.Edges); BackgroundColor = item.BackgroundColor?.Value; } #endregion } }
using System; using ProtoBuf; using AGS.API; using System.Collections.Generic; using Autofac; namespace AGS.Engine { [ProtoContract(AsReferenceDefault = true)] public class ContractRoom : IContract<IRoom> { public ContractRoom() { } [ProtoMember(1)] public string ID { get; set; } [ProtoMember(2)] public bool ShowPlayer { get; set; } [ProtoMember(3)] public IContract<IObject> Background { get; set; } [ProtoMember(4, AsReference = true)] public IList<IContract<IObject>> Objects { get; set; } [ProtoMember(5)] public IContract<ICustomProperties> Properties { get; set; } [ProtoMember(6)] public IList<IContract<IArea>> Areas { get; set; } [ProtoMember(7)] public IContract<IAGSEdges> Edges { get; set; } [ProtoMember(8)] public Color? BackgroundColor { get; set; } #region IContract implementation public IRoom ToItem(AGSSerializationContext context) { TypedParameter idParam = new TypedParameter (typeof(string), ID); TypedParameter edgesParam = new TypedParameter (typeof(IAGSEdges), Edges.ToItem(context)); IRoom room = context.Resolver.Container.Resolve<IRoom>(idParam, edgesParam); room.ShowPlayer = ShowPlayer; room.Background = Background.ToItem(context); foreach (var obj in Objects) { room.Objects.Add(obj.ToItem(context)); } room.Properties.CopyFrom(Properties.ToItem(context)); if (Areas != null) { foreach (var area in Areas) { room.Areas.Add(area.ToItem(context)); } } IAGSEdges edges = room.Edges as IAGSEdges; if (edges != null) { edges.FromEdges(Edges.ToItem(context)); } room.BackgroundColor = BackgroundColor; return room; } public void FromItem(AGSSerializationContext context, IRoom item) { ID = item.ID; ShowPlayer = item.ShowPlayer; Background = context.GetContract(item.Background); Objects = new List<IContract<IObject>> (item.Objects.Count); foreach (var obj in item.Objects) { Objects.Add(context.GetContract(obj)); } Properties = context.GetContract(item.Properties); Areas = new List<IContract<IArea>> (item.Areas.Count); foreach (var area in item.Areas) { Areas.Add(context.GetContract(area)); } Edges = context.GetContract((IAGSEdges)item.Edges); BackgroundColor = item.BackgroundColor; } #endregion } }
artistic-2.0
C#
87e8074cd267f9f8676fa7f7f5ecc18ae3a56029
Use a const for excess length
ZLima12/osu,naoey/osu,peppy/osu-new,UselessToucan/osu,EVAST9919/osu,ppy/osu,DrabWeb/osu,UselessToucan/osu,NeoAdonis/osu,naoey/osu,DrabWeb/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,naoey/osu,ppy/osu,johnneijzen/osu,ppy/osu,ZLima12/osu,johnneijzen/osu,2yangk23/osu,NeoAdonis/osu,DrabWeb/osu,smoogipooo/osu,peppy/osu,EVAST9919/osu,2yangk23/osu
osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs
osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; using osu.Framework.Audio.Track; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Beatmaps { public partial class WorkingBeatmap { /// <summary> /// A type of <see cref="TrackVirtual"/> which provides a valid length based on the <see cref="HitObject"/>s of an <see cref="IBeatmap"/>. /// </summary> protected class VirtualBeatmapTrack : TrackVirtual { private const double excess_length = 1000; private readonly IBeatmap beatmap; public VirtualBeatmapTrack(IBeatmap beatmap) { this.beatmap = beatmap; updateVirtualLength(); } protected override void UpdateState() { updateVirtualLength(); base.UpdateState(); } private void updateVirtualLength() { var lastObject = beatmap.HitObjects.LastOrDefault(); switch (lastObject) { case null: Length = excess_length; break; case IHasEndTime endTime: Length = endTime.EndTime + excess_length; break; default: Length = lastObject.StartTime + excess_length; break; } } } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; using osu.Framework.Audio.Track; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Beatmaps { public partial class WorkingBeatmap { /// <summary> /// A type of <see cref="TrackVirtual"/> which provides a valid length based on the <see cref="HitObject"/>s of an <see cref="IBeatmap"/>. /// </summary> protected class VirtualBeatmapTrack : TrackVirtual { private readonly IBeatmap beatmap; public VirtualBeatmapTrack(IBeatmap beatmap) { this.beatmap = beatmap; updateVirtualLength(); } protected override void UpdateState() { updateVirtualLength(); base.UpdateState(); } private void updateVirtualLength() { var lastObject = beatmap.HitObjects.LastOrDefault(); switch (lastObject) { case null: Length = 1000; break; case IHasEndTime endTime: Length = endTime.EndTime + 1000; break; default: Length = lastObject.StartTime + 1000; break; } } } } }
mit
C#
12d396a51359dcec41f24a34aa8424f43d5acc2f
Use `-1` to specify default buffer size
ppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu
osu.Game/IO/LineBufferedReader.cs
osu.Game/IO/LineBufferedReader.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.IO; using System.Text; namespace osu.Game.IO { /// <summary> /// A <see cref="StreamReader"/>-like decorator (with more limited API) for <see cref="Stream"/>s /// that allows lines to be peeked without consuming. /// </summary> public class LineBufferedReader : IDisposable { private readonly StreamReader streamReader; private string? peekedLine; public LineBufferedReader(Stream stream, bool leaveOpen = false) { streamReader = new StreamReader(stream, Encoding.UTF8, true, -1, leaveOpen); } /// <summary> /// Reads the next line from the stream without consuming it. /// Subsequent calls to <see cref="PeekLine"/> without a <see cref="ReadLine"/> will return the same string. /// </summary> public string? PeekLine() => peekedLine ??= streamReader.ReadLine(); /// <summary> /// Reads the next line from the stream and consumes it. /// If a line was peeked, that same line will then be consumed and returned. /// </summary> public string? ReadLine() { try { return peekedLine ?? streamReader.ReadLine(); } finally { peekedLine = null; } } /// <summary> /// Reads the stream to its end and returns the text read. /// Not compatible with calls to <see cref="PeekLine"/>. /// </summary> public string ReadToEnd() { if (peekedLine != null) throw new InvalidOperationException($"Do not use {nameof(ReadToEnd)} when also peeking for lines."); return streamReader.ReadToEnd(); } public void Dispose() { streamReader.Dispose(); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.IO; using System.Text; namespace osu.Game.IO { /// <summary> /// A <see cref="StreamReader"/>-like decorator (with more limited API) for <see cref="Stream"/>s /// that allows lines to be peeked without consuming. /// </summary> public class LineBufferedReader : IDisposable { private readonly StreamReader streamReader; private string? peekedLine; public LineBufferedReader(Stream stream, bool leaveOpen = false) { streamReader = new StreamReader(stream, Encoding.UTF8, true, 1024, leaveOpen); } /// <summary> /// Reads the next line from the stream without consuming it. /// Subsequent calls to <see cref="PeekLine"/> without a <see cref="ReadLine"/> will return the same string. /// </summary> public string? PeekLine() => peekedLine ??= streamReader.ReadLine(); /// <summary> /// Reads the next line from the stream and consumes it. /// If a line was peeked, that same line will then be consumed and returned. /// </summary> public string? ReadLine() { try { return peekedLine ?? streamReader.ReadLine(); } finally { peekedLine = null; } } /// <summary> /// Reads the stream to its end and returns the text read. /// Not compatible with calls to <see cref="PeekLine"/>. /// </summary> public string ReadToEnd() { if (peekedLine != null) throw new InvalidOperationException($"Do not use {nameof(ReadToEnd)} when also peeking for lines."); return streamReader.ReadToEnd(); } public void Dispose() { streamReader.Dispose(); } } }
mit
C#
762a1576fd052f1177ed0244d5cd110ec14e816d
make the sample 2.4 friendly
antoniusriha/gtk-sharp,orion75/gtk-sharp,orion75/gtk-sharp,openmedicus/gtk-sharp,antoniusriha/gtk-sharp,Gankov/gtk-sharp,antoniusriha/gtk-sharp,openmedicus/gtk-sharp,akrisiun/gtk-sharp,sillsdev/gtk-sharp,orion75/gtk-sharp,sillsdev/gtk-sharp,antoniusriha/gtk-sharp,sillsdev/gtk-sharp,akrisiun/gtk-sharp,openmedicus/gtk-sharp,Gankov/gtk-sharp,openmedicus/gtk-sharp,Gankov/gtk-sharp,sillsdev/gtk-sharp,sillsdev/gtk-sharp,Gankov/gtk-sharp,orion75/gtk-sharp,akrisiun/gtk-sharp,openmedicus/gtk-sharp,akrisiun/gtk-sharp,Gankov/gtk-sharp,orion75/gtk-sharp,openmedicus/gtk-sharp,Gankov/gtk-sharp,antoniusriha/gtk-sharp,akrisiun/gtk-sharp,openmedicus/gtk-sharp
sample/test/TestComboBox.cs
sample/test/TestComboBox.cs
// TestCombo.cs // // Author: Mike Kestner (mkestner@novell.com) // // Copyright (c) 2005, Novell, Inc. // using System; using Gtk; namespace WidgetViewer { public class TestComboBox { static Window window = null; public static Gtk.Window Create () { window = new Window ("GtkComboBox"); window.SetDefaultSize (200, 100); VBox box1 = new VBox (false, 0); window.Add (box1); VBox box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); ComboBoxEntry combo = new Gtk.ComboBoxEntry (new string[] {"Foo", "Bar"}); combo.Changed += new EventHandler (OnComboActivated); box2.PackStart (combo, true, true, 0); HSeparator separator = new HSeparator (); box1.PackStart (separator, false, false, 0); box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, false, 0); Button button = new Button (Stock.Close); button.Clicked += new EventHandler (OnCloseClicked); button.CanDefault = true; box2.PackStart (button, true, true, 0); button.GrabDefault (); return window; } static void OnCloseClicked (object o, EventArgs args) { window.Destroy (); } static void OnComboActivated (object o, EventArgs args) { ComboBox combo = o as ComboBox; TreeIter iter; combo.GetActiveIter (out iter); Console.WriteLine ((string)combo.Model.GetValue (iter, 0)); } } }
// TestCombo.cs // // Author: Mike Kestner (mkestner@novell.com) // // Copyright (c) 2005, Novell, Inc. // using System; using Gtk; namespace WidgetViewer { public class TestComboBox { static Window window = null; public static Gtk.Window Create () { window = new Window ("GtkComboBox"); window.SetDefaultSize (200, 100); VBox box1 = new VBox (false, 0); window.Add (box1); VBox box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, true, true, 0); ComboBoxEntry combo = new Gtk.ComboBoxEntry (new string[] {"Foo", "Bar"}); combo.Changed += new EventHandler (OnComboActivated); box2.PackStart (combo, true, true, 0); HSeparator separator = new HSeparator (); box1.PackStart (separator, false, false, 0); box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, false, 0); Button button = new Button (Stock.Close); button.Clicked += new EventHandler (OnCloseClicked); button.CanDefault = true; box2.PackStart (button, true, true, 0); button.GrabDefault (); return window; } static void OnCloseClicked (object o, EventArgs args) { window.Destroy (); } static void OnComboActivated (object o, EventArgs args) { Console.WriteLine ((o as ComboBox).ActiveText); } } }
lgpl-2.1
C#
d62e2e9f721ce06aa050ff35449900ae0372e8e3
Fix errors for IDFlags (EnterEffect, LeaveEffect etc..)
Trojaner25/Rocket-Regions,Trojaner25/Rocket-Safezone
Model/Flag/IDFlag.cs
Model/Flag/IDFlag.cs
using System; using Rocket.API; using Rocket.API.Extensions; namespace RocketRegions.Model.Flag { public abstract class IDFlag : RegionFlag { public override string Usage => "<ID>"; public override bool ParseValue(IRocketPlayer caller, Region region, string[] command, out string shownValue, Group group = Group.ALL) { shownValue = null; ushort? value = command.GetUInt16Parameter(0); if (!value.HasValue) return false; try { shownValue = value.Value.ToString(); SetValue(value.Value, group); return true; } catch (Exception) { return false; } } } }
using System; using Rocket.API; using Rocket.API.Extensions; namespace RocketRegions.Model.Flag { public abstract class IDFlag : RegionFlag { public override string Usage => "<ID>"; public override bool ParseValue(IRocketPlayer caller, Region region, string[] command, out string shownValue, Group group = Group.ALL) { shownValue = null; int? value = command.GetUInt16Parameter(0); if (!value.HasValue) return false; try { shownValue = value.Value.ToString(); SetValue(Convert.ToInt32(value.Value), group); return true; } catch (Exception) { return false; } } } }
agpl-3.0
C#
6f93aa6131838cc9f64ca79be6195ffe4828a374
Fix incomplete comment
UselessToucan/osu,Damnae/osu,Nabile-Rahmani/osu,DrabWeb/osu,EVAST9919/osu,ZLima12/osu,peppy/osu,Drezi126/osu,UselessToucan/osu,naoey/osu,johnneijzen/osu,NeoAdonis/osu,DrabWeb/osu,naoey/osu,2yangk23/osu,ppy/osu,ZLima12/osu,johnneijzen/osu,DrabWeb/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,Frontear/osuKyzer,smoogipooo/osu,2yangk23/osu,UselessToucan/osu,smoogipoo/osu,naoey/osu,peppy/osu,EVAST9919/osu,ppy/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,smoogipoo/osu
osu.Game/Rulesets/Mods/Mod.cs
osu.Game/Rulesets/Mods/Mod.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Graphics; using System; namespace osu.Game.Rulesets.Mods { /// <summary> /// The base class for gameplay modifiers. /// </summary> public abstract class Mod { /// <summary> /// The name of this mod. /// </summary> public abstract string Name { get; } /// <summary> /// The icon of this mod. /// </summary> public virtual FontAwesome Icon => FontAwesome.fa_question; /// <summary> /// The type of this mod. /// </summary> public virtual ModType Type => ModType.Special; /// <summary> /// The user readable description of this mod. /// </summary> public virtual string Description => string.Empty; /// <summary> /// The score multiplier of this mod. /// </summary> public abstract double ScoreMultiplier { get; } /// <summary> /// Returns if this mod is ranked. /// </summary> public virtual bool Ranked => false; /// <summary> /// The mods this mod cannot be enabled with. /// </summary> public virtual Type[] IncompatibleMods => new Type[] { }; /// <summary> /// Whether we should allow failing at the current point in time. /// </summary> public virtual bool AllowFail => true; } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Graphics; using System; namespace osu.Game.Rulesets.Mods { /// <summary> /// The base class for gameplay modifiers. /// </summary> public abstract class Mod { /// <summary> /// The name of this mod. /// </summary> public abstract string Name { get; } /// <summary> /// The icon of this mod. /// </summary> public virtual FontAwesome Icon => FontAwesome.fa_question; /// <summary> /// The type of this mod. /// </summary> public virtual ModType Type => ModType.Special; /// <summary> /// The user readable description of this mod. /// </summary> public virtual string Description => string.Empty; /// <summary> /// The score multiplier of this mod. /// </summary> public abstract double ScoreMultiplier { get; } /// <summary> /// Returns if this mod is ranked. /// </summary> public virtual bool Ranked => false; /// <summary> /// The mods this mod cannot be enabled with. /// </summary> public virtual Type[] IncompatibleMods => new Type[] { }; /// <summary> /// Whether we should allow fails at the /// </summary> public virtual bool AllowFail => true; } }
mit
C#
65bf7af8513605b6db2b85133e2977c1c55db8f1
Update UserAgents
Kingloo/Rdr
RdrLib/UserAgents.cs
RdrLib/UserAgents.cs
using System; using System.Collections.Generic; using System.Linq; namespace RdrLib { public static class UserAgents { public const string HeaderName = "User-Agent"; #pragma warning disable CA1707 public const string Firefox_102_Windows = nameof(Firefox_102_Windows); public const string Firefox_91_ESR_Linux = nameof(Firefox_91_ESR_Linux); public const string Edge_103_Windows = nameof(Edge_103_Windows); public const string Edge_103_Linux = nameof(Edge_103_Linux); #pragma warning restore CA1707 private static readonly IDictionary<string, string> agents = new Dictionary<string, string> { { Firefox_102_Windows, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0" }, { Firefox_91_ESR_Linux, "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" }, { Edge_103_Windows, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36 Edg/103.0.1264.37" }, { Edge_103_Linux, "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36 Edg/103.0.1264.37" } }; public static string Get(string browser) { return agents[browser]; } public static string GetRandomUserAgent() { #pragma warning disable CA5394 Random random = new Random(); int randomNumber = random.Next(0, agents.Count - 1); return agents.Values.ToArray()[randomNumber]; #pragma warning restore CA5394 } } }
using System.Linq; namespace RdrLib.Common { public static class UserAgents { public const string HeaderName = "User-Agent"; public const string Firefox_94_Windows = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"; public const string Edge_96_Windows = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36 Edg/96.0.1054.29"; public const string Edge_97_Linux = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4688.0 Safari/537.36 Edg/97.0.1069.0"; public const string Safari_13_1_MacOSX = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15"; public const string Chrome_85_Windows = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36"; public const string Opera_66_Windows = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 OPR/66.0.3515.72"; public const string Firefox_78ESR_Linux = "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0"; [System.Diagnostics.DebuggerStepThrough] public static string GetRandomUserAgent() { // .TickCount, measured in milliseconds, increments so quickly that the last digit is random enough for our needs return System.Environment.TickCount.ToString().Last() switch { '1' => Firefox_94_Windows, '2' => Edge_96_Windows, '3' => Edge_97_Linux, '4' => Safari_13_1_MacOSX, '5' => Chrome_85_Windows, '6' => Opera_66_Windows, _ => Firefox_78ESR_Linux }; } } }
unlicense
C#
d00d5119e8572934b9025114ca456943b954a752
Update sample
newky2k/MonoTouch.Dialog,benoitjadinon/MonoTouch.Dialog,migueldeicaza/MonoTouch.Dialog,jstedfast/MonoTouch.Dialog,ClusterReplyBUS/MonoTouch.Dialog,hisystems/MonoTouch.Dialog,Milan1992/MonoTouch.Dialog,danmiser/MonoTouch.Dialog
Sample/DemoStyled.cs
Sample/DemoStyled.cs
using System; using System.IO; using MonoTouch.UIKit; using MonoTouch.Dialog; using MonoTouch.Dialog.Utilities; using System.Threading; using System.Drawing; namespace Sample { public partial class AppDelegate { public void DemoStyled () { var imageBackground = new Uri ("file://" + Path.GetFullPath ("background.png")); var image = ImageLoader.RequestImage (imageBackground, null); var small = image.Scale (new SizeF (32, 32)); var imageIcon = new StyledStringElement ("Local image icon") { Image = small }; var backgroundImage = new StyledStringElement ("Image downloaded") { BackgroundUri = new Uri ("http://www.google.com/images/logos/ps_logo2.png") }; var localImage = new StyledStringElement ("Local image"){ BackgroundUri = imageBackground }; var backgroundSolid = new StyledStringElement ("Solid background") { BackgroundColor = UIColor.Green }; var colored = new StyledStringElement ("Colored", "Detail in Green") { TextColor = UIColor.Yellow, BackgroundColor = UIColor.Red, DetailColor = UIColor.Green, }; var root = new RootElement("Styled Elements") { new Section ("Image icon"){ imageIcon }, new Section ("Background") { backgroundImage, backgroundSolid, localImage }, new Section ("Text Color"){ colored }, new Section ("Cell Styles"){ new StyledStringElement ("Default", "Invisible value", UITableViewCellStyle.Default), new StyledStringElement ("Value1", "Aligned on each side", UITableViewCellStyle.Value1), new StyledStringElement ("Value2", "Like the Addressbook", UITableViewCellStyle.Value2), new StyledStringElement ("Subtitle", "Makes it sound more important", UITableViewCellStyle.Subtitle), new StyledStringElement ("Subtitle", "Brown subtitle", UITableViewCellStyle.Subtitle) { DetailColor = UIColor.Brown } }, new Section ("Accessories"){ new StyledStringElement ("DisclosureIndicator") { Accessory = UITableViewCellAccessory.DisclosureIndicator }, new StyledStringElement ("Checkmark") { Accessory = UITableViewCellAccessory.Checkmark }, new StyledStringElement ("DetailDisclosureIndicator") { Accessory = UITableViewCellAccessory.DetailDisclosureButton }, } }; var dvc = new DialogViewController (root, true); navigation.PushViewController (dvc, true); } } }
using System; using System.IO; using MonoTouch.UIKit; using MonoTouch.Dialog; using System.Threading; namespace Sample { public partial class AppDelegate { public void DemoStyled () { var backgroundImage = new StyledStringElement ("Image downloaded") { BackgroundUri = new Uri ("http://www.google.com/images/logos/ps_logo2.png") }; var localImage = new StyledStringElement ("Local image"){ BackgroundUri = new Uri ("file://" + Path.GetFullPath ("background.png")) }; var backgroundSolid = new StyledStringElement ("Solid background") { BackgroundColor = UIColor.Green }; var colored = new StyledStringElement ("Colored", "Detail in Green") { TextColor = UIColor.Yellow, BackgroundColor = UIColor.Red, DetailColor = UIColor.Green, }; var root = new RootElement("Styled Elements") { new Section ("Background") { backgroundImage, backgroundSolid, localImage }, new Section ("Text Color"){ colored }, new Section ("Cell Styles"){ new StyledStringElement ("Default", "Invisible value", UITableViewCellStyle.Default), new StyledStringElement ("Value1", "Aligned on each side", UITableViewCellStyle.Value1), new StyledStringElement ("Value2", "Like the Addressbook", UITableViewCellStyle.Value2), new StyledStringElement ("Subtitle", "Makes it sound more important", UITableViewCellStyle.Subtitle), new StyledStringElement ("Subtitle", "Brown subtitle", UITableViewCellStyle.Subtitle) { DetailColor = UIColor.Brown } }, new Section ("Accessories"){ new StyledStringElement ("DisclosureIndicator") { Accessory = UITableViewCellAccessory.DisclosureIndicator }, new StyledStringElement ("Checkmark") { Accessory = UITableViewCellAccessory.Checkmark }, new StyledStringElement ("DetailDisclosureIndicator") { Accessory = UITableViewCellAccessory.DetailDisclosureButton }, } }; var dvc = new DialogViewController (root, true); navigation.PushViewController (dvc, true); } } }
mit
C#
9226f0abbca34bd14e6c3571ea7a4426cf9abf57
Implement equality correctly in `Live`
ppy/osu,peppy/osu,peppy/osu,ppy/osu,peppy/osu,ppy/osu
osu.Game/Database/Live.cs
osu.Game/Database/Live.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using JetBrains.Annotations; namespace osu.Game.Database { /// <summary> /// A wrapper to provide access to database backed classes in a thread-safe manner. /// </summary> /// <typeparam name="T">The databased type.</typeparam> public abstract class Live<T> : IEquatable<Live<T>> where T : class, IHasGuidPrimaryKey { public Guid ID { get; } /// <summary> /// Perform a read operation on this live object. /// </summary> /// <param name="perform">The action to perform.</param> public abstract void PerformRead([InstantHandle] Action<T> perform); /// <summary> /// Perform a read operation on this live object. /// </summary> /// <param name="perform">The action to perform.</param> public abstract TReturn PerformRead<TReturn>([InstantHandle] Func<T, TReturn> perform); /// <summary> /// Perform a write operation on this live object. /// </summary> /// <param name="perform">The action to perform.</param> public abstract void PerformWrite([InstantHandle] Action<T> perform); /// <summary> /// Whether this instance is tracking data which is managed by the database backing. /// </summary> public abstract bool IsManaged { get; } /// <summary> /// Resolve the value of this instance on the update thread. /// </summary> /// <remarks> /// After resolving, the data should not be passed between threads. /// </remarks> public abstract T Value { get; } protected Live(Guid id) { ID = id; } public bool Equals(Live<T>? other) { if (ReferenceEquals(this, other)) return true; if (other == null) return false; return ID == other.ID; } public override int GetHashCode() => HashCode.Combine(ID); public override string ToString() => PerformRead(i => i.ToString()); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using JetBrains.Annotations; namespace osu.Game.Database { /// <summary> /// A wrapper to provide access to database backed classes in a thread-safe manner. /// </summary> /// <typeparam name="T">The databased type.</typeparam> public abstract class Live<T> : IEquatable<Live<T>> where T : class, IHasGuidPrimaryKey { public Guid ID { get; } /// <summary> /// Perform a read operation on this live object. /// </summary> /// <param name="perform">The action to perform.</param> public abstract void PerformRead([InstantHandle] Action<T> perform); /// <summary> /// Perform a read operation on this live object. /// </summary> /// <param name="perform">The action to perform.</param> public abstract TReturn PerformRead<TReturn>([InstantHandle] Func<T, TReturn> perform); /// <summary> /// Perform a write operation on this live object. /// </summary> /// <param name="perform">The action to perform.</param> public abstract void PerformWrite([InstantHandle] Action<T> perform); /// <summary> /// Whether this instance is tracking data which is managed by the database backing. /// </summary> public abstract bool IsManaged { get; } /// <summary> /// Resolve the value of this instance on the update thread. /// </summary> /// <remarks> /// After resolving, the data should not be passed between threads. /// </remarks> public abstract T Value { get; } protected Live(Guid id) { ID = id; } public bool Equals(Live<T>? other) => ID == other?.ID; public override int GetHashCode() => HashCode.Combine(ID); public override string ToString() => PerformRead(i => i.ToString()); } }
mit
C#
2381e716b771c8df8e8681baef7c70f3bc93dfca
Use collection initializer
khellang/Middleware,khellang/Middleware
src/ProblemDetails/Mvc/ProblemDetailsApplicationModelProvider.cs
src/ProblemDetails/Mvc/ProblemDetailsApplicationModelProvider.cs
using System.Collections.Generic; using System.Linq; using System.Reflection; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.AspNetCore.Mvc.Infrastructure; using MvcProblemDetails = Microsoft.AspNetCore.Mvc.ProblemDetails; namespace Hellang.Middleware.ProblemDetails.Mvc { internal class ProblemDetailsApplicationModelProvider : IApplicationModelProvider { public ProblemDetailsApplicationModelProvider() { var defaultErrorResponseType = new ProducesErrorResponseTypeAttribute(typeof(MvcProblemDetails)); ActionModelConventions = new List<IActionModelConvention> { new ApiConventionApplicationModelConvention(defaultErrorResponseType), new ProblemDetailsResultFilterConvention() }; } public int Order => -1000 + 200; private List<IActionModelConvention> ActionModelConventions { get; } public void OnProvidersExecuting(ApplicationModelProviderContext context) { foreach (var controller in context.Result.Controllers) { if (!IsApiController(controller)) { continue; } foreach (var action in controller.Actions) { foreach (var convention in ActionModelConventions) { convention.Apply(action); } } } } private static bool IsApiController(ControllerModel controller) { if (controller.Attributes.OfType<IApiBehaviorMetadata>().Any()) { return true; } var assembly = controller.ControllerType.Assembly; var attributes = assembly.GetCustomAttributes(); return attributes.OfType<IApiBehaviorMetadata>().Any(); } void IApplicationModelProvider.OnProvidersExecuted(ApplicationModelProviderContext context) { // Not needed. } } }
using System.Collections.Generic; using System.Linq; using System.Reflection; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.AspNetCore.Mvc.Infrastructure; using MvcProblemDetails = Microsoft.AspNetCore.Mvc.ProblemDetails; namespace Hellang.Middleware.ProblemDetails.Mvc { internal class ProblemDetailsApplicationModelProvider : IApplicationModelProvider { public ProblemDetailsApplicationModelProvider() { ActionModelConventions = new List<IActionModelConvention>(); var responseTypeAttribute = new ProducesErrorResponseTypeAttribute(typeof(MvcProblemDetails)); ActionModelConventions.Add(new ApiConventionApplicationModelConvention(responseTypeAttribute)); ActionModelConventions.Add(new ProblemDetailsResultFilterConvention()); } public int Order => -1000 + 200; private List<IActionModelConvention> ActionModelConventions { get; } public void OnProvidersExecuting(ApplicationModelProviderContext context) { foreach (var controller in context.Result.Controllers) { if (!IsApiController(controller)) { continue; } foreach (var action in controller.Actions) { foreach (var convention in ActionModelConventions) { convention.Apply(action); } } } } private static bool IsApiController(ControllerModel controller) { if (controller.Attributes.OfType<IApiBehaviorMetadata>().Any()) { return true; } var assembly = controller.ControllerType.Assembly; var attributes = assembly.GetCustomAttributes(); return attributes.OfType<IApiBehaviorMetadata>().Any(); } void IApplicationModelProvider.OnProvidersExecuted(ApplicationModelProviderContext context) { // Not needed. } } }
mit
C#
e960ca6fdbda6a57db0e32fe521ec7fcedefa584
Handle null in ConfigureKestrelServerOptions.cs
dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,dawoe/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS,dawoe/Umbraco-CMS,umbraco/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS
src/Umbraco.Web.Common/Security/ConfigureKestrelServerOptions.cs
src/Umbraco.Web.Common/Security/ConfigureKestrelServerOptions.cs
using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.Options; using Umbraco.Cms.Core.Configuration.Models; namespace Umbraco.Cms.Web.Common.Security { public class ConfigureKestrelServerOptions : IConfigureOptions<KestrelServerOptions> { private readonly IOptions<RuntimeSettings> _runtimeSettings; public ConfigureKestrelServerOptions(IOptions<RuntimeSettings> runtimeSettings) => _runtimeSettings = runtimeSettings; public void Configure(KestrelServerOptions options) { // convert from KB to bytes options.Limits.MaxRequestBodySize = _runtimeSettings.Value.MaxRequestLength.HasValue ? _runtimeSettings.Value.MaxRequestLength.Value * 1024 : long.MaxValue; } } }
using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.Options; using Umbraco.Cms.Core.Configuration.Models; namespace Umbraco.Cms.Web.Common.Security { public class ConfigureKestrelServerOptions : IConfigureOptions<KestrelServerOptions> { private readonly IOptions<RuntimeSettings> _runtimeSettings; public ConfigureKestrelServerOptions(IOptions<RuntimeSettings> runtimeSettings) => _runtimeSettings = runtimeSettings; public void Configure(KestrelServerOptions options) { // convert from KB to bytes options.Limits.MaxRequestBodySize = _runtimeSettings.Value.MaxRequestLength * 1024; } } }
mit
C#
159acf1cfb919611d2e56b5931be860625e6fff6
increment patch version,
jwChung/Experimentalism,jwChung/Experimentalism
build/CommonAssemblyInfo.cs
build/CommonAssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Jin-Wook Chung")] [assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyProduct("")] [assembly: AssemblyVersion("0.9.8")] [assembly: AssemblyInformationalVersion("0.9.8")] /* * Version 0.9.8 * * Uses single quotation mark to show the display name of `FirstClassCommand`, * because double quotation mark can mislead that a value is string, but * actually not. */
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Jin-Wook Chung")] [assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyProduct("")] [assembly: AssemblyVersion("0.9.7")] [assembly: AssemblyInformationalVersion("0.9.7")] /* * Version 0.9.7 * * Adds the MethodInfo parameter to the CreateFixture method of * TheoremAttribute and FirstClassTheoremAttribute to be used when creating * a fixture instance. * * BREAKING CHANGES * - TheoremAttribute and FirstClassTheoremAttribute: * protected IFixture CreateFixture() -> * protected IFixture CreateFixture(MethodInfo) */
mit
C#
a5b264ee45bb1d0da11b29613afb866d0473ba9a
Fix xml doc
InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform
InfinniPlatform.Http.Abstractions/Middlewares/IDefaultAppLayer.cs
InfinniPlatform.Http.Abstractions/Middlewares/IDefaultAppLayer.cs
namespace InfinniPlatform.Http.Middlewares { /// <summary> /// Marker interface for internal implementations of <see cref="IAppLayer"/>. /// </summary> public interface IDefaultAppLayer : IAppLayer { } }
namespace InfinniPlatform.Http.Middlewares { public interface IDefaultAppLayer : IAppLayer { } }
agpl-3.0
C#
a22e6cf46b2fd8833b7dc20600e54f0fba04daec
Remove printing of invocation in case of non-zero exit code.
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Core/Tooling/ProcessExtensions.cs
source/Nuke.Core/Tooling/ProcessExtensions.cs
// Copyright Matthias Koch 2017. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using JetBrains.Annotations; using Nuke.Core.Utilities; namespace Nuke.Core.Tooling { [PublicAPI] [DebuggerStepThrough] [DebuggerNonUserCode] public static class ProcessExtensions { [AssertionMethod] public static void AssertWaitForExit ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process) { ControlFlow.Assert(process != null && process.WaitForExit(), "process != null && process.WaitForExit()"); } [AssertionMethod] public static void AssertZeroExitCode ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process) { process.AssertWaitForExit(); ControlFlow.Assert(process.ExitCode == 0, $"Process '{Path.GetFileName(process.StartInfo.FileName)}' exited with code {process.ExitCode}. Please verify the invocation."); } public static IEnumerable<Output> EnsureOnlyStd (this IEnumerable<Output> output) { foreach (var o in output) { ControlFlow.Assert(o.Type == OutputType.Std, "o.Type == OutputType.Std"); yield return o; } } } }
// Copyright Matthias Koch 2017. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using JetBrains.Annotations; using Nuke.Core.Utilities; namespace Nuke.Core.Tooling { [PublicAPI] [DebuggerStepThrough] [DebuggerNonUserCode] public static class ProcessExtensions { [AssertionMethod] public static void AssertWaitForExit ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process) { ControlFlow.Assert(process != null && process.WaitForExit(), "process != null && process.WaitForExit()"); } [AssertionMethod] public static void AssertZeroExitCode ([AssertionCondition(AssertionConditionType.IS_NOT_NULL)] [CanBeNull] this IProcess process) { process.AssertWaitForExit(); ControlFlow.Assert(process.ExitCode == 0, new[] { $"Process '{Path.GetFileName(process.StartInfo.FileName)}' exited with code {process.ExitCode}. Please verify the invocation:", $"> {process.StartInfo.FileName.DoubleQuoteIfNeeded()} {process.StartInfo.Arguments}" }.Join(EnvironmentInfo.NewLine)); } public static IEnumerable<Output> EnsureOnlyStd (this IEnumerable<Output> output) { foreach (var o in output) { ControlFlow.Assert(o.Type == OutputType.Std, "o.Type == OutputType.Std"); yield return o; } } } }
mit
C#
a5ac0bcc74734d1478b20d02d92ae2096a027b73
Fix the usage string and an error path
sbennett1990/signify.cs
SignifyCS/Main.cs
SignifyCS/Main.cs
/* * Copyright (c) 2017 Scott Bennett <scottb@fastmail.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ using System; using System.IO; using libcmdline; namespace SignifyCS { public class Signify { public const string USAGE = "verify -p pubkey -x sigfile -m message"; public static void Main(string[] args) { PubKey pub_key = default(PubKey); Signature sig = default(Signature); byte[] message = new byte[0]; try { CommandLineArgs cmd_args = new CommandLineArgs(); cmd_args.RegisterSpecificSwitchMatchHandler("p", (sender, e) => { using (FileStream pub_key_file = readFile(e.Value)) { pub_key = PubKeyCryptoFile.ParsePubKeyFile(pub_key_file); } }); cmd_args.RegisterSpecificSwitchMatchHandler("x", (sender, e) => { using (FileStream sig_file = readFile(e.Value)) { sig = SigCryptoFile.ParseSigFile(sig_file); } }); cmd_args.RegisterSpecificSwitchMatchHandler("m", (sender, e) => { message = File.ReadAllBytes(e.Value); }); cmd_args.ProcessCommandLineArgs(args); if (cmd_args.ArgCount < 3) { Console.WriteLine("\nusage: " + USAGE); return; } bool success = Verify.VerifyMessage(pub_key, sig, message); if (success) { Console.WriteLine("\nSignature Verified"); } else { Console.WriteLine("\nsignature verification failed"); } } catch (Exception e) { Console.WriteLine(e.Message); #if DEBUG Console.WriteLine(e.StackTrace); #endif } } private static FileStream readFile(string file_name) { if (!File.Exists(file_name)) { throw new Exception($"File not found: {file_name}"); } return new FileStream(file_name, FileMode.Open, FileAccess.Read, FileShare.Read); } } }
/* * Copyright (c) 2017 Scott Bennett <scottb@fastmail.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ using System; using System.IO; using libcmdline; namespace SignifyCS { public class Signify { public static void Main(string[] args) { PubKey pub_key = default(PubKey); Signature sig = default(Signature); byte[] message = new byte[0]; try { CommandLineArgs cmd_args = new CommandLineArgs(); cmd_args.RegisterSpecificSwitchMatchHandler("p", (sender, e) => { using (FileStream pub_key_file = readFile(e.Value)) { pub_key = PubKeyCryptoFile.ParsePubKeyFile(pub_key_file); } }); cmd_args.RegisterSpecificSwitchMatchHandler("x", (sender, e) => { using (FileStream sig_file = readFile(e.Value)) { sig = SigCryptoFile.ParseSigFile(sig_file); } }); cmd_args.RegisterSpecificSwitchMatchHandler("m", (sender, e) => { message = File.ReadAllBytes(e.Value); }); cmd_args.ProcessCommandLineArgs(args); if (cmd_args.ArgCount < 3) { Console.WriteLine("usage: signify -p pubkey -x sigfile -m message"); throw new Exception(); } bool success = Verify.VerifyMessage(pub_key, sig, message); if (success) { Console.WriteLine("\nSignature Verified"); } else { Console.WriteLine("\nsignature verification failed"); } } catch (Exception e) { Console.WriteLine(e.Message); #if DEBUG Console.WriteLine(e.StackTrace); #endif } } private static FileStream readFile(string file_name) { if (!File.Exists(file_name)) { throw new Exception($"File not found: {file_name}"); } return new FileStream(file_name, FileMode.Open, FileAccess.Read, FileShare.Read); } } }
isc
C#
25427c2c198ba5bebda8281b79d5b4f7e76613d2
Bump version to 9.0.1.0.
jthorpe4/EDDiscovery,jgoode/EDDiscovery,jgoode/EDDiscovery,mwerle/EDDiscovery,mwerle/EDDiscovery
EDDiscovery/Properties/AssemblyInfo.cs
EDDiscovery/Properties/AssemblyInfo.cs
/* * Copyright © 2015 - 2017 EDDiscovery development team * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF * ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. * * EDDiscovery is not affiliated with Frontier Developments plc. */ 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("EDDiscovery")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EDDiscovery")] [assembly: AssemblyCopyright("Copyright © Robert Wahlström 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("1ad84dc2-298f-4d18-8902-7948bccbdc72")] // 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("9.0.1.0")] [assembly: AssemblyFileVersion("9.0.1.0")]
/* * Copyright © 2015 - 2017 EDDiscovery development team * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF * ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. * * EDDiscovery is not affiliated with Frontier Developments plc. */ 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("EDDiscovery")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EDDiscovery")] [assembly: AssemblyCopyright("Copyright © Robert Wahlström 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("1ad84dc2-298f-4d18-8902-7948bccbdc72")] // 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("9.0.0.0")] [assembly: AssemblyFileVersion("9.0.0.0")]
apache-2.0
C#
a677091e838febe3c9ff0ea05548b9cd9587a542
Create directory for error screenshot if it does not exist
cezarypiatek/Tellurium,cezarypiatek/Tellurium,cezarypiatek/MaintainableSelenium,cezarypiatek/MaintainableSelenium,cezarypiatek/MaintainableSelenium,cezarypiatek/Tellurium
Src/MvcPages/BrowserCamera/Storage/FileSystemScreenshotStorage.cs
Src/MvcPages/BrowserCamera/Storage/FileSystemScreenshotStorage.cs
using System; using System.Drawing.Imaging; using System.IO; using Tellurium.MvcPages.Utils; namespace Tellurium.MvcPages.BrowserCamera.Storage { public class FileSystemScreenshotStorage : IScreenshotStorage { private readonly string screenshotDirectoryPath; public FileSystemScreenshotStorage(string screenshotDirectoryPath) { this.screenshotDirectoryPath = screenshotDirectoryPath; } public virtual void Persist(byte[] image, string screenshotName) { var screenshotPath = GetScreenshotPath(screenshotName); image.ToBitmap().Save(screenshotPath, ImageFormat.Jpeg); } protected string GetScreenshotPath(string screenshotName) { if (string.IsNullOrWhiteSpace(screenshotDirectoryPath)) { throw new ApplicationException("Screenshot directory path not defined"); } if (string.IsNullOrWhiteSpace(screenshotName)) { throw new ArgumentException("Screenshot name cannot be empty", nameof(screenshotName)); } if (Directory.Exists(screenshotDirectoryPath) == false) { Directory.CreateDirectory(screenshotDirectoryPath); } var fileName = $"{screenshotName}.jpg"; return Path.Combine(screenshotDirectoryPath, fileName); } } }
using System; using System.Drawing.Imaging; using System.IO; using Tellurium.MvcPages.Utils; namespace Tellurium.MvcPages.BrowserCamera.Storage { public class FileSystemScreenshotStorage : IScreenshotStorage { private readonly string screenshotDirectoryPath; public FileSystemScreenshotStorage(string screenshotDirectoryPath) { this.screenshotDirectoryPath = screenshotDirectoryPath; } public virtual void Persist(byte[] image, string screenshotName) { var screenshotPath = GetScreenshotPath(screenshotName); image.ToBitmap().Save(screenshotPath, ImageFormat.Jpeg); } protected string GetScreenshotPath(string screenshotName) { if (string.IsNullOrWhiteSpace(screenshotDirectoryPath)) { throw new ApplicationException("Screenshot directory path not defined"); } if (string.IsNullOrWhiteSpace(screenshotName)) { throw new ArgumentException("Screenshot name cannot be empty", nameof(screenshotName)); } var fileName = $"{screenshotName}.jpg"; return Path.Combine(screenshotDirectoryPath, fileName); } } }
mit
C#
857b463b6d4bd94cad2e244b04a9e33e15d62ecd
make EventLoopScheduler thread background and cancellable until dueTime.
atsushieno/mono-reactive,paulcbetts/mono-reactive,jorik041/mono-reactive
System.Reactive/System.Reactive.Concurrency/EventLoopScheduler.cs
System.Reactive/System.Reactive.Concurrency/EventLoopScheduler.cs
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Reactive.Disposables; namespace System.Reactive.Concurrency { public sealed class EventLoopScheduler : IScheduler, IDisposable { public EventLoopScheduler () : this ((ts) => new Thread (ts) { IsBackground = true }) { } public EventLoopScheduler (Func<ThreadStart, Thread> threadFactory) { if (threadFactory == null) throw new ArgumentNullException ("threadFactory"); thread_factory = threadFactory; } Func<ThreadStart, Thread> thread_factory; public void Dispose () { throw new NotImplementedException (); } public DateTimeOffset Now { get { return Scheduler.Now; } } public IDisposable Schedule<TState> (TState state, Func<IScheduler, TState, IDisposable> action) { return Schedule (state, Scheduler.Now, action); } public IDisposable Schedule<TState> (TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action) { IDisposable dis = null; bool cancel = false; var th = thread_factory (() => { Thread.Sleep (Scheduler.Normalize (dueTime - Now)); if (!cancel) dis = action (this, state); }); th.Start (); // The thread is not aborted even if it's at work (ThreadAbortException is not caught inside the action). // FIXME: this should *always* dispose "dis" instance that is returned by the action even after disposable of this instance (action starts regardless of this). return Disposable.Create (() => { cancel = true; if (dis != null) dis.Dispose (); }); } public IDisposable Schedule<TState> (TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action) { return Schedule (state, Scheduler.Now + dueTime, action); } } }
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Reactive.Disposables; namespace System.Reactive.Concurrency { public sealed class EventLoopScheduler : IScheduler, IDisposable { public EventLoopScheduler () : this ((ts) => new Thread (ts)) { } public EventLoopScheduler (Func<ThreadStart, Thread> threadFactory) { if (threadFactory == null) throw new ArgumentNullException ("threadFactory"); thread_factory = threadFactory; } Func<ThreadStart, Thread> thread_factory; public void Dispose () { throw new NotImplementedException (); } public DateTimeOffset Now { get { return Scheduler.Now; } } public IDisposable Schedule<TState> (TState state, Func<IScheduler, TState, IDisposable> action) { return Schedule (state, Scheduler.Now, action); } public IDisposable Schedule<TState> (TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action) { IDisposable dis = null; var th = thread_factory (() => { Thread.Sleep (Scheduler.Normalize (dueTime - Now)); dis = action (this, state); }); th.Start (); // The thread is not aborted even if it's at work (ThreadAbortException is not caught inside the action). // FIXME: this should *always* dispose "dis" instance that is returned by the action even after disposable of this instance (action starts regardless of this). return Disposable.Create (() => { if (dis != null) dis.Dispose (); }); } public IDisposable Schedule<TState> (TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action) { return Schedule (state, Scheduler.Now + dueTime, action); } } }
mit
C#
340a8800751e00dcb95352990d55bfac720f3178
Fix small typo in C# Numbers Concept Exercise
exercism/xcsharp,exercism/xcsharp
exercises/concept/numbers/NumbersTest.cs
exercises/concept/numbers/NumbersTest.cs
using Xunit; public class AssemblyLineTest { [Fact] public void ProductionRatePerHourForSpeedZero() => Assert.Equal(0.0, AssemblyLine.ProductionRatePerHour(0)); [Fact] public void ProductionRatePerHourForSpeedOne() => Assert.Equal(221.0, AssemblyLine.ProductionRatePerHour(1)); [Fact] public void ProductionRatePerHourForSpeedFour() => Assert.Equal(884.0, AssemblyLine.ProductionRatePerHour(4)); [Fact] public void ProductionRatePerHourForSpeedSeven() => Assert.Equal(1392.3, AssemblyLine.ProductionRatePerHour(7)); [Fact] public void ProductionRatePerHourForSpeedNine() => Assert.Equal(1531.53, AssemblyLine.ProductionRatePerHour(9)); [Fact] public void WorkingItemsPerMinuteForSpeedZero() => Assert.Equal(0, AssemblyLine.WorkingItemsPerMinute(0)); [Fact] public void WorkingItemsPerMinuteForSpeedOne() => Assert.Equal(3, AssemblyLine.WorkingItemsPerMinute(1)); [Fact] public void WorkingItemsPerMinuteForSpeedFive() => Assert.Equal(16, AssemblyLine.WorkingItemsPerMinute(5)); [Fact] public void WorkingItemsPerMinuteForSpeedEight() => Assert.Equal(26, AssemblyLine.WorkingItemsPerMinute(8)); [Fact] public void WorkingItemsPerMinuteForSpeedTen() => Assert.Equal(28, AssemblyLine.WorkingItemsPerMinute(10)); }
using Xunit; public class AssemblyLineTest { [Fact] public void ProductionRatePerHourForSpeedZero() => Assert.Equal(0.0, AssemblyLine.ProductionRatePerHour(0)); [Fact] public void ProductionRatePerHourForSpeedOne() => Assert.Equal(221.0, AssemblyLine.ProductionRatePerHour(1)); [Fact] public void ProductionRatePerHourForSpeedFour() => Assert.Equal(884.0, AssemblyLine.ProductionRatePerHour(4)); [Fact] public void ProductionRatePerHourForSpeedSeven() => Assert.Equal(1392.3, AssemblyLine.ProductionRatePerHour(7)); [Fact] public void ProductionRatePerHourForSpeedNine() => Assert.Equal(1531.53, AssemblyLine.ProductionRatePerHour(9)); [Fact] public void WorkingItemsPerMinuteForSpeedZero() => Assert.Equal(0, AssemblyLine.WorkingItemsPerMinute(0)); [Fact] public void WorkingItemsPerMinuteForSpeedOne() => Assert.Equal(3, AssemblyLine.WorkingItemsPerMinute(1)); [Fact] public void WorkingItemsPerMinuteForSpeedFive() => Assert.Equal(16, AssemblyLine.WorkingItemsPerMinute(5)); [Fact] public void WorkingItemsPerMinuteForSpeedFour() => Assert.Equal(26, AssemblyLine.WorkingItemsPerMinute(8)); [Fact] public void WorkingItemsPerMinuteForSpeedTen() => Assert.Equal(28, AssemblyLine.WorkingItemsPerMinute(10)); }
mit
C#
fb5d92bdc02f1ed2af73fc26bbee67be20a2bb99
Change our cached task to a field
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNetCore.Mvc.Core/Internal/TaskCache.cs
src/Microsoft.AspNetCore.Mvc.Core/Internal/TaskCache.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading.Tasks; namespace Microsoft.AspNetCore.Mvc.Internal { public static class TaskCache { /// <summary> /// A <see cref="Task"/> that's already completed successfully. /// </summary> /// <remarks> /// We're caching this in a static readonly field to make it more inlinable and avoid the volatile lookup done /// by <c>Task.CompletedTask</c>. /// </remarks> #if NET451 public static readonly Task CompletedTask = Task.FromResult(0); #else public static readonly Task CompletedTask = Task.CompletedTask; #endif } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading.Tasks; namespace Microsoft.AspNetCore.Mvc.Internal { public static class TaskCache { #if NET451 static readonly Task _completedTask = Task.FromResult(0); #endif /// <summary>Gets a task that's already been completed successfully.</summary> /// <remarks>May not always return the same instance.</remarks> public static Task CompletedTask { get { #if NET451 return _completedTask; #else return Task.CompletedTask; #endif } } } }
apache-2.0
C#
cb8aafa55db9664d1db384723757126a9aff7bef
declare GreaterThanZeroRuleTests public
ahanusa/facile.net,peasy/Peasy.NET,ahanusa/Peasy.NET
src/Peasy/Peasy.Tests/Rules/GreaterThanZeroRuleTests.cs
src/Peasy/Peasy.Tests/Rules/GreaterThanZeroRuleTests.cs
using Peasy.Rules; using Microsoft.VisualStudio.TestTools.UnitTesting; using Shouldly; namespace Peasy.Tests.Rules { [TestClass] public class GreaterThanZeroRuleTests { [TestMethod] public void Returns_True() { var greaterThanZeroRule = new GreaterThanZeroRule(1, "foo"); greaterThanZeroRule.Validate().IsValid.ShouldBe(true); } [TestMethod] public void Returns_False() { var greaterThanZeroRule = new GreaterThanZeroRule(0, "foo"); greaterThanZeroRule.Validate().IsValid.ShouldBe(false); } [TestMethod] public void Sets_ErrorMessage_On_Invalid() { var greaterThanZeroRule = new GreaterThanZeroRule(0, "the supplied value must be greater than 0"); greaterThanZeroRule.Validate().ErrorMessage.ShouldBe("the supplied value must be greater than 0"); } } }
using Peasy.Rules; using Microsoft.VisualStudio.TestTools.UnitTesting; using Shouldly; namespace Peasy.Tests.Rules { [TestClass] class GreaterThanZeroRuleTests { [TestMethod] public void Returns_True() { var greaterThanZeroRule = new GreaterThanZeroRule(1, "foo"); greaterThanZeroRule.Validate().IsValid.ShouldBe(true); } [TestMethod] public void Returns_False() { var greaterThanZeroRule = new GreaterThanZeroRule(0, "foo"); greaterThanZeroRule.Validate().IsValid.ShouldBe(false); } [TestMethod] public void Sets_ErrorMessage_On_Invalid() { var greaterThanZeroRule = new GreaterThanZeroRule(0, "the supplied value must be greater than 0"); greaterThanZeroRule.Validate().ErrorMessage.ShouldBe("the supplied value must be greater than 0"); } } }
mit
C#
5c97135eb5e62456be36e856f7311829719d0e99
update version info
estorski/langlay
Langlay.App/Properties/AssemblyInfo.cs
Langlay.App/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("Langlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Langlay")] [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("764b8166-cdce-4c65-bfdd-ddbbd4789870")] // 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.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Langlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Langlay")] [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("764b8166-cdce-4c65-bfdd-ddbbd4789870")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
bdf13d3fb1795e8593305247c3023fba717ccb87
Test Win8.1
przemekwa/LiczbyNaSlowaNET
LiczbyNaSlowaNET_Testy/ThreadSafety.cs
LiczbyNaSlowaNET_Testy/ThreadSafety.cs
using LiczbyNaSlowaNET; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace LiczbyNaSlowaNET_Testy { [TestClass] public class ThreadSafety { List<string> testResult = new List<string>(); [TestMethod] public void ThreadSafetyTest() { var taskList = new List<Task>(); var objectsToConvert = new List<int>(); objectsToConvert.AddRange(Enumerable.Range(1, 5000)); foreach (var list in objectsToConvert.SplitInToParts(5)) { taskList.Add(new Task(this.ConvewrtTask, list)); } taskList.ForEach(t => t.Start()); foreach (var t in taskList) { t.Wait(); } using (var sr = new StreamWriter(@"j:\LiczbyNaSlowaTesty.txt")) { testResult.ForEach(tr => sr.WriteLine(tr)); } foreach( var s in testResult.Where(s=>s != null)) { Assert.AreNotEqual(true, s.Length > 99, s); } } private void ConvewrtTask(object obj) { var list = obj as IEnumerable<int>; foreach (var beforeComma in list) { foreach (var afterComma in Enumerable.Range(0, 30)) { var decimalNumber = decimal.Parse(beforeComma + "," + afterComma); testResult.Add(string.Format("{0} -> {1}", decimalNumber, NumberToText.Convert(decimalNumber, Currency.PL))); } } } } }
using LiczbyNaSlowaNET; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace LiczbyNaSlowaNET_Testy { [TestClass] public class ThreadSafety { List<string> testResult = new List<string>(); [TestMethod] public void ThreadSafetyTest() { var taskList = new List<Task>(); var objectsToConvert = new List<int>(); objectsToConvert.AddRange(Enumerable.Range(1, 5000)); foreach (var list in objectsToConvert.SplitInToParts(5)) { taskList.Add(new Task(this.ConvewrtTask, list)); } taskList.ForEach(t => t.Start()); foreach (var t in taskList) { t.Wait(); } using (var sr = new StreamWriter(@"d:\LiczbyNaSlowaTesty.txt")) { testResult.ForEach(tr => sr.WriteLine(tr)); } foreach( var s in testResult.Where(s=>s != null)) { Assert.AreNotEqual(true, s.Length > 99, s); } } private void ConvewrtTask(object obj) { var list = obj as IEnumerable<int>; foreach (var beforeComma in list) { foreach (var afterComma in Enumerable.Range(0, 30)) { var decimalNumber = decimal.Parse(beforeComma + "," + afterComma); testResult.Add(string.Format("{0} -> {1}", decimalNumber, NumberToText.Convert(decimalNumber, Currency.PL))); } } } } }
mit
C#
8f3ecb6d08ffac0d58d6a5907e8db908fdeb64ca
Fix bug in timer
p-dahlback/ld-35
Assets/Scripts/_Game/GameOverlayManager.cs
Assets/Scripts/_Game/GameOverlayManager.cs
using UnityEngine; using System.Collections; using UnityEngine.UI; public class GameOverlayManager : MonoBehaviour { public DoubleEndedProgressController shapeShiftProgress; public Text timerText; public Text lifeText; public HeartBeat lifeHeart; public Text waveText; public GameObject fadeOverlay; // Use this for initialization void Start () { fadeOverlay.SetActive (true); } void Update () { float time = Time.timeSinceLevelLoad; UpdateTimer (time); } public void SetLife (int lives) { lifeText.text = lives.ToString (); Color color = lifeText.color; if (lives == 0) { color = Color.gray; color.a = 0.5f; MaskableGraphic graphic = lifeHeart.GetComponent<MaskableGraphic> (); graphic.color = Color.gray; lifeHeart.transform.localScale = Vector2.one; lifeHeart.enabled = false; } else { color.a = 1.0f; lifeHeart.beatTime = 0.5f * ((float)lives / GameController.GetInstance ().playerLives); } lifeText.color = color; } public void SetShapeShiftProgress (float progress) { shapeShiftProgress.SetProgress (1.0f - progress); } public void ShowWaveIndicator (int index) { waveText.text = "WAVE " + index; waveText.gameObject.SetActive (true); } public void ShowWaveEndedEarly () { } private void UpdateTimer (float seconds) { float hours = (int)seconds / 3600; float minutes = (int)seconds / 60; float secondsLeft = seconds - hours * 3600 - minutes * 60; if (hours == 0) { timerText.text = string.Format ("{0:00}:{1:00}", minutes, secondsLeft); } else { timerText.text = string.Format ("{0:00}:{1:00}:{2:00}", hours, minutes, secondsLeft); } } }
using UnityEngine; using System.Collections; using UnityEngine.UI; public class GameOverlayManager : MonoBehaviour { public DoubleEndedProgressController shapeShiftProgress; public Text timerText; public Text lifeText; public HeartBeat lifeHeart; public Text waveText; public GameObject fadeOverlay; // Use this for initialization void Start () { fadeOverlay.SetActive (true); } void Update () { float time = Time.timeSinceLevelLoad; UpdateTimer (time); } public void SetLife (int lives) { lifeText.text = lives.ToString (); Color color = lifeText.color; if (lives == 0) { color = Color.gray; color.a = 0.5f; MaskableGraphic graphic = lifeHeart.GetComponent<MaskableGraphic> (); graphic.color = Color.gray; lifeHeart.transform.localScale = Vector2.one; lifeHeart.enabled = false; } else { color.a = 1.0f; lifeHeart.beatTime = 0.5f * ((float)lives / GameController.GetInstance ().playerLives); } lifeText.color = color; } public void SetShapeShiftProgress (float progress) { shapeShiftProgress.SetProgress (1.0f - progress); } public void ShowWaveIndicator (int index) { waveText.text = "WAVE " + index; waveText.gameObject.SetActive (true); } public void ShowWaveEndedEarly () { } private void UpdateTimer (float seconds) { float hours = (int)seconds / 3600; float minutes = (int)seconds / 60; float secondsLeft = seconds - hours * 3600 + minutes * 60; if (hours == 0) { timerText.text = string.Format ("{0:00}:{1:00}", minutes, secondsLeft); } else { timerText.text = string.Format ("{0:00}:{1:00}:{2:00}", hours, minutes, secondsLeft); } } }
apache-2.0
C#
c46a0cb56c241628b4d986f2db24085b40918be2
add integrated if test
sdcb/sdmap
sdmap/test/sdmap.test/IfTest.cs
sdmap/test/sdmap.test/IfTest.cs
using sdmap.Compiler; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace sdmap.test.IntegratedTest { public class IfTest { [Fact] public void TrueWillEmit() { var code = "sql v1{#if(A){HelloWorld}}"; var rt = new SdmapCompiler(); rt.AddSourceCode(code); var result = rt.Emit("v1", new { A = true }); Assert.Equal("HelloWorld", result); } [Fact] public void FalseWontEmit() { var code = "sql v1{#if(A){HelloWorld}}"; var rt = new SdmapCompiler(); rt.AddSourceCode(code); var result = rt.Emit("v1", new { A = false }); Assert.Equal("", result); } [Theory] [InlineData(null, "== null", true)] [InlineData(null, "!= null", false)] [InlineData("nn", "== null", false)] [InlineData("nn", "!= null", true)] public void EqualNullTest(string aValue, string nullOperator, bool willEmit) { var code = $"sql v1{{#if(A {nullOperator}){{HelloWorld}}}}"; var rt = new SdmapCompiler(); rt.AddSourceCode(code); var result = rt.Emit("v1", new { A = aValue }); if (willEmit) { Assert.Equal("HelloWorld", result); } else { Assert.Equal("", result); } } [Fact] public void AllTest() { var code = "sql v1{#if(A && !(false || isEmpty(B))){Emit}}"; var rt = new SdmapCompiler(); rt.AddSourceCode(code); var result = rt.Emit("v1", new { A = true, B = new[] { 1, 2, 3 } }); Assert.Equal("Emit", result); } } }
using sdmap.Compiler; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace sdmap.test.IntegratedTest { public class IfTest { [Fact] public void TrueWillEmit() { var code = "sql v1{#if(A){HelloWorld}}"; var rt = new SdmapCompiler(); rt.AddSourceCode(code); var result = rt.Emit("v1", new { A = true }); Assert.Equal("HelloWorld", result); } [Fact] public void FalseWontEmit() { var code = "sql v1{#if(A){HelloWorld}}"; var rt = new SdmapCompiler(); rt.AddSourceCode(code); var result = rt.Emit("v1", new { A = false }); Assert.Equal("", result); } [Theory] [InlineData(null, "== null", true)] [InlineData(null, "!= null", false)] [InlineData("nn", "== null", false)] [InlineData("nn", "!= null", true)] public void EqualNullTest(string aValue, string nullOperator, bool willEmit) { var code = $"sql v1{{#if(A {nullOperator}){{HelloWorld}}}}"; var rt = new SdmapCompiler(); rt.AddSourceCode(code); var result = rt.Emit("v1", new { A = aValue }); if (willEmit) { Assert.Equal("HelloWorld", result); } else { Assert.Equal("", result); } } } }
mit
C#
47d081a8ab1bba9c4af9b746b17ee17a79dd13fa
Remove check for either next or previous page, since the table might be empty.
nozzlegear/ShopifySharp,clement911/ShopifySharp
ShopifySharp/Lists/LinkHeaderParser.cs
ShopifySharp/Lists/LinkHeaderParser.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace ShopifySharp.Lists { public static class LinkHeaderParser { private static Regex _regexPrevLink = new Regex(@"<(https://[^>]*)>\s*;\s*rel=""previous""", RegexOptions.Compiled | RegexOptions.CultureInvariant); private static Regex _regexNextLink = new Regex(@"<(https://[^>]*)>\s*;\s*rel=""next""", RegexOptions.Compiled | RegexOptions.CultureInvariant); public static LinkHeaderParseResult Parse(string linkHeaderValue) { var prevLink = GetPageInfoParam(linkHeaderValue, _regexPrevLink); var nextLink = GetPageInfoParam(linkHeaderValue, _regexNextLink); return new LinkHeaderParseResult(prevLink, nextLink); } private static LinkHeaderParseResult.PagingLink GetPageInfoParam(string linkHeaderValue, Regex linkRegex) { var match = linkRegex.Match(linkHeaderValue); if (!match.Success || match.Groups.Count < 2 || !match.Groups[1].Success) return null; string matchedUrl = match.Groups[1].Value; if (!Uri.TryCreate(matchedUrl, UriKind.Absolute, out var uri)) throw new ShopifyException($"Cannot parse page link url: '{matchedUrl}'"); string pageInfo = uri.Query.Split('?', '&') .FirstOrDefault(p => p.StartsWith("page_info=")) ?.Substring("page_info=".Length); if (pageInfo == null) throw new ShopifyException($"Cannot parse page link's page info parameter: '{matchedUrl}'"); return new LinkHeaderParseResult.PagingLink(matchedUrl, pageInfo); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace ShopifySharp.Lists { public static class LinkHeaderParser { private static Regex _regexPrevLink = new Regex(@"<(https://[^>]*)>\s*;\s*rel=""previous""", RegexOptions.Compiled | RegexOptions.CultureInvariant); private static Regex _regexNextLink = new Regex(@"<(https://[^>]*)>\s*;\s*rel=""next""", RegexOptions.Compiled | RegexOptions.CultureInvariant); public static LinkHeaderParseResult Parse(string linkHeaderValue) { var prevLink = GetPageInfoParam(linkHeaderValue, _regexPrevLink); var nextLink = GetPageInfoParam(linkHeaderValue, _regexNextLink); if (prevLink == null && nextLink == null) throw new ShopifyException($"Found neither a 'previous' or 'next' url in the link header: '{linkHeaderValue}'"); return new LinkHeaderParseResult(prevLink, nextLink); } private static LinkHeaderParseResult.PagingLink GetPageInfoParam(string linkHeaderValue, Regex linkRegex) { var match = linkRegex.Match(linkHeaderValue); if (!match.Success || match.Groups.Count < 2 || !match.Groups[1].Success) return null; string matchedUrl = match.Groups[1].Value; if (!Uri.TryCreate(matchedUrl, UriKind.Absolute, out var uri)) throw new ShopifyException($"Cannot parse page link url: '{matchedUrl}'"); string pageInfo = uri.Query.Split('?', '&') .FirstOrDefault(p => p.StartsWith("page_info=")) ?.Substring("page_info=".Length); if (pageInfo == null) throw new ShopifyException($"Cannot parse page link's page info parameter: '{matchedUrl}'"); return new LinkHeaderParseResult.PagingLink(matchedUrl, pageInfo); } } }
mit
C#
6c645b8c868686fffb86576bf0c0f2b666aa8df3
Remove not implemented query option for now
dnauck/License.Manager,dnauck/License.Manager
src/License.Manager.Core/ServiceModel/GetLicense.cs
src/License.Manager.Core/ServiceModel/GetLicense.cs
// // Copyright © 2012 - 2013 Nauck IT KG http://www.nauck-it.de // // Author: // Daniel Nauck <d.nauck(at)nauck-it.de> // // 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 ServiceStack.ServiceHost; namespace License.Manager.Core.ServiceModel { [Route("/licenses/{Id}", "GET, OPTIONS")] //[Route("/licenses/{LicenseId}", "GET, OPTIONS")] [Route("/products/{ProductId}/licenses/{Id}", "GET, OPTIONS")] //[Route("/products/{ProductId}/licenses/{LicenseId}", "GET, OPTIONS")] [Route("/customers/{CustomerId}/licenses/{Id}", "GET, OPTIONS")] //[Route("/customers/{CustomerId}/licenses/{LicenseId}", "GET, OPTIONS")] public class GetLicense : IReturn<LicenseDto> { public int Id { get; set; } //public Guid LicenseId { get; set; } public int CustomerId { get; set; } public int ProductId { get; set; } } }
// // Copyright © 2012 - 2013 Nauck IT KG http://www.nauck-it.de // // Author: // Daniel Nauck <d.nauck(at)nauck-it.de> // // 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 ServiceStack.ServiceHost; namespace License.Manager.Core.ServiceModel { [Route("/licenses/{Id}", "GET, OPTIONS")] [Route("/licenses/{LicenseId}", "GET, OPTIONS")] [Route("/products/{ProductId}/licenses/{Id}", "GET, OPTIONS")] [Route("/products/{ProductId}/licenses/{LicenseId}", "GET, OPTIONS")] [Route("/customers/{CustomerId}/licenses/{Id}", "GET, OPTIONS")] [Route("/customers/{CustomerId}/licenses/{LicenseId}", "GET, OPTIONS")] public class GetLicense : IReturn<LicenseDto> { public int Id { get; set; } public Guid LicenseId { get; set; } public int CustomerId { get; set; } public int ProductId { get; set; } } }
mit
C#
c8cda2ffb6c50d6430dfd2fbae2a39cb20d7da91
Fix NH-1644 by Alexandre Payment
alobakov/nhibernate-core,RogerKratz/nhibernate-core,alobakov/nhibernate-core,RogerKratz/nhibernate-core,RogerKratz/nhibernate-core,hazzik/nhibernate-core,ngbrown/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,livioc/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,hazzik/nhibernate-core,fredericDelaporte/nhibernate-core,ManufacturingIntelligence/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,lnu/nhibernate-core,nkreipke/nhibernate-core,livioc/nhibernate-core,ngbrown/nhibernate-core,gliljas/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,livioc/nhibernate-core,nkreipke/nhibernate-core,lnu/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,lnu/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core
src/NHibernate/Driver/OracleLiteDataClientDriver.cs
src/NHibernate/Driver/OracleLiteDataClientDriver.cs
using System.Data; using NHibernate.AdoNet; using NHibernate.SqlTypes; namespace NHibernate.Driver { /// <summary> /// A NHibernate Driver for using the Oracle.DataAccess.Lite DataProvider /// </summary> public class OracleLiteDataClientDriver : ReflectionBasedDriver, IEmbeddedBatcherFactoryProvider { /// <summary> /// Initializes a new instance of <see cref="OracleLiteDataClientDriver"/>. /// </summary> /// <exception cref="HibernateException"> /// Thrown when the <c>Oracle.DataAccess.Lite_w32</c> assembly can not be loaded. /// </exception> public OracleLiteDataClientDriver() : base( "Oracle.DataAccess.Lite_w32", "Oracle.DataAccess.Lite.OracleConnection", "Oracle.DataAccess.Lite.OracleCommand") { } public override bool UseNamedPrefixInSql { get { return false; } } public override bool UseNamedPrefixInParameter { get { return false; } } public override string NamedPrefix { get { return string.Empty; } } /// <remarks> /// This adds logic to ensure that a DbType.Boolean parameter is not created since /// ODP.NET doesn't support it. /// </remarks> protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType) { // if the parameter coming in contains a boolean then we need to convert it // to another type since ODP.NET doesn't support DbType.Boolean if (sqlType.DbType == DbType.Boolean) { sqlType = SqlTypeFactory.Int16; } base.InitializeParameter(dbParam, name, sqlType); } #region IEmbeddedBatcherFactoryProvider Members System.Type IEmbeddedBatcherFactoryProvider.BatcherFactoryClass { get { return typeof(OracleDataClientBatchingBatcherFactory); } } #endregion } }
using System.Data; using NHibernate.AdoNet; using NHibernate.SqlTypes; namespace NHibernate.Driver { /// <summary> /// A NHibernate Driver for using the Oracle.DataAccess.Lite DataProvider /// </summary> public class OracleLiteDataClientDriver : ReflectionBasedDriver, IEmbeddedBatcherFactoryProvider { /// <summary> /// Initializes a new instance of <see cref="OracleLiteDataClientDriver"/>. /// </summary> /// <exception cref="HibernateException"> /// Thrown when the <c>Oracle.DataAccess.Lite_w32</c> assembly can not be loaded. /// </exception> public OracleLiteDataClientDriver() : base( "Oracle.DataAccess.Lite_w32", "Oracle.DataAccess.Lite.OracleConnection", "Oracle.DataAccess.Lite.OracleCommand") { } /// <summary></summary> public override bool UseNamedPrefixInSql { get { return true; } } /// <summary></summary> public override bool UseNamedPrefixInParameter { get { return true; } } /// <summary></summary> public override string NamedPrefix { get { return ":"; } } /// <remarks> /// This adds logic to ensure that a DbType.Boolean parameter is not created since /// ODP.NET doesn't support it. /// </remarks> protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType) { // if the parameter coming in contains a boolean then we need to convert it // to another type since ODP.NET doesn't support DbType.Boolean if (sqlType.DbType == DbType.Boolean) { sqlType = SqlTypeFactory.Int16; } base.InitializeParameter(dbParam, name, sqlType); } #region IEmbeddedBatcherFactoryProvider Members System.Type IEmbeddedBatcherFactoryProvider.BatcherFactoryClass { get { return typeof (OracleDataClientBatchingBatcherFactory); } } #endregion } }
lgpl-2.1
C#
3a238a246d69e72c2bb3f5fe3e56d586c94127ce
Fix order of views
ajbeaven/postal,vip32/postal,Lybecker/postal,andrewdavey/postal,andrewdavey/postal,hermanho/postal
src/Samples/WebSample/Views/Emails/MultiPart.cshtml
src/Samples/WebSample/Views/Emails/MultiPart.cshtml
To: test@example.org From: test@example.org Subject: Multi-part email example Views: Text,Html
To: test@example.org From: test@example.org Subject: Multi-part email example Views: Html,Text
mit
C#
328b1e0d0888df7ec944c4d706a246c3ae8bddfd
improve shouldly helpers
joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net
JoinRpg.Web.Test/ShouldlyFieldValueViewModelExtensions.cs
JoinRpg.Web.Test/ShouldlyFieldValueViewModelExtensions.cs
using System.Diagnostics; using JoinRpg.Web.Models; using Shouldly; namespace JoinRpg.Web.Test { internal static class ShouldlyFieldValueViewModelExtensions { //Attributes in this class will cause debugger to stop on exception in caller of that method //and thats probably what we like to see [DebuggerStepThrough] public static void ShouldNotHaveValue(this FieldValueViewModel field) => field.Value.ShouldBeNull(); [DebuggerStepThrough] public static void ShouldBeEditable(this FieldValueViewModel field) => field.CanEdit.ShouldBeTrue(); [DebuggerStepThrough] public static void ShouldBeHidden(this FieldValueViewModel field) => field.CanView.ShouldBeFalse(); [DebuggerStepThrough] public static void ShouldBeReadonly(this FieldValueViewModel field) => field.CanEdit.ShouldBeFalse(); [DebuggerStepThrough] public static void ShouldBeVisible(this FieldValueViewModel field) => field.CanView.ShouldBeTrue(); } }
using JoinRpg.Web.Models; using Shouldly; namespace JoinRpg.Web.Test { internal static class ShouldlyFieldValueViewModelExtensions { public static void ShouldNotHaveValue(this FieldValueViewModel field) => field.Value.ShouldBeNull(); public static void ShouldBeEditable(this FieldValueViewModel field) => field.CanEdit.ShouldBeTrue(); public static void ShouldBeHidden(this FieldValueViewModel field) => field.CanView.ShouldBeFalse(); public static void ShouldBeReadonly(this FieldValueViewModel field) => field.CanEdit.ShouldBeFalse(); public static void ShouldBeVisible(this FieldValueViewModel field) => field.CanView.ShouldBeTrue(); } }
mit
C#
f5c45d15ca419ca3c424d79dd8c55a8a61885af2
Fix code anlyzer issues
paiden/Nett
Source/Nett/Properties/AssemblyInfo.cs
Source/Nett/Properties/AssemblyInfo.cs
using System; using System.Resources; using System.Runtime.CompilerServices; [assembly: NeutralResourcesLanguage("en")] [assembly: CLSCompliant(true)] [assembly: InternalsVisibleTo("Nett.Tests.Internal")] [assembly: InternalsVisibleTo("Nett.Coma.Tests.Internal")] [assembly: InternalsVisibleTo("Nett.Coma")] [assembly: InternalsVisibleTo("Nett.Tests.Performance")] [assembly: InternalsVisibleTo("Nett.AspNet")]
using System; using System.Resources; using System.Runtime.CompilerServices; // 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: 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: CLSCompliant(true)] [assembly: InternalsVisibleTo("Nett.Tests.Internal")] [assembly: InternalsVisibleTo("Nett.Coma.Tests.Internal")] [assembly: InternalsVisibleTo("Nett.Coma")] [assembly: InternalsVisibleTo("Nett.Tests.Performance")] [assembly: InternalsVisibleTo("Nett.AspNet")]
mit
C#
70bf2a3169204fcf4d94010bb9d6f8af94708cf0
Fix Test 1057
ronnyek/linq2db,linq2db/linq2db,MaceWindu/linq2db,linq2db/linq2db,LinqToDB4iSeries/linq2db,LinqToDB4iSeries/linq2db,MaceWindu/linq2db
Tests/Linq/UserTests/Issue1057Tests.cs
Tests/Linq/UserTests/Issue1057Tests.cs
using System; using System.Linq; using System.Collections.Generic; using System.Linq.Expressions; using LinqToDB; using LinqToDB.Data; using LinqToDB.Mapping; using NUnit.Framework; namespace Tests.UserTests { [ActiveIssue(1057)] public class Issue1057Tests : TestBase { [Table, InheritanceMapping(Code = "bda.Requests", Type = typeof(BdaTask))] class Task { [Column(IsPrimaryKey = true)] public int Id { get; set; } [Column(IsDiscriminator = true)] public string TargetName { get; set; } [Association(ExpressionPredicate = nameof(ActualStageExp))] public TaskStage ActualStage { get; set; } private static Expression<Func<Task, TaskStage, bool>> ActualStageExp() => (t, ts) => t.Id == ts.TaskId && ts.Actual == true; } class BdaTask : Task { public const string Code = "bda.Requests"; } [Table] class TaskStage { [Column(IsPrimaryKey = true)] public int Id { get; set; } [Column] public int TaskId { get; set; } [Column] public bool Actual { get; set; } } [Test] public void Test() { DataConnection.AddConfiguration("Test1057Config", "Data Source=:memory:", new LinqToDB.DataProvider.SQLite.SQLiteDataProvider()); var db = new DataConnection("Test1057Config"); db.CreateTable<Task>(); db.CreateTable<TaskStage>(); db.Insert(new Task { Id = 1, TargetName = "bda.Requests" }); db.Insert(new TaskStage { Id = 1, TaskId = 1, Actual = true }); var query = db.GetTable<Task>() .OfType<BdaTask>() .Select(p => new { Instance = (Task)p, //without cast throw other exception ActualStageId = (p as Task).ActualStage.Id }); var res = query.ToArray(); //this call throw exception } } }
using System; using System.Linq; using System.Collections.Generic; using System.Linq.Expressions; using LinqToDB; using LinqToDB.Data; using LinqToDB.Mapping; using NUnit.Framework; namespace Tests.UserTests { [ActiveIssue(1057)] public class Issue1057Tests : TestBase { [Table, InheritanceMapping(Code = "bda.Requests", Type = typeof(BdaTask))] class Task { [Column(IsPrimaryKey = true)] public int Id { get; set; } [Column(IsDiscriminator = true)] public string TargetName { get; set; } [Association(ExpressionPredicate = nameof(ActualStageExp))] public TaskStage ActualStage { get; set; } private static Expression<Func<Task, TaskStage, bool>> ActualStageExp() => (t, ts) => t.Id == ts.TaskId && ts.Actual == true; } class BdaTask : Task { public const string Code = "bda.Requests"; } [Table] class TaskStage { [Column(IsPrimaryKey = true)] public int Id { get; set; } [Column] public int TaskId { get; set; } [Column] public bool Actual { get; set; } } [Test] public void Test() { DataConnection.AddConfiguration("default", "Data Source=:memory:", new LinqToDB.DataProvider.SQLite.SQLiteDataProvider()); DataConnection.DefaultConfiguration = "default"; var db = new DataConnection(); db.CreateTable<Task>(); db.CreateTable<TaskStage>(); db.Insert(new Task { Id = 1, TargetName = "bda.Requests" }); db.Insert(new TaskStage { Id = 1, TaskId = 1, Actual = true }); var query = db.GetTable<Task>() .OfType<BdaTask>() .Select(p => new { Instance = (Task)p, //without cast throw other exception ActualStageId = (p as Task).ActualStage.Id }); var res = query.ToArray(); //this call throw exception } } }
mit
C#
bed4e9d2b376259ffc53caca488117c263a0a846
use public name instead of reflected property name
Research-Institute/json-api-dotnet-core,json-api-dotnet/JsonApiDotNetCore,Research-Institute/json-api-dotnet-core
test/OperationsExampleTests/Get/GetRelationshipTests.cs
test/OperationsExampleTests/Get/GetRelationshipTests.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Threading.Tasks; using Bogus; using JsonApiDotNetCore.Models.Operations; using JsonApiDotNetCoreExample.Data; using OperationsExampleTests.Factories; using Xunit; namespace OperationsExampleTests { public class GetRelationshipTests : Fixture, IDisposable { private readonly Faker _faker = new Faker(); [Fact] public async Task Can_Get_Article_Author() { // arrange var context = GetService<AppDbContext>(); var author = AuthorFactory.Get(); var article = ArticleFactory.Get(); article.Author = author; context.Articles.Add(article); context.SaveChanges(); var content = new { operations = new[] { new Dictionary<string, object> { { "op", "get"}, { "ref", new { type = "articles", id = article.StringId, relationship = "author" } } } } }; // act var (response, data) = await PatchAsync<OperationsDocument>("api/bulk", content); // assert Assert.NotNull(response); Assert.NotNull(data); Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Single(data.Operations); var resourceObject = data.Operations.Single().DataObject; Assert.Equal(author.Id.ToString(), resourceObject.Id); Assert.Equal("authors", resourceObject.Type); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Threading.Tasks; using Bogus; using JsonApiDotNetCore.Models.Operations; using JsonApiDotNetCoreExample.Data; using OperationsExampleTests.Factories; using Xunit; namespace OperationsExampleTests { public class GetRelationshipTests : Fixture, IDisposable { private readonly Faker _faker = new Faker(); [Fact] public async Task Can_Get_Article_Author() { // arrange var context = GetService<AppDbContext>(); var author = AuthorFactory.Get(); var article = ArticleFactory.Get(); article.Author = author; context.Articles.Add(article); context.SaveChanges(); var content = new { operations = new[] { new Dictionary<string, object> { { "op", "get"}, { "ref", new { type = "articles", id = article.StringId, relationship = nameof(article.Author) } } } } }; // act var (response, data) = await PatchAsync<OperationsDocument>("api/bulk", content); // assert Assert.NotNull(response); Assert.NotNull(data); Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Single(data.Operations); var resourceObject = data.Operations.Single().DataObject; Assert.Equal(author.Id.ToString(), resourceObject.Id); Assert.Equal("authors", resourceObject.Type); } } }
mit
C#
0b6a3ae2baa144c5bd726ec047a6365d709a4f2f
Sort usings.
MavenRain/kudu,chrisrpatterson/kudu,sitereactor/kudu,shibayan/kudu,dev-enthusiast/kudu,barnyp/kudu,dev-enthusiast/kudu,projectkudu/kudu,dev-enthusiast/kudu,uQr/kudu,oliver-feng/kudu,bbauya/kudu,uQr/kudu,juvchan/kudu,duncansmart/kudu,barnyp/kudu,shrimpy/kudu,shanselman/kudu,sitereactor/kudu,chrisrpatterson/kudu,shibayan/kudu,WeAreMammoth/kudu-obsolete,juoni/kudu,bbauya/kudu,badescuga/kudu,shrimpy/kudu,bbauya/kudu,dev-enthusiast/kudu,juvchan/kudu,kali786516/kudu,shibayan/kudu,WeAreMammoth/kudu-obsolete,EricSten-MSFT/kudu,juoni/kudu,shibayan/kudu,mauricionr/kudu,badescuga/kudu,kali786516/kudu,mauricionr/kudu,barnyp/kudu,duncansmart/kudu,juvchan/kudu,WeAreMammoth/kudu-obsolete,EricSten-MSFT/kudu,badescuga/kudu,EricSten-MSFT/kudu,oliver-feng/kudu,chrisrpatterson/kudu,puneet-gupta/kudu,projectkudu/kudu,juvchan/kudu,YOTOV-LIMITED/kudu,kenegozi/kudu,badescuga/kudu,badescuga/kudu,projectkudu/kudu,sitereactor/kudu,juoni/kudu,YOTOV-LIMITED/kudu,projectkudu/kudu,oliver-feng/kudu,kenegozi/kudu,oliver-feng/kudu,duncansmart/kudu,projectkudu/kudu,uQr/kudu,EricSten-MSFT/kudu,shrimpy/kudu,YOTOV-LIMITED/kudu,kenegozi/kudu,EricSten-MSFT/kudu,shibayan/kudu,shanselman/kudu,sitereactor/kudu,puneet-gupta/kudu,puneet-gupta/kudu,shrimpy/kudu,puneet-gupta/kudu,sitereactor/kudu,chrisrpatterson/kudu,MavenRain/kudu,mauricionr/kudu,juvchan/kudu,YOTOV-LIMITED/kudu,mauricionr/kudu,kali786516/kudu,barnyp/kudu,kali786516/kudu,duncansmart/kudu,shanselman/kudu,juoni/kudu,bbauya/kudu,MavenRain/kudu,uQr/kudu,puneet-gupta/kudu,MavenRain/kudu,kenegozi/kudu
Kudu.Services.Web/App_Start/NinjectMVC3.cs
Kudu.Services.Web/App_Start/NinjectMVC3.cs
[assembly: WebActivator.PreApplicationStartMethod(typeof(Kudu.Services.Web.App_Start.NinjectMVC3), "Start")] [assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof(Kudu.Services.Web.App_Start.NinjectMVC3), "Stop")] namespace Kudu.Services.Web.App_Start { using Kudu.Core.Editor; using Kudu.Core.SourceControl; using Microsoft.Web.Infrastructure.DynamicModuleHelper; using Ninject; using Ninject.Web.Mvc; public static class NinjectMVC3 { private static readonly Bootstrapper bootstrapper = new Bootstrapper(); /// <summary> /// Starts the application /// </summary> public static void Start() { DynamicModuleUtility.RegisterModule(typeof(OnePerRequestModule)); DynamicModuleUtility.RegisterModule(typeof(HttpApplicationInitializationModule)); bootstrapper.Initialize(CreateKernel); } /// <summary> /// Stops the application. /// </summary> public static void Stop() { bootstrapper.ShutDown(); } /// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static IKernel CreateKernel() { var kernel = new StandardKernel(); RegisterServices(kernel); return kernel; } /// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<ILocationProvider>().To<LocationProvider>(); kernel.Bind<IFileSystem>().To<ServiceFileSystem>(); kernel.Bind<IRepository>().To<ServiceRepository>(); } } }
[assembly: WebActivator.PreApplicationStartMethod(typeof(Kudu.Services.Web.App_Start.NinjectMVC3), "Start")] [assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof(Kudu.Services.Web.App_Start.NinjectMVC3), "Stop")] namespace Kudu.Services.Web.App_Start { using System.Reflection; using Microsoft.Web.Infrastructure.DynamicModuleHelper; using Ninject; using Ninject.Web.Mvc; using Kudu.Core.Editor; using Kudu.Core.SourceControl; public static class NinjectMVC3 { private static readonly Bootstrapper bootstrapper = new Bootstrapper(); /// <summary> /// Starts the application /// </summary> public static void Start() { DynamicModuleUtility.RegisterModule(typeof(OnePerRequestModule)); DynamicModuleUtility.RegisterModule(typeof(HttpApplicationInitializationModule)); bootstrapper.Initialize(CreateKernel); } /// <summary> /// Stops the application. /// </summary> public static void Stop() { bootstrapper.ShutDown(); } /// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static IKernel CreateKernel() { var kernel = new StandardKernel(); RegisterServices(kernel); return kernel; } /// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { kernel.Bind<ILocationProvider>().To<LocationProvider>(); kernel.Bind<IFileSystem>().To<ServiceFileSystem>(); kernel.Bind<IRepository>().To<ServiceRepository>(); } } }
apache-2.0
C#
5a5d6d6de533260392ee3f6573fc37ac9a301018
Update the application %appdata% folder
xavierfoucrier/gmail-notifier,xavierfoucrier/gmail-notifier
code/Core.cs
code/Core.cs
using System; using System.Diagnostics; using System.IO; using System.Windows.Forms; using notifier.Properties; namespace notifier { static class Core { #region #attributes #endregion #region #methods /// <summary> /// Class constructor /// </summary> static Core() { // initialize the application version number, based on scheme Semantic Versioning - https://semver.org string[] ProductVersion = Application.ProductVersion.Split('.'); string VersionMajor = ProductVersion[0]; string VersionMinor = ProductVersion[1]; string VersionPatch = ProductVersion[2]; Version = "v" + VersionMajor + "." + VersionMinor + "." + VersionPatch; } /// <summary> /// Restart the application /// </summary> public static void RestartApplication() { // start a new process Process.Start(new ProcessStartInfo("cmd.exe", "/C ping 127.0.0.1 -n 2 && \"" + Application.ExecutablePath + "\"") { WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true }); // exit the application Application.Exit(); } /// <summary> /// Log a message to the application log file /// </summary> /// <param name="message">Message to log</param> public static void Log(string message) { using (StreamWriter writer = new StreamWriter(ApplicationDataFolder + "/" + Settings.Default.LOG_FILE, true)) { writer.Write(DateTime.Now + " - " + message + Environment.NewLine); } } #endregion #region #accessors /// <summary> /// Local application data folder name /// </summary> public static string ApplicationDataFolder { get; } = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/Inbox Notifier"; /// <summary> /// Full application version number /// </summary> public static string Version { get; } = ""; #endregion } }
using System; using System.Diagnostics; using System.IO; using System.Windows.Forms; using notifier.Properties; namespace notifier { static class Core { #region #attributes #endregion #region #methods /// <summary> /// Class constructor /// </summary> static Core() { // initialize the application version number, based on scheme Semantic Versioning - https://semver.org string[] ProductVersion = Application.ProductVersion.Split('.'); string VersionMajor = ProductVersion[0]; string VersionMinor = ProductVersion[1]; string VersionPatch = ProductVersion[2]; Version = "v" + VersionMajor + "." + VersionMinor + "." + VersionPatch; } /// <summary> /// Restart the application /// </summary> public static void RestartApplication() { // start a new process Process.Start(new ProcessStartInfo("cmd.exe", "/C ping 127.0.0.1 -n 2 && \"" + Application.ExecutablePath + "\"") { WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true }); // exit the application Application.Exit(); } /// <summary> /// Log a message to the application log file /// </summary> /// <param name="message">Message to log</param> public static void Log(string message) { using (StreamWriter writer = new StreamWriter(ApplicationDataFolder + "/" + Settings.Default.LOG_FILE, true)) { writer.Write(DateTime.Now + " - " + message + Environment.NewLine); } } #endregion #region #accessors /// <summary> /// Local application data folder name /// </summary> public static string ApplicationDataFolder { get; } = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/Gmail Notifier"; /// <summary> /// Full application version number /// </summary> public static string Version { get; } = ""; #endregion } }
mit
C#
1891e81539749e86fc25f49644be7996918e9827
change todo format :)
jamesology/PackingHelper
PackingHelper/PackingHelper.Cli/Program.cs
PackingHelper/PackingHelper.Cli/Program.cs
using System; using System.IO; using log4net; using log4net.Config; namespace PackingHelper.Cli { class Program { static void Main(string[] args) { XmlConfigurator.Configure(new FileInfo("PackingHelper.Cli.log4net.config")); var log = LogManager.GetLogger("main"); try { if (args.Length > 0) { var settingsFile = args[0]; log.DebugFormat("Settings File: {0}", settingsFile); var configuration = new Configuration(); if (File.Exists(settingsFile)) { log.Debug("File Found."); configuration = Configurator.Read(settingsFile, log); } else { log.Debug("File Not Found."); } if (Directory.Exists(configuration.TaskTemplates)) { log.Warn("TODO: Get User Entries"); log.Debug("Loading Task Templates."); //process task sets } log.Warn("TODO: Write task file"); } else { log.Warn("No settings file provided. Unable to proceed."); } } catch(Exception exception) { log.Error("Oh Snap!", exception); } Console.Write("Press Enter to exit."); Console.ReadLine(); } } }
using System; using System.IO; using log4net; using log4net.Config; namespace PackingHelper.Cli { class Program { static void Main(string[] args) { XmlConfigurator.Configure(new FileInfo("PackingHelper.Cli.log4net.config")); var log = LogManager.GetLogger("main"); try { if (args.Length > 0) { var settingsFile = args[0]; log.DebugFormat("Settings File: {0}", settingsFile); var configuration = new Configuration(); if (File.Exists(settingsFile)) { log.Debug("File Found."); configuration = Configurator.Read(settingsFile, log); } else { log.Debug("File Not Found."); } if (Directory.Exists(configuration.TaskTemplates)) { log.Debug("Loading Task Templates."); //process task sets } //write task file } else { log.Warn("No settings file provided. Unable to proceed."); } } catch(Exception exception) { log.Error("Oh Snap!", exception); } Console.Write("Press Enter to exit."); Console.ReadLine(); } } }
mit
C#