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
a9f9b0406355cd851e7ec0875cbfd53ddcf82a23
Remove the beta tag
who/RestSharp,jiangzm/RestSharp,benfo/RestSharp,amccarter/RestSharp,huoxudong125/RestSharp,wparad/RestSharp,kouweizhong/RestSharp,felipegtx/RestSharp,rucila/RestSharp,mattwalden/RestSharp,chengxiaole/RestSharp,fmmendo/RestSharp,dmgandini/RestSharp,mwereda/RestSharp,cnascimento/RestSharp,PKRoma/RestSharp,uQr/RestSharp,KraigM/RestSharp,rivy/RestSharp,restsharp/RestSharp,eamonwoortman/RestSharp.Unity,periface/RestSharp,haithemaraissia/RestSharp,SaltyDH/RestSharp,dgreenbean/RestSharp,lydonchandra/RestSharp,wparad/RestSharp,dyh333/RestSharp,RestSharp-resurrected/RestSharp,mattleibow/RestSharp
RestSharp/SharedAssemblyInfo.cs
RestSharp/SharedAssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System; // 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: AssemblyDescription("Simple REST and HTTP API Client")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("John Sheehan, RestSharp Community")] [assembly: AssemblyProduct("RestSharp")] [assembly: AssemblyCopyright("Copyright © RestSharp Project 2009-2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(true)] // 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(SharedAssembylInfo.Version + ".0")] [assembly: AssemblyInformationalVersion(SharedAssembylInfo.Version)] [assembly: AssemblyFileVersion(SharedAssembylInfo.Version + ".0")] class SharedAssembylInfo { public const string Version = "104.2.0"; }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System; // 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: AssemblyDescription("Simple REST and HTTP API Client")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("John Sheehan, RestSharp Community")] [assembly: AssemblyProduct("RestSharp")] [assembly: AssemblyCopyright("Copyright © RestSharp Project 2009-2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(true)] // 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(SharedAssembylInfo.Version + ".0")] [assembly: AssemblyInformationalVersion(SharedAssembylInfo.Version + "-beta")] [assembly: AssemblyFileVersion(SharedAssembylInfo.Version + ".0")] class SharedAssembylInfo { public const string Version = "104.2.0"; }
apache-2.0
C#
967c658b5d023b72ef74de8c1724e875068f4891
Revert "Use a PrivateAdditionalLibrary for czmq.lib instead of a public one"
DeltaMMO/ue4czmq,DeltaMMO/ue4czmq
Source/ue4czmq/ue4czmq.Build.cs
Source/ue4czmq/ue4czmq.Build.cs
// Copyright 2015 Palm Stone Games, Inc. All Rights Reserved. using System.IO; namespace UnrealBuildTool.Rules { public class ue4czmq : ModuleRules { public ue4czmq(TargetInfo Target) { // Include paths //PublicIncludePaths.AddRange(new string[] {}); //PrivateIncludePaths.AddRange(new string[] {}); // Dependencies PublicDependencyModuleNames.AddRange(new string[] { "Core", "Engine", }); //PrivateDependencyModuleNames.AddRange(new string[] {}); // Dynamically loaded modules //DynamicallyLoadedModuleNames.AddRange(new string[] {}); // Definitions Definitions.Add("WITH_UE4CZMQ=1"); LoadLib(Target); } public void LoadLib(TargetInfo Target) { string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); // CZMQ string czmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "czmq")); PublicAdditionalLibraries.Add(Path.Combine(czmqPath, "Libraries", "czmq.lib")); PrivateIncludePaths.Add(Path.Combine(czmqPath, "Includes")); // LIBZMQ string libzmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "libzmq")); PrivateIncludePaths.Add(Path.Combine(libzmqPath, "Includes")); } } }
// Copyright 2015 Palm Stone Games, Inc. All Rights Reserved. using System.IO; namespace UnrealBuildTool.Rules { public class ue4czmq : ModuleRules { public ue4czmq(TargetInfo Target) { // Include paths //PublicIncludePaths.AddRange(new string[] {}); //PrivateIncludePaths.AddRange(new string[] {}); // Dependencies PublicDependencyModuleNames.AddRange(new string[] { "Core", "Engine", }); //PrivateDependencyModuleNames.AddRange(new string[] {}); // Dynamically loaded modules //DynamicallyLoadedModuleNames.AddRange(new string[] {}); // Definitions Definitions.Add("WITH_UE4CZMQ=1"); LoadLib(Target); } public void LoadLib(TargetInfo Target) { string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); // CZMQ string czmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "czmq")); PrivateAdditionalLibraries.Add(Path.Combine(czmqPath, "Libraries", "czmq.lib")); PrivateIncludePaths.Add(Path.Combine(czmqPath, "Includes")); // LIBZMQ string libzmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "libzmq")); PrivateIncludePaths.Add(Path.Combine(libzmqPath, "Includes")); } } }
apache-2.0
C#
168fe28aec0c3b76e00722cd017f2ca4a18f4fb4
Make soldier a dropdown list
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Views/APFT/Edit.cshtml
Battery-Commander.Web/Views/APFT/Edit.cshtml
@model APFT @using (Html.BeginForm("Edit", "APFT", FormMethod.Post, new { @class = "form-horizontal" role = "form" })) { @Html.AntiForgeryToken() @Html.HiddenFor(model => model.Id) @Html.ValidationSummary() <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Soldier) @Html.DropDownListFor(model => model.SoldierId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --") </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Date) @Html.EditorFor(model => model.Date) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.PushUps) @Html.EditorFor(model => model.PushUps) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.SitUps) @Html.EditorFor(model => model.SitUps) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Run) @Html.EditorFor(model => model.Run) </div> <button type="submit">Save</button> }
@model APFT @using (Html.BeginForm("Edit", "APFT", FormMethod.Post, new { @class = "form-horizontal" role = "form" })) { @Html.AntiForgeryToken() @Html.HiddenFor(model => model.Id) @Html.ValidationSummary() <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Soldier) @Html.EditorFor(model => model.SoldierId) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Date) @Html.EditorFor(model => model.Date) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.PushUps) @Html.EditorFor(model => model.PushUps) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.SitUps) @Html.EditorFor(model => model.SitUps) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Run) @Html.EditorFor(model => model.Run) </div> <button type="submit">Save</button> }
mit
C#
4756056234f799b67f7b2f8404f07c14551e2243
Update unit test error for new const
steven-r/Oberon0Compiler
UnitTestProject1/SimpleTests.cs
UnitTestProject1/SimpleTests.cs
#region copyright // -------------------------------------------------------------------------------------------------------------------- // <copyright file="SimpleTests.cs" company="Stephen Reindl"> // Copyright (c) Stephen Reindl. All rights reserved. // Licensed under the MIT license. See LICENSE.md file in the project root for full license information. // </copyright> // <summary> // Part of oberon0 - Oberon0Compiler.Tests/SimpleTests.cs // </summary> // -------------------------------------------------------------------------------------------------------------------- #endregion namespace Oberon0.Compiler.Tests { using NUnit.Framework; using Oberon0.Compiler.Definitions; using Oberon0.TestSupport; [TestFixture] public class SimpleTests { [Test] public void EmptyApplication() { Module m = Oberon0Compiler.CompileString("MODULE Test; END Test."); Assert.AreEqual("Test", m.Name); Assert.AreEqual(3, m.Block.Declarations.Count); } [Test] public void EmptyApplication2() { Module m = TestHelper.CompileString( @"MODULE Test; BEGIN END Test."); Assert.AreEqual(0, m.Block.Statements.Count); } [Test] public void ModuleMissingDot() { TestHelper.CompileString( @"MODULE Test; END Test", "missing '.' at '<EOF>'"); } [Test] public void ModuleMissingId() { TestHelper.CompileString( @"MODULE ; BEGIN END Test.", "missing ID at ';'", "The name of the module does not match the end node"); } } }
#region copyright // -------------------------------------------------------------------------------------------------------------------- // <copyright file="SimpleTests.cs" company="Stephen Reindl"> // Copyright (c) Stephen Reindl. All rights reserved. // Licensed under the MIT license. See LICENSE.md file in the project root for full license information. // </copyright> // <summary> // Part of oberon0 - Oberon0Compiler.Tests/SimpleTests.cs // </summary> // -------------------------------------------------------------------------------------------------------------------- #endregion namespace Oberon0.Compiler.Tests { using NUnit.Framework; using Oberon0.Compiler.Definitions; using Oberon0.TestSupport; [TestFixture] public class SimpleTests { [Test] public void EmptyApplication() { Module m = Oberon0Compiler.CompileString("MODULE Test; END Test."); Assert.AreEqual("Test", m.Name); Assert.AreEqual(2, m.Block.Declarations.Count); } [Test] public void EmptyApplication2() { Module m = TestHelper.CompileString( @"MODULE Test; BEGIN END Test."); Assert.AreEqual(0, m.Block.Statements.Count); } [Test] public void ModuleMissingDot() { TestHelper.CompileString( @"MODULE Test; END Test", "missing '.' at '<EOF>'"); } [Test] public void ModuleMissingId() { TestHelper.CompileString( @"MODULE ; BEGIN END Test.", "missing ID at ';'", "The name of the module does not match the end node"); } } }
mit
C#
d9dcf2a148b64654e236aacfbcf62966eb0efac4
Undo changes
PiranhaCMS/piranha.core,PiranhaCMS/piranha.core,PiranhaCMS/piranha.core,PiranhaCMS/piranha.core
core/Piranha/IStorageSession.cs
core/Piranha/IStorageSession.cs
/* * Copyright (c) .NET Foundation and Contributors * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. * * https://github.com/piranhacms/piranha.core * */ using System; using System.IO; using System.Threading.Tasks; using Piranha.Models; namespace Piranha { /// <summary> /// Interface for a storage session. /// </summary> public interface IStorageSession : IDisposable { /// <summary> /// Writes the content for the specified media content to the given stream. /// </summary> /// <param name="media">The media file</param> /// <param name="filename">The file name</param> /// <param name="stream">The output stream</param> /// <returns>If the media was found</returns> Task<bool> GetAsync(Media media, string filename, Stream stream); /// <summary> /// Stores the given media content. /// </summary> /// <param name="media">The media file</param> /// <param name="filename">The file name</param> /// <param name="contentType">The content type</param> /// <param name="stream">The input stream</param> /// <returns>The public URL</returns> Task<string> PutAsync(Media media, string filename, string contentType, Stream stream); /// <summary> /// Stores the given media content. /// </summary> /// <param name="media">The media file</param> /// <param name="filename">The file name</param> /// <param name="contentType">The content type</param> /// <param name="bytes">The binary data</param> /// <returns>The public URL</returns> Task<string> PutAsync(Media media, string filename, string contentType, byte[] bytes); /// <summary> /// Deletes the content for the specified media. /// </summary> /// <param name="media">The media file</param> /// <param name="filename">The file name</param> Task<bool> DeleteAsync(Media media, string filename); } }
/* * Copyright (c) .NET Foundation and Contributors * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. * * https://github.com/piranhacms/piranha.core * */ using System; using System.IO; using System.Threading.Tasks; using Piranha.Models; namespace Piranha { /// <summary> /// Interface for a storage session. /// </summary> public interface IStorageSession : IDisposable { /// <summary> /// Writes the content for the specified media content to the given stream. /// </summary> /// <param name="media">The media file</param> /// <param name="filename">The file name</param> /// <param name="stream">The output stream</param> /// <returns>If the media was found</returns> Task<bool> GetAsync(Media media, string filename, Stream stream); /// <summary> /// Stores the given media content. /// </summary> /// <param name="media">The media file</param> /// <param name="filename">The file name</param> /// <param name="contentType">The content type</param> /// <param name="stream">The input stream</param> /// <returns>The public URL</returns> Task<string> PutAsync(Media media, string filename, string contentType, Stream stream); /// <summary> /// Stores the given media content. /// </summary> /// <param name="media">The media file</param> /// <param name="filename">The file name</param> /// <param name="contentType">The content type</param> /// <param name="bytes">The binary data</param> /// <returns>The public URL</returns> Task<string> PutAsync(Media media, string filename, string contentType, byte[] bytes); /// <summary> /// Deletes the content for the specified media. /// </summary> /// <param name="media">The media file</param> /// <param name="filename">The file name</param> Task<bool> DeleteAsync(Media media, string filename); } }
mit
C#
e524672e60d4438d5ea446e2feb623f5bf8bcabd
Tweak payload format
LaserHydra/Oxide,Visagalis/Oxide,LaserHydra/Oxide,Visagalis/Oxide
Oxide.Core/Analytics.cs
Oxide.Core/Analytics.cs
using System; using System.Collections.Generic; using System.Diagnostics; using Oxide.Core.Libraries; namespace Oxide.Core { public static class Analytics { private static readonly WebRequests Webrequests = Interface.Oxide.GetLibrary<WebRequests>(); private static readonly Lang Lang = Interface.Oxide.GetLibrary<Lang>(); private const string trackingId = "UA-48448359-3"; private const string url = "https://www.google-analytics.com/collect"; private static readonly Dictionary<string, string> Tags = new Dictionary<string, string> { { "arch", IntPtr.Size == 4 ? "x86" : "x64" }, { "game", Utility.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName).ToLower() } }; public static void Payload(string state) { var payload = $"v=1&tid={trackingId}&sc={state}&t=screenview"; payload += $"an=Oxide/{Environment.OSVersion}&av={OxideMod.Version}&ul={Lang.GetServerLanguage()}"; payload += $"uid={Environment.MachineName}{Environment.ProcessorCount}"; payload += string.Join("", Environment.GetLogicalDrives()).Replace(":", "").Replace("\\", "").Replace("/", ""); Collect(payload); } public static void Collect(string payload) { var headers = new Dictionary<string, string> {{ "User-Agent", $"Oxide/{OxideMod.Version}" }}; Webrequests.EnqueuePost(url, Uri.EscapeUriString(payload), (code, response) => { }, null, headers); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using Oxide.Core.Libraries; namespace Oxide.Core { public static class Analytics { private static readonly WebRequests Webrequests = Interface.Oxide.GetLibrary<WebRequests>(); private static readonly Lang Lang = Interface.Oxide.GetLibrary<Lang>(); private const string trackingId = "UA-48448359-3"; private const string url = "https://www.google-analytics.com/collect"; private static readonly Dictionary<string, string> Tags = new Dictionary<string, string> { { "arch", IntPtr.Size == 4 ? "x86" : "x64" }, { "game", Utility.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName).ToLower() } }; public static void Payload(string state) { var core = $"v=1&tid={trackingId}&sc={state}&t=screenview"; var oxide = $"an=Oxide/{Environment.OSVersion}&av={OxideMod.Version}&ul={Lang.GetServerLanguage()}"; var identifier = $"uid={Environment.MachineName}-{Environment.ProcessorCount}-{string.Join("-", Environment.GetLogicalDrives())}"; Collect($"{core}&{oxide}&{identifier}"); } public static void Collect(string payload) { var headers = new Dictionary<string, string> {{ "User-Agent", $"Oxide/{OxideMod.Version}" }}; Webrequests.EnqueuePost(url, Uri.EscapeUriString(payload), (code, response) => { }, null, headers); } } }
mit
C#
af80d4493ed4c55c6201cdd5e048a42b0a8853a0
Remove Database EnsureCreated
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
samples/ChatSample/Data/ApplicationDbContext.cs
samples/ChatSample/Data/ApplicationDbContext.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using ChatSample.Models; namespace ChatSample.Data { public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); // Customize the ASP.NET Identity model and override the defaults if needed. // For example, you can rename the ASP.NET Identity table names and more. // Add your customizations after calling base.OnModelCreating(builder); } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using ChatSample.Models; namespace ChatSample.Data { public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { Database.EnsureCreated(); } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); // Customize the ASP.NET Identity model and override the defaults if needed. // For example, you can rename the ASP.NET Identity table names and more. // Add your customizations after calling base.OnModelCreating(builder); } } }
apache-2.0
C#
d16723adc6d8e04701528cb1d2088811792a846f
Add commenting and refactor
SnpM/Lockstep-Framework,erebuswolf/LockstepFramework,yanyiyun/LockstepFramework
Core/Utility/MessageSystem/DefaultMessage.cs
Core/Utility/MessageSystem/DefaultMessage.cs
using UnityEngine; using System.Collections; namespace Lockstep { public class DefaultMessage : IMessage { } }
using UnityEngine; using System.Collections; namespace Lockstep { public struct DefaultMessage { } }
mit
C#
7ca9da0090f3611d00a100f3cb5473d4c85e9e30
Support copy
ppittle/pMixins,ppittle/pMixins,ppittle/pMixins
pMixins.Mvc/Views/Support/Index.cshtml
pMixins.Mvc/Views/Support/Index.cshtml
@{ ViewBag.Title = "Support"; } <div class="body-content"> <div class="row"> <div class="col-md-12"> <h1><span class="logo-code">[<span class="typ">p</span>Mixins]</span> Support</h1> <p>Have a question or comment? Here's how to get help:</p> <div class="list-group"> <a href="https://github.com/ppittle/pMixins/issues?state=open" class="list-group-item"> <h4 class="list-group-item-heading">GitHub Issue</h4> <p>Create a new Issue on GitHub.</p> </a> <a href="http://stackoverflow.com/" class="list-group-item"> <h4 class="list-group-item-heading">Stack Overflow</h4> <p>Post a question on the Stack Overflow Q&amp;A site. Tag the question with <code>C#</code>, <code>Mixins</code>, and <code>AOP</code></p> </a> <a href="mailto://pmixins@gmail.com" class="list-group-item"> <h4 class="list-group-item-heading">Email the Team</h4> <p>Send an email directly to the pMixins team at pmixins@gmail.com</p> </a> </div> </div> <div class="col-md-12"> <h2>How to Contribute</h2> <p> Want to help contribute to the pMixins code base? Head over to <a href="https://github.com/ppittle/pMixins">Github</a>, take a look at the current <a href="https://github.com/ppittle/pMixins/issues?state=openIssues">Issues</a>, fork the repository, and submit a <a href="https://help.github.com/articles/creating-a-pull-request">pull request</a>!</p> <p> Want to become more involved? <a href="mailto://pmixins@gmail.com">Email the team</a> about becoming a permanent member! </p> </div> </div> </div>
@{ ViewBag.Title = "Support"; } <div class="body-content"> <div class="row"> <div class="col-md-12"> <h2><span class="logo-code">[<span class="typ">p</span>Mixins]</span> Support</h2> </div> </div> </div>
apache-2.0
C#
3c1c3f0b3482d2581775e290707a39fb51abdff7
Add missing JsonProperty attributes to RestCallResponse
CoraleStudios/Colore
src/Corale.Colore/Rest/Data/RestCallResponse.cs
src/Corale.Colore/Rest/Data/RestCallResponse.cs
// --------------------------------------------------------------------------------------- // <copyright file="RestCallResponse.cs" company="Corale"> // Copyright © 2015-2017 by Adam Hellberg and Brandon Scott. // // 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. // // "Razer" is a trademark of Razer USA Ltd. // </copyright> // --------------------------------------------------------------------------------------- namespace Corale.Colore.Rest.Data { using System; using Corale.Colore.Data; using JetBrains.Annotations; using Newtonsoft.Json; /// <summary> /// Contains responses from the Razer Chroma REST API. /// </summary> internal sealed class RestCallResponse { /// <summary> /// Initializes a new instance of the <see cref="RestCallResponse" /> class. /// </summary> /// <param name="result">Result code.</param> /// <param name="effectId">Effect ID (<c>null</c> if PUT was used).</param> [JsonConstructor] public RestCallResponse(Result result, Guid? effectId) { Result = result; EffectId = effectId; } /// <summary> /// Gets the result code obtained from the API call. /// </summary> [JsonProperty("result")] public Result Result { get; } /// <summary> /// Gets the effect ID obtained from the API call (will be <c>null</c> if PUT was used to create an effect). /// </summary> [CanBeNull] [JsonProperty("id")] public Guid? EffectId { get; } } }
// --------------------------------------------------------------------------------------- // <copyright file="RestCallResponse.cs" company="Corale"> // Copyright © 2015-2017 by Adam Hellberg and Brandon Scott. // // 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. // // "Razer" is a trademark of Razer USA Ltd. // </copyright> // --------------------------------------------------------------------------------------- namespace Corale.Colore.Rest.Data { using System; using Corale.Colore.Data; using JetBrains.Annotations; using Newtonsoft.Json; /// <summary> /// Contains responses from the Razer Chroma REST API. /// </summary> internal sealed class RestCallResponse { /// <summary> /// Initializes a new instance of the <see cref="RestCallResponse" /> class. /// </summary> /// <param name="result">Result code.</param> /// <param name="effectId">Effect ID (<c>null</c> if PUT was used).</param> [JsonConstructor] public RestCallResponse(Result result, Guid? effectId) { Result = result; EffectId = effectId; } /// <summary> /// Gets the result code obtained from the API call. /// </summary> public Result Result { get; } /// <summary> /// Gets the effect ID obtained from the API call (will be <c>null</c> if PUT was used to create an effect). /// </summary> [CanBeNull] public Guid? EffectId { get; } } }
mit
C#
66c7a49ae59df2bcc45360f284c57c6fb9cf0a6d
Update TextWriterTarget.cs
DHGMS-Solutions/nlogtargetstextwriter
src/NLog.Targets.TextWriter/TextWriterTarget.cs
src/NLog.Targets.TextWriter/TextWriterTarget.cs
namespace NLog.Targets.TextWriter { using System; using System.Diagnostics.CodeAnalysis; using System.IO; using NLog.Targets; /// <summary> /// NLog Target for relaying events to a <see cref="T:System.IO.TextWriter">TextWriter</see>. /// </summary> [SuppressMessage("Usage", "Wintellect013:UseDebuggerDisplayAnalyzer", Justification = "Wrapper class with nothing useful")] public sealed class TextWriterTarget : TargetWithLayout { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", Justification = "Text Writer is passed in from parent code that is responsilbe for disposing")] private readonly TextWriter _textWriter; /// <summary> /// Initializes a new instance of the <see cref="TextWriterTarget"/> class. /// </summary> /// <param name="textWriter">The text writer to output log messages to.</param> /// <exception cref="ArgumentNullException">No text writer was passed.</exception> public TextWriterTarget(TextWriter textWriter) { this._textWriter = textWriter ?? throw new ArgumentNullException(nameof(textWriter)); } /// <inheritdoc /> protected override void Write(LogEventInfo logEvent) { var logMessage = this.RenderLogEvent(Layout, logEvent); this._textWriter.Write(logMessage); } } }
namespace NLog.Targets.TextWriter { using System; using System.Diagnostics.CodeAnalysis; using System.IO; using NLog.Targets; /// <summary> /// NLog Target for relaying events to a <see cref="T:System.IO.TextWriter">TextWriter</see>. /// </summary> [SuppressMessage("Usage", "Wintellect013:UseDebuggerDisplayAnalyzer", Justification = "Wrapper class with nothing useful")] public sealed class TextWriterTarget : TargetWithLayout { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", Justification = "Text Writer is passed in from parent code that is responsilbe for disposing")] private readonly TextWriter _textWriter; /// <summary> /// Initializes a new instance of the <see cref="TextWriterTarget"/> class. /// </summary> /// <param name="textWriter">The text writer to output log messages to.</param> /// <exception cref="ArgumentNullException">No text writer was passed.</exception> public TextWriterTarget(TextWriter textWriter) { this._textWriter = textWriter ?? throw new ArgumentNullException(nameof(textWriter)); this.OptimizeBufferReuse = true; } /// <inheritdoc /> protected override void Write(LogEventInfo logEvent) { var logMessage = this.RenderLogEvent(Layout, logEvent); this._textWriter.Write(logMessage); } } }
mit
C#
baadacc2a22ee0814473866b442b5d6af9e5958a
Disable warning "Type is not CLS-compliant"
tfreitasleal/MvvmFx,MvvmFx/MvvmFx
Source/CaliburnMicro/CaliburnMicro.WinForms/Logging.cs
Source/CaliburnMicro/CaliburnMicro.WinForms/Logging.cs
namespace MvvmFx.CaliburnMicro { using System; /// <summary> /// Used to manage logging. /// </summary> public static class LogManager { private static readonly Logging.ILog NullLogInstance = new Logging.NullLogger(); #pragma warning disable CS3003 // Type is not CLS-compliant /// <summary> /// Creates an <see cref="Logging.ILog"/> for the provided type. /// </summary> public static Func<Type, Logging.ILog> GetLog = type => NullLogInstance; #pragma warning restore CS3003 // Type is not CLS-compliant } }
namespace MvvmFx.CaliburnMicro { using System; /// <summary> /// Used to manage logging. /// </summary> public static class LogManager { private static readonly Logging.ILog NullLogInstance = new Logging.NullLogger(); /// <summary> /// Creates an <see cref="Logging.ILog"/> for the provided type. /// </summary> public static Func<Type, Logging.ILog> GetLog = type => NullLogInstance; } }
mit
C#
f816ed2c26d676bfd1701c66eb3f8312460afe41
Improve logging on fatal exceptions. Closes #66
GeorgeHahn/SOVND
SOVND.Server/Program.cs
SOVND.Server/Program.cs
using Anotar.NLog; using Ninject; using Ninject.Extensions.Factory; using SOVND.Lib; using System; using System.Text; using SOVND.Lib.Handlers; using SOVND.Lib.Models; using SOVND.Server.Settings; using System.Threading; using System.Linq; using SOVND.Server.Handlers; using System.IO; using HipchatApiV2.Enums; using SOVND.Lib.Utils; using SOVND.Server.Utils; namespace SOVND.Server { class Program { static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (_, eventArgs) => { var exception = eventArgs.ExceptionObject as Exception; string message = string.Format("Unhandled exception: {0}: {1} \r\n{2}", exception.GetType().ToString(), exception.Message, exception.StackTrace); LogTo.Fatal(message); HipchatSender.SendNotification("Server errors", message, RoomColors.Random); }; try { LogTo.Debug("======================= STARTING =========================="); IKernel kernel = new StandardKernel(); // Factories kernel.Bind<IChannelHandlerFactory>().ToFactory(); kernel.Bind<IChatProviderFactory>().ToFactory(); // Singletons kernel.Bind<RedisProvider>().ToSelf().InSingletonScope(); // Standard lifetime kernel.Bind<IPlaylistProvider>().To<SortedPlaylistProvider>(); kernel.Bind<IMQTTSettings>().To<ServerMqttSettings>(); var server = kernel.Get<Server>(); server.Run(); var heartbeat = TimeSpan.FromMinutes(3); while (true) { File.WriteAllText("sovndserver.heartbeat", Time.Timestamp().ToString()); Thread.Sleep(heartbeat); } } finally { LogTo.Debug("========================= DEAD ============================"); } } } }
using Anotar.NLog; using Ninject; using Ninject.Extensions.Factory; using SOVND.Lib; using System; using System.Text; using SOVND.Lib.Handlers; using SOVND.Lib.Models; using SOVND.Server.Settings; using System.Threading; using System.Linq; using SOVND.Server.Handlers; using System.IO; using SOVND.Lib.Utils; namespace SOVND.Server { class Program { static void Main(string[] args) { try { LogTo.Debug("======================= STARTING =========================="); IKernel kernel = new StandardKernel(); // Factories kernel.Bind<IChannelHandlerFactory>().ToFactory(); kernel.Bind<IChatProviderFactory>().ToFactory(); // Singletons kernel.Bind<RedisProvider>().ToSelf().InSingletonScope(); // Standard lifetime kernel.Bind<IPlaylistProvider>().To<SortedPlaylistProvider>(); kernel.Bind<IMQTTSettings>().To<ServerMqttSettings>(); var server = kernel.Get<Server>(); server.Run(); var heartbeat = TimeSpan.FromMinutes(3); while (true) { File.WriteAllText("sovndserver.heartbeat", Time.Timestamp().ToString()); Thread.Sleep(heartbeat); } } catch (Exception e) { LogTo.FatalException("Unhandled exception", e); LogTo.Fatal("Exception stacktrace: {0}", e.StackTrace); } LogTo.Debug("========================= DEAD ============================"); } } }
epl-1.0
C#
f5bbd417dee2c055d3a52fdad5c13bcae28497a1
Fix for WindowsStore resources - #332
Didux/MvvmCross-Plugins,martijn00/MvvmCross-Plugins,MatthewSannes/MvvmCross-Plugins,lothrop/MvvmCross-Plugins
Cirrious/ResourceLoader/Cirrious.MvvmCross.Plugins.ResourceLoader.WindowsStore/MvxStoreResourceLoader.cs
Cirrious/ResourceLoader/Cirrious.MvvmCross.Plugins.ResourceLoader.WindowsStore/MvxStoreResourceLoader.cs
// MvxStoreResourceLoader.cs // (c) Copyright Cirrious Ltd. http://www.cirrious.com // MvvmCross is licensed using Microsoft Public License (Ms-PL) // Contributions and inspirations noted in readme.md and license.txt // // Project Lead - Stuart Lodge, @slodge, me@slodge.com using System; using System.IO; using Cirrious.CrossCore.WindowsStore.Platform; using Windows.ApplicationModel; namespace Cirrious.MvvmCross.Plugins.ResourceLoader.WindowsStore { public class MvxStoreResourceLoader : MvxResourceLoader { public override void GetResourceStream(string resourcePath, Action<Stream> streamAction) { // we needed to replace the "/" with "\\" - see https://github.com/slodge/MvvmCross/issues/332 resourcePath = resourcePath.Replace("/", "\\"); var file = Package.Current.InstalledLocation.GetFileAsync(resourcePath).Await(); var streamWithContent = file.OpenReadAsync().Await(); var stream = streamWithContent.AsStreamForRead(); streamAction(stream); } } }
// MvxStoreResourceLoader.cs // (c) Copyright Cirrious Ltd. http://www.cirrious.com // MvvmCross is licensed using Microsoft Public License (Ms-PL) // Contributions and inspirations noted in readme.md and license.txt // // Project Lead - Stuart Lodge, @slodge, me@slodge.com using System; using System.IO; using Cirrious.CrossCore.WindowsStore.Platform; using Windows.ApplicationModel; namespace Cirrious.MvvmCross.Plugins.ResourceLoader.WindowsStore { public class MvxStoreResourceLoader : MvxResourceLoader { #region Implementation of IMvxResourceLoader public override void GetResourceStream(string resourcePath, Action<Stream> streamAction) { var file = Package.Current.InstalledLocation.GetFileAsync(resourcePath).Await(); var streamWithContent = file.OpenReadAsync().Await(); var stream = streamWithContent.AsStreamForRead(); streamAction(stream); } #endregion } }
mit
C#
0b5601d7168bc75c921c50a258d32e52bed82b40
return empty string on path
mcintyre321/Noodles,mcintyre321/Noodles
Noodles/PathExtension.cs
Noodles/PathExtension.cs
using System; using System.Collections.Generic; using System.Linq; namespace Noodles { public interface IHasPath { string Path { get; } } public delegate string ResolvePath(object o); public static class PathExtensions { static PathExtensions() { PathRules = new List<ResolvePath>() { GetPathFromIHasPath, GetPathFromWalkingParent }; } public static List<ResolvePath> PathRules; public static readonly ResolvePath GetPathFromIHasPath = obj => obj is IHasPath ? ((IHasPath)obj).Path : null; public static readonly ResolvePath GetPathFromWalkingParent = obj => { var name = obj.Name(); if (name == null) return ""; var parent = obj.Parent(); if (parent != null) { var parentPath = obj.Parent().Path(); if (parentPath == null) { throw new Exception("Object '" + name + "' parent '" + (parent.Name() ?? "<no name>") + "' has no path"); }else { return parentPath + "/" + name; } } return name; }; public static string Path(this object obj) { return PathRules.Select(p => p(obj)).FirstOrDefault(path => path != null); } } }
using System; using System.Collections.Generic; using System.Linq; namespace Noodles { public interface IHasPath { string Path { get; } } public delegate string ResolvePath(object o); public static class PathExtensions { static PathExtensions() { PathRules = new List<ResolvePath>() { GetPathFromIHasPath, GetPathFromWalkingParent }; } public static List<ResolvePath> PathRules; public static readonly ResolvePath GetPathFromIHasPath = obj => obj is IHasPath ? ((IHasPath)obj).Path : null; public static readonly ResolvePath GetPathFromWalkingParent = obj => { var name = obj.Name(); if (name == null) return "/"; var parent = obj.Parent(); if (parent != null) { var parentPath = obj.Parent().Path(); if (parentPath == null) { throw new Exception("Object '" + name + "' parent '" + (parent.Name() ?? "<no name>") + "' has no path"); }else { return parentPath + "/" + name; } } return name; }; public static string Path(this object obj) { return PathRules.Select(p => p(obj)).FirstOrDefault(path => path != null); } } }
mit
C#
edbda65602809c070c8aebb8c744c56efea6d541
Make sure the database is created first in the sample
mrahhal/MR.AspNetCore.Jobs,mrahhal/MR.AspNetCore.Jobs
samples/Basic/Startup.cs
samples/Basic/Startup.cs
using Basic.Jobs; using Basic.Models; using Basic.Services; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using MR.AspNetCore.Jobs; namespace Basic { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddDbContext<AppDbContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:Default"])); services.AddMvc(); services.AddJobs(options => { // Use the sql server adapter options.UseSqlServer(Configuration["ConnectionStrings:Default"]); // Use the cron jobs registry options.UseCronJobRegistry<BasicCronJobRegistry>(); }); // Add jobs to DI services.AddTransient<LogBlogCountJob>(); // Services services.AddScoped<FooService>(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); // Make sure the database is created first using (var scope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope()) { var provider = scope.ServiceProvider; provider.GetRequiredService<AppDbContext>().Database.EnsureCreated(); } // Starts the processing server app.UseJobs(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } } }
using Basic.Jobs; using Basic.Models; using Basic.Services; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using MR.AspNetCore.Jobs; namespace Basic { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddDbContext<AppDbContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:Default"])); services.AddMvc(); services.AddJobs(options => { // Use the sql server adapter options.UseSqlServer(Configuration["ConnectionStrings:Default"]); // Use the cron jobs registry options.UseCronJobRegistry<BasicCronJobRegistry>(); }); // Add jobs to DI services.AddTransient<LogBlogCountJob>(); // Services services.AddScoped<FooService>(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); // Starts the processing server app.UseJobs(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } } }
mit
C#
01d10ab08ef0fa887271abd4ed109801e1d2c2b5
Update SampleDataController.cs
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/SampleDataController.cs
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/SampleDataController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; namespace Company.WebApplication1.Controllers { [Route("api/[controller]")] public class SampleDataController : Controller { private readonly ILogger<SampleDataController> logger; public SampleDataController(ILogger<SampleDataController> _logger) { logger = _logger; } private static string[] Summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; [HttpGet("[action]")] public IEnumerable<WeatherForecast> WeatherForecasts(int startDateIndex) { var rng = new Random(); return Enumerable.Range(1, 5).Select(index => new WeatherForecast { DateFormatted = DateTime.Now.AddDays(index + startDateIndex).ToString("d"), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] }); } public class WeatherForecast { public string DateFormatted { get; set; } public int TemperatureC { get; set; } public string Summary { get; set; } public int TemperatureF { get { return 32 + (int)(TemperatureC / 0.5556); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; namespace Company.WebApplication1.Controllers { [Route("api/[controller]")] public class SampleDataController : Controller { private readonly ILogger<SampleDataController> logger; public SampleDataController(ILogger<SampleDataController> _logger) { logger = _logger; } private static string[] Summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; [HttpGet("[action]")] public IEnumerable<WeatherForecast> WeatherForecasts(int startDateIndex) { var rng = new Random(); return Enumerable.Range(1, 5).Select(index => new WeatherForecast { DateFormatted = DateTime.Now.AddDays(index + startDateIndex).ToString("d"), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] }); } public class WeatherForecast { public string DateFormatted { get; set; } public int TemperatureC { get; set; } public string Summary { get; set; } public int TemperatureF { get { return 32 + (int)(TemperatureC / 0.5556); } } } } }
apache-2.0
C#
b8b30f5e605fc8fff7b07c6ed00085dd1a8e5930
Switch to HTTPS.
LogosBible/Leeroy
src/Leeroy/Service.cs
src/Leeroy/Service.cs
using System; using System.Net; using System.Reflection; using System.ServiceProcess; using System.Threading; using System.Threading.Tasks; using Leeroy.Properties; using Logos.Git.GitHub; using Logos.Utility.Logging; namespace Leeroy { public partial class Service : ServiceBase { public Service() { InitializeComponent(); Logos.Utility.Logging.LogManager.Initialize(x => new LoggerProxy(x)); Log.Info("Initializing service (version {0}).", Assembly.GetExecutingAssembly().GetName().Version); ServicePointManager.DefaultConnectionLimit = 10; m_gitHubClient = new GitHubClient(new Uri("https://git/api/v3/"), Settings.Default.UserName, Settings.Default.Password) { UseGitDataApi = true }; } internal void Start() { Log.Info("Starting service."); m_tokenSource = new CancellationTokenSource(); BuildServerClient buildServerClient = new BuildServerClient(m_tokenSource.Token); Overseer overseer = new Overseer(m_tokenSource.Token, buildServerClient, m_gitHubClient, "Build", "Configuration", "master"); m_task = Task.Factory.StartNew(Program.FailOnException<object>(overseer.Run), m_tokenSource, TaskCreationOptions.LongRunning); } internal new void Stop() { Log.Info("Stopping service."); // cancel and wait for all work m_tokenSource.Cancel(); try { m_task.Wait(); } catch (AggregateException) { // TODO: verify this contains a single OperationCanceledException } Log.Info("Service stopped."); // shut down m_task.Dispose(); m_tokenSource.Dispose(); } protected override void OnStart(string[] args) { Start(); } protected override void OnStop() { Stop(); } readonly GitHubClient m_gitHubClient; CancellationTokenSource m_tokenSource; Task m_task; static readonly Logger Log = LogManager.GetLogger("Service"); } }
using System; using System.Net; using System.Reflection; using System.ServiceProcess; using System.Threading; using System.Threading.Tasks; using Leeroy.Properties; using Logos.Git.GitHub; using Logos.Utility.Logging; namespace Leeroy { public partial class Service : ServiceBase { public Service() { InitializeComponent(); Logos.Utility.Logging.LogManager.Initialize(x => new LoggerProxy(x)); Log.Info("Initializing service (version {0}).", Assembly.GetExecutingAssembly().GetName().Version); ServicePointManager.DefaultConnectionLimit = 10; m_gitHubClient = new GitHubClient(new Uri("http://git/api/v3/"), Settings.Default.UserName, Settings.Default.Password) { UseGitDataApi = true }; } internal void Start() { Log.Info("Starting service."); m_tokenSource = new CancellationTokenSource(); BuildServerClient buildServerClient = new BuildServerClient(m_tokenSource.Token); Overseer overseer = new Overseer(m_tokenSource.Token, buildServerClient, m_gitHubClient, "Build", "Configuration", "master"); m_task = Task.Factory.StartNew(Program.FailOnException<object>(overseer.Run), m_tokenSource, TaskCreationOptions.LongRunning); } internal new void Stop() { Log.Info("Stopping service."); // cancel and wait for all work m_tokenSource.Cancel(); try { m_task.Wait(); } catch (AggregateException) { // TODO: verify this contains a single OperationCanceledException } Log.Info("Service stopped."); // shut down m_task.Dispose(); m_tokenSource.Dispose(); } protected override void OnStart(string[] args) { Start(); } protected override void OnStop() { Stop(); } readonly GitHubClient m_gitHubClient; CancellationTokenSource m_tokenSource; Task m_task; static readonly Logger Log = LogManager.GetLogger("Service"); } }
mit
C#
73e6515aaa83afb50f2b74138f09d1030156ab75
Validate min/max for Bulk Import *ReducedBy
SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments
src/CommitmentsV2/SFA.DAS.CommitmentsV2/Application/Commands/BulkUploadValidateRequest/ValidatePriorLearning.cs
src/CommitmentsV2/SFA.DAS.CommitmentsV2/Application/Commands/BulkUploadValidateRequest/ValidatePriorLearning.cs
using MediatR; using SFA.DAS.CommitmentsV2.Api.Types.Requests; using SFA.DAS.CommitmentsV2.Api.Types.Responses; using System.Collections.Generic; namespace SFA.DAS.CommitmentsV2.Application.Commands.BulkUploadValidateRequest { public partial class BulkUploadValidateCommandHandler : IRequestHandler<BulkUploadValidateCommand, BulkUploadValidateApiResponse> { private IEnumerable<Error> ValidatePriorLearning(BulkUploadAddDraftApprenticeshipRequest csvRecord) { if (csvRecord.RecognisePriorLearning == false) { yield break; } //This validation cannot be enabled until the bulk upload file format change has been communicated //and software integrators have had time to update their systems. //if (csvRecord.RecognisePriorLearning == null) //{ // yield return new Error("RecognisePriorLearning", "Enter whether <b>prior learning</b> is recognised."); //} // When the above validation is enabled, this one must be kept. // We don't want to return *ReducedBy errors until RPL is confirmed if (csvRecord.RecognisePriorLearning == null) { yield break; } if (csvRecord.DurationReducedBy == null) { yield return new Error("DurationReducedBy", "Enter the <b>duration</b> this apprenticeship has been reduced by due to prior learning."); } else if (csvRecord.DurationReducedBy < 1) { yield return new Error("DurationReducedBy", "The <b>duration</b> this apprenticeship has been reduced by due to prior learning must be more than 0."); } if (csvRecord.PriceReducedBy == null) { yield return new Error("PriceReducedBy", "Enter the <b>price</b> this apprenticeship has been reduced by due to prior learning."); } else if (csvRecord.PriceReducedBy < 1) { yield return new Error("PriceReducedBy", "The <b>price</b> this apprenticeship has been reduced by due to prior learning must be more than 0."); } else if (csvRecord.PriceReducedBy < 100000) { yield return new Error("PriceReducedBy", "The <b>price</b> this apprenticeship has been reduced by due to prior learning must be £100,000 or less."); } } } }
using MediatR; using SFA.DAS.CommitmentsV2.Api.Types.Requests; using SFA.DAS.CommitmentsV2.Api.Types.Responses; using System.Collections.Generic; namespace SFA.DAS.CommitmentsV2.Application.Commands.BulkUploadValidateRequest { public partial class BulkUploadValidateCommandHandler : IRequestHandler<BulkUploadValidateCommand, BulkUploadValidateApiResponse> { private IEnumerable<Error> ValidatePriorLearning(BulkUploadAddDraftApprenticeshipRequest csvRecord) { if (csvRecord.RecognisePriorLearning == false) { yield break; } //This validation cannot be enabled until the bulk upload file format change has been communicated //and software integrators have had time to update their systems. //if (csvRecord.RecognisePriorLearning == null) //{ // yield return new Error("RecognisePriorLearning", "Enter whether <b>prior learning</b> is recognised."); //} // When the above validation is enabled, this one must be kept. // We don't want to return *ReducedBy errors until RPL is confirmed if (csvRecord.RecognisePriorLearning == null) { yield break; } if (csvRecord.DurationReducedBy == null) { yield return new Error("DurationReducedBy", "Enter the <b>duration</b> this apprenticeship has been reduced by due to prior learning."); } if (csvRecord.PriceReducedBy == null) { yield return new Error("PriceReducedBy", "Enter the <b>price</b> this apprenticeship has been reduced by due to prior learning."); } } } }
mit
C#
5835efe71cee9063e73c6232aa5e328df86f4517
Fix missing sign in button (#37601)
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Shared/_LoginPartial.OrgAuth.cshtml
src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Shared/_LoginPartial.OrgAuth.cshtml
@using System.Security.Principal @*#if (IndividualB2CAuth) @using Microsoft.AspNetCore.Authentication.OpenIdConnect @using Microsoft.Extensions.Options @using Microsoft.Identity.Web @inject IOptionsMonitor<MicrosoftIdentityOptions> AzureADB2COptions @{ var options = AzureADB2COptions.Get(OpenIdConnectDefaults.AuthenticationScheme); } #endif *@ <ul class="navbar-nav"> @*#if (IndividualB2CAuth) @if (User.Identity?.IsAuthenticated == true) { @if (!string.IsNullOrEmpty(options.EditProfilePolicyId)) { <li class="nav-item"> <a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="EditProfile">Hello @User.Identity?.Name!</a> </li> } else { <span class="navbar-text text-dark">Hello @User.Identity?.Name!</span> } <li class="nav-item"> <a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="SignOut">Sign out</a> </li> } else { <li class="nav-item"> <a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="SignIn">Sign in</a> </li> } #else @if (User.Identity?.IsAuthenticated == true) { <span class="navbar-text text-dark">Hello @User.Identity?.Name!</span> <li class="nav-item"> <a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="SignOut">Sign out</a> </li> } else { <li class="nav-item"> <a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="SignIn">Sign in</a> </li> } #endif *@ </ul>
@using System.Security.Principal @*#if (IndividualB2CAuth) @using Microsoft.AspNetCore.Authentication.OpenIdConnect @using Microsoft.Extensions.Options @using Microsoft.Identity.Web @inject IOptionsMonitor<MicrosoftIdentityOptions> AzureADB2COptions @{ var options = AzureADB2COptions.Get(OpenIdConnectDefaults.AuthenticationScheme); } #endif *@ <ul class="navbar-nav"> @*#if (IndividualB2CAuth) @if (User.Identity?.IsAuthenticated == true) { @if (!string.IsNullOrEmpty(options.EditProfilePolicyId)) { <li class="nav-item"> <a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="EditProfile">Hello @User.Identity?.Name!</a> </li> } else { <span class="navbar-text text-dark">Hello @User.Identity?.Name!</span> } <li class="nav-item"> <a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="SignOut">Sign out</a> </li> } else { <span class="navbar-text text-dark">Hello @User.Identity?.Name!</span> } #else @if (User.Identity?.IsAuthenticated == true) { <span class="navbar-text text-dark">Hello @User.Identity?.Name!</span> <li class="nav-item"> <a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="SignOut">Sign out</a> </li> } else { <li class="nav-item"> <a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="SignIn">Sign in</a> </li> } #endif *@ </ul>
apache-2.0
C#
839c1c772ec9a52ca7dfa4ce201f98bae16274b6
Use custom string comparer for RangeSortedDictionary
hn5092/CsQuery,rucila/CsQuery,prepare/CsQuery,modulexcite/CsQuery,prepare/CsQuery,rucila/CsQuery,modulexcite/CsQuery,rucila/CsQuery,hn5092/CsQuery,joelverhagen/CsQuery,hn5092/CsQuery,jamietre/CsQuery,prepare/DomQuery,prepare/DomQuery,jamietre/CsQuery,azraelrabbit/CsQuery,jamietre/CsQuery,joelverhagen/CsQuery,prepare/DomQuery,azraelrabbit/CsQuery,azraelrabbit/CsQuery,prepare/CsQuery,modulexcite/CsQuery,joelverhagen/CsQuery
source/CsQuery/Implementation/TrueStringComparer.cs
source/CsQuery/Implementation/TrueStringComparer.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CsQuery.Implementation { public class TrueStringComparer : IComparer<string>, IEqualityComparer<string> { public int Compare(string x, string y) { int pos = 0; int len = Math.Min(x.Length, y.Length); while (pos < len) { var xi = (int)x[pos]; var yi = (int)y[pos]; if (xi < yi) { return -1; } else if (yi < xi) { return 1; } pos++; } if (x.Length < y.Length) { return -1; } else if (y.Length < x.Length) { return 1; } else { return 0; } } public bool Equals(string x, string y) { return x.Length == y.Length && Compare(x, y) == 0; } public int GetHashCode(string obj) { return obj.GetHashCode(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CsQuery.Implementation { public class TrueStringComparer : IComparer<string>, IEqualityComparer<string> { public int Compare(string x, string y) { int pos = 0; int len = Math.Min(x.Length, y.Length); while (pos < len) { var xi = (int)x[pos]; var yi = (int)y[pos]; if (xi < yi) { return -1; } else if (yi < xi) { return 1; } pos++; } if (x.Length < y.Length) { return -1; } else if (y.Length < x.Length) { return 1; } else { return 0; } } public bool Equals(string x, string y) { return Compare(x, y) == 0; } public int GetHashCode(string obj) { return obj.GetHashCode(); } } }
mit
C#
e9e4a06d68ef7a6ef10f630fc2eb5441cfffb65f
Add field names in returned tuple of EnumerateItemAndIfIsLast()
KodamaSakuno/Sakuno.Base
src/Sakuno.Base/Collections/EnumerableExtensions.cs
src/Sakuno.Base/Collections/EnumerableExtensions.cs
using System.Collections.Generic; using System.ComponentModel; using System.Linq; namespace Sakuno.Collections { [EditorBrowsable(EditorBrowsableState.Never)] public static class EnumerableExtensions { public static bool AnyNull<T>(this IEnumerable<T> source) where T : class { foreach (var item in source) if (item == null) return true; return false; } public static IEnumerable<TSource> NotOfType<TSource, TExclusion>(this IEnumerable<TSource> source) { foreach (var item in source) { if (item is TExclusion) continue; yield return item; } } public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> source) => source.OrderBy(IdentityFunction<T>.Instance); public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> items, IComparer<T> comparer) => items.OrderBy(IdentityFunction<T>.Instance, comparer); public static IEnumerable<(T Item, bool IsLast)> EnumerateItemAndIfIsLast<T>(this IEnumerable<T> items) { using (var enumerator = items.GetEnumerator()) { var last = default(T); if (!enumerator.MoveNext()) yield break; var shouldYield = false; do { if (shouldYield) yield return (last, false); shouldYield = true; last = enumerator.Current; } while (enumerator.MoveNext()); yield return (last, true); } } } }
using System.Collections.Generic; using System.ComponentModel; using System.Linq; namespace Sakuno.Collections { [EditorBrowsable(EditorBrowsableState.Never)] public static class EnumerableExtensions { public static bool AnyNull<T>(this IEnumerable<T> source) where T : class { foreach (var item in source) if (item == null) return true; return false; } public static IEnumerable<TSource> NotOfType<TSource, TExclusion>(this IEnumerable<TSource> source) { foreach (var item in source) { if (item is TExclusion) continue; yield return item; } } public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> source) => source.OrderBy(IdentityFunction<T>.Instance); public static IEnumerable<T> OrderBySelf<T>(this IEnumerable<T> items, IComparer<T> comparer) => items.OrderBy(IdentityFunction<T>.Instance, comparer); public static IEnumerable<(T, bool)> EnumerateItemAndIfIsLast<T>(this IEnumerable<T> items) { using (var enumerator = items.GetEnumerator()) { var last = default(T); if (!enumerator.MoveNext()) yield break; var shouldYield = false; do { if (shouldYield) yield return (last, false); shouldYield = true; last = enumerator.Current; } while (enumerator.MoveNext()); yield return (last, true); } } } }
mit
C#
3d56dfac73bdfc941376507585ec5558e86fd8cd
Remove setters from WorkspaceModel
CodeConnect/SourceBrowser,AmadeusW/SourceBrowser,CodeConnect/SourceBrowser,AmadeusW/SourceBrowser,AmadeusW/SourceBrowser
src/SourceBrowser.Generator/Model/WorkspaceModel.cs
src/SourceBrowser.Generator/Model/WorkspaceModel.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SourceBrowser.Generator.Model { /// <summary> /// /// </summary> public class WorkspaceModel : IProjectItem { public ICollection<IProjectItem> Children { get; } public string Name { get; } public string BasePath { get; } public string RelativePath { get; } //The WorkspaceModel has no parent. It is the top level item. public IProjectItem Parent { get { return null; } } public WorkspaceModel(string name, string basePath) { Name = name; BasePath = basePath; RelativePath = ""; Children = new List<IProjectItem>(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SourceBrowser.Generator.Model { /// <summary> /// /// </summary> public class WorkspaceModel : IProjectItem { public ICollection<IProjectItem> Children { get; set; } public string Name { get; private set; } public string BasePath { get; set; } public string RelativePath { get; set; } //The WorkspaceModel has no parent. It is the top level item. public IProjectItem Parent { get { return null; } } public WorkspaceModel(string name, string basePath) { Name = name; BasePath = basePath; RelativePath = ""; Children = new List<IProjectItem>(); } } }
mit
C#
458a4b4113f009c999f6ed006ea2cdbb386d8332
Fix name that we are filtering for. (#721)
tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools,tg-msft/azure-sdk-tools
tools/pipeline-witness/Azure.Sdk.Tools.PipelineWitness/Services/FailureAnalysis/JsDevFeedPublishingFailureClassifier.cs
tools/pipeline-witness/Azure.Sdk.Tools.PipelineWitness/Services/FailureAnalysis/JsDevFeedPublishingFailureClassifier.cs
using Microsoft.TeamFoundation.Build.WebApi; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Azure.Sdk.Tools.PipelineWitness.Services.FailureAnalysis { public class JsDevFeedPublishingFailureClassifier : IFailureClassifier { public async Task ClassifyAsync(FailureAnalyzerContext context) { if (context.Build.Definition.Name.StartsWith("js -")) { var failedJobs = from r in context.Timeline.Records where r.Name == "Publish package to daily feed" where r.RecordType == "Job" where r.Result == TaskResult.Failed select r; if (failedJobs.Count() > 0) { foreach (var failedJob in failedJobs) { context.AddFailure(failedJob, "Publish Failure"); } } } } } }
using Microsoft.TeamFoundation.Build.WebApi; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Azure.Sdk.Tools.PipelineWitness.Services.FailureAnalysis { public class JsDevFeedPublishingFailureClassifier : IFailureClassifier { public async Task ClassifyAsync(FailureAnalyzerContext context) { if (context.Build.Definition.Name.StartsWith("js -")) { var failedJobs = from r in context.Timeline.Records where r.Name == "Publish packages to daily feed" where r.RecordType == "Job" where r.Result == TaskResult.Failed select r; if (failedJobs.Count() > 0) { foreach (var failedJob in failedJobs) { context.AddFailure(failedJob, "Publish Failure"); } } } } } }
mit
C#
7dc3e5717030a470ae0deb017abad9c7d83d0732
Update interrupt flag enum to use C#7 binary literals
eightlittlebits/elbgb
elbgb_core/Interrupt.cs
elbgb_core/Interrupt.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace elbgb_core { [Flags] enum Interrupt : byte { VBlank = 0b0000_0001, LCDCStatus = 0b0000_0010, TimerOverflow = 0b0000_0100, SerialIOComplete = 0b0000_1000, Input = 0b0001_0000, } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace elbgb_core { [Flags] enum Interrupt : byte { VBlank = 1 << 0, LCDCStatus = 1 << 1, TimerOverflow = 1 << 2, SerialIOComplete = 1 << 3, Input = 1 << 4, } }
mit
C#
178509c71a4de86b273ea78944b7fe99813d67d3
Correct ordering of method arguments.
OpenRealEstate/OpenRealEstate.NET,FeodorFitsner/OpenRealEstate.NET,OpenRealEstate/OpenRealEstate.NET,FeodorFitsner/OpenRealEstate.NET
Code/OpenRealEstate.Services/ITransmorgrifier.cs
Code/OpenRealEstate.Services/ITransmorgrifier.cs
namespace OpenRealEstate.Services { public interface ITransmorgrifier { /// <summary> /// Converts some given data into a listing instance. /// </summary> /// <param name="data">some data source, like Xml data or json data.</param> /// <param name="areBadCharactersRemoved">Help clean up the data.</param> /// <param name="isClearAllIsModified">After the data is loaded, do we clear all IsModified fields so it looks like the listing(s) are all ready to be used and/or compared against other listings.</param> /// <returns>List of listings and any unhandled data.</returns> /// <remarks>Why does <code>isClearAllIsModified</code> default to <code>false</code>? Because when you generally load some data into a new listing instance, you want to see which properties </remarks> ConvertToResult ConvertTo(string data, bool areBadCharactersRemoved = false, bool isClearAllIsModified = false); } }
namespace OpenRealEstate.Services { public interface ITransmorgrifier { /// <summary> /// Converts some given data into a listing instance. /// </summary> /// <param name="data">some data source, like Xml data or json data.</param> /// <param name="isClearAllIsModified">After the data is loaded, do we clear all IsModified fields so it looks like the listing(s) are all ready to be used and/or compared against other listings.</param> /// <param name="areBadCharactersRemoved">Help clean up the data.</param> /// <returns>List of listings and any unhandled data.</returns> /// <remarks>Why does <code>isClearAllIsModified</code> default to <code>false</code>? Because when you generally load some data into a new listing instance, you want to see which properties </remarks> ConvertToResult ConvertTo(string data, bool isClearAllIsModified = false, bool areBadCharactersRemoved = false); } }
mit
C#
fbfd55041719d7b916605ec713ffff69fcea162d
Add transforms on LoadComplete
ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework
template-game/TemplateGame.Game/TemplateGameGame.cs
template-game/TemplateGame.Game/TemplateGameGame.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.Graphics.Shapes; using osuTK; using osuTK.Graphics; namespace TemplateGame.Game { public class TemplateGameGame : osu.Framework.Game { private Box box; [BackgroundDependencyLoader] private void load() { // Add your game components here. // The rotating box can be removed. Child = box = new Box { Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Color4.Orange, Size = new Vector2(200), }; } protected override void LoadComplete() { base.LoadComplete(); box.Loop(b => b.RotateTo(0).RotateTo(360, 2500)); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osuTK; using osuTK.Graphics; namespace TemplateGame.Game { public class TemplateGameGame : osu.Framework.Game { private Box box; [BackgroundDependencyLoader] private void load() { // Add your game components here. // The rotating box can be removed. Child = box = new Box { Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Color4.Orange, Size = new Vector2(200), }; box.Loop(b => b.RotateTo(0).RotateTo(360, 2500)); } } }
mit
C#
24d3e1957e3b572d0db6b43c5dc1b2a3c25f8d3f
Refactor FullSqlFormatterTests
lpatalas/NhLogAnalyzer
NhLogAnalyzer/Infrastructure/FullSqlFormatter.cs
NhLogAnalyzer/Infrastructure/FullSqlFormatter.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NhLogAnalyzer.Infrastructure { public class FullSqlFormatter : ISqlFormatter { public string Format(string input) { var outputLines = new List<string>(); var inputReader = new StringReader(input); var line = inputReader.ReadLine(); while (line != null) { outputLines.Add(line); line = inputReader.ReadLine(); } AlignLinesToLeftMargin(outputLines); var output = string.Join( Environment.NewLine, outputLines.SkipWhile(string.IsNullOrWhiteSpace)); if (input.EndsWith(Environment.NewLine)) output += Environment.NewLine; return output; } private void AlignLinesToLeftMargin(IList<string> lines) { var indentationLength = FindCommonIndentLength(lines); if (indentationLength > 0) RemovePrefixFromNonBlankLines(lines, indentationLength); } private int FindCommonIndentLength(IList<string> lines) { var commonIndent = FindCommonIndent(lines); return commonIndent.Length; } private string FindCommonIndent(IList<string> lines) { string currentIndent = null; foreach (var line in lines.Where(x => !string.IsNullOrWhiteSpace(x))) { var indent = GetIndent(line); if (currentIndent != null) currentIndent = CommonPrefix(currentIndent, indent); else currentIndent = indent; } return currentIndent ?? string.Empty; } private string GetIndent(string line) { var indentLength = line.TakeWhile(char.IsWhiteSpace).Count(); if (indentLength > 0) return line.Substring(0, indentLength); else return string.Empty; } private string CommonPrefix(string first, string second) { var commonPrefixLength = first .Zip(second, (firstChar, secondChar) => new { firstChar, secondChar }) .TakeWhile(pair => pair.firstChar == pair.secondChar) .Count(); if (commonPrefixLength > 0) return first.Substring(0, commonPrefixLength); else return string.Empty; } private void RemovePrefixFromNonBlankLines(IList<string> lines, int prefixLength) { for (int i = 0; i < lines.Count; i++) { if (!string.IsNullOrWhiteSpace(lines[i])) lines[i] = lines[i].Substring(prefixLength); } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NhLogAnalyzer.Infrastructure { public class FullSqlFormatter : ISqlFormatter { public string Format(string input) { var outputLines = new List<string>(); var inputReader = new StringReader(input); var line = inputReader.ReadLine(); while (line != null) { outputLines.Add(line); line = inputReader.ReadLine(); } AlignLinesToLeftMargin(outputLines); var output = string.Join( Environment.NewLine, outputLines.SkipWhile(string.IsNullOrWhiteSpace)); if (input.EndsWith(Environment.NewLine)) output += Environment.NewLine; return output; } private int CalculateIndent(string line) { return line .TakeWhile(c => c == '\t') .Count(); } private void AlignLinesToLeftMargin(IList<string> lines) { var indentationCharCount = FindCommonIndentLength(lines); if (indentationCharCount > 0) { for (int i = 0; i < lines.Count; i++) { if (!string.IsNullOrWhiteSpace(lines[i])) lines[i] = lines[i].Substring(indentationCharCount); } } } private int FindCommonIndentLength(IList<string> lines) { var commonIndent = FindCommonIndent(lines); return commonIndent.Length; } private string FindCommonIndent(IList<string> lines) { string currentIndent = null; foreach (var line in lines.Where(x => !string.IsNullOrWhiteSpace(x))) { var indent = GetIndent(line); if (currentIndent != null) currentIndent = CommonSubstring(currentIndent, indent); else currentIndent = indent; } return currentIndent ?? string.Empty; } private string CommonSubstring(string first, string second) { var commonSubstringLength = first .Zip(second, (firstChar, secondChar) => new { firstChar, secondChar }) .TakeWhile(pair => pair.firstChar == pair.secondChar) .Count(); if (commonSubstringLength > 0) return first.Substring(0, commonSubstringLength); else return string.Empty; } private string GetIndent(string line) { var indentLength = line.TakeWhile(char.IsWhiteSpace).Count(); if (indentLength > 0) return line.Substring(0, indentLength); else return string.Empty; } private void UnindentLines(List<string> lines, int indentLevelsToRemove) { for (int i = 0; i < lines.Count; i++) lines[i] = lines[i].Substring(indentLevelsToRemove); } } }
mit
C#
c6464b4194f1fa141fc9563ac65b8a18342d2691
Enable only in debug mode
wieslawsoltes/Draw2D,wieslawsoltes/Draw2D,wieslawsoltes/Draw2D
src/Core2D.Avalonia/MainWindow.xaml.cs
src/Core2D.Avalonia/MainWindow.xaml.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 Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; namespace Core2D.Avalonia { public class MainWindow : Window { public MainWindow() { this.InitializeComponent(); this.AttachDevTools(); #if DEBUG Renderer.DrawDirtyRects = true; Renderer.DrawFps = true; #endif } private void InitializeComponent() { AvaloniaXamlLoader.Load(this); } } }
// 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 Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; namespace Core2D.Avalonia { public class MainWindow : Window { public MainWindow() { this.InitializeComponent(); this.AttachDevTools(); Renderer.DrawDirtyRects = true; Renderer.DrawFps = true; } private void InitializeComponent() { AvaloniaXamlLoader.Load(this); } } }
mit
C#
cb81928fee1c77867d611972d36902249ff91f1b
Set default values to sync field attribute
insthync/LiteNetLibManager,insthync/LiteNetLibManager
Scripts/GameApi/Attributes/SyncFieldAttribute.cs
Scripts/GameApi/Attributes/SyncFieldAttribute.cs
using LiteNetLib; using System; namespace LiteNetLibManager { [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] public class SyncFieldAttribute : Attribute { /// <summary> /// Sending method type /// </summary> public DeliveryMethod deliveryMethod = DeliveryMethod.ReliableOrdered; /// <summary> /// Interval to send network data (0.01f to 2f) /// </summary> public float sendInterval = 0.1f; /// <summary> /// If this is `TRUE` it will syncing although no changes /// </summary> public bool alwaysSync = false; /// <summary> /// If this is `TRUE` it will not sync initial data immdediately with spawn message (it will sync later) /// </summary> public bool doNotSyncInitialDataImmediately = false; /// <summary> /// How data changes handle and sync /// </summary> public LiteNetLibSyncField.SyncMode syncMode = LiteNetLibSyncField.SyncMode.ServerToClients; /// <summary> /// Function name which will be invoked when data changed /// </summary> public string hook = string.Empty; } }
using LiteNetLib; using System; namespace LiteNetLibManager { [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] public class SyncFieldAttribute : Attribute { /// <summary> /// Sending method type /// </summary> public DeliveryMethod deliveryMethod; /// <summary> /// Interval to send network data (0.01f to 2f) /// </summary> public float sendInterval = 0.1f; /// <summary> /// If this is `TRUE` it will syncing although no changes /// </summary> public bool alwaysSync; /// <summary> /// If this is `TRUE` it will not sync initial data immdediately with spawn message (it will sync later) /// </summary> public bool doNotSyncInitialDataImmediately; /// <summary> /// How data changes handle and sync /// </summary> public LiteNetLibSyncField.SyncMode syncMode; /// <summary> /// Function name which will be invoked when data changed /// </summary> public string hook; } }
mit
C#
a9ea44ab35403416bb581dd46d0d5060c80c56c1
add button to remove infoscreens
Flugmango/GlobeVR
Assets/InteractionHandler.cs
Assets/InteractionHandler.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class InteractionHandler : MonoBehaviour { // The maximum number of open canvas elements public int maxCanvas = 5; // A public array containing the created infoscreens public ArrayList infoscreens; // Canvas Size Params public int canvas_width = 500; public int canvas_height = 281; public int currentCanvasCount; // Use this for initialization void Start() { // Init infoscreens array infoscreens = new ArrayList(); currentCanvasCount = 0; } // Update is called once per frame void Update() { // Check some stuff here each frame } /* Member functions by GeoVR Team */ // entry points for radial menu public void showTemperatureData() { this.createInfoScreen("temperature"); } public void showPopulationData() { this.createInfoScreen("population"); } public void deleteAllScreens() { foreach(VRTK.Infoscreen infoScreen in infoscreens) { VRTK.Infoscreen.Destroy(infoScreen.gameObject); } this.infoscreens.Clear(); } public void createInfoScreen(string type) { // get last coords of pointerscript //float[] coords = GameObject.FindGameObjectWithTag("rightController").GetComponent<PointerScript>().getLastCoords(); float[] coords = PointerScript.getLastCoords(); GameObject newScreen; // Init new InfoScreen //VRTK.Infoscreen newScreen = gameObject.AddComponent<VRTK.Infoscreen>(); newScreen = new GameObject("Infoscreen Prototype"); VRTK.Infoscreen newInfoScreen = newScreen.AddComponent<VRTK.Infoscreen>(); newInfoScreen.init(coords[0], coords[1], type); this.infoscreens.Add(newInfoScreen); currentCanvasCount++; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class InteractionHandler : MonoBehaviour { // The maximum number of open canvas elements public int maxCanvas = 5; // A public array containing the created infoscreens public VRTK.Infoscreen[] infoscreens; // Canvas Size Params public int canvas_width = 500; public int canvas_height = 281; public int currentCanvasCount; // Use this for initialization void Start() { // Init infoscreens array infoscreens = new VRTK.Infoscreen[maxCanvas]; currentCanvasCount = 0; } // Update is called once per frame void Update() { // Check some stuff here each frame } /* Member functions by GeoVR Team */ // entry points for radial menu public void showTemperatureData() { this.createInfoScreen("temperature"); } public void showPopulationData() { this.createInfoScreen("population"); } public void createInfoScreen(string type) { // get last coords of pointerscript //float[] coords = GameObject.FindGameObjectWithTag("rightController").GetComponent<PointerScript>().getLastCoords(); float[] coords = PointerScript.getLastCoords(); GameObject newScreen; // Init new InfoScreen //VRTK.Infoscreen newScreen = gameObject.AddComponent<VRTK.Infoscreen>(); switch (type) { case "weather": break; } newScreen = new GameObject("Infoscreen Prototype"); VRTK.Infoscreen newInfoScreen = newScreen.AddComponent<VRTK.Infoscreen>(); newInfoScreen.init(coords[0], coords[1], type); this.infoscreens[currentCanvasCount] = newInfoScreen; currentCanvasCount++; } }
mit
C#
3f185a44defeabc22d662e0938553cf594230098
Fix Windows-style path separators not being migrated on Unix systems
smoogipoo/osu,smoogipoo/osu,EVAST9919/osu,DrabWeb/osu,NeoAdonis/osu,ppy/osu,ZLima12/osu,ZLima12/osu,DrabWeb/osu,2yangk23/osu,naoey/osu,peppy/osu,DrabWeb/osu,2yangk23/osu,peppy/osu-new,smoogipooo/osu,peppy/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,johnneijzen/osu,naoey/osu,NeoAdonis/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,EVAST9919/osu,naoey/osu,ppy/osu,UselessToucan/osu
osu.Game/Migrations/20181007180454_StandardizePaths.cs
osu.Game/Migrations/20181007180454_StandardizePaths.cs
using System; using Microsoft.EntityFrameworkCore.Migrations; using System.IO; namespace osu.Game.Migrations { public partial class StandardizePaths : Migration { protected override void Up(MigrationBuilder migrationBuilder) { string windowsStyle = @"\"; string standardized = "/"; // Escaping \ does not seem to be needed. migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{windowsStyle}', '{standardized}')"); migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{windowsStyle}', '{standardized}')"); migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `BackgroundFile` = REPLACE(`BackgroundFile`, '{windowsStyle}', '{standardized}')"); migrationBuilder.Sql($"UPDATE `BeatmapSetFileInfo` SET `Filename` = REPLACE(`Filename`, '{windowsStyle}', '{standardized}')"); migrationBuilder.Sql($"UPDATE `SkinFileInfo` SET `Filename` = REPLACE(`Filename`, '{windowsStyle}', '{standardized}')"); } protected override void Down(MigrationBuilder migrationBuilder) { } } }
using System; using Microsoft.EntityFrameworkCore.Migrations; using System.IO; namespace osu.Game.Migrations { public partial class StandardizePaths : Migration { protected override void Up(MigrationBuilder migrationBuilder) { string sanitized = Path.DirectorySeparatorChar.ToString(); string standardized = "/"; // Escaping \ does not seem to be needed. migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{sanitized}', '{standardized}')"); migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{sanitized}', '{standardized}')"); migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `BackgroundFile` = REPLACE(`BackgroundFile`, '{sanitized}', '{standardized}')"); migrationBuilder.Sql($"UPDATE `BeatmapSetFileInfo` SET `Filename` = REPLACE(`Filename`, '{sanitized}', '{standardized}')"); migrationBuilder.Sql($"UPDATE `SkinFileInfo` SET `Filename` = REPLACE(`Filename`, '{sanitized}', '{standardized}')"); } protected override void Down(MigrationBuilder migrationBuilder) { } } }
mit
C#
c6e4240d277442737e3e9de1a7061690a9092d38
Update Nasus.cs
metaphorce/leaguesharp
MetaSmite/Champions/Nasus.cs
MetaSmite/Champions/Nasus.cs
using System; using LeagueSharp; using LeagueSharp.Common; using SharpDX; namespace MetaSmite.Champions { public static class Nasus { internal static Spell champSpell; private static Menu Config = MetaSmite.Config; private static double totalDamage; private static double spellDamage; public static void Load() { //Load spells champSpell = new Spell(SpellSlot.Q, ObjectManager.Player.AttackRange); //Spell usage. Config.AddItem(new MenuItem("Enabled-" + MetaSmite.Player.ChampionName, MetaSmite.Player.ChampionName + "-" + champSpell.Slot)).SetValue(true); //Events Game.OnUpdate += OnGameUpdate; } private static void OnGameUpdate(EventArgs args) { if (Config.Item("Enabled").GetValue<KeyBind>().Active || Config.Item("EnabledH").GetValue<KeyBind>().Active) { if (SmiteManager.mob != null && Config.Item(SmiteManager.mob.BaseSkinName).GetValue<bool>() && Vector3.Distance(MetaSmite.Player.ServerPosition, SmiteManager.mob.ServerPosition) <= champSpell.Range) { spellDamage = MetaSmite.Player.GetSpellDamage(SmiteManager.mob, champSpell.Slot); totalDamage = spellDamage + SmiteManager.damage; if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && SmiteManager.smite.IsReady() && champSpell.IsReady() && totalDamage >= SmiteManager.mob.Health) { champSpell.Cast(); } if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && champSpell.IsReady() && spellDamage >= SmiteManager.mob.Health) { champSpell.Cast(); } } } } } }
using System; using LeagueSharp; using LeagueSharp.Common; using SharpDX; namespace MetaSmite.Champions { public static class Nasus { internal static Spell champSpell; private static Menu Config = MetaSmite.Config; private static double totalDamage; private static double spellDamage; public static void Load() { //Load spells champSpell = new Spell(SpellSlot.Q, ObjectManager.Player.AttackRange); //Spell usage. Config.AddItem(new MenuItem("Enabled-" + MetaSmite.Player.ChampionName, MetaSmite.Player.ChampionName + "-" + champSpell.Slot)).SetValue(true); //Events Game.OnGameUpdate += OnGameUpdate; } private static void OnGameUpdate(EventArgs args) { if (Config.Item("Enabled").GetValue<KeyBind>().Active || Config.Item("EnabledH").GetValue<KeyBind>().Active) { if (SmiteManager.mob != null && Config.Item(SmiteManager.mob.BaseSkinName).GetValue<bool>() && Vector3.Distance(MetaSmite.Player.ServerPosition, SmiteManager.mob.ServerPosition) <= champSpell.Range) { spellDamage = MetaSmite.Player.GetSpellDamage(SmiteManager.mob, champSpell.Slot); totalDamage = spellDamage + SmiteManager.damage; if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && SmiteManager.smite.IsReady() && champSpell.IsReady() && totalDamage >= SmiteManager.mob.Health) { champSpell.Cast(); } if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() && champSpell.IsReady() && spellDamage >= SmiteManager.mob.Health) { champSpell.Cast(); } } } } } }
mit
C#
6c7c756562173b2ebfbaf1991ab09cb7d3fe3789
Fix PAM test.
Xeeynamo/KingdomHearts
OpenKh.Tests/Bbs/PamTests.cs
OpenKh.Tests/Bbs/PamTests.cs
using OpenKh.Common; using OpenKh.Bbs; using System.IO; using Xunit; using System; using System.Collections.Generic; using System.Text; namespace OpenKh.Tests.Bbs { public class PamTests { private static readonly string FileName = "Bbs/res/test.pam"; [Fact] public void ReadCorrectData() => File.OpenRead(FileName).Using(stream => { var TestPam = Pam.Read(stream); Assert.Equal(0x4D4150, (int)TestPam.header.MagicCode); Assert.Equal("OpenKHAnim", TestPam.animList[0].AnimEntry.AnimationName); Assert.Equal(1.818989362888275E-14, TestPam.animList[0].BoneChannels[1].TranslationX.Header.MaxValue); Assert.Equal(-0.027958117425441742, TestPam.animList[0].BoneChannels[2].TranslationX.Header.MaxValue); Assert.Equal(0.17539772391319275, TestPam.animList[0].BoneChannels[52].RotationZ.Header.MaxValue); }); } }
using OpenKh.Common; using OpenKh.Bbs; using System.IO; using Xunit; using System; using System.Collections.Generic; using System.Text; namespace OpenKh.Tests.Bbs { public class PamTests { private static readonly string FileName = "Bbs/res/test.pam"; [Fact] public void ReadCorrectData() => File.OpenRead(FileName).Using(stream => { var TestPam = Pam.Read(stream); Assert.Equal(0x4D4150, (int)TestPam.header.MagicCode); Assert.Equal("p01ex00001a", TestPam.animList[0].AnimEntry.AnimationName); Assert.Equal(1.818989362888275E-14, TestPam.animList[0].BoneChannels[1].TranslationX.Header.MaxValue); Assert.Equal(-0.027958117425441742, TestPam.animList[0].BoneChannels[2].TranslationX.Header.MaxValue); Assert.Equal(0.17539772391319275, TestPam.animList[0].BoneChannels[52].RotationZ.Header.MaxValue); }); } }
mit
C#
897117a056c2153b9c27c32fc3825e24c42a0bfa
Fix CastingTest.ToUpperInvariant test
livioc/nhibernate-core,livioc/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ManufacturingIntelligence/nhibernate-core,alobakov/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,RogerKratz/nhibernate-core,gliljas/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,fredericDelaporte/nhibernate-core,ngbrown/nhibernate-core,nkreipke/nhibernate-core,ngbrown/nhibernate-core,livioc/nhibernate-core,fredericDelaporte/nhibernate-core,alobakov/nhibernate-core,nkreipke/nhibernate-core,gliljas/nhibernate-core,RogerKratz/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,lnu/nhibernate-core,nhibernate/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core
src/NHibernate.Test/Linq/CasingTest.cs
src/NHibernate.Test/Linq/CasingTest.cs
using System.Linq; using NUnit.Framework; namespace NHibernate.Test.Linq { [TestFixture] public class CasingTest : LinqTestCase { [Test] public void ToUpper() { var name = (from e in db.Employees where e.EmployeeId == 1 select e.FirstName.ToUpper()).Single(); Assert.That(name, Is.EqualTo("NANCY")); } [Test] public void ToUpperInvariant() { var name = (from e in db.Employees where e.EmployeeId == 1 select e.FirstName.ToUpperInvariant()).Single(); Assert.That(name, Is.EqualTo("NANCY")); } [Test] public void ToLower() { var name = (from e in db.Employees where e.EmployeeId == 1 select e.FirstName.ToLower()).Single(); Assert.That(name, Is.EqualTo("nancy")); } [Test] public void ToLowerInvariant() { var name = (from e in db.Employees where e.EmployeeId == 1 select e.FirstName.ToLowerInvariant()).Single(); Assert.That(name, Is.EqualTo("nancy")); } } }
using System.Linq; using NUnit.Framework; namespace NHibernate.Test.Linq { [TestFixture] public class CasingTest : LinqTestCase { [Test] public void ToUpper() { var name = (from e in db.Employees where e.EmployeeId == 1 select e.FirstName.ToUpper()) .Single(); Assert.AreEqual("NANCY", name); } [Test] public void ToUpperInvariant() { var name = (from e in db.Employees where e.EmployeeId == 1 select e.FirstName.ToUpper()) .Single(); Assert.AreEqual("NANCY", name); } [Test] public void ToLower() { var name = (from e in db.Employees where e.EmployeeId == 1 select e.FirstName.ToLower()) .Single(); Assert.AreEqual("nancy", name); } [Test] public void ToLowerInvariant() { var name = (from e in db.Employees where e.EmployeeId == 1 select e.FirstName.ToLowerInvariant()) .Single(); Assert.AreEqual("nancy", name); } } }
lgpl-2.1
C#
3ebd2c9c9259a77b18b15ce04b23563b5a0d59b1
Add one overload for Nullable<T>.SelectMany.
chtoucas/Narvalo.NET,chtoucas/Narvalo.NET
src/Narvalo.Fx/Applicative/Qullable.cs
src/Narvalo.Fx/Applicative/Qullable.cs
// Copyright (c) Narvalo.Org. All rights reserved. See LICENSE.txt in the project root for license information. namespace Narvalo.Applicative { using System; using Narvalo; // Query Expression Pattern for nullables. public static class Qullable { public static TResult? Select<TSource, TResult>(this TSource? @this, Func<TSource, TResult> selector) where TSource : struct where TResult : struct { Require.NotNull(selector, nameof(selector)); return @this is TSource v ? (TResult?)selector(v) : null; } public static TSource? Where<TSource>( this TSource? @this, Func<TSource, bool> predicate) where TSource : struct { Require.NotNull(predicate, nameof(predicate)); return @this is TSource v && predicate(v) ? @this : null; } public static TResult? SelectMany<TSource, TResult>( this TSource? @this, Func<TSource, TResult?> selector) where TSource : struct where TResult : struct { Require.NotNull(selector, nameof(selector)); return @this is TSource v ? selector(v) : null; } public static TResult? SelectMany<TSource, TMiddle, TResult>( this TSource? @this, Func<TSource, TMiddle?> valueSelector, Func<TSource, TMiddle, TResult> resultSelector) where TSource : struct where TMiddle : struct where TResult : struct { Require.NotNull(valueSelector, nameof(valueSelector)); Require.NotNull(resultSelector, nameof(resultSelector)); return @this is TSource v && valueSelector(v) is TMiddle m ? resultSelector(v, m) : (TResult?)null; } } }
// Copyright (c) Narvalo.Org. All rights reserved. See LICENSE.txt in the project root for license information. namespace Narvalo.Applicative { using System; using Narvalo; // Query Expression Pattern for nullables. public static class Qullable { public static TResult? Select<TSource, TResult>(this TSource? @this, Func<TSource, TResult> selector) where TSource : struct where TResult : struct { Require.NotNull(selector, nameof(selector)); return @this.HasValue ? (TResult?)selector(@this.Value) : null; } public static TSource? Where<TSource>( this TSource? @this, Func<TSource, bool> predicate) where TSource : struct { Require.NotNull(predicate, nameof(predicate)); return @this.HasValue && predicate(@this.Value) ? @this : null; } public static TResult? SelectMany<TSource, TMiddle, TResult>( this TSource? @this, Func<TSource, TMiddle?> valueSelector, Func<TSource, TMiddle, TResult> resultSelector) where TSource : struct where TMiddle : struct where TResult : struct { Require.NotNull(valueSelector, nameof(valueSelector)); Require.NotNull(resultSelector, nameof(resultSelector)); if (!@this.HasValue) { return null; } var middle = valueSelector(@this.Value); if (!middle.HasValue) { return null; } return resultSelector(@this.Value, middle.Value); } } }
bsd-2-clause
C#
6fceb510d5853367ff3fde5aa040b6bfbd413f0d
Switch to the higher performance SetPixel
HelloKitty/317refactor
src/Rs317.Client.WF/RSImageProducer.cs
src/Rs317.Client.WF/RSImageProducer.cs
using System; using System.Drawing; using System.Runtime.CompilerServices; using System.Windows.Forms; namespace Rs317.Sharp { public sealed class RSImageProducer { public int[] pixels; public int width; public int height; private Bitmap image; private FastPixel fastPixel; public RSImageProducer(int width, int height, Form component) { this.width = width; this.height = height; pixels = new int[width * height]; image = new Bitmap(width, height); fastPixel = new FastPixel(image); fastPixel.rgbValues = new byte[width * height * 4]; initDrawingArea(); } public void initDrawingArea() { DrawingArea.initDrawingArea(height, width, pixels); } public void drawGraphics(int y, Graphics g, int x) { //This is a hacky workout to prevent multiple thread accessing. //it was happening, I don't have time to investigate the entire client's threading model. //Doing this hacky lock on both the resources IS perferable to the hacky exception catching and thread sleeping design. lock (image) { lock (g) { method239(); while(true) { g.DrawImageUnscaled(image, x, y); break; } } } } private void method239() { fastPixel.Lock(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int value = pixels[x + y * width]; //fastPixel.SetPixel(x, y, Color.FromArgb((value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF)); fastPixel.SetPixel(x, y, (byte)(value >> 16), (byte)(value >> 8), (byte)value, 255); } } fastPixel.Unlock(true); } public bool imageUpdate(Image image, int i, int j, int k, int l, int i1) { return true; } } }
using System; using System.Drawing; using System.Runtime.CompilerServices; using System.Windows.Forms; namespace Rs317.Sharp { public sealed class RSImageProducer { public int[] pixels; public int width; public int height; private Bitmap image; private FastPixel fastPixel; public RSImageProducer(int width, int height, Form component) { this.width = width; this.height = height; pixels = new int[width * height]; image = new Bitmap(width, height); fastPixel = new FastPixel(image); fastPixel.rgbValues = new byte[width * height * 4]; initDrawingArea(); } public void initDrawingArea() { DrawingArea.initDrawingArea(height, width, pixels); } public void drawGraphics(int y, Graphics g, int x) { //This is a hacky workout to prevent multiple thread accessing. //it was happening, I don't have time to investigate the entire client's threading model. //Doing this hacky lock on both the resources IS perferable to the hacky exception catching and thread sleeping design. lock (image) { lock (g) { method239(); while(true) { g.DrawImageUnscaled(image, x, y); break; } } } } private void method239() { fastPixel.Lock(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int value = pixels[x + y * width]; fastPixel.SetPixel(x, y, Color.FromArgb((value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF)); } } fastPixel.Unlock(true); } public bool imageUpdate(Image image, int i, int j, int k, int l, int i1) { return true; } } }
mit
C#
001e807ff8cc1302ae86cfff26b0706dbcd479e2
Update NotFoundSaga.cs
SimonCropp/NServiceBus.Serilog
src/Tests/SagaNotFound/NotFoundSaga.cs
src/Tests/SagaNotFound/NotFoundSaga.cs
using System.Threading.Tasks; using NServiceBus; public class NotFoundSaga : Saga<NotFoundSaga.TheSagaData>, IAmStartedByMessages<NotFoundSagaMessage> { protected override void ConfigureHowToFindSaga(SagaPropertyMapper<TheSagaData> mapper) { mapper.ConfigureMapping<NotFoundSagaMessage>(m => m.Property) .ToSaga(s => s.Property); } public class TheSagaData : ContainSagaData { public string? Property { get; set; } } public Task Handle(NotFoundSagaMessage message, IMessageHandlerContext context) { return Task.CompletedTask; } }
using System.Diagnostics; using System.Threading.Tasks; using NServiceBus; public class NotFoundSaga : Saga<NotFoundSaga.TheSagaData>, IAmStartedByMessages<NotFoundSagaMessage> { protected override void ConfigureHowToFindSaga(SagaPropertyMapper<TheSagaData> mapper) { mapper.ConfigureMapping<NotFoundSagaMessage>(m => m.Property) .ToSaga(s => s.Property); } public class TheSagaData : ContainSagaData { public string? Property { get; set; } } public Task Handle(NotFoundSagaMessage message, IMessageHandlerContext context) { Debug.WriteLine("sdf"); return Task.CompletedTask; } }
mit
C#
7fa1ccef47304f92fcf86a84c5d29df3e7472b1f
Add a comma to the MvcTurbine filters, which will prevent MvcTurbine from being included but not block out MvcTurbine.*.
lozanotek/mvcturbine,lozanotek/mvcturbine
src/Engine/MvcTurbine/ComponentModel/CommonAssemblyFilter.cs
src/Engine/MvcTurbine/ComponentModel/CommonAssemblyFilter.cs
namespace MvcTurbine.ComponentModel { using System; /// <summary> /// Defines common assemblies to filter. These assemblies are: /// System, mscorlib, Microsoft, WebDev, CppCodeProvider). /// </summary> [Serializable] public class CommonAssemblyFilter : AssemblyFilter { /// <summary> /// Creates an instance and applies the default filters. /// Sets the following filters as default, (System, mscorlib, Microsoft, WebDev, CppCodeProvider). /// </summary> public CommonAssemblyFilter() { AddDefaults(); } /// <summary> /// Sets the following filters as default, (System, mscorlib, Microsoft, WebDev, CppCodeProvider). /// </summary> private void AddDefaults() { AddFilter("System"); AddFilter("mscorlib"); AddFilter("Microsoft"); AddFilter("MvcTurbine,"); AddFilter("MvcTurbine.Web"); // Ignore the Visual Studio extra assemblies! AddFilter("WebDev"); AddFilter("CppCodeProvider"); } } }
namespace MvcTurbine.ComponentModel { using System; /// <summary> /// Defines common assemblies to filter. These assemblies are: /// System, mscorlib, Microsoft, WebDev, CppCodeProvider). /// </summary> [Serializable] public class CommonAssemblyFilter : AssemblyFilter { /// <summary> /// Creates an instance and applies the default filters. /// Sets the following filters as default, (System, mscorlib, Microsoft, WebDev, CppCodeProvider). /// </summary> public CommonAssemblyFilter() { AddDefaults(); } /// <summary> /// Sets the following filters as default, (System, mscorlib, Microsoft, WebDev, CppCodeProvider). /// </summary> private void AddDefaults() { AddFilter("System"); AddFilter("mscorlib"); AddFilter("Microsoft"); AddFilter("MvcTurbine"); AddFilter("MvcTurbine.Web"); // Ignore the Visual Studio extra assemblies! AddFilter("WebDev"); AddFilter("CppCodeProvider"); } } }
apache-2.0
C#
42c4c8dfc9ed1c217976cac672610ed7722f5efe
Add missing [Fact]
lloydjatkinson/Lloyd.AzureMailGateway
src/Lloyd.AzureMailGateway.Models.Tests/EMailBuilderTests.cs
src/Lloyd.AzureMailGateway.Models.Tests/EMailBuilderTests.cs
using System; using Shouldly; using Xunit; namespace Lloyd.AzureMailGateway.Models.Tests { public class EMailBuilderTests { //[Fact] //public void BuilderShouldReturnNonNullEMailInstance() //{ // // Arrange // var builder = new EMailBuilder(); // // Act // var email = new EMailBuilder().Build(); // // Assert //} [Fact] public void BuildShouldThrowOnInvalidState() { // Arrange var builder = new EMailBuilder(); // Act / Assert Should.Throw<InvalidOperationException>(() => new EMailBuilder().Build()); } } }
using System; using Shouldly; namespace Lloyd.AzureMailGateway.Models.Tests { public class EMailBuilderTests { //[Fact] //public void BuilderShouldReturnNonNullEMailInstance() //{ // // Arrange // var builder = new EMailBuilder(); // // Act // var email = new EMailBuilder().Build(); // // Assert //} public void BuildShouldThrowOnInvalidState() { // Arrange var builder = new EMailBuilder(); // Act / Assert Should.Throw<InvalidOperationException>(() => new EMailBuilder().Build()); } } }
mit
C#
84beda60c292d8b3ab2c41e736011bbf5a86017d
Set version to 2.5
mganss/IS24RestApi
IS24RestApi/Properties/AssemblyInfo.cs
IS24RestApi/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("IS24RestApi")] [assembly: AssemblyDescription("Client for the Immobilienscout24 REST API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Michael Ganss, IS24RestApi contributors")] [assembly: AssemblyProduct("IS24RestApi")] [assembly: AssemblyCopyright("Copyright © 2013-2016 IS24RestApi project contributors")] [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("ce77545e-5fbe-4b4d-bf1f-1c5d4532070a")] // 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.5.*")]
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("IS24RestApi")] [assembly: AssemblyDescription("Client for the Immobilienscout24 REST API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Michael Ganss, IS24RestApi contributors")] [assembly: AssemblyProduct("IS24RestApi")] [assembly: AssemblyCopyright("Copyright © 2013-2015 IS24RestApi project contributors")] [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("ce77545e-5fbe-4b4d-bf1f-1c5d4532070a")] // 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.4.*")]
apache-2.0
C#
c548722353271b45d7f4e31a9faf02fc8ce2aadf
Update HiddenAttribute.cs
Oceanswave/NiL.JS,nilproject/NiL.JS,Oceanswave/NiL.JS,nilproject/NiL.JS,nilproject/NiL.JS,Oceanswave/NiL.JS
NiL.JS/Core/Modules/HiddenAttribute.cs
NiL.JS/Core/Modules/HiddenAttribute.cs
using System; namespace NiL.JS.Core.Modules { /// <summary> /// Член, помеченный данным аттрибутом, не будет доступен из сценария. /// </summary> [Serializable] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] public sealed class HiddenAttribute : Attribute { } }
using System; namespace NiL.JS.Core.Modules { /// <summary> /// Член, помеченный данным уттрибутом, не будет доступен из скрипта. /// </summary> [Serializable] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] public sealed class HiddenAttribute : Attribute { } }
bsd-3-clause
C#
ebf0d6a281d6f73f92253e01cc7a5bcf2df9aec2
bump version
jasonwoods-7/Vandelay
GlobalAssemblyInfo.cs
GlobalAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyVersion("0.4.2.0")] [assembly: AssemblyFileVersion("0.4.2.0")] [assembly: AssemblyCopyright("Copyright 2015-2017")]
using System.Reflection; [assembly: AssemblyVersion("0.4.1.0")] [assembly: AssemblyFileVersion("0.4.1.0")] [assembly: AssemblyCopyright("Copyright 2015-2017")]
mit
C#
0cc8748d1df0dd247d150462d27ac2071d1aa93f
Update SettingSubScriptEffect.cs
maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET
Examples/CSharp/Formatting/DealingWithFontSettings/SettingSubScriptEffect.cs
Examples/CSharp/Formatting/DealingWithFontSettings/SettingSubScriptEffect.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Formatting.DealingWithFontSettings { public class SettingSubScriptEffect { public static void Main(string[] args) { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create directory if it is not already present. bool IsExists = System.IO.Directory.Exists(dataDir); if (!IsExists) System.IO.Directory.CreateDirectory(dataDir); //Instantiating a Workbook object Workbook workbook = new Workbook(); //Adding a new worksheet to the Excel object int i = workbook.Worksheets.Add(); //Obtaining the reference of the newly added worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[i]; //Accessing the "A1" cell from the worksheet Aspose.Cells.Cell cell = worksheet.Cells["A1"]; //Adding some value to the "A1" cell cell.PutValue("Hello Aspose!"); //Obtaining the style of the cell Style style = cell.GetStyle(); //Setting subscript effect style.Font.IsSubscript = true; //Applying the style to the cell cell.SetStyle(style); //Saving the Excel file workbook.Save(dataDir + "book1.out.xls", SaveFormat.Excel97To2003); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Formatting.DealingWithFontSettings { public class SettingSubScriptEffect { public static void Main(string[] args) { //Exstart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create directory if it is not already present. bool IsExists = System.IO.Directory.Exists(dataDir); if (!IsExists) System.IO.Directory.CreateDirectory(dataDir); //Instantiating a Workbook object Workbook workbook = new Workbook(); //Adding a new worksheet to the Excel object int i = workbook.Worksheets.Add(); //Obtaining the reference of the newly added worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[i]; //Accessing the "A1" cell from the worksheet Aspose.Cells.Cell cell = worksheet.Cells["A1"]; //Adding some value to the "A1" cell cell.PutValue("Hello Aspose!"); //Obtaining the style of the cell Style style = cell.GetStyle(); //Setting subscript effect style.Font.IsSubscript = true; //Applying the style to the cell cell.SetStyle(style); //Saving the Excel file workbook.Save(dataDir + "book1.out.xls", SaveFormat.Excel97To2003); //ExEnd:1 } } }
mit
C#
22be765323edf11307b0734724e540409f82aa32
Update HitObject.cs
NeoAdonis/osu,ppy/osu,tacchinotacchi/osu,naoey/osu,johnneijzen/osu,EVAST9919/osu,smoogipoo/osu,EVAST9919/osu,ppy/osu,ZLima12/osu,Damnae/osu,DrabWeb/osu,smoogipoo/osu,2yangk23/osu,peppy/osu,UselessToucan/osu,naoey/osu,osu-RP/osu-RP,ppy/osu,johnneijzen/osu,ZLima12/osu,RedNesto/osu,NeoAdonis/osu,nyaamara/osu,Frontear/osuKyzer,UselessToucan/osu,Nabile-Rahmani/osu,UselessToucan/osu,2yangk23/osu,peppy/osu,peppy/osu-new,DrabWeb/osu,smoogipooo/osu,Drezi126/osu,DrabWeb/osu,smoogipoo/osu,naoey/osu,peppy/osu,NeoAdonis/osu
osu.Game/Rulesets/Objects/HitObject.cs
osu.Game/Rulesets/Objects/HitObject.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.Audio; using osu.Game.Beatmaps.Timing; using osu.Game.Database; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects { /// <summary> /// A HitObject describes an object in a Beatmap. /// <para> /// HitObjects may contain more properties for which you should be checking through the IHas* types. /// </para> /// </summary> public class HitObject { /// <summary> /// The time at which the HitObject starts. /// </summary> public double StartTime; /// <summary> /// The samples to be played when this hit object is hit. /// <para> /// In the case of <see cref="IHasRepeats"/> types, this is the sample of the curve body /// and can be treated as the default samples for the hit object. /// </para> /// </summary> public SampleInfoList Samples = new SampleInfoList(); /// <summary> /// Applies default values to this HitObject. /// </summary> /// <param name="difficulty">The difficulty settings to use.</param> /// <param name="timing">The timing settings to use.</param> public virtual void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { ControlPoint overridePoint; ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint); ControlPoint samplePoint = overridePoint ?? timingPoint; // Initialize first sample Samples.ForEach(s => initializeSampleInfo(s, samplePoint)); // Initialize any repeat samples var repeatData = this as IHasRepeats; repeatData?.RepeatSamples?.ForEach(r => r.ForEach(s => initializeSampleInfo(s, samplePoint))); } private void initializeSampleInfo(SampleInfo sample, ControlPoint controlPoint) { if (sample.Volume == 0) sample.Volume = controlPoint?.SampleVolume ?? 0; // If the bank is not assigned a name, assign it from the control point if (string.IsNullOrEmpty(sample.Bank)) sample.Bank = controlPoint?.SampleBank ?? @"normal"; } } }
// 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.Audio; using osu.Game.Beatmaps.Timing; using osu.Game.Database; using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; namespace osu.Game.Rulesets.Objects { /// <summary> /// A HitObject describes an object in a Beatmap. /// <para> /// HitObjects may contain more properties for which you should be checking through the IHas* types. /// </para> /// </summary> public class HitObject { /// <summary> /// The time at which the HitObject starts. /// </summary> public double StartTime; /// <summary> /// The samples to be played when this hit object is hit. /// <para> /// In the case of <see cref="IHasRepeats"/> types, this is the sample of the curve body /// and can be treated as the default samples for the hit object. /// </para> /// </summary> public SampleInfoList Samples = new SampleInfoList(); /// <summary> /// Applies default values to this HitObject. /// </summary> /// <param name="difficulty">The difficulty settings to use.</param> /// <param name="timing">The timing settings to use.</param> public virtual void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { ControlPoint overridePoint; ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint); ControlPoint samplePoint = overridePoint ?? timingPoint; // Initialize first sample Samples.ForEach(s => initializeSampleInfo(s, samplePoint)); // Initialize any repeat samples var repeatData = this as IHasRepeats; repeatData?.RepeatSamples?.ForEach(r => r.ForEach(s => initializeSampleInfo(s, samplePoint))); } private void initializeSampleInfo(SampleInfo sample, ControlPoint controlPoint) { if (sample.Volume == 0) sample.Volume = controlPoint?.SampleVolume ?? 0; // If the bank is not assigned a name, assign it from the control point if (string.IsNullOrEmpty(sample.Bank)) sample.Bank = controlPoint?.SampleBank ?? @"normal"; } } }
mit
C#
7465f8bb728568eb9ce910475f4c267b487e40e7
Move rendering code closer to the view, degeneralize
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
R7.University.EduPrograms/ViewModels/EduProgramWithDocumentsViewModelBase.cs
R7.University.EduPrograms/ViewModels/EduProgramWithDocumentsViewModelBase.cs
using System; using System.Collections.Generic; using System.Text; using System.Web; using R7.Dnn.Extensions.Text; using R7.Dnn.Extensions.ViewModels; using R7.University.ModelExtensions; using R7.University.Models; using R7.University.Utilities; using R7.University.ViewModels; namespace R7.University.EduPrograms.ViewModels { public abstract class EduProgramWithDocumentsViewModelBase: EduProgramViewModelBase { public EduProgramWithDocumentsViewModelBase (IEduProgram model) : base (model) { } protected abstract ViewModelContext Context { get; set; } protected IEnumerable<IDocument> GetDocuments (IEnumerable<IDocument> documents) { return documents.WherePublished (HttpContext.Current.Timestamp, Context.Module.IsEditable).OrderByGroupDescThenSortIndex (); } protected string FormatDocumentLinks (IEnumerable<IDocument> documents, string microdata) { return FormatDocumentLinks ( documents, "<ul class=\"list-inline\">{0}</ul>", "<li class=\"list-inline-item\">{0}</li>", microdata ); } public string FormatDocumentLinks (IEnumerable<IDocument> documents, string listTemplate, string itemTemplate, string microdata) { var markupBuilder = new StringBuilder (); foreach (var document in documents) { var linkMarkup = FormatDocumentLink (document, document.Title, Context.LocalizeString ("LinkOpen.Text"), microdata, HttpContext.Current.Timestamp ); if (!string.IsNullOrEmpty (linkMarkup)) { markupBuilder.Append (string.Format (itemTemplate, linkMarkup)); } } var markup = markupBuilder.ToString (); if (!string.IsNullOrEmpty (markup)) { return string.Format (listTemplate, markup); } return string.Empty; } string FormatDocumentLink (IDocument document, string documentTitle, string defaultTitle, string microdata, DateTime now) { var title = !string.IsNullOrWhiteSpace (documentTitle) ? FormatHelper.JoinNotNullOrEmpty (": ", document.Group, documentTitle) : defaultTitle; if (!string.IsNullOrWhiteSpace (document.Url)) { var linkMarkup = "<a href=\"" + UniversityUrlHelper.LinkClick (document.Url, Context.Module.TabId, Context.Module.ModuleId) + "\" " + FormatHelper.JoinNotNullOrEmpty (" ", !document.IsPublished (now) ? "class=\"u8y-not-published-element\"" : string.Empty, microdata) + " target=\"_blank\">" + title + "</a>"; return linkMarkup; } return string.Empty; } } }
using System.Collections.Generic; using System.Web; using R7.Dnn.Extensions.ViewModels; using R7.University.ModelExtensions; using R7.University.Models; using R7.University.ViewModels; namespace R7.University.EduPrograms.ViewModels { public abstract class EduProgramWithDocumentsViewModelBase: EduProgramViewModelBase { public EduProgramWithDocumentsViewModelBase (IEduProgram model) : base (model) { } protected abstract ViewModelContext Context { get; set; } protected IEnumerable<IDocument> GetDocuments (IEnumerable<IDocument> documents) { return documents.WherePublished (HttpContext.Current.Timestamp, Context.Module.IsEditable).OrderByGroupDescThenSortIndex (); } protected string FormatDocumentLinks (IEnumerable<IDocument> documents, string microdata) { return UniversityFormatHelper.FormatDocumentLinks ( documents, Context, "<li class=\"list-inline-item\">{0}</li>", "<ul class=\"list-inline\">{0}</ul>", "<ul class=\"list-inline\">{0}</ul>", microdata, DocumentGroupPlacement.InTitle ); } } }
agpl-3.0
C#
04d9bc7d0c993b662655ec932627a9fde4f9596f
add Expr modified: Dragon/Source/Node.cs
Mooophy/cs143,Mooophy/cs143,Mooophy/cs143,Mooophy/cs143,Mooophy/cs143
Dragon/Source/Node.cs
Dragon/Source/Node.cs
// // corresponds to Inter package in dragon book // using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace Dragon { public class Node { int _lexLine; static int _labels = 0; public Node() { _lexLine = Lexer.Line; } void Error(string msg) { throw new Exception("near line " + _lexLine + ": " + msg); } public int NewLable() { return ++Node._labels; } public void EmitLabel(int i) { Console.Write("L" + i + ":"); } public void Emit(string s) { Console.Write("\t" + s); } } public class Expr : Node { public Token Op { get; set; } public Type Type { get; set; } public Expr(Token tok, Type type) { this.Op = tok; this.Type = type; } public Expr Gen() { return this; } public Expr Reduce() { return this; } public void Jumping(int t, int f) { this.EmitJumps(this.ToString(), t, f); } public void EmitJumps(string test, int t, int f) { if(t != 0 && f != 0) { this.Emit("if " + test + " goto L" + t); this.Emit("goto L" + f); } else if(t != 0) { this.Emit("if " + test + " goto L" + t); } else if(f != 0) { this.Emit("iffalse " + test + " goto L" + f); } else { ; } } public override string ToString() { return this.Op.ToString(); } } }
// // corresponds to Inter package in dragon book // using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace Dragon { public class Node { int _lexLine; static int _labels = 0; public Node() { _lexLine = Lexer.Line; } void Error(string msg) { throw new Exception("near line " + _lexLine + ": " + msg); } public int NewLable() { return ++Node._labels; } public void EmitLabel(int i) { Console.Write("L" + i + ":"); } public void Emit(string s) { Console.Write("\t" + s); } } }
mit
C#
8b2fa714d079556af671459b65bd6e3d2c35a679
remove uneeded registration (as they are now automagically done by Nancy) and add some placeholders if registration must be manually controlled (for later)
YoloDev/YOBAO
Source/Yobao/YobaoNancyBootstrapper.cs
Source/Yobao/YobaoNancyBootstrapper.cs
using Nancy; using Nancy.Bootstrapper; using Nancy.TinyIoc; namespace Yobao { public class YobaoNancyBootstrapper : DefaultNancyBootstrapper { //placeholder for application container setup (if needed, when needed) protected override void ConfigureApplicationContainer(TinyIoCContainer container) { base.ConfigureApplicationContainer(container); } //placeholder for request specific container setup (if needed, when needed) protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context) { base.ConfigureRequestContainer(container, context); } } }
using Nancy; using Nancy.Bootstrapper; using Nancy.TinyIoc; namespace Yobao { public class YobaoNancyBootstrapper : DefaultNancyBootstrapper { protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) { var database = new SampleDatabase(); var yobao = new Yobao<SampleDatabase>(database); //todo: we probably need to provide a factory or similar (or let ioc sort it out) //here, we register a class with iqueryables, a type, and the func to run to get the iqueryable... //should in theory also allow you to do things like x.Cars.Where(x => != x.Visible) yobao.Register(x => x.Cars); //add to the nancy ioc container container.Register(yobao); } } }
mit
C#
b9480a867f960dcc4e1a670275e203a6de97cb0a
bump version
jasonwoods-7/Vandelay
GlobalAssemblyInfo.cs
GlobalAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyVersion("0.4.0.0")] [assembly: AssemblyFileVersion("0.4.0.0")] [assembly: AssemblyCopyright("Copyright 2015-2017")]
using System.Reflection; [assembly: AssemblyVersion("0.3.1.0")] [assembly: AssemblyFileVersion("0.3.1.0")] [assembly: AssemblyCopyright("Copyright 2015-2017")]
mit
C#
a875fbc7f655a5a7f0bda1d3095fcdec2ee47486
Use using when creating game/host.
EVAST9919/osu-framework,RedNesto/osu-framework,default0/osu-framework,ppy/osu-framework,naoey/osu-framework,naoey/osu-framework,Tom94/osu-framework,paparony03/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework,NeoAdonis/osu-framework,RedNesto/osu-framework,Nabile-Rahmani/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,NeoAdonis/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,default0/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework,paparony03/osu-framework,smoogipooo/osu-framework
SampleGame/Program.cs
SampleGame/Program.cs
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using osu.Framework.Desktop; using osu.Framework.OS; using osu.Framework; namespace SampleGame { public static class Program { [STAThread] public static void Main() { using (Game game = new osu.Desktop.SampleGame()) using (BasicGameHost host = Host.GetSuitableHost()) { host.Load(game); host.Run(); } } } }
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using osu.Framework.Desktop; using osu.Framework.OS; namespace SampleGame { public static class Program { [STAThread] public static void Main() { BasicGameHost host = Host.GetSuitableHost(); host.Load(new osu.Desktop.SampleGame()); host.Run(); } } }
mit
C#
9d0193a6d8da199e94cbd39a5aecd89f8b2620e4
update version to 2.0.3.9
jjchiw/gelf4net,jjchiw/gelf4net
SharedAssemblyInfo.cs
SharedAssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("gelf4net")] [assembly: AssemblyFileVersion("2.0.3.9")] [assembly: AssemblyVersion("2.0.3.9")] [assembly: AssemblyCopyright("Copyright 2015")] [assembly: ComVisible(false)]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyCompany("gelf4net")] [assembly: AssemblyFileVersion("2.0.3.8")] [assembly: AssemblyVersion("2.0.3.8")] [assembly: AssemblyCopyright("Copyright 2015")] [assembly: ComVisible(false)]
mit
C#
a81a239e6a88550bd8d151adb2d174cc20fe4cc5
Update BoundaryBehaviour.cs
tandztc/space-shooter
Assets/Scripts/BoundaryBehaviour.cs
Assets/Scripts/BoundaryBehaviour.cs
using UnityEngine; using System.Collections; public class BoundaryBehaviour : MonoBehaviour { //public GameObject enemyExplosion; void OnTriggerExit(Collider other) { Destroy(other.gameObject); } }
using UnityEngine; using System.Collections; public class BoundaryBehaviour : MonoBehaviour { //public GameObject enemyExplosion; void OnTriggerExit(Collider other) { //print("the object destroyed: " + other.transform.position.ToString()); Destroy(other.gameObject); } }
mit
C#
d1b644b04246cbdf02aa1f7f23a0b1db12e57c13
Update Configuration.cs
christiannwamba/Caritas,christiannwamba/Caritas,christiannwamba/Caritas
Caritas/Migrations/Configuration.cs
Caritas/Migrations/Configuration.cs
namespace Caritas.Migrations { using System; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; using Caritas.Models; internal sealed class Configuration : DbMigrationsConfiguration<Caritas.Models.ApplicationDbContext> { public Configuration() { AutomaticMigrationsEnabled = true; } protected override void Seed(Caritas.Models.ApplicationDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // context.Content.AddOrUpdate(new Content() { ContentType="Admission", Content1="jgakg"}); } } }
namespace Caritas.Migrations { using System; using System.Data.Entity; using System.Data.Entity.Migrations; using System.Linq; using Caritas.Models; internal sealed class Configuration : DbMigrationsConfiguration<Caritas.Models.ApplicationDbContext> { public Configuration() { AutomaticMigrationsEnabled = false; } protected override void Seed(Caritas.Models.ApplicationDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // context.Content.AddOrUpdate(new Content() { ContentType="Admission", Content1="jgakg"}); } } }
apache-2.0
C#
9c381eb2f223f936562c75eda0c4d9ed3383231a
Remove seconds from Showing DisplayText.
lewishenson/FluentCineworld
FluentCineworld/Listings/Showing.cs
FluentCineworld/Listings/Showing.cs
using System; using System.Collections.Generic; using System.Diagnostics; namespace FluentCineworld.Listings { [DebuggerDisplay("Time = {Time}")] public class Showing { public DateTime Time { get; set; } public IEnumerable<string> AttributeIds { get; set; } public IEnumerable<string> AttributeTexts { get; set; } public string DisplayText { get { var attributes = string.Join(", ", this.AttributeTexts); return $"{this.Time.ToString("HH:mm")} ({attributes})"; } } } }
using System; using System.Collections.Generic; using System.Diagnostics; namespace FluentCineworld.Listings { [DebuggerDisplay("Time = {Time}")] public class Showing { public DateTime Time { get; set; } public IEnumerable<string> AttributeIds { get; set; } public IEnumerable<string> AttributeTexts { get; set; } public string DisplayText { get { var attributes = string.Join(", ", this.AttributeTexts); return $"{this.Time.TimeOfDay} ({attributes})"; } } } }
mit
C#
c7c425d6175230573320792c7e1b8dfe55907c77
Bump version to 12.0.0.25770
HearthSim/HearthDb
HearthDb/Properties/AssemblyInfo.cs
HearthDb/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("HearthDb")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HearthSim")] [assembly: AssemblyProduct("HearthDb")] [assembly: AssemblyCopyright("Copyright © HearthSim 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")] // 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("12.0.0.25770")] [assembly: AssemblyFileVersion("12.0.0.25770")]
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("HearthDb")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HearthSim")] [assembly: AssemblyProduct("HearthDb")] [assembly: AssemblyCopyright("Copyright © HearthSim 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")] // 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("11.4.0.25252")] [assembly: AssemblyFileVersion("11.4.0.25252")]
mit
C#
e73e60519e0d7d90d39aa56eef34e0c6bdf56da4
Allow all for now
dev-academy-phase4/cs-portfolio,dev-academy-phase4/cs-portfolio
Portfolio/App_Start/FilterConfig.cs
Portfolio/App_Start/FilterConfig.cs
using System.Web; using System.Web.Mvc; namespace Portfolio { public class FilterConfig { public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); //filters.Add(new AuthorizeAttribute()); filters.Add(new RequireHttpsAttribute()); } } }
using System.Web; using System.Web.Mvc; namespace Portfolio { public class FilterConfig { public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); filters.Add(new AuthorizeAttribute()); filters.Add(new RequireHttpsAttribute()); } } }
isc
C#
f4facfa651649ca86231bcec47db059811a03097
Remove args
aloisdg/RandomStringUtils
RandomStringUtils.Sample/Program.cs
RandomStringUtils.Sample/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RandomStringUtils.Sample { class Program { static void Main() { Console.WriteLine(RandomStringUtils.Random(42)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RandomStringUtils.Sample { class Program { static void Main(string[] args) { Console.WriteLine(RandomStringUtils.Random(42)); } } }
apache-2.0
C#
fd4b60d5f6b740552dde46d7a4903694f9b494b3
add comments
nessos/Eff
src/Eff/Unit.cs
src/Eff/Unit.cs
using System; namespace Nessos.Effects { /// <summary> /// A type inhabited by a single value. /// </summary> /// <remarks> /// While similar to <see cref="void"/>, the unit type is inhabited /// by a single materialized value and can be used as a generic parameter. /// </remarks> public readonly struct Unit : IEquatable<Unit> { public static Unit Value => new Unit(); public override int GetHashCode() => 1; public override bool Equals(object other) => other is Unit; public bool Equals(Unit other) => true; public static bool operator ==(Unit x, Unit y) => true; public static bool operator !=(Unit x, Unit y) => false; } }
using System; namespace Nessos.Effects { /// <summary> /// A type inhabited by a single value. /// </summary> public readonly struct Unit : IEquatable<Unit> { public static Unit Value => new Unit(); public override int GetHashCode() => 1; public override bool Equals(object other) => other is Unit; public bool Equals(Unit other) => true; public static bool operator ==(Unit x, Unit y) => true; public static bool operator !=(Unit x, Unit y) => false; } }
mit
C#
c37bdf6cf07749f53b2ec594b8e92f4e0c6d1ec1
Return 'long'
cgooley/stripe-dotnet,xamarin/XamarinStripe,gooley/stripe-dotnet,haithemaraissia/XamarinStripe
XamarinStripe/DateTimeExtensions.cs
XamarinStripe/DateTimeExtensions.cs
/* * Copyright 2011 Xamarin, Inc. * * Author(s): * Gonzalo Paniagua Javier (gonzalo@xamarin.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace Xamarin.Payments.Stripe { public static class DateTimeExtensions { static DateTime epoch = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); public static DateTime FromUnixEpoch (this int utc_unix) { return epoch.AddSeconds (utc_unix); } public static DateTime FromUnixEpoch (this long utc_unix) { return epoch.AddSeconds (utc_unix); } public static long ToUnixEpoch (this DateTime dt) { dt = dt.ToUniversalTime (); return Convert.ToInt64 ((dt - epoch).TotalSeconds); } } }
/* * Copyright 2011 Xamarin, Inc. * * Author(s): * Gonzalo Paniagua Javier (gonzalo@xamarin.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace Xamarin.Payments.Stripe { public static class DateTimeExtensions { static DateTime epoch = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); public static DateTime FromUnixEpoch (this int utc_unix) { return epoch.AddSeconds (utc_unix); } public static DateTime FromUnixEpoch (this long utc_unix) { return epoch.AddSeconds (utc_unix); } public static long ToUnixEpoch (this DateTime dt) { dt = dt.ToUniversalTime (); return Convert.ToInt32 ((dt - epoch).TotalSeconds); } } }
apache-2.0
C#
490af46d0d150ab6efa576cd78294e4ae81274e5
throw on parse error
MasDevProject/CSharp.Common
MasDev.Common/Rest/MasDev.Common.Rest.WebApi/Source/WebApi/Utils/DynamicDictionary.cs
MasDev.Common/Rest/MasDev.Common.Rest.WebApi/Source/WebApi/Utils/DynamicDictionary.cs
using System; using System.Collections.Generic; using Newtonsoft.Json; namespace MasDev.Rest.WebApi { public class DynamicDictionary { readonly Dictionary<string, string> _innerDictionary = new Dictionary<string, string> (); public T Get<T> (string key) { var json = this [key]; if (json == null) return default(T); try { return JsonConvert.DeserializeObject<T> (json); } catch { throw new BadRequestException (int.MaxValue); } } public string this [string i] { get { try { return _innerDictionary [i]; } catch (Exception) { return null; } } set { _innerDictionary [i] = value; } } internal void Add (string key, string value) { if (key == null || value == null) return; _innerDictionary.Add (key, value); } } }
using System; using System.Collections.Generic; using Newtonsoft.Json; namespace MasDev.Rest.WebApi { public class DynamicDictionary { readonly Dictionary<string, string> _innerDictionary = new Dictionary<string, string> (); public T Get<T> (string key) { var json = this [key]; if (json == null) return default(T); try { return JsonConvert.DeserializeObject<T> (json); } catch { return default(T); } } public string this [string i] { get { try { return _innerDictionary [i]; } catch (Exception) { return null; } } set { _innerDictionary [i] = value; } } internal void Add (string key, string value) { if (key == null || value == null) return; _innerDictionary.Add (key, value); } } }
mit
C#
329bf6cea0228cd8e2fb43bf54606af75461bd9d
Debug view now displays the camera position and speed.
mitchfizz05/Citysim,pigant/Citysim
Citysim/Views/DebugView.cs
Citysim/Views/DebugView.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MonoGame.Extended.BitmapFonts; namespace Citysim.Views { public class DebugView : IView { public void LoadContent(ContentManager content) { } public void Render(SpriteBatch spriteBatch, Citysim game, GameTime gameTime) { if (!game.debug) return; // Debug mode disabled StringBuilder sb = new StringBuilder(); sb.AppendLine("Citysim " + Citysim.VERSION); sb.AppendLine("Map size " + game.city.world.height + "x" + game.city.world.width); sb.AppendLine("Camera: " + game.camera.position.X + "," + game.camera.position.Y + " [" + game.camera.speed + "]"); spriteBatch.DrawString(game.font, sb, new Vector2(10, 10), Color.Black, 0F, new Vector2(0,0), 0.5F, SpriteEffects.None, 1.0F); } public void Update(Citysim game, GameTime gameTime) { // F3 toggles debug mode if (KeyboardHelper.IsKeyPressed(Keys.F3)) game.debug = !game.debug; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MonoGame.Extended.BitmapFonts; namespace Citysim.Views { public class DebugView : IView { public void LoadContent(ContentManager content) { } public void Render(SpriteBatch spriteBatch, Citysim game, GameTime gameTime) { if (!game.debug) return; // Debug mode disabled StringBuilder sb = new StringBuilder(); sb.AppendLine("Citysim " + Citysim.VERSION); sb.AppendLine("Map size " + game.city.world.height + "x" + game.city.world.width); spriteBatch.DrawString(game.font, sb, new Vector2(10, 10), Color.Black, 0F, new Vector2(0,0), 0.5F, SpriteEffects.None, 1.0F); } public void Update(Citysim game, GameTime gameTime) { // F3 toggles debug mode if (KeyboardHelper.IsKeyPressed(Keys.F3)) game.debug = !game.debug; } } }
mit
C#
41c09eff12fca3bc7d59e218b5c05175a089081f
Stabilize NodesCanConnectToEachOthers (#3238)
fassadlr/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode
src/Stratis.SmartContracts.IntegrationTests/PoW/SmartContractNodeSyncTests.cs
src/Stratis.SmartContracts.IntegrationTests/PoW/SmartContractNodeSyncTests.cs
using System.Linq; using Stratis.Bitcoin.Connection; using Stratis.Bitcoin.IntegrationTests.Common; using Stratis.SmartContracts.Tests.Common; using Xunit; namespace Stratis.SmartContracts.IntegrationTests.PoW { public sealed class SmartContractNodeSyncTests { [Fact] public void NodesCanConnectToEachOthers() { using (SmartContractNodeBuilder builder = SmartContractNodeBuilder.Create(this)) { var node1 = builder.CreateSmartContractPowNode().Start(); var node2 = builder.CreateSmartContractPowNode().Start(); Assert.Empty(node1.FullNode.ConnectionManager.ConnectedPeers); Assert.Empty(node2.FullNode.ConnectionManager.ConnectedPeers); TestHelper.Connect(node1, node2); TestHelper.WaitLoop(() => node1.FullNode.ConnectionManager.ConnectedPeers.Any()); TestHelper.WaitLoop(() => node2.FullNode.ConnectionManager.ConnectedPeers.Any()); var behavior = node1.FullNode.ConnectionManager.ConnectedPeers.First().Behaviors.OfType<IConnectionManagerBehavior>().FirstOrDefault(); Assert.False(behavior.AttachedPeer.Inbound); Assert.True(behavior.OneTry); behavior = node2.FullNode.ConnectionManager.ConnectedPeers.First().Behaviors.OfType<IConnectionManagerBehavior>().FirstOrDefault(); Assert.True(behavior.AttachedPeer.Inbound); Assert.False(behavior.OneTry); } } } }
using System.Linq; using Stratis.Bitcoin.Connection; using Stratis.Bitcoin.IntegrationTests.Common; using Stratis.Bitcoin.IntegrationTests.Common.EnvironmentMockUpHelpers; using Stratis.SmartContracts.Tests.Common; using Xunit; namespace Stratis.SmartContracts.IntegrationTests.PoW { public sealed class SmartContractNodeSyncTests { [Fact] public void NodesCanConnectToEachOthers() { using (SmartContractNodeBuilder builder = SmartContractNodeBuilder.Create(this)) { var node1 = builder.CreateSmartContractPowNode().Start(); var node2 = builder.CreateSmartContractPowNode().Start(); Assert.Empty(node1.FullNode.ConnectionManager.ConnectedPeers); Assert.Empty(node2.FullNode.ConnectionManager.ConnectedPeers); TestHelper.Connect(node1, node2); Assert.Single(node1.FullNode.ConnectionManager.ConnectedPeers); Assert.Single(node2.FullNode.ConnectionManager.ConnectedPeers); var behavior = node1.FullNode.ConnectionManager.ConnectedPeers.First().Behaviors.OfType<IConnectionManagerBehavior>().FirstOrDefault(); Assert.False(behavior.AttachedPeer.Inbound); Assert.True(behavior.OneTry); behavior = node2.FullNode.ConnectionManager.ConnectedPeers.First().Behaviors.OfType<IConnectionManagerBehavior>().FirstOrDefault(); Assert.True(behavior.AttachedPeer.Inbound); Assert.False(behavior.OneTry); } } } }
mit
C#
3b9819a965fde617efa62b5039bac1b6d6448b46
add Descendants test
thematthopkins/LINQ-to-GameObject-for-Unity,letroll/LINQ-to-GameObject-for-Unity,thematthopkins/LINQ-to-GameObject-for-Unity,letroll/LINQ-to-GameObject-for-Unity,neuecc/LINQ-to-GameObject-for-Unity
Assets/Editor/Tests/TraverseTest.cs
Assets/Editor/Tests/TraverseTest.cs
using System; using System.Linq; using System.Collections.Generic; using System.Threading; using NUnit.Framework; using UnityEngine; using Unity.Linq; namespace UnityTest { [TestFixture] internal class TraverseTest { GameObject Origin { get { return GameObject.Find("Origin"); } } [Test] public void Parent() { Origin.Parent().name.Is("Root"); } [Test] public void Children() { Origin.Children().Select(x => x.name) .IsCollection("Sphere_A", "Sphere_B", "Group", "Sphere_A", "Sphere_B"); } [Test] public void Descendants() { Origin.Descendants().Select(x => x.name) .IsCollection("Sphere_A", "Sphere_B", "Group", "P1", "P2", "P3", "P4", "Sphere_A", "Sphere_B"); } } }
using System; using System.Linq; using System.Collections.Generic; using System.Threading; using NUnit.Framework; using UnityEngine; using Unity.Linq; namespace UnityTest { [TestFixture] internal class TraverseTest { GameObject Origin { get { return GameObject.Find("Origin"); } } [Test] public void Parent() { Origin.Parent().name.Is("Root"); } [Test] public void Children() { Origin.Children().Select(x => x.name) .IsCollection("Sphere_A", "Sphere_B", "Group", "Sphere_A", "Sphere_B"); } } }
mit
C#
00b90043ebc725f5cb6565aead2aa11981565de0
add resource extension to get welcome message from bot resources; create quickreply menu with options
iperoyg/ItaimBibiGasPizzaBot
CooperativeGasPriceBot/CooperativeGasPriceBot/Receivers/BaseMessageReceiver.cs
CooperativeGasPriceBot/CooperativeGasPriceBot/Receivers/BaseMessageReceiver.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Lime.Protocol; using Takenet.MessagingHub.Client.Listener; using Takenet.MessagingHub.Client.Extensions.Contacts; using Takenet.MessagingHub.Client.Extensions.Directory; using Lime.Messaging.Resources; using Lime.Protocol.Network; using CooperativeGasPriceBot.Extensions; using Takenet.MessagingHub.Client.Sender; using Takenet.MessagingHub.Client; using CooperativeGasPriceBot.Services; using Takenet.MessagingHub.Client.Extensions.Resource; using Lime.Messaging.Contents; namespace CooperativeGasPriceBot.Receivers { public class BaseMessageReceiver : IMessageReceiver { private readonly IMessagingHubSender _sender; private readonly IContactService _contactService; private readonly IResourceExtension _resource; public BaseMessageReceiver( IMessagingHubSender sender, IContactService contactService, IResourceExtension resource ) { _sender = sender; _contactService = contactService; _resource = resource; } public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken = default(CancellationToken)) { var userNode = envelope.From.ToIdentity(); var contact = await GetContact(userNode, cancellationToken); if (_contactService.IsContactFirstTime(contact)) { var welcomeMessageResource = await _resource.GetAsync<Document>("$welcome_message", cancellationToken); //$welcome_message await _sender.SendMessageAsync(welcomeMessageResource, userNode, cancellationToken); } var mainOptions = new Select { Text = "Escolha uma das opções abaixo:", Scope = SelectScope.Immediate, // QuickReply Options = new SelectOption[2] { new SelectOption { Order = 1, Text = "Pesquisar preços", Value = PlainText.Parse("/searchPrice")}, new SelectOption { Order = 2, Text = "Informar preço", Value = PlainText.Parse("/reportPrice")}, } }; await _sender.SendMessageAsync(mainOptions, userNode, cancellationToken); } private async Task<Contact> GetContact(Identity userNode, CancellationToken cancellationToken) { return await _contactService.GetContactAsync(userNode, cancellationToken); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Lime.Protocol; using Takenet.MessagingHub.Client.Listener; using Takenet.MessagingHub.Client.Extensions.Contacts; using Takenet.MessagingHub.Client.Extensions.Directory; using Lime.Messaging.Resources; using Lime.Protocol.Network; using CooperativeGasPriceBot.Extensions; using Takenet.MessagingHub.Client.Sender; using Takenet.MessagingHub.Client; using CooperativeGasPriceBot.Services; namespace CooperativeGasPriceBot.Receivers { public class BaseMessageReceiver : IMessageReceiver { private readonly IMessagingHubSender _sender; private readonly IContactService _contactService; public BaseMessageReceiver( IMessagingHubSender sender, IContactService contactService ) { _sender = sender; _contactService = contactService; } public async Task ReceiveAsync(Message envelope, CancellationToken cancellationToken = default(CancellationToken)) { var userNode = envelope.From.ToIdentity(); var contact = await GetContact(userNode, cancellationToken); if (_contactService.IsContactFirstTime(contact)) { await _sender.SendMessageAsync("Oi! Essa é a primeira vez que vc interage cmg!", userNode, cancellationToken); } else { await _sender.SendMessageAsync("Oi! Essa não é a sua primeira vez cmg!", userNode, cancellationToken); } } private async Task<Contact> GetContact(Identity userNode, CancellationToken cancellationToken) { return await _contactService.GetContactAsync(userNode, cancellationToken); } } }
mit
C#
dadc6bc0b49d150b23ab542a63d18755c938f4c1
Fix compile
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
resharper/resharper-unity/src/Settings/AutoImportSolutionSettingsProvider.cs
resharper/resharper-unity/src/Settings/AutoImportSolutionSettingsProvider.cs
using System.Collections.Generic; using JetBrains.Application.Settings; using JetBrains.Application.Settings.Implementation; using JetBrains.ProjectModel; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.ImportType; using JetBrains.Util; namespace JetBrains.ReSharper.Plugins.Unity.Settings { [SolutionComponent] public class AutoImportSolutionSettingsProvider : IUnitySolutionSettingsProvider { private readonly ISettingsSchema mySettingsSchema; private readonly ILogger myLogger; public AutoImportSolutionSettingsProvider(ISettingsSchema settingsSchema, ILogger logger) { mySettingsSchema = settingsSchema; myLogger = logger; } public void InitialiseSolutionSettings(ISettingsStorageMountPoint mountPoint) { // Remove items from auto completion. Anything in these namespaces, or matching the method name will not // show in the auto import completion lists, and will not get the auto-import alt+enter tooltip popup. // If you want to use a type that matches, you need to add the using statement manually. // * Ignore Bool.Lang.* and UnityScript.* as they were deprecated in late 2017, and most of the code there // is not intended to be consumed by users, but the assemblies are still referenced. This prevents e.g.: // Boo.Lang.List`1 from appearing in the completion list above System.Collections.Generic.List`1 // * Also exclude System.Diagnostics.Debug() to prevent similar clashes with UnityEngine.Debug() // See the internal DumpDuplicateTypeNamesAction to generate a list of types that can clash. There are about // 80 types on this list. It's not worth ignoring all of them. But some candidates: // * System.Numerics.Vector{2,3,4} + Quaternion + Plane // * System.Random + UnityEngine.Random AddAutoImportExclusions(mountPoint, "Boo.Lang.*", "UnityScript.*", "System.Diagnostics.Debug"); } private void AddAutoImportExclusions(ISettingsStorageMountPoint mountPoint, params string[] settings) { var entry = mySettingsSchema.GetIndexedEntry((AutoImport2Settings s) => s.BlackLists); var indexedKey = new Dictionary<SettingsKey, object> { {mySettingsSchema.GetKey<AutoImport2Settings>(), CSharpLanguage.Name} }; foreach (var setting in settings) ScalarSettingsStoreAccess.SetIndexedValue(mountPoint, entry, setting, indexedKey, true, null, myLogger); } } }
using System.Collections.Generic; using JetBrains.Application.Settings; using JetBrains.Application.Settings.Implementation; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.ImportType.BlockList; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.Util; namespace JetBrains.ReSharper.Plugins.Unity.Settings { [SolutionComponent] public class AutoImportSolutionSettingsProvider : IUnitySolutionSettingsProvider { private readonly ISettingsSchema mySettingsSchema; private readonly ILogger myLogger; public AutoImportSolutionSettingsProvider(ISettingsSchema settingsSchema, ILogger logger) { mySettingsSchema = settingsSchema; myLogger = logger; } public void InitialiseSolutionSettings(ISettingsStorageMountPoint mountPoint) { // Remove items from auto completion. Anything in these namespaces, or matching the method name will not // show in the auto import completion lists, and will not get the auto-import alt+enter tooltip popup. // If you want to use a type that matches, you need to add the using statement manually. // * Ignore Bool.Lang.* and UnityScript.* as they were deprecated in late 2017, and most of the code there // is not intended to be consumed by users, but the assemblies are still referenced. This prevents e.g.: // Boo.Lang.List`1 from appearing in the completion list above System.Collections.Generic.List`1 // * Also exclude System.Diagnostics.Debug() to prevent similar clashes with UnityEngine.Debug() // See the internal DumpDuplicateTypeNamesAction to generate a list of types that can clash. There are about // 80 types on this list. It's not worth ignoring all of them. But some candidates: // * System.Numerics.Vector{2,3,4} + Quaternion + Plane // * System.Random + UnityEngine.Random AddAutoImportExclusions(mountPoint, "Boo.Lang.*", "UnityScript.*", "System.Diagnostics.Debug"); } private void AddAutoImportExclusions(ISettingsStorageMountPoint mountPoint, params string[] settings) { var entry = mySettingsSchema.GetIndexedEntry((AutoImport2Settings s) => s.BlackLists); var indexedKey = new Dictionary<SettingsKey, object> { {mySettingsSchema.GetKey<AutoImport2Settings>(), CSharpLanguage.Name} }; foreach (var setting in settings) ScalarSettingsStoreAccess.SetIndexedValue(mountPoint, entry, setting, indexedKey, true, null, myLogger); } } }
apache-2.0
C#
0f16fc65ad8ffc76e7d38c356468b8aefaedd779
Fix bug in User-Model
Frostymalts/xamarin-store-app,anasonov/xamarin-store-app,melvinlee/xamarin-store-app,fellipecouto96/xamarin-store-app,BytesGuy/xamarin-store-app,zleao/xamarin-store-app,enspdf/xamarin-store-app,noorthapa/xamarin-store-app,zayenCh/xamarin-store-app
Shared/Models/User.cs
Shared/Models/User.cs
using System; using System.Threading.Tasks; namespace XamarinStore { public class User { public User () { } public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } public string Token { get; set; } public string Phone {get;set;} public string Address { get; set; } public string Address2 { get; set; } public string City { get; set; } public string State { get; set; } public string Country { get; set; } public string ZipCode { get; set; } public async Task<Tuple<bool,string>> IsInformationValid() { if (string.IsNullOrEmpty (FirstName)) return new Tuple<bool, string>(false,"First name is required"); if (string.IsNullOrEmpty (LastName)) return new Tuple<bool, string>(false,"Last name is required"); if (string.IsNullOrEmpty (Phone)) return new Tuple<bool, string>(false,"Phone number is required"); if (string.IsNullOrEmpty (FirstName)) return new Tuple<bool, string>(false,"First name is required"); if (string.IsNullOrEmpty (LastName)) return new Tuple<bool, string>(false,"Last name is required"); if(string.IsNullOrEmpty(Address)) return new Tuple<bool, string>(false,"Address is required"); if (string.IsNullOrEmpty (City)) return new Tuple<bool, string>(false,"City is required"); if (!string.IsNullOrEmpty (Country) && Country.ToLower () == "usa") { var states = await WebService.Shared.GetStates (await WebService.Shared.GetCountryFromCode(Country)); if(!states.Contains(State)) return new Tuple<bool, string> (false, "State is required"); } if (string.IsNullOrEmpty (Country)) return new Tuple<bool, string>(false,"Country is required"); if (string.IsNullOrEmpty (ZipCode)) return new Tuple<bool, string>(false,"ZipCode is required"); return new Tuple<bool, string>(true,""); } } }
using System; using System.Threading.Tasks; namespace XamarinStore { public class User { public User () { } public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } public string Token { get; set; } public string Phone {get;set;} public string Address { get; set; } public string Address2 { get; set; } public string City { get; set; } public string State { get; set; } public string Country { get; set; } public string ZipCode { get; set; } public async Task<Tuple<bool,string>> IsInformationValid() { if (string.IsNullOrEmpty (FirstName)) return new Tuple<bool, string>(false,"First name is required"); if (string.IsNullOrEmpty (LastName)) return new Tuple<bool, string>(false,"Last name is required"); if (string.IsNullOrEmpty (Phone)) return new Tuple<bool, string>(false,"Phone number is required"); if (string.IsNullOrEmpty (FirstName)) return new Tuple<bool, string>(false,"First name is required"); if (string.IsNullOrEmpty (LastName)) return new Tuple<bool, string>(false,"Last name is required"); if(string.IsNullOrEmpty(Address)) return new Tuple<bool, string>(false,"Address is required"); if (string.IsNullOrEmpty (City)) return new Tuple<bool, string>(false,"City is required"); if (Country.ToLower () == "usa") { var states = await WebService.Shared.GetStates (await WebService.Shared.GetCountryFromCode(Country)); if(!states.Contains(State)) return new Tuple<bool, string> (false, "State is required"); } if (string.IsNullOrEmpty (Country)) return new Tuple<bool, string>(false,"Country is required"); if (string.IsNullOrEmpty (ZipCode)) return new Tuple<bool, string>(false,"ZipCode is required"); return new Tuple<bool, string>(true,""); } } }
mit
C#
8f5cd49c0d5f2b1cfcb04b9ba066cbb73549dd43
Edit it
sta/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp,sta/websocket-sharp,jogibear9988/websocket-sharp,sta/websocket-sharp
websocket-sharp/Server/IWebSocketSession.cs
websocket-sharp/Server/IWebSocketSession.cs
#region License /* * IWebSocketSession.cs * * The MIT License * * Copyright (c) 2013-2014 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion using System; using WebSocketSharp.Net.WebSockets; namespace WebSocketSharp.Server { /// <summary> /// Exposes the access to the information in a WebSocket session. /// </summary> public interface IWebSocketSession { #region Properties /// <summary> /// Gets the information in the connection request to the WebSocket service. /// </summary> /// <value> /// A <see cref="WebSocketContext"/> that provides the access to the connection request. /// </value> WebSocketContext Context { get; } /// <summary> /// Gets the unique ID of the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the unique ID of the session. /// </value> string ID { get; } /// <summary> /// Gets the WebSocket subprotocol used in the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the subprotocol if any. /// </value> string Protocol { get; } /// <summary> /// Gets the time that the session has started. /// </summary> /// <value> /// A <see cref="DateTime"/> that represents the time that the session has started. /// </value> DateTime StartTime { get; } /// <summary> /// Gets the state of the <see cref="WebSocket"/> used in the session. /// </summary> /// <value> /// One of the <see cref="WebSocketState"/> enum values, indicates the state of /// the <see cref="WebSocket"/> used in the session. /// </value> WebSocketState State { get; } #endregion } }
#region License /* * IWebSocketSession.cs * * The MIT License * * Copyright (c) 2013-2014 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion using System; using WebSocketSharp.Net.WebSockets; namespace WebSocketSharp.Server { /// <summary> /// Exposes the properties used to access the information in a session in a WebSocket service. /// </summary> public interface IWebSocketSession { #region Properties /// <summary> /// Gets the information in the connection request to the WebSocket service. /// </summary> /// <value> /// A <see cref="WebSocketContext"/> that provides the access to the connection request. /// </value> WebSocketContext Context { get; } /// <summary> /// Gets the unique ID of the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the unique ID of the session. /// </value> string ID { get; } /// <summary> /// Gets the WebSocket subprotocol used in the session. /// </summary> /// <value> /// A <see cref="string"/> that represents the subprotocol if any. /// </value> string Protocol { get; } /// <summary> /// Gets the time that the session has started. /// </summary> /// <value> /// A <see cref="DateTime"/> that represents the time that the session has started. /// </value> DateTime StartTime { get; } /// <summary> /// Gets the state of the <see cref="WebSocket"/> used in the session. /// </summary> /// <value> /// One of the <see cref="WebSocketState"/> enum values, indicates the state of /// the <see cref="WebSocket"/> used in the session. /// </value> WebSocketState State { get; } #endregion } }
mit
C#
3463dd493daedd6c9c9f8f803a73d776575ef030
Fix nl_NL locale (#189)
Viincenttt/MollieApi,Viincenttt/MollieApi
Mollie.Api/Models/Payment/Locale.cs
Mollie.Api/Models/Payment/Locale.cs
namespace Mollie.Api.Models.Payment { public static class Locale { public static string de_DE = "de_DE"; public static string en_US = "en_US"; public static string es_ES = "es_ES"; public static string fr_FR = "fr_FR"; public static string nl_BE = "nl_BE"; public static string fr_BE = "fr_BE"; public static string nl_NL = "nl_NL"; } }
namespace Mollie.Api.Models.Payment { public static class Locale { public static string de_DE = "de_DE"; public static string en_US = "en_US"; public static string es_ES = "es_ES"; public static string fr_FR = "fr_FR"; public static string nl_BE = "nl_BE"; public static string fr_BE = "fr_BE"; public static string nl_NL = "nl_BE"; } }
mit
C#
05c17d267bb94272dfb94282166756294632c2b6
Delete some of index
SpilledMilkCOM/ParkerSmart,SpilledMilkCOM/ParkerSmart,SpilledMilkCOM/ParkerSmart
ParkerSmart/Views/Home/Index.cshtml
ParkerSmart/Views/Home/Index.cshtml
@{ ViewBag.Title = "Home Page"; } <div class="jumbotron"> <h1>ASP.NET</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> <p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p> </div> <div class="row"> </div>
@{ ViewBag.Title = "Home Page"; } <div class="jumbotron"> <h1>ASP.NET</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> <p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p> </div> <div class="row"> <div class="col-md-4"> <h2>Getting started</h2> <p> ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and gives you full control over markup for enjoyable, agile development. </p> <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p> </div> </div>
mit
C#
087b90e7d70dd18175afb2f1de480b48b02c9df8
Add link for more info about WebGrid.Column
Neurothustra/ProductGrid,Neurothustra/ProductGrid,Neurothustra/ProductGrid
ProductGrid/Views/Home/Index.cshtml
ProductGrid/Views/Home/Index.cshtml
@model IEnumerable<ProductGrid.Models.Product> @{ ViewBag.Title = "Index"; //WebGrid displays data on a web page using an HTML table element. //In this instance, I've provided the constructor with a couple of arguments: Model is obviously the data object, //ajaxUpdateContainerId looks in the DOM for the Id container to make dynamic Ajax updates, defaultSort indicates the default //column on which to begin filtering //more info at https://msdn.microsoft.com/en-us/library/system.web.helpers.webgrid(v=vs.111).aspx WebGrid grid = new WebGrid(Model, ajaxUpdateContainerId: "productGrid", defaultSort: "Name"); } <h2>Index</h2> <p> @Html.ActionLink("Create New", "Create") </p> <div id="productGrid"> @*Returns the HTML markup that is used to render the WebGrid instance and using the specified paging options. more information at https://msdn.microsoft.com/en-us/library/system.web.helpers.webgrid.gethtml(v=vs.111).aspx*@ @grid.GetHtml(tableStyle: "grid", headerStyle: "header", footerStyle: "footer", alternatingRowStyle: "alternate", selectedRowStyle: "selected", columns: grid.Columns( //Create the ActionLink to enable linking to other views, such as Details or Edit //More info at https://msdn.microsoft.com/en-us/magazine/hh288075.aspx grid.Column("Name", format: @<text>@Html.ActionLink((string)item.Name, "Edit", "Home", new {id=item.ProductId}, null)</text>), grid.Column("Description", "Description", style: "description"), grid.Column("Quantity", "Quantity") )) </div>
@model IEnumerable<ProductGrid.Models.Product> @{ ViewBag.Title = "Index"; //WebGrid displays data on a web page using an HTML table element. //In this instance, I've provided the constructor with a couple of arguments: Model is obviously the data object, //ajaxUpdateContainerId looks in the DOM for the Id container to make dynamic Ajax updates, defaultSort indicates the default //column on which to begin filtering //more info at https://msdn.microsoft.com/en-us/library/system.web.helpers.webgrid(v=vs.111).aspx WebGrid grid = new WebGrid(Model, ajaxUpdateContainerId: "productGrid", defaultSort: "Name"); } <h2>Index</h2> <p> @Html.ActionLink("Create New", "Create") </p> <div id="productGrid"> @*Returns the HTML markup that is used to render the WebGrid instance and using the specified paging options. more information at https://msdn.microsoft.com/en-us/library/system.web.helpers.webgrid.gethtml(v=vs.111).aspx*@ @grid.GetHtml(tableStyle: "grid", headerStyle: "header", footerStyle: "footer", alternatingRowStyle: "alternate", selectedRowStyle: "selected", columns: grid.Columns( //Create the ActionLink to enable linking to other views, such as Details or Edit grid.Column("Name", format: @<text>@Html.ActionLink((string)item.Name, "Edit", "Home", new {id=item.ProductId}, null)</text>), grid.Column("Description", "Description", style: "description"), grid.Column("Quantity", "Quantity") )) </div>
mit
C#
5445bb931aecb760d8abe2439f9d36fd88f006e5
Remove Duplicate Path Parameters
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
src/Server/Bit.WebApi/Implementations/SwaggerDefaultValuesOperationFilter.cs
src/Server/Bit.WebApi/Implementations/SwaggerDefaultValuesOperationFilter.cs
using Swashbuckle.Swagger; using System.Linq; using System.Web.Http.Description; namespace Bit.WebApi.Implementations { /// <summary> /// Represents the Swagger/Swashbuckle operation filter used to provide default values. /// </summary> /// <remarks>This <see cref="IOperationFilter"/> is only required due to bugs in the <see cref="SwaggerGenerator"/>. /// Once they are fixed and published, this class can be removed.</remarks> public class SwaggerDefaultValuesOperationFilter : IOperationFilter { /// <summary> /// Applies the filter to the specified operation using the given context. /// </summary> /// <param name="operation">The operation to apply the filter to.</param> /// <param name="schemaRegistry">The API schema registry.</param> /// <param name="apiDescription">The API description being filtered.</param> public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription) { if (operation.parameters == null) { return; } foreach (Parameter parameter in operation.parameters) { var parameterName = parameter.name; if (parameterName.Contains('.')) parameterName = parameter.name.Split('.')[0]; ApiParameterDescription description = apiDescription.ParameterDescriptions.First(p => p.Name == parameterName); // REF: https://github.com/domaindrivendev/Swashbuckle/issues/1101 if (parameter.description == null) { parameter.description = description.Documentation; } // REF: https://github.com/domaindrivendev/Swashbuckle/issues/1089 // REF: https://github.com/domaindrivendev/Swashbuckle/pull/1090 if (parameter.@default == null) { parameter.@default = description.ParameterDescriptor?.DefaultValue; } } } } }
using Swashbuckle.Swagger; using System.Linq; using System.Web.Http.Description; namespace Bit.WebApi.Implementations { /// <summary> /// Represents the Swagger/Swashbuckle operation filter used to provide default values. /// </summary> /// <remarks>This <see cref="IOperationFilter"/> is only required due to bugs in the <see cref="SwaggerGenerator"/>. /// Once they are fixed and published, this class can be removed.</remarks> public class SwaggerDefaultValuesOperationFilter : IOperationFilter { /// <summary> /// Applies the filter to the specified operation using the given context. /// </summary> /// <param name="operation">The operation to apply the filter to.</param> /// <param name="schemaRegistry">The API schema registry.</param> /// <param name="apiDescription">The API description being filtered.</param> public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription) { if (operation.parameters == null) { return; } foreach (Parameter parameter in operation.parameters) { ApiParameterDescription description = apiDescription.ParameterDescriptions.First(p => p.Name == parameter.name); // REF: https://github.com/domaindrivendev/Swashbuckle/issues/1101 if (parameter.description == null) { parameter.description = description.Documentation; } // REF: https://github.com/domaindrivendev/Swashbuckle/issues/1089 // REF: https://github.com/domaindrivendev/Swashbuckle/pull/1090 if (parameter.@default == null) { parameter.@default = description.ParameterDescriptor?.DefaultValue; } } } } }
mit
C#
218646724a8359166e5061480d100601fc95eea5
Update assembly attribute values
BrandonLWhite/UnitsNet,anjdreas/UnitsNet,neutmute/UnitsNet,anjdreas/UnitsNet,BrandonLWhite/UnitsNet
UnitsNet/Properties/AssemblyInfo.cs
UnitsNet/Properties/AssemblyInfo.cs
// Copyright(c) 2007 Andreas Gullberg Larsen // https://github.com/anjdreas/UnitsNet // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Reflection; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Units.NET")] [assembly: AssemblyDescription("Units.NET gives you all the common units of measurement and the conversions between them. It is light-weight, unit tested and supports PCL.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Andreas Gullberg Larsen")] [assembly: AssemblyProduct("Units.NET")] [assembly: AssemblyCopyright("Copyright © 2007 Andreas Gullberg Larsen")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("")] [assembly: CLSCompliant(true)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("3.28.1")] [assembly: AssemblyFileVersion("3.28.1")]
// Copyright(c) 2007 Andreas Gullberg Larsen // https://github.com/anjdreas/UnitsNet // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Reflection; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("UnitsNet")] [assembly: AssemblyDescription( "Data structures and helper methods to convert values between units, parse value and unit from text or get textual representation." )] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Initial Force AS")] [assembly: AssemblyProduct("UnitsNet")] [assembly: AssemblyCopyright("Copyright © 2007-2016 Initial Force AS")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("")] [assembly: CLSCompliant(true)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("3.28.1")] [assembly: AssemblyFileVersion("3.28.1")]
mit
C#
27d7c3326f407e94ed80e6f708a0c96af77a153b
add Get2DLocalPosFrom3DWorldPos
NDark/ndinfrastructure,NDark/ndinfrastructure
Unity/UnityTools/CoordinateTools.cs
Unity/UnityTools/CoordinateTools.cs
/** MIT License Copyright (c) 2017 - 2020 NDark Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** @file CoordinateTools.cs @date 20180922 . add UpdateRectFrom3DWorldPos(). */ using UnityEngine; public static class CoordinateTools { public static Vector3 Get2DLocalPosFrom3DWorldPos(Camera _3DCamera , Camera _2DCamera , Vector3 _3DWorldPos , GameObject _Ref2DObj ) { Vector3 screen = _3DCamera.WorldToScreenPoint(_3DWorldPos); screen.z = 0; Vector3 world = _2DCamera.ScreenToWorldPoint(screen); Vector3 local = _Ref2DObj.transform.InverseTransformPoint( new Vector3(world.x, world.y) ) ; return local; } public static void Update2DFrom3DWorldPos( Camera _3DCamera , Camera _2DCamera , Vector3 _3DWorldPos , GameObject _2DObj ) { Vector3 screen = _3DCamera.WorldToScreenPoint( _3DWorldPos ) ; screen.z = 0 ; Vector3 world = _2DCamera.ScreenToWorldPoint( screen ); _2DObj.transform.position = new Vector3( world.x , world.y ) ; Vector3 local = _2DObj.transform.localPosition ; local.z = 0 ; _2DObj.transform.localPosition = local ; } public static void UpdateRectFrom3DWorldPos( Camera _3DCamera , Vector3 _3DWorldPos , RectTransform _2DRect ) { Vector3 screen = _3DCamera.WorldToScreenPoint( _3DWorldPos ) ; _2DRect.position = screen; } }
/** MIT License Copyright (c) 2017 - 2020 NDark Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** @file CoordinateTools.cs @date 20180922 . add UpdateRectFrom3DWorldPos(). */ using UnityEngine; public static class CoordinateTools { public static void Update2DFrom3DWorldPos( Camera _3DCamera , Camera _2DCamera , Vector3 _3DWorldPos , GameObject _2DObj ) { Vector3 screen = _3DCamera.WorldToScreenPoint( _3DWorldPos ) ; screen.z = 0 ; Vector3 world = _2DCamera.ScreenToWorldPoint( screen ); _2DObj.transform.position = new Vector3( world.x , world.y ) ; Vector3 local = _2DObj.transform.localPosition ; local.z = 0 ; _2DObj.transform.localPosition = local ; } public static void UpdateRectFrom3DWorldPos( Camera _3DCamera , Vector3 _3DWorldPos , RectTransform _2DRect ) { Vector3 screen = _3DCamera.WorldToScreenPoint( _3DWorldPos ) ; _2DRect.position = screen; } }
mit
C#
06cabdc864e2f9e994f5f30845d5b6b430bdaf43
Switch JSONValue to a readonly struct type.
r3c/Verse
Verse/src/Schemas/JSON/JSONValue.cs
Verse/src/Schemas/JSON/JSONValue.cs
namespace Verse.Schemas.JSON { /// <summary> /// Native JSON value. /// </summary> public readonly struct JSONValue { /// <summary> /// Boolean value (only set if type is boolean). /// </summary> public readonly bool Boolean; /// <summary> /// Numeric value (only set if type is number). /// </summary> public readonly double Number; /// <summary> /// String value (only set if type is string). /// </summary> public readonly string String; /// <summary> /// Value content type. /// </summary> public readonly JSONType Type; /// <summary> /// Static instance of undefined value. /// </summary> public static readonly JSONValue Void = new JSONValue(); /// <summary> /// Create a new boolean JSON value. /// </summary> /// <param name="value">Boolean value</param> /// <returns>JSON boolean value</returns> public static JSONValue FromBoolean(bool value) { return new JSONValue(JSONType.Boolean, value, default, default); } /// <summary> /// Create a new number JSON value. /// </summary> /// <param name="value">Number value</param> /// <returns>JSON number value</returns> public static JSONValue FromNumber(double value) { return new JSONValue(JSONType.Number, default, value, default); } /// <summary> /// Create a new string JSON value. /// </summary> /// <param name="value">String value</param> /// <returns>JSON string value</returns> public static JSONValue FromString(string value) { return new JSONValue(JSONType.String, default, default, value); } private JSONValue(JSONType type, bool boolean, double number, string str) { this.Boolean = boolean; this.Number = number; this.String = str; this.Type = type; } } }
namespace Verse.Schemas.JSON { /// <summary> /// Native JSON value. /// </summary> public struct JSONValue { /// <summary> /// Boolean value (only set if type is boolean). /// </summary> public bool Boolean; /// <summary> /// Numeric value (only set if type is number). /// </summary> public double Number; /// <summary> /// String value (only set if type is string). /// </summary> public string String; /// <summary> /// Value content type. /// </summary> public JSONType Type; /// <summary> /// Static instance of undefined value. /// </summary> public static readonly JSONValue Void = new JSONValue(); /// <summary> /// Create a new boolean JSON value. /// </summary> /// <param name="value">Boolean value</param> /// <returns>JSON boolean value</returns> public static JSONValue FromBoolean(bool value) { return new JSONValue { Boolean = value, Type = JSONType.Boolean }; } /// <summary> /// Create a new number JSON value. /// </summary> /// <param name="value">Number value</param> /// <returns>JSON number value</returns> public static JSONValue FromNumber(double value) { return new JSONValue { Number = value, Type = JSONType.Number }; } /// <summary> /// Create a new string JSON value. /// </summary> /// <param name="value">String value</param> /// <returns>JSON string value</returns> public static JSONValue FromString(string value) { return new JSONValue { String = value, Type = JSONType.String }; } } }
mit
C#
1bc509b46f76a5299b631df105b763ddcaddf346
Add readonly in ContextKey property
thiagolunardi/MvcMusicStoreDDD
MvcMusicStore.Data.Context/ContextManager.cs
MvcMusicStore.Data.Context/ContextManager.cs
using System.Web; using MvcMusicStore.Data.Context.Interfaces; namespace MvcMusicStore.Data.Context { public class ContextManager<TContext> : IContextManager<TContext> where TContext : IDbContext, new() { private readonly string ContextKey; public ContextManager() { ContextKey = "ContextKey." + typeof(TContext).Name; } public IDbContext GetContext() { if (HttpContext.Current.Items[ContextKey] == null) HttpContext.Current.Items[ContextKey] = new TContext(); return HttpContext.Current.Items[ContextKey] as IDbContext; } public void Finish() { if (HttpContext.Current.Items[ContextKey] != null) (HttpContext.Current.Items[ContextKey] as IDbContext).Dispose(); } } }
using System.Web; using MvcMusicStore.Data.Context.Interfaces; namespace MvcMusicStore.Data.Context { public class ContextManager<TContext> : IContextManager<TContext> where TContext : IDbContext, new() { private string ContextKey = "ContextManager.Context"; public ContextManager() { ContextKey = "ContextKey." + typeof(TContext).Name; } public IDbContext GetContext() { if (HttpContext.Current.Items[ContextKey] == null) HttpContext.Current.Items[ContextKey] = new TContext(); return HttpContext.Current.Items[ContextKey] as IDbContext; } public void Finish() { if (HttpContext.Current.Items[ContextKey] != null) (HttpContext.Current.Items[ContextKey] as IDbContext).Dispose(); } } }
mit
C#
eb4ee3bef4fc70366e7f3b23b8d483c7a7b15a89
Fix cast crash in AppItemView
File-New-Project/EarTrumpet
EarTrumpet/UI/Views/AppItemView.xaml.cs
EarTrumpet/UI/Views/AppItemView.xaml.cs
using EarTrumpet.UI.ViewModels; using System.Windows; using System.Windows.Controls; namespace EarTrumpet.UI.Views { public partial class AppItemView : UserControl { private IAppItemViewModel App => (IAppItemViewModel)DataContext; public AppItemView() { InitializeComponent(); PreviewMouseRightButtonUp += AppVolumeControl_PreviewMouseRightButtonUp; } private void AppVolumeControl_PreviewMouseRightButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { ExpandApp(); } private void MuteButton_Click(object sender, RoutedEventArgs e) { App.IsMuted = !App.IsMuted; e.Handled = true; } public void ExpandApp() { App.OpenPopup(this); } private void UserControl_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e) { App.RefreshDisplayName(); } } }
using EarTrumpet.UI.ViewModels; using System.Windows; using System.Windows.Controls; namespace EarTrumpet.UI.Views { public partial class AppItemView : UserControl { private AppItemViewModel App => (AppItemViewModel)DataContext; public AppItemView() { InitializeComponent(); PreviewMouseRightButtonUp += AppVolumeControl_PreviewMouseRightButtonUp; } private void AppVolumeControl_PreviewMouseRightButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { ExpandApp(); } private void MuteButton_Click(object sender, RoutedEventArgs e) { App.IsMuted = !App.IsMuted; e.Handled = true; } public void ExpandApp() { App.OpenPopup(this); } private void UserControl_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e) { App.RefreshDisplayName(); } } }
mit
C#
eedd6154e5dd742420c433ab78bf2b305352ae69
upgrade version
ezaurum/dapper
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("dapper extention")] [assembly: AssemblyDescription("dapper auto generated repository extension")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ezaurum")] [assembly: AssemblyProduct("dapper extention")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("c3a998b9-1a09-4589-9e91-481383acb2ec")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.1.17")] [assembly: AssemblyFileVersion("0.0.1.17")]
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("dapper extention")] [assembly: AssemblyDescription("dapper auto generated repository extension")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ezaurum")] [assembly: AssemblyProduct("dapper extention")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("c3a998b9-1a09-4589-9e91-481383acb2ec")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.1.16")] [assembly: AssemblyFileVersion("0.0.1.16")]
mit
C#
8f052c4a2de71c956ca55ea2d19128990b698ac0
Increment nuget version.
lukesampson/HastyAPI,lukesampson/HastyAPI
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("HastyAPI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HastyAPI")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9090dc7c-d62c-41d3-9296-7ef2e1610a2f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.12")] [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("HastyAPI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HastyAPI")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9090dc7c-d62c-41d3-9296-7ef2e1610a2f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.10")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
632f47d36599f39b2baa3075b65fafbaf4e2a0a9
Use Collection instead of List for consistency
code4romania/anabi-gestiune-api,code4romania/anabi-gestiune-api,code4romania/anabi-gestiune-api
Anabi.DataAccess.Ef/DbModels/AssetDb.cs
Anabi.DataAccess.Ef/DbModels/AssetDb.cs
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Text; namespace Anabi.DataAccess.Ef.DbModels { public class AssetDb : BaseEntity { public string Name { get; set; } public int? AddressId { get; set; } public virtual AddressDb Address { get; set; } public int CategoryId { get; set; } public virtual CategoryDb Category { get; set; } public string Description { get; set; } public int? DecisionId { get; set; } public virtual DecisionDb CurrentDecision { get; set; } public string Identifier { get; set; } public decimal? NecessaryVolume { get; set; } public virtual ICollection<HistoricalStageDb> HistoricalStages { get; set; } = new Collection<HistoricalStageDb>(); public bool IsDeleted { get; set; } public int? NrOfObjects { get; set; } public string MeasureUnit { get; set; } public string Remarks { get; set; } public virtual ICollection<AssetsFileDb> FilesForAsset { get; set; } public virtual ICollection<AssetStorageSpaceDb> AssetsStorageSpaces { get; set; } public virtual ICollection<AssetDefendantDb> Defendants { get; set; } } }
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Text; namespace Anabi.DataAccess.Ef.DbModels { public class AssetDb : BaseEntity { public string Name { get; set; } public int? AddressId { get; set; } public virtual AddressDb Address { get; set; } public int CategoryId { get; set; } public virtual CategoryDb Category { get; set; } public string Description { get; set; } public int? DecisionId { get; set; } public virtual DecisionDb CurrentDecision { get; set; } public string Identifier { get; set; } public decimal? NecessaryVolume { get; set; } public List<HistoricalStageDb> HistoricalStages { get; set; } = new List<HistoricalStageDb>(); public bool IsDeleted { get; set; } public int? NrOfObjects { get; set; } public string MeasureUnit { get; set; } public string Remarks { get; set; } public virtual ICollection<AssetsFileDb> FilesForAsset { get; set; } public virtual ICollection<AssetStorageSpaceDb> AssetsStorageSpaces { get; set; } public virtual ICollection<AssetDefendantDb> Defendants { get; set; } } }
mpl-2.0
C#
9c09a745ded102dbfa2a53db9de1a61f3750379c
Connect routine
L4fter/CrocoDie
Assets/Src/Controller/GameController.cs
Assets/Src/Controller/GameController.cs
using System; using UnityEngine; using System.Collections; public class GameController : MonoBehaviour { public NetworkView NetworkView; private bool controlMan; // Use this for initialization void Start () { DontDestroyOnLoad(this.gameObject); } // Update is called once per frame void Update () { } public void LoadSingleGame() { controlMan = false; Application.LoadLevel("TestLevel"); } public void LoadServerGame() { Debug.Log("Loading server game..."); controlMan = false; NetworkView.RPC("LoadClientGame", RPCMode.All, !controlMan); Application.LoadLevel("TestLevel"); } public void LoadClientGame(bool controlMan) { Debug.Log("Loading client game..."); this.controlMan = controlMan; Application.LoadLevel("TestLevel"); } public void Host() { var useNat = !Network.HavePublicAddress(); var er = Network.InitializeServer(32, 25000, useNat); Debug.Log("Hosting error: " + er); } public void Connect() { StartCoroutine(this.ConnectRoutine()); } private IEnumerator ConnectRoutine() { var er = Network.Connect("127.0.0.1", 25000); var error = true; var count = 0; while (error && count < 5) { try { NetworkView.RPC("LoadServerGame", RPCMode.All); error = false; } catch (Exception e) { error = true; } if (error) { count++; yield return new WaitForSeconds(1); } error = false; } } }
using UnityEngine; using System.Collections; public class GameController : MonoBehaviour { public NetworkView NetworkView; private bool controlMan; // Use this for initialization void Start () { DontDestroyOnLoad(this.gameObject); } // Update is called once per frame void Update () { } public void LoadSingleGame() { controlMan = false; Application.LoadLevel("TestLevel"); } public void LoadServerGame() { Debug.Log("Loading server game..."); controlMan = false; NetworkView.RPC("LoadClientGame", RPCMode.All, !controlMan); Application.LoadLevel("TestLevel"); } public void LoadClientGame(bool controlMan) { Debug.Log("Loading client game..."); this.controlMan = controlMan; Application.LoadLevel("TestLevel"); } public void Host() { var useNat = !Network.HavePublicAddress(); var er = Network.InitializeServer(32, 25000, useNat); Debug.Log("Hosting error: " + er); } public void Connect() { var er = Network.Connect("127.0.0.1", 25000); if (er == NetworkConnectionError.NoError) { NetworkView.RPC("LoadServerGame", RPCMode.All); } } }
mit
C#
e19bf6f9f9f7c43cddff2cb4e1f73d2dc17746aa
fix incorrect error code type
taxomania/ReceiptBank-WindowsSDK
ReceiptBankLibrary/Model/ReceiptBankError.cs
ReceiptBankLibrary/Model/ReceiptBankError.cs
using System.Runtime.Serialization; using Newtonsoft.Json; namespace Taxomania.ReceiptBank.Model { [DataContract] public sealed class ReceiptBankError { [DataMember(Name = "errorcode")] public int Code { get; set; } [DataMember(Name = "errormessage")] public string Message { get; set; } public override string ToString() { return JsonConvert.SerializeObject(this); } } }
using System.Runtime.Serialization; using Newtonsoft.Json; namespace Taxomania.ReceiptBank.Model { [DataContract] public sealed class ReceiptBankError { [DataMember(Name = "errorcode")] public string Code { get; set; } [DataMember(Name = "errormessage")] public string Message { get; set; } public override string ToString() { return JsonConvert.SerializeObject(this); } } }
mit
C#
6ba341de741dca57c244c2fb4f311c26b4dc3615
include favicon in head tag
JakeLunn/Landmine.Web,akatakritos/Landmine.Web,akatakritos/Landmine.Web,JakeLunn/Landmine.Web,JakeLunn/Landmine.Web,akatakritos/Landmine.Web,akatakritos/Landmine.Web,JakeLunn/Landmine.Web
LandmineWeb/Views/Shared/_Layout.cshtml
LandmineWeb/Views/Shared/_Layout.cshtml
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="shortcut icon" href="/favicon.ico" /> <title>@ViewBag.Title - Landmine</title> @Styles.Render("~/Content/css") @Html.Partial("_Rollbar") @Html.Partial("_GoogleAnalytics") </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> @Html.ActionLink("Landmine", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li>@Html.ActionLink("Home", "Index", "Home")</li> <li>@Html.ActionLink("Leaderboard", "Index", "Leaderboard")</li> </ul> </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - <a href="http://www.mattburkedev.com">Matt Burke</a></p> <p> <a href="https://twitter.com/akatakritos/">Twitter</a> &bull; <a href="https://github.com/akatakritos/">Github</a> &bull; <a href="http://www.linkedin.com/pub/matt-burke/50/8b8/895">LinkedIn</a> </footer> </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @Scripts.Render("~/bundles/application-scripts") @RenderSection("scripts", required: false) </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@ViewBag.Title - Landmine</title> @Styles.Render("~/Content/css") @Html.Partial("_Rollbar") @Html.Partial("_GoogleAnalytics") </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> @Html.ActionLink("Landmine", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" }) </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li>@Html.ActionLink("Home", "Index", "Home")</li> <li>@Html.ActionLink("Leaderboard", "Index", "Leaderboard")</li> </ul> </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - <a href="http://www.mattburkedev.com">Matt Burke</a></p> <p> <a href="https://twitter.com/akatakritos/">Twitter</a> &bull; <a href="https://github.com/akatakritos/">Github</a> &bull; <a href="http://www.linkedin.com/pub/matt-burke/50/8b8/895">LinkedIn</a> </footer> </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @Scripts.Render("~/bundles/application-scripts") @RenderSection("scripts", required: false) </body> </html>
mit
C#
89751106914e9077083cb950dc262136e6145919
introduce GetTriangles(double[] bounds)
bertt/quantized-mesh-tile-cs,bertt/quantized-mesh-tile-cs
src/TerrainTile.cs
src/TerrainTile.cs
using System; using System.Collections.Generic; using Tiles.Tools; namespace Terrain.Tiles { public class TerrainTile { public TerrainTileHeader Header { get; set; } public VertexData VertexData { get; set; } public IndexData16 IndexData16 { get; set; } public EdgeIndices16 EdgeIndices16 { get; set; } // public NormalExtensionData NormalExtensionData { get; set; } private const int MAX = 32767; public List<Triangle> GetTriangles(double[] bounds) { var triangles = new List<Triangle>(); for (var i = 0; i < IndexData16.indices.Length; i += 3) { var firstIndex = IndexData16.indices[i]; var secondIndex = IndexData16.indices[i + 1]; var thirdIndex = IndexData16.indices[i + 2]; var c1 = GetCoordinate(firstIndex, bounds); var c2 = GetCoordinate(secondIndex, bounds); var c3 = GetCoordinate(thirdIndex, bounds); triangles.Add(new Triangle(c1, c2, c3)); } return triangles; } [Obsolete("Method GetTriangles(x,y,z) is obsolete, try using GetTraingles(bounds) instead")] public List<Triangle> GetTriangles(int x, int y, int z) { var tile = new Tile(x, y, z); var bounds = tile.Bounds(); bounds = new double[] { bounds[0], -bounds[3], bounds[2], -bounds[1] }; return GetTriangles(bounds); } private Coordinate GetCoordinate(ushort index, double[] bounds) { var x = VertexData.u[index]; var y = VertexData.v[index]; var height = VertexData.height[index]; var x1 = Mathf.Lerp(bounds[0], bounds[2], ((double)(x) / MAX)); var y1 = Mathf.Lerp(bounds[1], bounds[3], ((double)(y) / MAX)); var h1 = Mathf.Lerp(Header.MinimumHeight, Header.MaximumHeight, ((double)height / MAX)); return new Coordinate(x1, y1, h1); } } }
using System.Collections.Generic; using Tiles.Tools; namespace Terrain.Tiles { public class TerrainTile { public TerrainTileHeader Header { get; set; } public VertexData VertexData { get; set; } public IndexData16 IndexData16 { get; set; } public EdgeIndices16 EdgeIndices16 { get; set; } // public NormalExtensionData NormalExtensionData { get; set; } private const int MAX = 32767; public List<Triangle> GetTriangles(int x, int y, int z) { var tile = new Tile(x, y, z); var bounds = tile.Bounds(); // make it according to tms bounds = new double[] { bounds[0], -bounds[3], bounds[2], -bounds[1] }; var triangles = new List<Triangle>(); for (var i = 0; i < IndexData16.indices.Length; i += 3) { var firstIndex = IndexData16.indices[i]; var secondIndex = IndexData16.indices[i + 1]; var thirdIndex = IndexData16.indices[i + 2]; var c1 = GetCoordinate(firstIndex, bounds); var c2 = GetCoordinate(secondIndex, bounds); var c3 = GetCoordinate(thirdIndex, bounds); triangles.Add(new Triangle(c1, c2, c3)); } return triangles; } private Coordinate GetCoordinate(ushort index, double[] bounds) { var x = VertexData.u[index]; var y = VertexData.v[index]; var height = VertexData.height[index]; var x1 = Mathf.Lerp(bounds[0], bounds[2], ((double)(x) / MAX)); var y1 = Mathf.Lerp(bounds[1], bounds[3], ((double)(y) / MAX)); var h1 = Mathf.Lerp(Header.MinimumHeight, Header.MaximumHeight, ((double)height / MAX)); return new Coordinate(x1, y1, h1); } } }
mit
C#
a90b8e950e31b0a5dd20a77fb8637b9ad1743063
Update AssemblyInfo.cs
idormenco/PolyBool.Net
Polybool.Net/Properties/AssemblyInfo.cs
Polybool.Net/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("Polybool.Net")] [assembly: AssemblyDescription("Boolean operations on polygons (union, intersection, difference, xor) (this library is a port for .net of polybooljs")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Polybool.Net")] [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("5fb7c719-ba44-48da-8384-1796a5cf3ff6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.0.0")] [assembly: AssemblyFileVersion("1.4.0.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Polybool.Net")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Polybool.Net")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5fb7c719-ba44-48da-8384-1796a5cf3ff6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")]
mit
C#
a0962b0040761cc0bf32c1b5e52f0f8de2189234
Handle invalid query parameter
DeepakChoudhari/WeatherData-AzureFunction
WeatherDataFunctionApp/WeatherDataService.cs
WeatherDataFunctionApp/WeatherDataService.cs
namespace WeatherDataFunctionApp { using System; using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Azure.WebJobs.Host; public static class WeatherDataService { private static readonly HttpClient WeatherDataHttpClient = new HttpClient(); private static readonly string ApiUrl; static WeatherDataService() { string apiKey = System.Configuration.ConfigurationManager.AppSettings["ApiKey"]; ApiUrl = $"https://api.apixu.com/v1/current.json?key={apiKey}&q={{0}}"; } [FunctionName("WeatherDataService")] public static async Task<HttpResponseMessage> RunAsync([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)]HttpRequestMessage req, TraceWriter log) { log.Info("C# HTTP trigger function processed a request."); var queryNameValuePairs = req.GetQueryNameValuePairs(); var location = queryNameValuePairs.Where(pair => pair.Key.Equals("location", StringComparison.InvariantCultureIgnoreCase)).Select(queryParam => queryParam.Value).FirstOrDefault(); if (location == null) { log.Error("location query string parameter was missing."); return req.CreateErrorResponse(HttpStatusCode.BadRequest, "Query string parameter/value for 'location' was missing"); } HttpResponseMessage responseMessage = await GetCurrentWeatherDataForLocation(location); if (responseMessage.IsSuccessStatusCode) return req.CreateResponse(HttpStatusCode.OK, responseMessage.Content.ReadAsAsync(typeof(object)).Result); log.Error($"Error occurred while trying to retrieve current weather data from api {ApiUrl}"); return req.CreateErrorResponse(HttpStatusCode.InternalServerError, "Internal Server Error."); } private static async Task<HttpResponseMessage> GetCurrentWeatherDataForLocation(string location) { return await WeatherDataHttpClient.GetAsync(String.Format(ApiUrl, location)); } } }
namespace WeatherDataFunctionApp { using System; using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Azure.WebJobs.Host; public static class WeatherDataService { private static readonly HttpClient WeatherDataHttpClient = new HttpClient(); private static readonly string ApiUrl; static WeatherDataService() { string apiKey = System.Configuration.ConfigurationManager.AppSettings["ApiKey"]; ApiUrl = $"https://api.apixu.com/v1/current.json?key={apiKey}&q={{0}}"; } [FunctionName("WeatherDataService")] public static async Task<HttpResponseMessage> RunAsync([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)]HttpRequestMessage req, TraceWriter log) { log.Info("C# HTTP trigger function processed a request."); var queryNameValuePairs = req.GetQueryNameValuePairs(); var location = queryNameValuePairs.Where(pair => pair.Key.Equals("location", StringComparison.InvariantCultureIgnoreCase)).Select(queryParam => queryParam.Value).FirstOrDefault(); HttpResponseMessage responseMessage = await GetCurrentWeatherDataForLocation(location); if (responseMessage.IsSuccessStatusCode) return req.CreateResponse(HttpStatusCode.OK, responseMessage.Content.ReadAsAsync(typeof(object)).Result); log.Error($"Error occurred while trying to retrieve weather data for {req.Content.ReadAsStringAsync().Result}"); return req.CreateErrorResponse(HttpStatusCode.InternalServerError, "Internal Server Error."); } private static async Task<HttpResponseMessage> GetCurrentWeatherDataForLocation(string location) { return await WeatherDataHttpClient.GetAsync(String.Format(ApiUrl, location)); } } }
mit
C#
df97b89bbaf5ce755ebc297594bddbf188aea645
Change logic for deviceName matching
2gis/Winium.StoreApps,2gis/Winium.StoreApps
Winium/Winium.Mobile.Connectivity/Devices.cs
Winium/Winium.Mobile.Connectivity/Devices.cs
namespace Winium.Mobile.Connectivity { #region using System; using System.Collections.Generic; using System.Linq; using Microsoft.Phone.Tools.Deploy.Patched; #endregion public class Devices { #region Static Fields private static readonly Lazy<Devices> LazyInstance = new Lazy<Devices>(() => new Devices()); #endregion #region Constructors and Destructors private Devices() { this.AvailableDevices = Utils.GetDevices().Where(x => !x.ToString().Equals("Device")).ToList(); } #endregion #region Public Properties public static Devices Instance { get { return LazyInstance.Value; } } #endregion #region Properties private IEnumerable<DeviceInfo> AvailableDevices { get; set; } #endregion #region Public Methods and Operators public DeviceInfo GetMatchingDevice(string desiredName, bool strict) { DeviceInfo deviceInfo; deviceInfo = this.AvailableDevices.FirstOrDefault( x => x.ToString().Equals(desiredName, StringComparison.OrdinalIgnoreCase)); if (!strict && deviceInfo == null) { deviceInfo = this.AvailableDevices.FirstOrDefault( x => x.ToString().StartsWith(desiredName, StringComparison.OrdinalIgnoreCase)); } return deviceInfo; } public bool IsValidDeviceName(string desiredName) { var deviceInfo = this.GetMatchingDevice(desiredName, true); return deviceInfo != null; } public override string ToString() { return string.Join("\n", this.AvailableDevices.Select(x => x.ToString())); } #endregion } }
namespace Winium.Mobile.Connectivity { #region using System; using System.Collections.Generic; using System.Linq; using Microsoft.Phone.Tools.Deploy.Patched; #endregion public class Devices { #region Static Fields private static readonly Lazy<Devices> LazyInstance = new Lazy<Devices>(() => new Devices()); #endregion #region Constructors and Destructors private Devices() { this.AvailableDevices = Utils.GetDevices().Where(x => !x.ToString().Equals("Device")).ToList(); } #endregion #region Public Properties public static Devices Instance { get { return LazyInstance.Value; } } #endregion #region Properties private IEnumerable<DeviceInfo> AvailableDevices { get; set; } #endregion #region Public Methods and Operators public DeviceInfo GetMatchingDevice(string desiredName, bool strict) { DeviceInfo deviceInfo; if (strict) { deviceInfo = this.AvailableDevices.FirstOrDefault( x => x.ToString().Equals(desiredName, StringComparison.OrdinalIgnoreCase)); } else { deviceInfo = this.AvailableDevices.FirstOrDefault( x => x.ToString().StartsWith(desiredName, StringComparison.OrdinalIgnoreCase)); } return deviceInfo; } public bool IsValidDeviceName(string desiredName) { var deviceInfo = this.GetMatchingDevice(desiredName, true); return deviceInfo != null; } public override string ToString() { return string.Join("\n", this.AvailableDevices.Select(x => x.ToString())); } #endregion } }
mpl-2.0
C#
781178439e17398690433148c35bd9efe04a42c8
allow same name enums in different packages
sauliusvl/ProtoBuf
CodeGenerator/Proto/ProtoCollection.cs
CodeGenerator/Proto/ProtoCollection.cs
using System; using System.Collections.Generic; namespace SilentOrbit.ProtocolBuffers { /// <summary> /// Representation content of on or more .proto files /// </summary> class ProtoCollection : ProtoMessage { public ProtoCollection() : base(null, null) { } /// <summary> /// Defaults to Example if not specified /// </summary> public override string CsNamespace { get { throw new InvalidOperationException("This is a collection of multiple .proto files with different namespaces, namespace should have been set at local."); } } public void Merge(ProtoCollection proto) { foreach (var m in proto.Messages.Values) { Messages.Add(m.FullProtoName, m); m.Parent = this; } foreach (var e in proto.Enums.Values) { Enums.Add(e.FullProtoName, e); e.Parent = this; } } public override string ToString() { string t = "ProtoCollection: "; foreach (ProtoMessage m in Messages.Values) t += "\n\t" + m; return t; } } }
using System; using System.Collections.Generic; namespace SilentOrbit.ProtocolBuffers { /// <summary> /// Representation content of on or more .proto files /// </summary> class ProtoCollection : ProtoMessage { public ProtoCollection() : base(null, null) { } /// <summary> /// Defaults to Example if not specified /// </summary> public override string CsNamespace { get { throw new InvalidOperationException("This is a collection of multiple .proto files with different namespaces, namespace should have been set at local."); } } public void Merge(ProtoCollection proto) { foreach (var m in proto.Messages.Values) { Messages.Add(m.FullProtoName, m); m.Parent = this; } foreach (var e in proto.Enums.Values) { Enums.Add(e.ProtoName, e); e.Parent = this; } } public override string ToString() { string t = "ProtoCollection: "; foreach (ProtoMessage m in Messages.Values) t += "\n\t" + m; return t; } } }
apache-2.0
C#
cb60aeb809ff5c8e6e8aef1b4a65172bda589c10
Add AssemblyInformationalVersion
bcemmett/SurveyMonkeyApi-v3,davek17/SurveyMonkeyApi-v3
SurveyMonkey/Properties/AssemblyInfo.cs
SurveyMonkey/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("SurveyMonkeyApi")] [assembly: AssemblyDescription("Library for accessing v3 of the Survey Monkey Api")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SurveyMonkeyApi")] [assembly: AssemblyCopyright("Copyright © Ben Emmett")] [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("8046d9e9-7851-4837-860d-cc546d51ae57")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0.0")] [assembly: InternalsVisibleTo("SurveyMonkeyTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001005950447217c0b51774d98537acdd2246afef2eee315308acc30639dfee0dcbf928d485498d8cb671998124d967b06ef65314bd53466811d05de3a70e2d7591dbe5ab5b03b1693f0e0d42e6db4f8acf951d72f8eaf4acc925e2fc9e5533fa3315229bd2bbd92b48fab29da1ab22a184337b77b80025c4bab62b673e0310143ca3")]
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("SurveyMonkeyApi")] [assembly: AssemblyDescription("Library for accessing v3 of the Survey Monkey Api")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SurveyMonkeyApi")] [assembly: AssemblyCopyright("Copyright © Ben Emmett")] [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("8046d9e9-7851-4837-860d-cc546d51ae57")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("SurveyMonkeyTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001005950447217c0b51774d98537acdd2246afef2eee315308acc30639dfee0dcbf928d485498d8cb671998124d967b06ef65314bd53466811d05de3a70e2d7591dbe5ab5b03b1693f0e0d42e6db4f8acf951d72f8eaf4acc925e2fc9e5533fa3315229bd2bbd92b48fab29da1ab22a184337b77b80025c4bab62b673e0310143ca3")]
mit
C#
f685c3277abb5c98c01d7f8acb9cb40b3bc54fe8
Fix issue in Page page.
Talagozis/Talagozis.Website,Talagozis/Talagozis.Website,Talagozis/Talagozis.Website
Talagozis.Website/Views/Cms/Page.cshtml
Talagozis.Website/Views/Cms/Page.cshtml
@model Talagozis.Website.Models.Cms.PageTypes.StandardPage @{ ViewBag.Title = Model?.Title; } <div class="container"> <div class="row justify-content-center"> <div class="col-sm-10"> <h1>@Model?.Title</h1> </div> </div> @Html.DisplayFor(m => m.Blocks) </div>
@model Talagozis.Website.Models.Cms.PageTypes.StandardPage @{ ViewBag.Title = Model.Title; } <div class="container"> <div class="row justify-content-center"> <div class="col-sm-10"> <h1>@Model.Title</h1> </div> </div> @Html.DisplayFor(m => m.Blocks) </div>
mit
C#
fa2475f91f5bc61c2cd7bd09b127bd1753a89c8d
Update AzureRMConstants.cs
ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell
src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMConstants.cs
src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMConstants.cs
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- namespace Microsoft.Azure.Commands.ResourceManager.Common { public class AzureRMConstants { #if NETSTANDARD public const string AzurePrefix = "Az"; public const string AzureRMPrefix = "Az"; public const string AzureRMStoragePrefix = "AzRm"; #else public const string AzurePrefix = "Azure"; public const string AzureRMPrefix = "AzureRM"; public const string AzureRMStoragePrefix = "AzureRm"; #endif } }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- namespace Microsoft.Azure.Commands.ResourceManager.Common { public class AzureRMConstants { #if NETSTANDARD public const string AzurePrefix = "Az"; public const string AzureRMPrefix = "Az"; public const string AzureRMStoragePrefix = "AzRm" #else public const string AzurePrefix = "Azure"; public const string AzureRMPrefix = "AzureRM"; public const string AzureRMStoragePrefix = "AzureRm" #endif } }
apache-2.0
C#
571e21549d722b8da7b5248be71b42500b484bfc
Remove Register link
JetBrains/ReSharperGallery,JetBrains/ReSharperGallery,JetBrains/ReSharperGallery
Website/Views/Shared/UserDisplay.cshtml
Website/Views/Shared/UserDisplay.cshtml
<div class="user-display"> @{ string returnUrl = ViewData.ContainsKey(Constants.ReturnUrlViewDataKey) ? (string)ViewData[Constants.ReturnUrlViewDataKey] : Request.RawUrl; if (!User.Identity.IsAuthenticated) { <span class="welcome"><a href="@Url.LogOn(returnUrl)">Log On</a></span> } else { <span class="welcome"><a href="@Url.Action(MVC.Users.Account())">@User.Identity.Name</a></span> <span class="user-actions"> <a href="@Url.LogOff(returnUrl)">Log Off</a> </span> } } </div>
<div class="user-display"> @{ string returnUrl = ViewData.ContainsKey(Constants.ReturnUrlViewDataKey) ? (string)ViewData[Constants.ReturnUrlViewDataKey] : Request.RawUrl; if (!User.Identity.IsAuthenticated) { <span class="welcome"><a href="@Url.LogOn(returnUrl)">Log On</a></span> <a href="@Url.Action(MVC.Users.Register())" class="register">Register</a> } else { <span class="welcome"><a href="@Url.Action(MVC.Users.Account())">@User.Identity.Name</a></span> <span class="user-actions"> <a href="@Url.LogOff(returnUrl)">Log Off</a> </span> } } </div>
apache-2.0
C#
5dc4aa0e10919db88a53217f9140c411fed575ba
fix old school aliases url tests
CSGOpenSource/elasticsearch-net,RossLieberman/NEST,elastic/elasticsearch-net,CSGOpenSource/elasticsearch-net,adam-mccoy/elasticsearch-net,RossLieberman/NEST,UdiBen/elasticsearch-net,elastic/elasticsearch-net,UdiBen/elasticsearch-net,adam-mccoy/elasticsearch-net,TheFireCookie/elasticsearch-net,azubanov/elasticsearch-net,adam-mccoy/elasticsearch-net,azubanov/elasticsearch-net,RossLieberman/NEST,CSGOpenSource/elasticsearch-net,KodrAus/elasticsearch-net,jonyadamit/elasticsearch-net,jonyadamit/elasticsearch-net,cstlaurent/elasticsearch-net,KodrAus/elasticsearch-net,jonyadamit/elasticsearch-net,azubanov/elasticsearch-net,TheFireCookie/elasticsearch-net,KodrAus/elasticsearch-net,cstlaurent/elasticsearch-net,TheFireCookie/elasticsearch-net,UdiBen/elasticsearch-net,cstlaurent/elasticsearch-net
src/Tests/Indices/AliasManagement/GetAliasesUrlTests.cs/GetAliasesUrlTests.cs
src/Tests/Indices/AliasManagement/GetAliasesUrlTests.cs/GetAliasesUrlTests.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Nest; using Tests.Framework; using Tests.Framework.MockData; using static Tests.Framework.UrlTester; namespace Tests.Indices.GetAliasesManagement { public class GetAliasesUrlTests { [U] public async Task Urls() { Name name = "hardcoded"; IndexName index = "index"; await GET($"/_aliases") .Fluent(c=>c.GetAliases()) .Request(c=>c.GetAliases(new GetAliasesRequest())) .FluentAsync(c=>c.GetAliasesAsync()) .RequestAsync(c=>c.GetAliasesAsync(new GetAliasesRequest())) ; await GET($"/_aliases/hardcoded") .Fluent(c=>c.GetAliases(b=>b.Name(name))) .Request(c=>c.GetAliases(new GetAliasesRequest(name))) .FluentAsync(c=>c.GetAliasesAsync(b=>b.Name(name))) .RequestAsync(c=>c.GetAliasesAsync(new GetAliasesRequest(name))) ; await GET($"/index/_aliases") .Fluent(c=>c.GetAliases(b=>b.Index(index))) .Request(c=>c.GetAliases(new GetAliasesRequest(index))) .FluentAsync(c=>c.GetAliasesAsync(b=>b.Index(index))) .RequestAsync(c=>c.GetAliasesAsync(new GetAliasesRequest(index))) ; await GET($"/index/_aliases/hardcoded") .Fluent(c=>c.GetAliases(b=>b.Index(index).Name(name))) .Request(c=>c.GetAliases(new GetAliasesRequest(index, name))) .FluentAsync(c=>c.GetAliasesAsync(b=>b.Index(index).Name(name))) .RequestAsync(c=>c.GetAliasesAsync(new GetAliasesRequest(index, name))) ; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Nest; using Tests.Framework; using Tests.Framework.MockData; using static Tests.Framework.UrlTester; namespace Tests.Indices.GetAliasesManagement { public class GetAliasesUrlTests { [U] public async Task Urls() { Name name = "hardcoded"; IndexName index = "index"; await GET($"/_alias") .Fluent(c=>c.GetAliases()) .Request(c=>c.GetAliases(new GetAliasesRequest())) .FluentAsync(c=>c.GetAliasesAsync()) .RequestAsync(c=>c.GetAliasesAsync(new GetAliasesRequest())) ; await GET($"/_alias/hardcoded") .Fluent(c=>c.GetAliases(b=>b.Name(name))) .Request(c=>c.GetAliases(new GetAliasesRequest(name))) .FluentAsync(c=>c.GetAliasesAsync(b=>b.Name(name))) .RequestAsync(c=>c.GetAliasesAsync(new GetAliasesRequest(name))) ; await GET($"/index/_alias") .Fluent(c=>c.GetAliases(b=>b.Index(index))) .Request(c=>c.GetAliases(new GetAliasesRequest(index))) .FluentAsync(c=>c.GetAliasesAsync(b=>b.Index(index))) .RequestAsync(c=>c.GetAliasesAsync(new GetAliasesRequest(index))) ; await GET($"/index/_alias/hardcoded") .Fluent(c=>c.GetAliases(b=>b.Index(index).Name(name))) .Request(c=>c.GetAliases(new GetAliasesRequest(index, name))) .FluentAsync(c=>c.GetAliasesAsync(b=>b.Index(index).Name(name))) .RequestAsync(c=>c.GetAliasesAsync(new GetAliasesRequest(index, name))) ; } } }
apache-2.0
C#
a1b5b3a7b22555fa12fd66705f896620590a8573
fix merge conflict and apply review feedback
ViktorHofer/corefx,gkhanna79/corefx,ptoonen/corefx,zhenlan/corefx,stone-li/corefx,billwert/corefx,yizhang82/corefx,richlander/corefx,dotnet-bot/corefx,alexperovich/corefx,cydhaselton/corefx,twsouthwick/corefx,tijoytom/corefx,krytarowski/corefx,Petermarcu/corefx,Jiayili1/corefx,DnlHarvey/corefx,dhoehna/corefx,elijah6/corefx,the-dwyer/corefx,richlander/corefx,twsouthwick/corefx,YoupHulsebos/corefx,ericstj/corefx,stone-li/corefx,ericstj/corefx,rubo/corefx,ptoonen/corefx,twsouthwick/corefx,stephenmichaelf/corefx,DnlHarvey/corefx,ravimeda/corefx,cydhaselton/corefx,mmitche/corefx,rahku/corefx,krk/corefx,axelheer/corefx,shimingsg/corefx,tijoytom/corefx,Petermarcu/corefx,Jiayili1/corefx,the-dwyer/corefx,rahku/corefx,the-dwyer/corefx,weltkante/corefx,BrennanConroy/corefx,Ermiar/corefx,parjong/corefx,shimingsg/corefx,dotnet-bot/corefx,shimingsg/corefx,elijah6/corefx,yizhang82/corefx,Ermiar/corefx,stephenmichaelf/corefx,nchikanov/corefx,axelheer/corefx,ericstj/corefx,axelheer/corefx,zhenlan/corefx,wtgodbe/corefx,gkhanna79/corefx,MaggieTsang/corefx,Petermarcu/corefx,mazong1123/corefx,stephenmichaelf/corefx,parjong/corefx,stephenmichaelf/corefx,parjong/corefx,billwert/corefx,MaggieTsang/corefx,elijah6/corefx,tijoytom/corefx,gkhanna79/corefx,JosephTremoulet/corefx,rjxby/corefx,krk/corefx,ptoonen/corefx,mmitche/corefx,dotnet-bot/corefx,nbarbettini/corefx,rjxby/corefx,mazong1123/corefx,rahku/corefx,the-dwyer/corefx,ViktorHofer/corefx,jlin177/corefx,Petermarcu/corefx,the-dwyer/corefx,rjxby/corefx,seanshpark/corefx,alexperovich/corefx,JosephTremoulet/corefx,krytarowski/corefx,twsouthwick/corefx,twsouthwick/corefx,Jiayili1/corefx,ravimeda/corefx,stephenmichaelf/corefx,cydhaselton/corefx,wtgodbe/corefx,seanshpark/corefx,shimingsg/corefx,Jiayili1/corefx,billwert/corefx,DnlHarvey/corefx,wtgodbe/corefx,YoupHulsebos/corefx,yizhang82/corefx,dhoehna/corefx,jlin177/corefx,jlin177/corefx,tijoytom/corefx,alexperovich/corefx,axelheer/corefx,Jiayili1/corefx,Ermiar/corefx,ravimeda/corefx,BrennanConroy/corefx,weltkante/corefx,stone-li/corefx,nbarbettini/corefx,rjxby/corefx,ravimeda/corefx,parjong/corefx,yizhang82/corefx,the-dwyer/corefx,ViktorHofer/corefx,mmitche/corefx,Jiayili1/corefx,zhenlan/corefx,krk/corefx,Ermiar/corefx,YoupHulsebos/corefx,Ermiar/corefx,richlander/corefx,billwert/corefx,axelheer/corefx,ericstj/corefx,mazong1123/corefx,seanshpark/corefx,alexperovich/corefx,ravimeda/corefx,mazong1123/corefx,alexperovich/corefx,seanshpark/corefx,alexperovich/corefx,nchikanov/corefx,weltkante/corefx,weltkante/corefx,gkhanna79/corefx,ericstj/corefx,cydhaselton/corefx,nchikanov/corefx,JosephTremoulet/corefx,Jiayili1/corefx,rahku/corefx,dhoehna/corefx,ViktorHofer/corefx,nbarbettini/corefx,YoupHulsebos/corefx,axelheer/corefx,twsouthwick/corefx,JosephTremoulet/corefx,rjxby/corefx,rubo/corefx,rjxby/corefx,dotnet-bot/corefx,rubo/corefx,weltkante/corefx,cydhaselton/corefx,stone-li/corefx,shimingsg/corefx,wtgodbe/corefx,nchikanov/corefx,nbarbettini/corefx,dotnet-bot/corefx,ravimeda/corefx,fgreinacher/corefx,elijah6/corefx,yizhang82/corefx,ptoonen/corefx,MaggieTsang/corefx,nbarbettini/corefx,rahku/corefx,krytarowski/corefx,krytarowski/corefx,Ermiar/corefx,ptoonen/corefx,krytarowski/corefx,tijoytom/corefx,mmitche/corefx,rubo/corefx,stone-li/corefx,elijah6/corefx,stephenmichaelf/corefx,shimingsg/corefx,krk/corefx,mazong1123/corefx,mazong1123/corefx,weltkante/corefx,MaggieTsang/corefx,JosephTremoulet/corefx,alexperovich/corefx,rahku/corefx,zhenlan/corefx,krytarowski/corefx,jlin177/corefx,YoupHulsebos/corefx,tijoytom/corefx,parjong/corefx,nbarbettini/corefx,twsouthwick/corefx,weltkante/corefx,stone-li/corefx,cydhaselton/corefx,YoupHulsebos/corefx,krk/corefx,fgreinacher/corefx,mmitche/corefx,ptoonen/corefx,zhenlan/corefx,billwert/corefx,Petermarcu/corefx,dhoehna/corefx,nchikanov/corefx,yizhang82/corefx,MaggieTsang/corefx,ericstj/corefx,krk/corefx,nchikanov/corefx,MaggieTsang/corefx,dhoehna/corefx,YoupHulsebos/corefx,richlander/corefx,fgreinacher/corefx,mazong1123/corefx,billwert/corefx,gkhanna79/corefx,DnlHarvey/corefx,DnlHarvey/corefx,dotnet-bot/corefx,yizhang82/corefx,jlin177/corefx,mmitche/corefx,ravimeda/corefx,dhoehna/corefx,JosephTremoulet/corefx,mmitche/corefx,JosephTremoulet/corefx,elijah6/corefx,Petermarcu/corefx,DnlHarvey/corefx,ericstj/corefx,parjong/corefx,dhoehna/corefx,fgreinacher/corefx,Ermiar/corefx,richlander/corefx,DnlHarvey/corefx,stephenmichaelf/corefx,stone-li/corefx,rubo/corefx,seanshpark/corefx,krytarowski/corefx,wtgodbe/corefx,seanshpark/corefx,seanshpark/corefx,gkhanna79/corefx,jlin177/corefx,MaggieTsang/corefx,richlander/corefx,dotnet-bot/corefx,wtgodbe/corefx,the-dwyer/corefx,zhenlan/corefx,shimingsg/corefx,ViktorHofer/corefx,nchikanov/corefx,Petermarcu/corefx,nbarbettini/corefx,jlin177/corefx,billwert/corefx,ptoonen/corefx,richlander/corefx,elijah6/corefx,ViktorHofer/corefx,rahku/corefx,tijoytom/corefx,rjxby/corefx,gkhanna79/corefx,krk/corefx,wtgodbe/corefx,cydhaselton/corefx,zhenlan/corefx,parjong/corefx,BrennanConroy/corefx,ViktorHofer/corefx
src/System.Security.Cryptography.Xml/tests/Samples/SigningVerifyingX509Cert.cs
src/System.Security.Cryptography.Xml/tests/Samples/SigningVerifyingX509Cert.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; using System.Xml; using Xunit; namespace System.Security.Cryptography.Xml.Tests { public class SigningVerifyingX509Cert { const string ExampleXml = @"<?xml version=""1.0""?> <example> <test>some text node</test> </example>"; private static void SignXml(XmlDocument doc, AsymmetricAlgorithm key) { var signedXml = new SignedXml(doc) { SigningKey = key }; var reference = new Reference(); reference.Uri = ""; reference.AddTransform(new XmlDsigEnvelopedSignatureTransform()); signedXml.AddReference(reference); signedXml.ComputeSignature(); XmlElement xmlDigitalSignature = signedXml.GetXml(); doc.DocumentElement.AppendChild(doc.ImportNode(xmlDigitalSignature, true)); } private static bool VerifyXml(string signedXmlText, X509Certificate2 certificate) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.PreserveWhitespace = true; xmlDoc.LoadXml(signedXmlText); SignedXml signedXml = new SignedXml(xmlDoc); var signatureNode = (XmlElement)xmlDoc.GetElementsByTagName("Signature")[0]; signedXml.LoadXml(signatureNode); return signedXml.CheckSignature(certificate, true); } [Fact] public void SignedXmlHasCertificateVerifiableSignature() { using (X509Certificate2 x509cert = TestHelpers.GetSampleX509Certificate()) { var xmlDoc = new XmlDocument(); xmlDoc.PreserveWhitespace = true; xmlDoc.LoadXml(ExampleXml); using (RSA key = x509cert.GetRSAPrivateKey()) { SignXml(xmlDoc, key); } Assert.True(VerifyXml(xmlDoc.OuterXml, x509cert)); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; using System.Xml; using Xunit; namespace System.Security.Cryptography.Xml.Tests { public class SigningVerifyingX509Cert { const string ExampleXml = @"<?xml version=""1.0""?> <example> <test>some text node</test> </example>"; private static void SignXml(XmlDocument doc, AsymmetricAlgorithm key) { var signedXml = new SignedXml(doc) { SigningKey = key }; var reference = new Reference(); reference.Uri = ""; reference.AddTransform(new XmlDsigEnvelopedSignatureTransform()); signedXml.AddReference(reference); signedXml.ComputeSignature(); XmlElement xmlDigitalSignature = signedXml.GetXml(); doc.DocumentElement.AppendChild(doc.ImportNode(xmlDigitalSignature, true)); } private static bool VerifyXml(string signedXmlText, X509Certificate2 certificate) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.PreserveWhitespace = true; xmlDoc.LoadXml(signedXmlText); SignedXml signedXml = new SignedXml(xmlDoc); var signatureNode = (XmlElement)xmlDoc.GetElementsByTagName("Signature")[0]; signedXml.LoadXml(signatureNode); return signedXml.CheckSignature(certificate, true); } [Fact] public void SignedXmlHasCertificateVerifiableSignature() { using (X509Certificate2 x509cert = TestHelpers.GetSampleX509Certificate()) { var xmlDoc = new XmlDocument(); xmlDoc.PreserveWhitespace = true; xmlDoc.LoadXml(ExampleXml); SignXml(xmlDoc, x509cert.PrivateKey); Assert.True(VerifyXml(xmlDoc.OuterXml, x509cert)); } } } }
mit
C#
8ef1d9e11a069d5312936ae7fb95c5d325115371
Update to use DbContextOptionsBuilder
OmniSharp/omnisharp-scaffolding,OmniSharp/omnisharp-scaffolding
src/Microsoft.Framework.CodeGeneration.EntityFramework/Templates/DbContext/NewLocalDbContext.cshtml
src/Microsoft.Framework.CodeGeneration.EntityFramework/Templates/DbContext/NewLocalDbContext.cshtml
@inherits Microsoft.Framework.CodeGeneration.Templating.RazorTemplateBase using Microsoft.Data.Entity; using Microsoft.Data.Entity.Metadata; @{ foreach (var namespaceName in Model.RequiredNamespaces) { @:using @namespaceName; } @: string baseClassName; if (String.Equals(Model.DbContextTypeName, "DbContext", StringComparison.Ordinal)) { baseClassName = "Microsoft.Data.Entity.DbContext"; } else { baseClassName = "DbContext"; } if (!String.IsNullOrEmpty(Model.DbContextNamespace)) { @:namespace @Model.DbContextNamespace @:{ //PushIndent(" "); } } public class @Model.DbContextTypeName : @baseClassName { private static bool _created = false; public @(Model.DbContextTypeName)() { if (!_created) { Database.EnsureCreated(); _created = true; } } public DbSet<@Model.ModelTypeName> @Model.ModelTypeName { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlServer(@@"Server=(localdb)\mssqllocaldb;Database=@Model.DbContextTypeName;Trusted_Connection=True;MultipleActiveResultSets=true"); } protected override void OnModelCreating(ModelBuilder builder) { } } @{ if (!String.IsNullOrEmpty(Model.DbContextNamespace)) { //ClearIndent(); @:} } }
@inherits Microsoft.Framework.CodeGeneration.Templating.RazorTemplateBase using Microsoft.Data.Entity; using Microsoft.Data.Entity.Metadata; @{ foreach (var namespaceName in Model.RequiredNamespaces) { @:using @namespaceName; } @: string baseClassName; if (String.Equals(Model.DbContextTypeName, "DbContext", StringComparison.Ordinal)) { baseClassName = "Microsoft.Data.Entity.DbContext"; } else { baseClassName = "DbContext"; } if (!String.IsNullOrEmpty(Model.DbContextNamespace)) { @:namespace @Model.DbContextNamespace @:{ //PushIndent(" "); } } public class @Model.DbContextTypeName : @baseClassName { private static bool _created = false; public @(Model.DbContextTypeName)() { if (!_created) { Database.EnsureCreated(); _created = true; } } public DbSet<@Model.ModelTypeName> @Model.ModelTypeName { get; set; } protected override void OnConfiguring(DbContextOptions options) { options.UseSqlServer(@@"Server=(localdb)\mssqllocaldb;Database=@Model.DbContextTypeName;Trusted_Connection=True;MultipleActiveResultSets=true"); } protected override void OnModelCreating(ModelBuilder builder) { } } @{ if (!String.IsNullOrEmpty(Model.DbContextNamespace)) { //ClearIndent(); @:} } }
mit
C#
fce4ff3f8d5d3f05b3059cdf347025c11d76352a
Fix a race in HybridWebViewRenderer initialization
chkn/HybridKit,chkn/HybridKit
HybridKit.iOS/HybridWebViewRenderer.cs
HybridKit.iOS/HybridWebViewRenderer.cs
using System; using System.Threading.Tasks; using UIKit; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; [assembly:ExportRenderer (typeof (HybridKit.Forms.HybridWebView), typeof (HybridKit.Forms.HybridWebViewRenderer))] namespace HybridKit.Forms { public class HybridWebViewRenderer : WebViewRenderer { IWebView native; public static new void Init () { // Keeps us from being linked out. // Call the ctor here to work around a very weird linker(?) issue new HybridWebViewRenderer (); } public HybridWebViewRenderer () { native = this.AsHybridWebView (); native.Loaded += Native_Loaded; } void Native_Loaded (object sender, EventArgs e) { // There appears to be a race that causes this to be called before `OnElementChanged` var element = Element as HybridWebView; if (element != null) element.Native = native; } protected override void OnElementChanged (VisualElementChangedEventArgs e) { base.OnElementChanged (e); ((HybridWebView)e.NewElement).Native = native; } } }
using System; using System.Threading.Tasks; using UIKit; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; [assembly:ExportRenderer (typeof (HybridKit.Forms.HybridWebView), typeof (HybridKit.Forms.HybridWebViewRenderer))] namespace HybridKit.Forms { public class HybridWebViewRenderer : WebViewRenderer { public static new void Init () { // Keeps us from being linked out. // Call the ctor here to work around a very weird linker(?) issue new HybridWebViewRenderer (); } protected override void OnElementChanged (VisualElementChangedEventArgs e) { base.OnElementChanged (e); ((HybridWebView)e.NewElement).Native = ((UIWebView)NativeView).AsHybridWebView (); } } }
mit
C#
d79b59cbcc17a704ed8599b3646c9c06a192789d
Set version to 1.2
mganss/IS24RestApi,enkol/IS24RestApi
IS24RestApi/Properties/AssemblyInfo.cs
IS24RestApi/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("IS24RestApi")] [assembly: AssemblyDescription("Client for the Immobilienscout24 REST API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Michael Ganss")] [assembly: AssemblyProduct("IS24RestApi")] [assembly: AssemblyCopyright("Copyright © 2013 IS24RestApi project contributors")] [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("ce77545e-5fbe-4b4d-bf1f-1c5d4532070a")] // 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.*")]
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("IS24RestApi")] [assembly: AssemblyDescription("Client for the Immobilienscout24 REST API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Michael Ganss")] [assembly: AssemblyProduct("IS24RestApi")] [assembly: AssemblyCopyright("Copyright © 2013 IS24RestApi project contributors")] [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("ce77545e-5fbe-4b4d-bf1f-1c5d4532070a")] // 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.*")]
apache-2.0
C#
406a7f9d26a68f75413b9eff52c7eb4c3833d511
add getAll() endpoint
Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen
Dashen/Controllers/ModelsController.cs
Dashen/Controllers/ModelsController.cs
using System.Linq; using System.Net.Http; using System.Text; using System.Web.Http; using Newtonsoft.Json; namespace Dashen.Controllers { public class ModelsController : ApiController { private readonly ModelInfoRepository _models; public ModelsController(ModelInfoRepository modelInfo) { _models = modelInfo; } public HttpResponseMessage Get(int id) { var model = _models.GetModel(id); return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "text/javascript") }; } public HttpResponseMessage GetAll() { var wrapperInfo = _models .All() .Select(info => new { Type = info.Component.Name.ToString(), Path = "models/" + info.ModelID }); var json = JsonConvert.SerializeObject(wrapperInfo); return new HttpResponseMessage { Content = new StringContent(json, Encoding.UTF8, "text/javascript") }; } } }
using System.Net.Http; using System.Text; using System.Web.Http; using Newtonsoft.Json; namespace Dashen.Controllers { public class ModelsController : ApiController { private readonly ModelInfoRepository _models; public ModelsController(ModelInfoRepository modelInfo) { _models = modelInfo; } public HttpResponseMessage Get(int id) { var model = _models.GetModel(id); return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "text/javascript") }; } } }
lgpl-2.1
C#
46f1511238b5e4d3d0fbf53394019b61c277b973
Set default time zone to UTC
InEngine-NET/InEngine.NET,InEngine-NET/InEngine.NET,InEngine-NET/InEngine.NET
IntegrationEngine.Model/CronTrigger.cs
IntegrationEngine.Model/CronTrigger.cs
using System; namespace IntegrationEngine.Model { public class CronTrigger : IHasStringId, IIntegrationJobTrigger { public string Id { get; set; } public string JobType { get; set; } public string CronExpressionString { get; set; } TimeZoneInfo _timeZone { get; set; } public TimeZoneInfo TimeZone { get { return _timeZone ?? TimeZoneInfo.Utc; } set { _timeZone = value; } } } }
using System; namespace IntegrationEngine.Model { public class CronTrigger : IHasStringId, IIntegrationJobTrigger { public string Id { get; set; } public string JobType { get; set; } public string CronExpressionString { get; set; } public TimeZoneInfo TimeZone { get; set; } } }
mit
C#
fb26533e198218b256df97c29aaa10ae96a3e1a6
change return type and fix squaring function
KerbaeAdAstra/KerbalFuture
KerbalFuture/SpaceFolderFlightDrive.cs
KerbalFuture/SpaceFolderFlightDrive.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using KSP; using KerbalFuture; namespace KerbalFuture { class FlightDrive : VesselModule { private static Vector3d vesPos; private static double vesHeight; private static CelestialBody vesBody; private static CelestialBody warpBody; private static double gravPot; public void WarpVessel() { if(WarpIsGo()) { vesPos = this.Vessel.GetWorldPosition3D(); vesBody = this.Vessel.mainBody; vesHeight = (this.Vessel.alitiude + vesBody.Radius); warpBody = GUIChosenBody(); } } private double GetVesselAltitude(bool includePlanetRadius, Vessel v) { if(includePlanetRadius) { return v.altitude + v.mainBody.Radius(); } return v.altitude; } private double GetVesselLongPos(Vector3d pos) { return this.Vessel.GetLongitude(pos, false); } private double GetVesselLatPos(Vector3d pos) { return this.Vessel.GetLatitude(pos, false); } private double CalculateGravPot(CelestialBody cb) { gravPot = cb.gravParameter / Math.Pow(GetVesselAltitude(true, this.Vessel), 2); // gravPot = } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using KSP; using KerbalFuture; namespace KerbalFuture { class FlightDrive : VesselModule { private static Vector3d vesPos; private static double vesHeight; private static CelestialBody vesBody; private static CelestialBody warpBody; private static double gravPot; public void WarpVessel() { if(WarpIsGo()) { vesPos = this.Vessel.GetWorldPosition3D(); vesBody = this.Vessel.mainBody; vesHeight = (this.Vessel.alitiude + vesBody.Radius); warpBody = GUIChosenBody(); } } private double GetVesselAltitude(bool includePlanetRadius, Vessel v) { if(includePlanetRadius) { return v.altitude + v.mainBody.Radius(); } return v.altitude; } private double GetVesselLongPos(Vector3d pos) { return this.Vessel.GetLongitude(pos, false); } private double GetVesselLatPos(Vector3d pos) { return this.Vessel.GetLatitude(pos, false); } private void CalculateGravPot(CelestialBody cb) { gravPot = cb.gravParameter / GetVesselAltitude(true, this.Vessel)^2; // gravPot = } } }
mit
C#
7e4b506aaf568e5b16590d3263c6ab6a4868a997
Fix AI not using items in hand (#1273)
space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14
Content.Server/AI/Operators/Inventory/UseItemInHandsOperator.cs
Content.Server/AI/Operators/Inventory/UseItemInHandsOperator.cs
using Content.Server.GameObjects; using Robust.Shared.Interfaces.GameObjects; namespace Content.Server.AI.Operators.Inventory { /// <summary> /// Will find the item in storage, put it in an active hand, then use it /// </summary> public class UseItemInHandsOperator : AiOperator { private readonly IEntity _owner; private readonly IEntity _target; public UseItemInHandsOperator(IEntity owner, IEntity target) { _owner = owner; _target = target; } public override Outcome Execute(float frameTime) { if (_target == null) { return Outcome.Failed; } // TODO: Also have this check storage a la backpack etc. if (!_owner.TryGetComponent(out HandsComponent handsComponent)) { return Outcome.Failed; } if (!_target.TryGetComponent(out ItemComponent itemComponent)) { return Outcome.Failed; } foreach (var slot in handsComponent.ActivePriorityEnumerable()) { if (handsComponent.GetHand(slot) != itemComponent) continue; handsComponent.ActiveIndex = slot; handsComponent.ActivateItem(); return Outcome.Success; } return Outcome.Failed; } } }
using Content.Server.GameObjects; using Robust.Shared.Interfaces.GameObjects; namespace Content.Server.AI.Operators.Inventory { /// <summary> /// Will find the item in storage, put it in an active hand, then use it /// </summary> public class UseItemInHandsOperator : AiOperator { private readonly IEntity _owner; private readonly IEntity _target; public UseItemInHandsOperator(IEntity owner, IEntity target) { _owner = owner; _target = target; } public override Outcome Execute(float frameTime) { if (_target == null) { return Outcome.Failed; } // TODO: Also have this check storage a la backpack etc. if (!_owner.TryGetComponent(out HandsComponent handsComponent)) { return Outcome.Failed; } if (_target.TryGetComponent(out ItemComponent itemComponent)) { return Outcome.Failed; } foreach (var slot in handsComponent.ActivePriorityEnumerable()) { if (handsComponent.GetHand(slot) != itemComponent) continue; handsComponent.ActiveIndex = slot; handsComponent.ActivateItem(); return Outcome.Success; } return Outcome.Failed; } } }
mit
C#