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
90b12c8cbb79e7fb9702f669e00d75628cba2543
Add a default Logger implementation for AbpMemoryCacheManager
verdentk/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ilyhacker/aspnetboilerplate,zclmoon/aspnetboilerplate,virtualcca/aspnetboilerplate,Nongzhsh/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,andmattia/aspnetboilerplate,Nongzhsh/aspnetboilerplate,zclmoon/aspnetboilerplate,virtualcca/aspnetboilerplate,carldai0106/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,andmattia/aspnetboilerplate,carldai0106/aspnetboilerplate,beratcarsi/aspnetboilerplate,ilyhacker/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,andmattia/aspnetboilerplate,beratcarsi/aspnetboilerplate,virtualcca/aspnetboilerplate,Nongzhsh/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,carldai0106/aspnetboilerplate,luchaoshuai/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,zclmoon/aspnetboilerplate,ryancyq/aspnetboilerplate,verdentk/aspnetboilerplate,beratcarsi/aspnetboilerplate,carldai0106/aspnetboilerplate,verdentk/aspnetboilerplate
src/Abp/Runtime/Caching/Memory/AbpMemoryCacheManager.cs
src/Abp/Runtime/Caching/Memory/AbpMemoryCacheManager.cs
using Abp.Dependency; using Abp.Runtime.Caching.Configuration; using Castle.Core.Logging; namespace Abp.Runtime.Caching.Memory { /// <summary> /// Implements <see cref="ICacheManager"/> to work with MemoryCache. /// </summary> public class AbpMemoryCacheManager : CacheManagerBase { public ILogger Logger { get; set; } /// <summary> /// Constructor. /// </summary> public AbpMemoryCacheManager(IIocManager iocManager, ICachingConfiguration configuration) : base(iocManager, configuration) { Logger = NullLogger.Instance; } protected override ICache CreateCacheImplementation(string name) { return new AbpMemoryCache(name) { Logger = Logger }; } protected override void DisposeCaches() { foreach (var cache in Caches.Values) { cache.Dispose(); } } } }
using Abp.Dependency; using Abp.Runtime.Caching.Configuration; using Castle.Core.Logging; namespace Abp.Runtime.Caching.Memory { /// <summary> /// Implements <see cref="ICacheManager"/> to work with MemoryCache. /// </summary> public class AbpMemoryCacheManager : CacheManagerBase { public ILogger Logger { get; set; } /// <summary> /// Constructor. /// </summary> public AbpMemoryCacheManager(IIocManager iocManager, ICachingConfiguration configuration) : base(iocManager, configuration) { } protected override ICache CreateCacheImplementation(string name) { return new AbpMemoryCache(name) { Logger = Logger }; } protected override void DisposeCaches() { foreach (var cache in Caches.Values) { cache.Dispose(); } } } }
mit
C#
34e33c828661546f7ccd9c9ed42b62efc4844158
Update version
mruhul/Bolt.Validation,mruhul/Bolt.Validation
Src/Bolt.Validation/Properties/AssemblyInfo.cs
Src/Bolt.Validation/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("Bolt.Validation")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Bolt.Validation")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("eec220dd-485c-4faf-b7a3-e24201c7f185")] // 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.1")] [assembly: AssemblyFileVersion("1.0.0.1")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Bolt.Validation")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Bolt.Validation")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("eec220dd-485c-4faf-b7a3-e24201c7f185")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
cb693e5b49b2717d4583c23f2c5016c6f6ef3803
fix typo
MicrosoftDX/botFramework-proactiveMessages,MicrosoftDX/botFramework-proactiveMessages,MicrosoftDX/botFramework-proactiveMessages
csharp/simpleSendMessage/Controllers/CustomWebAPIController.cs
csharp/simpleSendMessage/Controllers/CustomWebAPIController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; using System.Web; using System.Web.Http; namespace simpleSendMessage.Controllers { //This controller exists just to prove that we can trigger that proactive conversation even from completely outside the bot's code //Let's say you have a web service or some backend system that needs to trigger it, this is how you would do that public class CustomWebAPIController : ApiController { [HttpGet] [Route("api/CustomWebAPI")] public async Task<HttpResponseMessage> SendMessage() { try { if (!string.IsNullOrEmpty(ConversationStarter.fromId)) { await ConversationStarter.Resume(ConversationStarter.conversationId, ConversationStarter.channelId); //We don't need to wait for this, just want to start the interruption here var resp = new HttpResponseMessage(HttpStatusCode.OK); resp.Content = new StringContent($"<html><body>Message sent, thanks.</body></html>", System.Text.Encoding.UTF8, @"text/html"); return resp; } else { var resp = new HttpResponseMessage(HttpStatusCode.OK); resp.Content = new StringContent($"<html><body>You need to talk to the bot first so it can capture your details.</body></html>", System.Text.Encoding.UTF8, @"text/html"); return resp; } } catch (Exception ex) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading.Tasks; using System.Web; using System.Web.Http; namespace simpleSendMessage.Controllers { //This controller exists just to prove that we can trigger that proactive conversation even from compeltely outside the bot's code //Let's say you have a web service or some backend system that needs to trigger it, this is how you would do that public class CustomWebAPIController : ApiController { [HttpGet] [Route("api/CustomWebAPI")] public async Task<HttpResponseMessage> SendMessage() { try { if (!string.IsNullOrEmpty(ConversationStarter.fromId)) { await ConversationStarter.Resume(ConversationStarter.conversationId, ConversationStarter.channelId); //We don't need to wait for this, just want to start the interruption here var resp = new HttpResponseMessage(HttpStatusCode.OK); resp.Content = new StringContent($"<html><body>Message sent, thanks.</body></html>", System.Text.Encoding.UTF8, @"text/html"); return resp; } else { var resp = new HttpResponseMessage(HttpStatusCode.OK); resp.Content = new StringContent($"<html><body>You need to talk to the bot first so it can capture your details.</body></html>", System.Text.Encoding.UTF8, @"text/html"); return resp; } } catch (Exception ex) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); } } } }
mit
C#
5554d0f781991dcde29111debc7cdf1f278072f5
change google tokens data format
CloudBreadProject/CloudBread-Client-Unity,CloudBreadProject/CloudBread-Client-Unity,CloudBreadProject/CloudBread-Client-Unity,CloudBreadProject/CloudBread-Client-Unity
Assets/Scripts/CloudBread/AzureAuthentication.cs
Assets/Scripts/CloudBread/AzureAuthentication.cs
using UnityEngine; using System; using System.Collections; using System.Collections.Generic; public class AzureAuthentication : MonoBehaviour { public class AuthenticationToken { } public class FacebookGoogleAuthenticationToken : AuthenticationToken { public string access_token; } public class GoogleAuthenticationToken : AuthenticationToken { public string access_token; public string id_token; public string authorization_code; } public class MicrosoftAuthenticationToken : AuthenticationToken { public string authenticationToken; } public enum AuthenticationProvider { // Summary: // Microsoft Account authentication provider. MicrosoftAccount = 0, // // Summary: // Google authentication provider. Google = 1, // // Summary: // Twitter authentication provider. Twitter = 2, // // Summary: // Facebook authentication provider. Facebook = 3, } private Action<string,WWW> Callback_Success; private Action<string,WWW> Callback_Error; public void Login(AuthenticationProvider provider, string ServerAddress, string token, Action<string, WWW> callback_success, Action<string, WWW> callback_error){ var path = ".auth/login/" + provider.ToString().ToLower(); AuthenticationToken authToken = CreateToken(provider, token); string json = JsonUtility.ToJson(authToken); print (json); Callback_Success = callback_success; Callback_Error = callback_error; WWWHelper helper = WWWHelper.Instance; helper.OnHttpRequest += OnHttpRequest; helper.POST ("Login", ServerAddress + path, json); } public void Login(string ServerAddress, AuthenticationProvider provider, AuthenticationToken token, Action<string, WWW> callback_success, Action<string, WWW> callback_error){ var path = ".auth/login/" + provider.ToString().ToLower(); string json = JsonUtility.ToJson(token); print (json); Callback_Success = callback_success; Callback_Error = callback_error; WWWHelper helper = WWWHelper.Instance; helper.OnHttpRequest += OnHttpRequest; helper.POST ("Login", ServerAddress + path, json); } public void OnHttpRequest(string id, WWW www) { WWWHelper helper = WWWHelper.Instance; helper.OnHttpRequest -= OnHttpRequest; if (www.error != null) { // Debug.Log ("[Error] " + www.error); Callback_Error(id,www); } else { // Debug.Log (www.text); Callback_Success(id, www); } } private static AuthenticationToken CreateToken(AuthenticationProvider provider, string token) { AuthenticationToken authToken = new AuthenticationToken(); switch (provider) { case AuthenticationProvider.Facebook: case AuthenticationProvider.Google: case AuthenticationProvider.Twitter: { authToken = new FacebookGoogleAuthenticationToken() { access_token = token }; break; } case AuthenticationProvider.MicrosoftAccount: { authToken = new MicrosoftAuthenticationToken() { authenticationToken = token }; break; } } return authToken; } }
using UnityEngine; using System; using System.Collections; using System.Collections.Generic; public class AzureAuthentication : MonoBehaviour { public class AuthenticationToken { } public class FacebookGoogleAuthenticationToken : AuthenticationToken { public string access_token; } public class MicrosoftAuthenticationToken : AuthenticationToken { public string authenticationToken; } public enum AuthenticationProvider { // Summary: // Microsoft Account authentication provider. MicrosoftAccount = 0, // // Summary: // Google authentication provider. Google = 1, // // Summary: // Twitter authentication provider. Twitter = 2, // // Summary: // Facebook authentication provider. Facebook = 3, } private Action<string,WWW> Callback_Success; private Action<string,WWW> Callback_Error; public void Login(AuthenticationProvider provider, string ServerAddress, string token, Action<string, WWW> callback_success, Action<string, WWW> callback_error){ var path = ".auth/login/" + provider.ToString().ToLower(); AuthenticationToken authToken = CreateToken(provider, token); string json = JsonUtility.ToJson(authToken); print (json); Callback_Success = callback_success; Callback_Error = callback_error; WWWHelper helper = WWWHelper.Instance; helper.OnHttpRequest += OnHttpRequest; helper.POST ("Login", ServerAddress + path, json); } public void OnHttpRequest(string id, WWW www) { WWWHelper helper = WWWHelper.Instance; helper.OnHttpRequest -= OnHttpRequest; if (www.error != null) { // Debug.Log ("[Error] " + www.error); Callback_Error(id,www); } else { // Debug.Log (www.text); Callback_Success(id, www); } } private static AuthenticationToken CreateToken(AuthenticationProvider provider, string token) { AuthenticationToken authToken = new AuthenticationToken(); switch (provider) { case AuthenticationProvider.Facebook: case AuthenticationProvider.Google: case AuthenticationProvider.Twitter: { authToken = new FacebookGoogleAuthenticationToken() { access_token = token }; break; } case AuthenticationProvider.MicrosoftAccount: { authToken = new MicrosoftAuthenticationToken() { authenticationToken = token }; break; } } return authToken; } }
mit
C#
5fc9c739148cfda076bc01a6c36d4fe7f6e6c85f
Fix link to users list
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
BatteryCommander.Web/Views/Shared/_Layout.cshtml
BatteryCommander.Web/Views/Shared/_Layout.cshtml
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>@ViewBag.Title - Battery Commander</title> @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") </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("Battery Commander", "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("Soldiers", "List", "Soldier")</li> <!--<li>@Html.ActionLink("Groups", "List", "Group")</li>--> <li>@Html.ActionLink("Qualifications", "List", "Qualification")</li> <!--<li>@Html.ActionLink("Alerts", "List", "Alert")</li>--> <!--<li>@Html.ActionLink("Work Items", "List", "WorkItem")</li>--> <li>@Html.ActionLink("Users", "List", "Users")</li> </ul> @Html.Partial("_LoginPartial") </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - MattGWagner</p> </footer> </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @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 - Battery Commander</title> @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") </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("Battery Commander", "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("Soldiers", "List", "Soldier")</li> <!--<li>@Html.ActionLink("Groups", "List", "Group")</li>--> <li>@Html.ActionLink("Qualifications", "List", "Qualification")</li> <!--<li>@Html.ActionLink("Alerts", "List", "Alert")</li>--> <!--<li>@Html.ActionLink("Work Items", "List", "WorkItem")</li>--> <li>@Html.ActionLink("Users", "List", "User")</li> </ul> @Html.Partial("_LoginPartial") </div> </div> </div> <div class="container body-content"> @RenderBody() <hr /> <footer> <p>&copy; @DateTime.Now.Year - MattGWagner</p> </footer> </div> @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @RenderSection("scripts", required: false) </body> </html>
mit
C#
07c43304a267a5592d42f32b567f16d53267dab4
reorder usings
ChrisHel/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,hal-ler/omnisharp-roslyn,nabychan/omnisharp-roslyn,RichiCoder1/omnisharp-roslyn,sriramgd/omnisharp-roslyn,hach-que/omnisharp-roslyn,haled/omnisharp-roslyn,haled/omnisharp-roslyn,hitesh97/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,xdegtyarev/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,hitesh97/omnisharp-roslyn,jtbm37/omnisharp-roslyn,ianbattersby/omnisharp-roslyn,jtbm37/omnisharp-roslyn,david-driscoll/omnisharp-roslyn,david-driscoll/omnisharp-roslyn,ianbattersby/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,fishg/omnisharp-roslyn,fishg/omnisharp-roslyn,xdegtyarev/omnisharp-roslyn,khellang/omnisharp-roslyn,khellang/omnisharp-roslyn,hal-ler/omnisharp-roslyn,sreal/omnisharp-roslyn,hach-que/omnisharp-roslyn,sreal/omnisharp-roslyn,ChrisHel/omnisharp-roslyn,nabychan/omnisharp-roslyn,RichiCoder1/omnisharp-roslyn,sriramgd/omnisharp-roslyn
tests/OmniSharp.Tests/Fakes/FakeOmniSharpEnvironment.cs
tests/OmniSharp.Tests/Fakes/FakeOmniSharpEnvironment.cs
using Microsoft.Framework.Logging; using OmniSharp.Services; namespace OmniSharp.Tests { public class FakeEnvironment : IOmnisharpEnvironment { public LogLevel TraceType { get; } public int Port { get; } public int HostPID { get; } public string Path { get { return "."; } } public string SolutionFilePath { get; } public TransportType TransportType { get; } } }
using OmniSharp.Services; using Microsoft.Framework.Logging; namespace OmniSharp.Tests { public class FakeEnvironment : IOmnisharpEnvironment { public LogLevel TraceType { get; } public int Port { get; } public int HostPID { get; } public string Path { get { return "."; } } public string SolutionFilePath { get; } public TransportType TransportType { get; } } }
mit
C#
7038aa4d4ff595907da7a06f1636578b773628b5
Change version number.
jonnybee/csla,jonnybee/csla,ronnymgm/csla-light,rockfordlhotka/csla,JasonBock/csla,JasonBock/csla,BrettJaner/csla,rockfordlhotka/csla,rockfordlhotka/csla,ronnymgm/csla-light,MarimerLLC/csla,ronnymgm/csla-light,BrettJaner/csla,BrettJaner/csla,jonnybee/csla,MarimerLLC/csla,MarimerLLC/csla,JasonBock/csla
cslacs/Csla/Properties/AssemblyInfo.cs
cslacs/Csla/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("CSLA .NET")] [assembly: AssemblyDescription("CSLA .NET Framework")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rockford Lhotka")] [assembly: AssemblyProduct("CSLA .NET")] [assembly: AssemblyCopyright("Copyright © 2007 Rockford Lhotka")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Mark the assembly as CLS compliant [assembly: System.CLSCompliant(true)] // 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("43110d9d-9176-498d-95e0-2be52fcd11d2")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("3.0.1.0")] [assembly: AssemblyFileVersion("3.0.1.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("CSLA .NET")] [assembly: AssemblyDescription("CSLA .NET Framework")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rockford Lhotka")] [assembly: AssemblyProduct("CSLA .NET")] [assembly: AssemblyCopyright("Copyright © 2007 Rockford Lhotka")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Mark the assembly as CLS compliant [assembly: System.CLSCompliant(true)] // 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("43110d9d-9176-498d-95e0-2be52fcd11d2")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.0.0")]
mit
C#
3f506696b12abe534787451446fd06480ae9ea18
Rename TdfConvert.ToInt to ToInt32
MHeasell/Mappy,MHeasell/Mappy
Mappy/TdfConvert.cs
Mappy/TdfConvert.cs
namespace Mappy { using System; public static class TdfConvert { public static string ToString(int i) { return Convert.ToString(i); } public static string ToString(bool b) { return b ? "1" : "0"; } public static bool ToBool(string s) { return !(string.IsNullOrEmpty(s) || s == "0"); } public static int ToInt32(string s) { if (string.IsNullOrWhiteSpace(s)) { return 0; } return Convert.ToInt32(s); } } }
namespace Mappy { using System; public static class TdfConvert { public static string ToString(int i) { return Convert.ToString(i); } public static string ToString(bool b) { return b ? "1" : "0"; } public static bool ToBool(string s) { return !(string.IsNullOrEmpty(s) || s == "0"); } public static int ToInt(string s) { if (string.IsNullOrWhiteSpace(s)) { return 0; } return Convert.ToInt32(s); } } }
mit
C#
ae7d8da40d9cced3c7de564f449f6b37c709eb57
Fix typo
TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets
guides/voice/gather-dtmf-tones-guide/gather-example-step-1/example.5.x.cs
guides/voice/gather-dtmf-tones-guide/gather-example-step-1/example.5.x.cs
// In Package Manager, run: // Install-Package Twilio.AspNet.Mvc -DependencyVersion HighestMinor using System.Web.Mvc; using Twilio.AspNet.Mvc; using Twilio.AspNet.Common; using Twilio.TwiML; using System; public class VoiceController : TwilioController { [HttpPost] public TwiMLResult Index(VoiceRequest request) { var response = new VoiceResponse(); if (!string.IsNullOrEmpty(request.Digits)) { switch (request.Digits) { case "1": response.Say("You selected sales. Good for you!"); break; case "2": response.Say("You need support. We will help!"); break; default: response.Say("Sorry, I don't understand that choice.").Pause(); RenderMainMenu(response); break; } } else { // If no input was sent, use the <Gather> verb to collect user input RenderMainMenu(response); } return TwiML(response); } private static void RenderMainMenu(VoiceResponse response) { response.Gather(numDigits: 1) .Say("For sales, press 1. For support, press 2."); // If the user doesn't enter input, loop response.Redirect(new Uri("/voice")); } }
// In Package Manager, run: // Install-Package Twilio.AspNet.Mvc -DependencyVersion HighestMinor using System.Web.Mvc; using Twilio.AspNet.Mvc; using Twilio.AspNet.Common; using Twilio.TwiML; using System; public class VoiceController : TwilioController { [HttpPost] public TiwMLResult Index(VoiceRequest request) { var response = new VoiceResponse(); if (!string.IsNullOrEmpty(request.Digits)) { switch (request.Digits) { case "1": response.Say("You selected sales. Good for you!"); break; case "2": response.Say("You need support. We will help!"); break; default: response.Say("Sorry, I don't understand that choice.").Pause(); RenderMainMenu(response); break; } } else { // If no input was sent, use the <Gather> verb to collect user input RenderMainMenu(response); } return TwiML(response); } private static void RenderMainMenu(VoiceResponse response) { response.Gather(numDigits: 1) .Say("For sales, press 1. For support, press 2."); // If the user doesn't enter input, loop response.Redirect(new Uri("/voice")); } }
mit
C#
a4a2e29b88a024585fb0aad31a1ba6c0fe772ac0
Increment patch -> 0.1.1
awseward/restivus
AssemblyInfo.sln.cs
AssemblyInfo.sln.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("0.1.1.0")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")]
mit
C#
50a4c522b8ab9be94436deb13d8976e4d7e245d0
Update Examples/CSharp/Outlook/OLM/LoadAndReadOLMFile.cs
aspose-email/Aspose.Email-for-.NET,asposeemail/Aspose_Email_NET
Examples/CSharp/Outlook/OLM/LoadAndReadOLMFile.cs
Examples/CSharp/Outlook/OLM/LoadAndReadOLMFile.cs
using System; using Aspose.Email.Storage.Olm; using Aspose.Email.Mapi; namespace Aspose.Email.Examples.CSharp.Email.Outlook.OLM { class LoadAndReadOLMFile { public static void Run() { // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); string dst = dataDir + "OutlookforMac.olm"; // ExStart:LoadAndReadOLMFile using (OlmStorage storage = new OlmStorage(dst)) { foreach (OlmFolder folder in storage.FolderHierarchy) { if (folder.HasMessages) { // extract messages from folder foreach (MapiMessage msg in storage.EnumerateMessages(folder)) { Console.WriteLine("Subject: " + msg.Subject); } } // read sub-folders if (folder.SubFolders.Count > 0) { foreach (OlmFolder sub_folder in folder.SubFolders) { Console.WriteLine("Subfolder: " + sub_folder.Name); } } } } // ExEnd:LoadAndReadOLMFile } } }
using System; using Aspose.Email.Storage.Olm; using Aspose.Email.Mapi; namespace Aspose.Email.Examples.CSharp.Email.Outlook.OLM { class LoadAndReadOLMFile { public static void Run() { // The path to the File directory. string dataDir = RunExamples.GetDataDir_Outlook(); string dst = dataDir + "OutlookforMac.olm"; // ExStart:LoadAndReadOLMFile using (OlmStorage storage = new OlmStorage(dst)) { foreach (OlmFolder folder in storage.FolderHierarchy) { if (folder.HasMessages) { // extract messages from folder foreach (MapiMessage msg in storage.EnumerateMessages(folder)) { Console.WriteLine("Subject: " + msg.Subject); } } // read sub-folders if (folder.SubFolders.Count > 0) { foreach (OlmFolder sub_folder in folder.SubFolders) { Console.WriteLine("Subfolder: " + sub_folder.Name); } } } } // ExEnd:LoadAndReadOLMFile } } }
mit
C#
e00688242066263de4297576022f4c7d77e2eb56
Increment build number
emoacht/SnowyImageCopy
Source/SnowyImageCopy/Properties/AssemblyInfo.cs
Source/SnowyImageCopy/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Snowy")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Snowy")] [assembly: AssemblyCopyright("Copyright © 2014-2018 emoacht")] [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("55df0585-a26e-489e-bd94-4e6a50a83e23")] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US" , UltimateResourceFallbackLocation.MainAssembly)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.5.34")] [assembly: AssemblyFileVersion("1.5.5.34")] // For unit test [assembly: InternalsVisibleTo("SnowyImageCopy.Test")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Snowy")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Snowy")] [assembly: AssemblyCopyright("Copyright © 2014-2018 emoacht")] [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("55df0585-a26e-489e-bd94-4e6a50a83e23")] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US" , UltimateResourceFallbackLocation.MainAssembly)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.4.32")] [assembly: AssemblyFileVersion("1.5.4.32")] // For unit test [assembly: InternalsVisibleTo("SnowyImageCopy.Test")]
mit
C#
0c79fa3300c3776dbdd17f549f2088aa493012fd
Revert "Add Bruce Wayne to contact page."
jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox,jpfultonzm/trainingsandbox
ZirMed.TrainingSandbox/Views/Home/Contact.cshtml
ZirMed.TrainingSandbox/Views/Home/Contact.cshtml
@{ ViewBag.Title = "Contact"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <address> One Microsoft Way<br /> Redmond, WA 98052-6399<br /> <abbr title="Phone">P:</abbr> 425.555.0100 </address> <address> <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br /> <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a> <strong>Pat:</strong> <a href="mailto:patrick.fulton@zirmed.com">patrick.fulton@zirmed.com</a> <strong>Dustin:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> <strong>Nicolas:</strong> <a href="mailto:nick.wolf@zirmed.com">nick.wolf@zirmed.com</a> <strong>Dustin2:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> <strong>Travis:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a> <strong>Travis2:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a> <strong>Stephanie:</strong> <a href="mailto:stephanie.craig@zirmed.com">stephanie.craig@zirmed.com</a> </address>
@{ ViewBag.Title = "Contact"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <address> One Microsoft Way<br /> Redmond, WA 98052-6399<br /> <abbr title="Phone">P:</abbr> 425.555.0100 </address> <address> <strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br /> <strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a> <strong>Pat:</strong> <a href="mailto:patrick.fulton@zirmed.com">patrick.fulton@zirmed.com</a> <strong>Dustin:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> <strong>Nicolas:</strong> <a href="mailto:nick.wolf@zirmed.com">nick.wolf@zirmed.com</a> <strong>Dustin2:</strong> <a href="mailto:dustin.crawford@zirmed.com">dustin.crawford@zirmed.com</a> <strong>Travis:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a> <strong>Travis2:</strong> <a href="mailto:travis.elkins@zirmed.com">travis.elkins@zirmed.com</a> <strong>Stephanie:</strong> <a href="mailto:stephanie.craig@zirmed.com">stephanie.craig@zirmed.com</a> <strong>Bruce:</strong> <a href="mailto:bruce.wayne@gotham.com">bruce.wayne@gotham.com</a> </address>
mit
C#
7994581ebaabac78d7132b45e821256623d651c1
Hide the form in the taskbar
DanH91/vuwall-motion,VuWall/VuWall-Motion
vuwall-motion/vuwall-motion/TransparentForm.cs
vuwall-motion/vuwall-motion/TransparentForm.cs
using System; using System.Drawing; using System.Windows.Forms; namespace vuwall_motion { public partial class TransparentForm : Form { public TransparentForm() { InitializeComponent(); DoubleBuffered = true; ShowInTaskbar = false; } private void TransparentForm_Load(object sender, EventArgs e) { int wl = TransparentWindowAPI.GetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle); wl = wl | 0x80000 | 0x20; TransparentWindowAPI.SetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle, wl); TransparentWindowAPI.SetLayeredWindowAttributes(this.Handle, 0, 128, TransparentWindowAPI.LWA.Alpha); Invalidate(); } private void TransparentForm_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawEllipse(Pens.Red, 250, 250, 20, 20); } // TODO: Method to get an event from MYO to get x & w positions, used to invalidate } }
using System; using System.Drawing; using System.Windows.Forms; namespace vuwall_motion { public partial class TransparentForm : Form { public TransparentForm() { InitializeComponent(); DoubleBuffered = true; } private void TransparentForm_Load(object sender, EventArgs e) { int wl = TransparentWindowAPI.GetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle); wl = wl | 0x80000 | 0x20; TransparentWindowAPI.SetWindowLong(this.Handle, TransparentWindowAPI.GWL.ExStyle, wl); TransparentWindowAPI.SetLayeredWindowAttributes(this.Handle, 0, 128, TransparentWindowAPI.LWA.Alpha); Invalidate(); } private void TransparentForm_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawEllipse(Pens.Red, 250, 250, 20, 20); } // TODO: Method to get an event from MYO to get x & w positions, used to invalidate } }
mit
C#
969f304b62042127fce8be0e777d84f2f22be5bd
Fix whitespace.
alastairs/cgowebsite,alastairs/cgowebsite
src/CGO.Web/Global.asax.cs
src/CGO.Web/Global.asax.cs
using System.Web; using System.Web.Http; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; using Newtonsoft.Json.Serialization; namespace CGO.Web { // Note: For instructions on enabling IIS6 or IIS7 classic mode, // visit http://go.microsoft.com/?LinkId=9394801 public class WebApiApplication : HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter; json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); } } }
using System.Web; using System.Web.Http; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; using Newtonsoft.Json.Serialization; namespace CGO.Web { // Note: For instructions on enabling IIS6 or IIS7 classic mode, // visit http://go.microsoft.com/?LinkId=9394801 public class WebApiApplication : HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter; json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); } } }
mit
C#
1d07d3012a7d72150b8d5aeb63a20fa501b177d5
Update dns_client.cs
damianrusinek/classes-pas,damianrusinek/classes-pas,damianrusinek/classes-pas,damianrusinek/classes-pas,damianrusinek/classes-pas,damianrusinek/classes-pas
dns_client/dns_client.cs
dns_client/dns_client.cs
using System; using System.Linq; using System.Net; using static System.Net.Dns; namespace DnsClient { class Program { static void Main(string[] args) { // c# 7.0 tinkering, use this version of input error handling if you want if (args.Length != 1) { Console.Error.WriteLine("Usage: run with parameter <host-name>"); Environment.Exit(1); } var hostname = args[0]; try { IPHostEntry entry = GetHostEntry(hostname); //GetHostByName method is obsolete var ip = entry.AddressList.FirstOrDefault(); Console.WriteLine($"Resolved IP address: {ip}"); } catch (Exception e) { Console.WriteLine(e.Message); } } } }
using System; using System.Linq; using System.Net; using static System.Net.Dns; namespace DnsClient { class Program { static void Main(string[] args) { // c# 7.0 tinkering, use this version of input error handling if you want //string hostname = args.Length == 1 // ? args[0] // : throw new ArgumentException("Usage: run with parameter <host-name>"); if (args.Length != 1) { Console.Error.WriteLine("Usage: run with parameter <host-name>"); Environment.Exit(1); } var hostname = args[0]; try { IPHostEntry entry = GetHostEntry(hostname); //GetHostByName method is obsolete var ip = entry.AddressList.FirstOrDefault(); Console.WriteLine($"Resolved IP address: {ip}"); #if DEBUG Console.Read(); #endif } catch (Exception e) { Console.WriteLine(e.Message); } } } }
mit
C#
75fbbea599f3883af6c58b31dbd44f8658392a65
allow translatable menu items for extensions
nathansamson/F-Spot-Album-Exporter,mans0954/f-spot,GNOME/f-spot,nathansamson/F-Spot-Album-Exporter,NguyenMatthieu/f-spot,dkoeb/f-spot,dkoeb/f-spot,mono/f-spot,Sanva/f-spot,GNOME/f-spot,Yetangitu/f-spot,nathansamson/F-Spot-Album-Exporter,GNOME/f-spot,mono/f-spot,Sanva/f-spot,GNOME/f-spot,mono/f-spot,mans0954/f-spot,Yetangitu/f-spot,Yetangitu/f-spot,dkoeb/f-spot,NguyenMatthieu/f-spot,mans0954/f-spot,mans0954/f-spot,Sanva/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,mans0954/f-spot,GNOME/f-spot,nathansamson/F-Spot-Album-Exporter,mans0954/f-spot,Sanva/f-spot,Yetangitu/f-spot,mono/f-spot,mono/f-spot,dkoeb/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,dkoeb/f-spot,mono/f-spot,dkoeb/f-spot,Yetangitu/f-spot
src/Extensions/MenuNode.cs
src/Extensions/MenuNode.cs
/* * MenuNode.cs * * Author(s): * Stephane Delcroix <stephane@delcroix.org> * * This is free software. See COPYING for details * */ using System; using Mono.Addins; using Mono.Unix; namespace FSpot.Extensions { [ExtensionNode ("Menu")] [ExtensionNodeChild (typeof (MenuItemNode))] [ExtensionNodeChild (typeof (ExportMenuItemNode))] [ExtensionNodeChild (typeof (CommandMenuItemNode))] [ExtensionNodeChild (typeof (MenuSeparatorNode))] [ExtensionNodeChild (typeof (SubmenuNode))] [ExtensionNodeChild (typeof (MenuGeneratorNode))] [ExtensionNodeChild (typeof (ComplexMenuItemNode))] public class SubmenuNode : MenuNode { public override Gtk.MenuItem GetMenuItem () { Gtk.MenuItem item = base.GetMenuItem (); Gtk.Menu submenu = GetSubmenu (); if (item.Submenu != null) item.Submenu.Dispose (); item.Submenu = submenu; return item; } public Gtk.Menu GetSubmenu () { Gtk.Menu submenu = new Gtk.Menu (); foreach (MenuNode node in ChildNodes) submenu.Insert (node.GetMenuItem (), -1); return submenu; } } [ExtensionNode ("MenuGenerator")] public class MenuGeneratorNode : MenuNode { [NodeAttribute ("generator_type", true)] protected string command_type; private IMenuGenerator menu_generator; public override Gtk.MenuItem GetMenuItem () { Gtk.MenuItem item = base.GetMenuItem (); menu_generator = (IMenuGenerator) Addin.CreateInstance (command_type); item.Submenu = menu_generator.GetMenu (); item.Activated += menu_generator.OnActivated; return item; } } [ExtensionNode ("MenuItem")] public class MenuItemNode : MenuNode { public override Gtk.MenuItem GetMenuItem () { Gtk.MenuItem item = base.GetMenuItem (); item.Activated += OnActivated; return item; } protected virtual void OnActivated (object o, EventArgs e) { } } [ExtensionNode ("MenuSeparator")] public class MenuSeparatorNode : MenuNode { public override Gtk.MenuItem GetMenuItem () { return new Gtk.SeparatorMenuItem (); } } public abstract class MenuNode : ExtensionNode { [NodeAttribute (Localizable=true)] protected string _label; [NodeAttribute] protected string icon; public virtual Gtk.MenuItem GetMenuItem () { Gtk.MenuItem item; if (icon == null) item = new Gtk.MenuItem (_label != null ? Catalog.GetString (_label) : Id); else { item = new Gtk.ImageMenuItem (_label != null ? Catalog.GetString (_label) : Id); (item as Gtk.ImageMenuItem).Image = Gtk.Image.NewFromIconName (icon, Gtk.IconSize.Menu); } return item; } } }
/* * MenuNode.cs * * Author(s): * Stephane Delcroix <stephane@delcroix.org> * * This is free software. See COPYING for details * */ using System; using Mono.Addins; using Mono.Unix; namespace FSpot.Extensions { [ExtensionNode ("Menu")] [ExtensionNodeChild (typeof (MenuItemNode))] [ExtensionNodeChild (typeof (ExportMenuItemNode))] [ExtensionNodeChild (typeof (CommandMenuItemNode))] [ExtensionNodeChild (typeof (MenuSeparatorNode))] [ExtensionNodeChild (typeof (SubmenuNode))] [ExtensionNodeChild (typeof (MenuGeneratorNode))] [ExtensionNodeChild (typeof (ComplexMenuItemNode))] public class SubmenuNode : MenuNode { public override Gtk.MenuItem GetMenuItem () { Gtk.MenuItem item = base.GetMenuItem (); Gtk.Menu submenu = GetSubmenu (); if (item.Submenu != null) item.Submenu.Dispose (); item.Submenu = submenu; return item; } public Gtk.Menu GetSubmenu () { Gtk.Menu submenu = new Gtk.Menu (); foreach (MenuNode node in ChildNodes) submenu.Insert (node.GetMenuItem (), -1); return submenu; } } [ExtensionNode ("MenuGenerator")] public class MenuGeneratorNode : MenuNode { [NodeAttribute ("generator_type", true)] protected string command_type; private IMenuGenerator menu_generator; public override Gtk.MenuItem GetMenuItem () { Gtk.MenuItem item = base.GetMenuItem (); menu_generator = (IMenuGenerator) Addin.CreateInstance (command_type); item.Submenu = menu_generator.GetMenu (); item.Activated += menu_generator.OnActivated; return item; } } [ExtensionNode ("MenuItem")] public class MenuItemNode : MenuNode { public override Gtk.MenuItem GetMenuItem () { Gtk.MenuItem item = base.GetMenuItem (); item.Activated += OnActivated; return item; } protected virtual void OnActivated (object o, EventArgs e) { } } [ExtensionNode ("MenuSeparator")] public class MenuSeparatorNode : MenuNode { public override Gtk.MenuItem GetMenuItem () { return new Gtk.SeparatorMenuItem (); } } public abstract class MenuNode : ExtensionNode { [NodeAttribute] protected string _label; [NodeAttribute] protected string icon; public virtual Gtk.MenuItem GetMenuItem () { Gtk.MenuItem item; if (icon == null) item = new Gtk.MenuItem (_label != null ? Catalog.GetString (_label) : Id); else { item = new Gtk.ImageMenuItem (_label != null ? Catalog.GetString (_label) : Id); (item as Gtk.ImageMenuItem).Image = Gtk.Image.NewFromIconName (icon, Gtk.IconSize.Menu); } return item; } } }
mit
C#
b5b8c9779154d0e674174c498dab75058f07a4c8
Bump version to v1.1.0.30
TDaphneB/XeroAPI.Net,jcvandan/XeroAPI.Net,XeroAPI/XeroAPI.Net,MatthewSteeples/XeroAPI.Net
source/XeroApi/Properties/AssemblyInfo.cs
source/XeroApi/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("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 2011")] [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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.30")] [assembly: AssemblyFileVersion("1.1.0.30")]
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("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 2011")] [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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.1.0.29")] [assembly: AssemblyFileVersion("1.1.0.29")]
mit
C#
51edd8827772898e6e5ece224e4507cdeb182dac
Add back fade
ppy/osu,2yangk23/osu,UselessToucan/osu,johnneijzen/osu,EVAST9919/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,EVAST9919/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,smoogipooo/osu,NeoAdonis/osu,johnneijzen/osu,peppy/osu-new,peppy/osu,2yangk23/osu,ppy/osu,peppy/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu
osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/SpinnerPlacementBlueprint.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osuTK; using osuTK.Input; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners { public class SpinnerPlacementBlueprint : PlacementBlueprint { public new Spinner HitObject => (Spinner)base.HitObject; private readonly SpinnerPiece piece; private bool isPlacingEnd; public SpinnerPlacementBlueprint() : base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 }) { InternalChild = piece = new SpinnerPiece { Alpha = 0.5f }; } protected override void Update() { base.Update(); if (isPlacingEnd) HitObject.EndTime = Math.Max(HitObject.StartTime, EditorClock.CurrentTime); piece.UpdateFrom(HitObject); } protected override bool OnMouseDown(MouseDownEvent e) { if (isPlacingEnd) { if (e.Button != MouseButton.Right) return false; HitObject.EndTime = EditorClock.CurrentTime; EndPlacement(); } else { if (e.Button != MouseButton.Left) return false; BeginPlacement(); piece.FadeTo(1f, 150, Easing.OutQuint); isPlacingEnd = true; } return true; } public override void UpdatePosition(Vector2 screenSpacePosition) { } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osuTK; using osuTK.Input; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners { public class SpinnerPlacementBlueprint : PlacementBlueprint { public new Spinner HitObject => (Spinner)base.HitObject; private readonly SpinnerPiece piece; private bool isPlacingEnd; public SpinnerPlacementBlueprint() : base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 }) { InternalChild = piece = new SpinnerPiece { Alpha = 0.5f }; } protected override void Update() { base.Update(); if (isPlacingEnd) HitObject.EndTime = Math.Max(HitObject.StartTime, EditorClock.CurrentTime); piece.UpdateFrom(HitObject); } protected override bool OnMouseDown(MouseDownEvent e) { if (isPlacingEnd) { if (e.Button != MouseButton.Right) return false; HitObject.EndTime = EditorClock.CurrentTime; EndPlacement(); } else { if (e.Button != MouseButton.Left) return false; BeginPlacement(); isPlacingEnd = true; } return true; } public override void UpdatePosition(Vector2 screenSpacePosition) { } } }
mit
C#
d7a2eb669b243996c44193d3af3311ac854a56a1
Rename method.
scott-fleischman/algorithms-csharp
tests/Algorithms.Sort.Tests/LinearSearchTests.cs
tests/Algorithms.Sort.Tests/LinearSearchTests.cs
using NUnit.Framework; namespace Algorithms.Sort.Tests { [TestFixture] public class LinearSearchTests { [TestCase(4, new[] { 1, 2, 3, 4 }, 3)] [TestCase(5, new[] { 1, 2, 3, 4 }, null)] [TestCase(0, new[] { 1, 2, 3, 4 }, null)] [TestCase(1, new[] { 1, 2, 3, 4, 1 }, 0)] public void Test(int value, int[] values, int? expectedIndex) { int? result = LinearSearch.FindIndex(value, values); Assert.That(result, Is.EqualTo(expectedIndex)); } } }
using NUnit.Framework; namespace Algorithms.Sort.Tests { [TestFixture] public class LinearSearchTests { [TestCase(4, new[] { 1, 2, 3, 4 }, 3)] [TestCase(5, new[] { 1, 2, 3, 4 }, null)] [TestCase(0, new[] { 1, 2, 3, 4 }, null)] [TestCase(1, new[] { 1, 2, 3, 4, 1 }, 0)] public void TestNull(int value, int[] values, int? expectedIndex) { int? result = LinearSearch.FindIndex(value, values); Assert.That(result, Is.EqualTo(expectedIndex)); } } }
mit
C#
591c5312593f19ca0be8d59e233cdadb78d6a9b3
Add "+" to attributes to fetch since ApacheDS doesn't return all on * and AD doesn't return anything on +
dsbenghe/Novell.Directory.Ldap.NETStandard,dsbenghe/Novell.Directory.Ldap.NETStandard
src/Novell.Directory.Ldap.NETStandard/ILdapConnection.ExtensionMethods.cs
src/Novell.Directory.Ldap.NETStandard/ILdapConnection.ExtensionMethods.cs
namespace Novell.Directory.Ldap { /// <summary> /// Extension Methods for <see cref="ILdapConnection"/> to /// avoid bloating that interface. /// </summary> public static class LdapConnectionExtensionMethods { /// <summary> /// Get some common Attributes from the Root DSE. /// This is really just a specialized <see cref="LdapSearchRequest"/> /// to handle getting some commonly requested information. /// </summary> public static RootDseInfo GetRootDseInfo(this ILdapConnection conn) { var searchResults = conn.Search("", LdapConnection.ScopeBase, "(objectClass=*)", new string[] { "*", "+", "supportedExtension" }, false); if (searchResults.HasMore()) { var sr = searchResults.Next(); return new RootDseInfo(sr); } return null; } } }
namespace Novell.Directory.Ldap { /// <summary> /// Extension Methods for <see cref="ILdapConnection"/> to /// avoid bloating that interface. /// </summary> public static class LdapConnectionExtensionMethods { /// <summary> /// Get some common Attributes from the Root DSE. /// This is really just a specialized <see cref="LdapSearchRequest"/> /// to handle getting some commonly requested information. /// </summary> public static RootDseInfo GetRootDseInfo(this ILdapConnection conn) { var searchResults = conn.Search("", LdapConnection.ScopeBase, "(objectClass=*)", new string[] { "*", "supportedExtension" }, false); if (searchResults.HasMore()) { var sr = searchResults.Next(); return new RootDseInfo(sr); } return null; } } }
mit
C#
b1fa5e514f89b6c7f526bac2bf6258ed3ec33dcb
Add using
Azure-Samples/MyDriving,Azure-Samples/MyDriving,Azure-Samples/MyDriving
XamarinApp/MyTrips/MyTrips.UWP/Views/GetStarted5.xaml.cs
XamarinApp/MyTrips/MyTrips.UWP/Views/GetStarted5.xaml.cs
using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; using MyTrips.Utils; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace MyTrips.UWP.Views { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class GetStarted5 : Page { private double StartX; private double EndX; public GetStarted5() { this.InitializeComponent(); Dots.SelectCircle(5); ManipulationMode = ManipulationModes.TranslateX; ManipulationStarted += Manipulation_Started; ManipulationCompleted += Manipulation_Completed; } void Manipulation_Started(object sender, ManipulationStartedRoutedEventArgs e) { StartX = e.Position.X; e.Handled = true; } void Manipulation_Completed(object sender, ManipulationCompletedRoutedEventArgs e) { EndX = e.Position.X; if (EndX > StartX) //back this.Frame.Navigate(typeof(GetStarted4)); e.Handled = true; } private void GoNext(object sender, RoutedEventArgs e) { Settings.Current.FirstRun = false; Window.Current.Content = new SplitViewShell(this.Frame); this.Frame.Navigate(typeof(LoginView)); } } }
using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace MyTrips.UWP.Views { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class GetStarted5 : Page { private double StartX; private double EndX; public GetStarted5() { this.InitializeComponent(); Dots.SelectCircle(5); ManipulationMode = ManipulationModes.TranslateX; ManipulationStarted += Manipulation_Started; ManipulationCompleted += Manipulation_Completed; } void Manipulation_Started(object sender, ManipulationStartedRoutedEventArgs e) { StartX = e.Position.X; e.Handled = true; } void Manipulation_Completed(object sender, ManipulationCompletedRoutedEventArgs e) { EndX = e.Position.X; if (EndX > StartX) //back this.Frame.Navigate(typeof(GetStarted4)); e.Handled = true; } private void GoNext(object sender, RoutedEventArgs e) { Settings.Current.FirstRun = false; Window.Current.Content = new SplitViewShell(this.Frame); this.Frame.Navigate(typeof(LoginView)); } } }
mit
C#
ffba435d7e6f4faae82070dd13d8a65d70f70bc9
update samples
dotnetcore/CAP,dotnetcore/CAP,dotnetcore/CAP,ouraspnet/cap
samples/Sample.Kafka.SqlServer/Controllers/ValuesController.cs
samples/Sample.Kafka.SqlServer/Controllers/ValuesController.cs
using System; using System.Data.SqlClient; using Dapper; using DotNetCore.CAP; using Microsoft.AspNetCore.Mvc; namespace Sample.Kafka.SqlServer.Controllers { [Route("api/[controller]")] public class ValuesController : Controller { private readonly ICapPublisher _capBus; public ValuesController(ICapPublisher capPublisher) { _capBus = capPublisher; } [Route("~/without/transaction")] public IActionResult WithoutTransaction() { _capBus.Publish("sample.kafka.sqlserver", DateTime.Now); return Ok(); } [Route("~/adonet/transaction")] public IActionResult AdonetWithTransaction() { using (var connection = new SqlConnection(Startup.ConnectionString)) { using (var transaction = connection.BeginTransaction(_capBus, autoCommit: false)) { //your business code connection.Execute("insert into dbo.test1(tname) values('test');", transaction: transaction); _capBus.Publish("sample.kafka.sqlserver", DateTime.Now); transaction.Commit(); } } return Ok(); } [NonAction] [CapSubscribe("sample.kafka.sqlserver")] public void Subscriber(DateTime time) { Console.WriteLine($@"{DateTime.Now}, Subscriber invoked, Sent time:{time}"); } } }
using System; using System.Data.SqlClient; using Dapper; using DotNetCore.CAP; using Microsoft.AspNetCore.Mvc; namespace Sample.Kafka.SqlServer.Controllers { [Route("api/[controller]")] public class ValuesController : Controller { private readonly ICapPublisher _capBus; public ValuesController(ICapPublisher capPublisher) { _capBus = capPublisher; } [Route("~/without/transaction")] public IActionResult WithoutTransaction() { _capBus.Publish("sample.rabbitmq.mysql", DateTime.Now); return Ok(); } [Route("~/adonet/transaction")] public IActionResult AdonetWithTransaction() { using (var connection = new SqlConnection(Startup.ConnectionString)) { using (var transaction = connection.BeginTransaction(_capBus, autoCommit: false)) { //your business code connection.Execute("insert into dbo.test1(tname) values('test');", transaction: transaction); _capBus.Publish("sample.rabbitmq.mysql", DateTime.Now); transaction.Commit(); } } return Ok(); } [NonAction] [CapSubscribe("sample.rabbitmq.mysql")] public void Subscriber(DateTime time) { Console.WriteLine($@"{DateTime.Now}, Subscriber invoked, Sent time:{time}"); } } }
mit
C#
63a5a1d02aa9bdf8dfc0c6111146c6f75fc6e20b
Update the 'name' field description
lukyad/Eco
Eco/Elements/variable.cs
Eco/Elements/variable.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Eco { /// <summary> /// Eco configuration library supports string varibales. /// You can enable variables in your configuration file by adding 'public variable[] variables;' /// field to your root configuration type. /// Variable can be referenced anywhere in a configuration file by it's name using the following syntax: ${name}. /// /// Variable's value can reference another variable. In this case variable value is expanded recursively. /// Eco library throws an exception if a circular variable dendency is detected. /// </summary> [Doc("Represents a configuration variable of the string type. Can be referenced anywhere in a configuration file by the following syntax: ${name}.")] public class variable { [Required, Doc("Name of the varible. Can contain 'word' characters only (ie [A-Za-z0-9_]).")] public string name; [Required, Doc("Variable's value.")] public string value; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Eco { /// <summary> /// Eco configuration library supports string varibales. /// You can enable variables in your configuration file by adding 'public variable[] variables;' /// field to your root configuration type. /// Variable can be referenced anywhere in a configuration file by it's name using the following syntax: ${name}. /// /// Variable's value can reference another variable. In this case variable value is expanded recursively. /// Eco library throws an exception if a circular variable dendency is detected. /// </summary> [Doc("Represents a configuration variable of the string type. Can be referenced anywhere in a configuration file by the following syntax: ${name}.")] public class variable { [Required, Doc("Name of the varible. Can contain 'word' characters only.")] public string name; [Required, Doc("Variable's value.")] public string value; } }
apache-2.0
C#
47cbe632ea38685ac8604c150d85cf0b3c68aeb3
Update FibonacciNums.cs
NayaIT/CSharp,NayaIT/CSharp-part-1
ConsoleInAndOut/FibonacciNumbers/FibonacciNums.cs
ConsoleInAndOut/FibonacciNumbers/FibonacciNums.cs
/*10. Fibonacci Numbers Description Write a program that reads a number N and prints on the console the first N members of the Fibonacci sequence (at a single line, separated by comma and space - ", ") : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, …. Input On the only line you will receive the number N Output On the only line you should print the first N numbers of the sequence, separated by ", " (comma and space) Constraints 1 <= N <= 50 N will always be a valid positive integer number Time limit: 0.1s Memory limit: 16MB */ namespace FibonacciNumbers { using System; class FibonacciNums { static void Main() { int n = int.Parse(Console.ReadLine()); long currentNumber; long firstNumber = 0; long secondNumber = 1; for (int i = 0; i < n; i++) { if (i == 0) { currentNumber = firstNumber; } else if (i == 1) { currentNumber = secondNumber; } else { currentNumber = firstNumber + secondNumber; firstNumber = secondNumber; secondNumber = currentNumber; } if (i < n - 1) { Console.Write("{0}, ", currentNumber); } else { Console.Write(currentNumber); } } } } }
/*10. Fibonacci Numbers Description Write a program that reads a number N and prints on the console the first N members of the Fibonacci sequence (at a single line, separated by comma and space - ", ") : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, …. Input On the only line you will receive the number N Output On the only line you should print the first N numbers of the sequence, separated by ", " (comma and space) Constraints 1 <= N <= 50 N will always be a valid positive integer number Time limit: 0.1s Memory limit: 16MB */ namespace FibonacciNumbers { using System; class FibonacciNums { static void Main() { int n = int.Parse(Console.ReadLine()); long currentNumber; long firstNumber = 0; long secondNumber = 1; for (int i = 0; i < n; i++) { if (i == 0) { currentNumber = firstNumber; } else if (i == 1) { currentNumber = secondNumber; } else { currentNumber = firstNumber + secondNumber; firstNumber = secondNumber; secondNumber = currentNumber; } if (i < n - 1) { Console.Write("{0}, ", currentNumber); } else { Console.Write(currentNumber); } }
mit
C#
2e99c1aef0e741180b95c6ceca86ed6c37c787ed
Convert _cards to auto-property
StefanoFiumara/Harry-Potter-Unity
Assets/Scripts/HarryPotterUnity/Game/Discard.cs
Assets/Scripts/HarryPotterUnity/Game/Discard.cs
using System.Collections.Generic; using Assets.Scripts.HarryPotterUnity.Cards; using Assets.Scripts.HarryPotterUnity.Utils; using UnityEngine; namespace Assets.Scripts.HarryPotterUnity.Game { public class Discard : MonoBehaviour { public List<GenericCard> Cards { get; private set; } //TODO: Does this need to be private? public static readonly Vector2 DiscardPositionOffset = new Vector2(-355f, -30f); public static readonly Vector3 PreviewOffset = new Vector3(-300f, -30f, -6f); public void Start () { Cards = new List<GenericCard>(); if (gameObject.collider == null) { var col = gameObject.AddComponent<BoxCollider>(); col.isTrigger = true; col.size = new Vector3(50f, 70f, 1f); col.center = new Vector3(DiscardPositionOffset.x, DiscardPositionOffset.y, 0f); } } public void Add(GenericCard card) { Cards.Add(card); card.transform.parent = transform; var cardPos = new Vector3(DiscardPositionOffset.x, DiscardPositionOffset.y, 16f); cardPos.z -= Cards.Count * 0.2f; var cardPreviewPos = cardPos; cardPreviewPos.z -= 20f; UtilManager.AddTweenToQueue(card, cardPreviewPos, 0.35f, 0f, GenericCard.CardStates.Discarded, card.State == GenericCard.CardStates.InDeck, card.State == GenericCard.CardStates.InPlay); UtilManager.AddTweenToQueue(card, cardPos, 0.25f, 0f, GenericCard.CardStates.Discarded, false, false); } //TODO: OnMouseUp: View cards in discard pile } }
using System.Collections.Generic; using Assets.Scripts.HarryPotterUnity.Cards; using Assets.Scripts.HarryPotterUnity.Utils; using UnityEngine; namespace Assets.Scripts.HarryPotterUnity.Game { public class Discard : MonoBehaviour { private List<GenericCard> _cards; //TODO: Does this need to be private? public static readonly Vector2 DiscardPositionOffset = new Vector2(-355f, -30f); public static readonly Vector3 PreviewOffset = new Vector3(-300f, -30f, -6f); public void Start () { _cards = new List<GenericCard>(); if (gameObject.collider == null) { var col = gameObject.AddComponent<BoxCollider>(); col.isTrigger = true; col.size = new Vector3(50f, 70f, 1f); col.center = new Vector3(DiscardPositionOffset.x, DiscardPositionOffset.y, 0f); } } public void Add(GenericCard card) { _cards.Add(card); card.transform.parent = transform; var cardPos = new Vector3(DiscardPositionOffset.x, DiscardPositionOffset.y, 16f); cardPos.z -= _cards.Count * 0.2f; var cardPreviewPos = cardPos; cardPreviewPos.z -= 20f; UtilManager.AddTweenToQueue(card, cardPreviewPos, 0.35f, 0f, GenericCard.CardStates.Discarded, card.State == GenericCard.CardStates.InDeck, card.State == GenericCard.CardStates.InPlay); UtilManager.AddTweenToQueue(card, cardPos, 0.25f, 0f, GenericCard.CardStates.Discarded, false, false); } //TODO: OnMouseUp: View cards in discard pile } }
mit
C#
7528a5fa1bd0a072cae97185bec05d54fcac11ad
Deal with case of removing a Subscription that has been previously removed (06624d)
AdaptiveConsulting/Aeron.NET,AdaptiveConsulting/Aeron.NET
src/Adaptive.Aeron/ActiveSubscriptions.cs
src/Adaptive.Aeron/ActiveSubscriptions.cs
using System; using System.Collections.Generic; using System.Linq; namespace Adaptive.Aeron { internal class ActiveSubscriptions : IDisposable { private readonly Dictionary<int, List<Subscription>> _subscriptionsByStreamIdMap = new Dictionary<int, List<Subscription>>(); public void ForEach(int streamId, Action<Subscription> handler) { List<Subscription> subscriptions; if (_subscriptionsByStreamIdMap.TryGetValue(streamId, out subscriptions)) { subscriptions.ForEach(handler); } } public void Add(Subscription subscription) { List<Subscription> subscriptions; if (!_subscriptionsByStreamIdMap.TryGetValue(subscription.StreamId(), out subscriptions)) { subscriptions = new List<Subscription>(); _subscriptionsByStreamIdMap[subscription.StreamId()] = subscriptions; } subscriptions.Add(subscription); } public void Remove(Subscription subscription) { int streamId = subscription.StreamId(); List<Subscription> subscriptions; if (_subscriptionsByStreamIdMap.TryGetValue(streamId, out subscriptions)) { if (subscriptions.Remove(subscription) && subscriptions.Count == 0) { _subscriptionsByStreamIdMap.Remove(streamId); } } } public void Dispose() { var subscriptions = from subs in _subscriptionsByStreamIdMap.Values from subscription in subs select subscription; foreach (var subscription in subscriptions) { subscription.Dispose(); } } } }
using System; using System.Collections.Generic; using System.Linq; namespace Adaptive.Aeron { internal class ActiveSubscriptions : IDisposable { private readonly Dictionary<int, List<Subscription>> _subscriptionsByStreamIdMap = new Dictionary<int, List<Subscription>>(); public void ForEach(int streamId, Action<Subscription> handler) { List<Subscription> subscriptions; if (_subscriptionsByStreamIdMap.TryGetValue(streamId, out subscriptions)) { subscriptions.ForEach(handler); } } public void Add(Subscription subscription) { List<Subscription> subscriptions; if (!_subscriptionsByStreamIdMap.TryGetValue(subscription.StreamId(), out subscriptions)) { subscriptions = new List<Subscription>(); _subscriptionsByStreamIdMap[subscription.StreamId()] = subscriptions; } subscriptions.Add(subscription); } public void Remove(Subscription subscription) { int streamId = subscription.StreamId(); var subscriptions = _subscriptionsByStreamIdMap[streamId]; if (subscriptions.Remove(subscription) && subscriptions.Count == 0) { _subscriptionsByStreamIdMap.Remove(streamId); } } public void Dispose() { var subscriptions = from subs in _subscriptionsByStreamIdMap.Values from subscription in subs select subscription; foreach (var subscription in subscriptions) { subscription.Dispose(); } } } }
apache-2.0
C#
b434cbd0158b6c5ceac0da13192fa20ec2ebcb96
Update QueryableExtensions.cs
keith-hall/Extensions,keith-hall/Extensions
src/QueryableExtensions.cs
src/QueryableExtensions.cs
using System; using System.Collections.Generic; using System.Linq; namespace HallLibrary.Extensions { /// <summary> /// Contains static methods for working with queryables. /// </summary> public static class QueryableExtensions { /// <summary> /// Returns a single value from the specified <paramref name="queryable"/>, or throws an Exception if it contains no or multiple values. /// </summary> /// <typeparam name="T">The type of elements in the queryable.</typeparam> /// <param name="queryable">The queryable sequence to get the single value of.</param> /// <returns>Returns the single value from the specified <paramref name="queryable"/>, using the most efficient method possible to determine that it is a single value.</returns> /// <remarks>More efficient than the built in LINQ to SQL "Single" method, because this one takes the minimum number of results necessary to determine if the queryable contains a single value or not.</remarks> /// <exception cref="InvalidOperationException"><paramref name="queryable" /> contains 0 or more than 1 element.</exception> public static T EnsureSingle<T>(this IQueryable<T> queryable) { return queryable.Take(2).Single(); } } }
using System; using System.Collections.Generic; using System.Linq; namespace HallLibrary.Extensions { /// <summary> /// Contains static methods for working with queryables. /// </summary> public static class QueryableExtensions { /// <summary> /// Returns a single value from the specified <paramref name="queryable"/>, or throws an Exception if it contains no or multiple values. /// </summary> /// <typeparam name="T">The type of elements in the queryable.</typeparam> /// <param name="queryable">The queryable sequence to get the single value of.</param> /// <returns>Returns the single value from the specified <paramref name="queryable"/>, using the most efficient method possible to determine that it is a single value.</returns> /// <remarks>More efficient than the built in LINQ to SQL "Single" method, because this one takes the minimum number of results necessary to determine if the queryable contains a single value or not.</remarks> public static T EnsureSingle<T>(this IQueryable<T> queryable) { return queryable.Take(2).Single(); } } }
apache-2.0
C#
5186bc0ddc984171a5d2b0def0fd3a4d567cff0e
Remove Comments.
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
src/CompetitionPlatform/Views/Project/VotingBarsPartial.cshtml
src/CompetitionPlatform/Views/Project/VotingBarsPartial.cshtml
@model CompetitionPlatform.Models.ProjectViewModels.ProjectVoteViewModel @{ var totalVotes = Model.VotesFor + Model.VotesAgainst; var forPercent = 0; var againstPercent = 0; if (totalVotes != 0) { forPercent = Model.VotesFor * 100 / totalVotes; againstPercent = Model.VotesAgainst * 100 / totalVotes; } } <div class="voting_group__group"> <div class="status_bar"><span class="status_bar__line status_bar__line--green" style="width: @forPercent%"></span></div> <div class="voting_group__count"> <span class="text-green">@Model.VotesFor<!--max 3 symbols, for example, 240 or 10k--></span> Yes </div> </div> <div class="voting_group__group"> <div class="status_bar"><span class="status_bar__line status_bar__line--red" style="width: @againstPercent%"></span></div> <div class="voting_group__count"> <span class="text-red">@Model.VotesAgainst</span> No </div> </div>
@model CompetitionPlatform.Models.ProjectViewModels.ProjectVoteViewModel @{ var totalVotes = Model.VotesFor + Model.VotesAgainst; var forPercent = 0; var againstPercent = 0; if (totalVotes != 0) { forPercent = Model.VotesFor * 100 / totalVotes; againstPercent = Model.VotesAgainst * 100 / totalVotes; } } @*<div class="row"> <div class="col-md-10"> <div class="progress vote-progress-bar"> <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="@forPercent" aria-valuemin="0" aria-valuemax="100" style="width: @forPercent%"></div> </div> </div> <div class="col-md-2"> <p class="text-success bold-text vote-progress-bar-text">@Model.VotesFor</p> </div> </div> <div class="row"> <div class="col-md-10"> <div class="progress vote-progress-bar"> <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="@againstPercent" aria-valuemin="0" aria-valuemax="100" style="width: @againstPercent%"></div> </div> </div> <div class="col-md-2"> <p class="text-danger bold-text vote-progress-bar-text">@Model.VotesAgainst</p> </div> </div>*@ <div class="voting_group__group"> <div class="status_bar"><span class="status_bar__line status_bar__line--green" style="width: @forPercent%"></span></div> <div class="voting_group__count"> <span class="text-green">@Model.VotesFor<!--max 3 symbols, for example, 240 or 10k--></span> Yes </div> </div> <div class="voting_group__group"> <div class="status_bar"><span class="status_bar__line status_bar__line--red" style="width: @againstPercent%"></span></div> <div class="voting_group__count"> <span class="text-red">@Model.VotesAgainst</span> No </div> </div>
mit
C#
020d29f7bb2476bd93ed61fee6650c75a072434c
Update PowerShellLoggerProvider.cs
tiksn/TIKSN-Framework
TIKSN.Core/PowerShell/PowerShellLoggerProvider.cs
TIKSN.Core/PowerShell/PowerShellLoggerProvider.cs
using System; using System.Collections.Concurrent; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace TIKSN.PowerShell { public class PowerShellLoggerProvider : ILoggerProvider { private readonly ICurrentCommandProvider _currentCommandProvider; private readonly ConcurrentDictionary<string, PowerShellLogger> _loggers = new(); private readonly IOptions<PowerShellLoggerOptions> options; public PowerShellLoggerProvider(ICurrentCommandProvider currentCommandProvider, IOptions<PowerShellLoggerOptions> options) { this.options = options; this._currentCommandProvider = currentCommandProvider ?? throw new ArgumentNullException(nameof(currentCommandProvider)); } public ILogger CreateLogger(string categoryName) => this._loggers.GetOrAdd(categoryName, this.CreateLoggerImplementation); public void Dispose() { } private PowerShellLogger CreateLoggerImplementation(string name) => new(this._currentCommandProvider, this.options, name); } }
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; using System.Collections.Concurrent; namespace TIKSN.PowerShell { public class PowerShellLoggerProvider : ILoggerProvider { private readonly ICurrentCommandProvider _currentCommandProvider; private readonly ConcurrentDictionary<string, PowerShellLogger> _loggers = new ConcurrentDictionary<string, PowerShellLogger>(); private readonly IOptions<PowerShellLoggerOptions> options; public PowerShellLoggerProvider(ICurrentCommandProvider currentCommandProvider, IOptions<PowerShellLoggerOptions> options) { this.options = options; _currentCommandProvider = currentCommandProvider ?? throw new ArgumentNullException(nameof(currentCommandProvider)); } public ILogger CreateLogger(string categoryName) { return _loggers.GetOrAdd(categoryName, CreateLoggerImplementation); } public void Dispose() { } private PowerShellLogger CreateLoggerImplementation(string name) { return new PowerShellLogger(_currentCommandProvider, options, name); } } }
mit
C#
c7938fa59f3ba26481d1565a452a7403067d79eb
Remove some playing stuff.
jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr
HelloCoreClrApp.Test/GetHelloWorldActionTest.cs
HelloCoreClrApp.Test/GetHelloWorldActionTest.cs
using Xunit; namespace HelloWorldApp { public class GetHelloWorldActionTest { [Fact] public void ExecuteTest() { var sut = new GetHelloWorldAction(); var result = sut.Execute("World"); Assert.Equal("Hello World!", result.Name); } } }
using Xunit; namespace HelloWorldApp { public class GetHelloWorldActionTest { [Fact] public void ExecuteTest() { var sut = new GetHelloWorldAction(); var result = sut.Execute("World"); Assert.Equal("Hello World!", result.Name); } [Fact] public void ExecuteTest2() { var sut = new GetHelloWorldAction(); var result = sut.Execute("World1"); Assert.Equal("Hello World1!", result.Name); } [Fact(Skip="No fun")] public void ExecuteTest3() { var sut = new GetHelloWorldAction(); var result = sut.Execute("World3"); Assert.Equal("Hello World3!", result.Name); } [Fact] public void ExecuteTest4() { var sut = new GetHelloWorldAction(); var result = sut.Execute("World5"); Assert.Equal("Hello World4!", result.Name); } } }
mit
C#
ab00d4d0f771e9d7bb665f26068b7f6f469c8e7b
Update ModelConfig.cs
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
Test/AdventureWorksFunctionalModel/ModelConfig.cs
Test/AdventureWorksFunctionalModel/ModelConfig.cs
using Microsoft.Extensions.Configuration; using System; using System.Collections.Generic; using System.Linq; using System.Data.Entity; namespace AW { public static class ModelConfig { //IsAbstract && IsSealed defines a static class. Not really necessary here, just extra safety check. public static Type[] FunctionalTypes() => DomainClasses.Where(t => t.Namespace == "AW.Types" && !(t.IsAbstract && t.IsSealed)).ToArray(); public static Type[] Functions() => DomainClasses.Where(t => t.Namespace == "AW.Functions" && t.IsAbstract && t.IsSealed).ToArray(); private static IEnumerable<Type> DomainClasses => typeof(ModelConfig).Assembly.GetTypes().Where(t => t.IsPublic && (t.IsClass || t.IsInterface || t.IsEnum)); public static Func<IConfiguration, DbContext> DbContextInstaller => c => new AdventureWorksContext(c.GetConnectionString("AdventureWorksContext")); public static Type[] MainMenuTypes() => Functions().Where(t => t.FullName.Contains("MenuFunctions")).ToArray(); } }
using Microsoft.Extensions.Configuration; using System; using System.Collections.Generic; using System.Linq; using NakedFramework; using System.Data.Entity; namespace AW { public static class ModelConfig { //IsAbstract && IsSealed defines a static class. Not really necessary here, just extra safety check. public static Type[] FunctionalTypes() => DomainClasses.Where(t => t.Namespace == "AW.Types" && !(t.IsAbstract && t.IsSealed)).ToArray(); public static Type[] Functions() => DomainClasses.Where(t => t.Namespace == "AW.Functions" && t.IsAbstract && t.IsSealed).ToArray(); private static IEnumerable<Type> DomainClasses => typeof(ModelConfig).Assembly.GetTypes().Where(t => t.IsPublic && (t.IsClass || t.IsInterface || t.IsEnum)); public static Func<IConfiguration, DbContext> DbContextInstaller => c => new AdventureWorksContext(c.GetConnectionString("AdventureWorksContext")); //TODO: Delete when new NF.PM Helpers is available public static IMenu[] MainMenus(IMenuFactory mf) => MainMenuTypes().Select(t => mf.NewMenu(t, true)).ToArray(); public static Type[] MainMenuTypes() => Functions().Where(t => t.FullName.Contains("MenuFunctions")).ToArray(); } }
apache-2.0
C#
9dd8a31c0438f8d23cbf1c31c17e8c3b9f2b3920
use markdown editor
scheshan/DotNetBlog,scheshan/DotNetBlog
src/DotNetBlog.Web/Views/Home/Page.cshtml
src/DotNetBlog.Web/Views/Home/Page.cshtml
@model DotNetBlog.Core.Model.Page.PageModel @inject ClientManager clientManager <div id="page" class="page-global"> <h2 class="page-global-title">@Model.Title</h2> <div> <markdown content="@Model.Content"></markdown> </div> <div id="admin" condition="@clientManager.IsLogin"> <a asp-action="Index" asp-controller="Admin" asp-fragment="@("/content/page/" + Model.ID.ToString())">编辑</a> </div> </div>
@model DotNetBlog.Core.Model.Page.PageModel @inject ClientManager clientManager <div id="page" class="page-global"> <h2 class="page-global-title">@Model.Title</h2> <div> @Html.Raw(Model.Content) </div> <div id="admin" condition="@clientManager.IsLogin"> <a asp-action="Index" asp-controller="Admin" asp-fragment="@("/content/page/" + Model.ID.ToString())">编辑</a> </div> </div>
apache-2.0
C#
31b5119c647a27d86eb4966f65455a47e39bfc60
fix build of VSIX
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
tooling/Microsoft.VisualStudio.BlazorExtension/Properties/AssemblyInfo.cs
tooling/Microsoft.VisualStudio.BlazorExtension/Properties/AssemblyInfo.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 Microsoft.VisualStudio.Shell; // Add binding redirects for each assembly we ship in VS. This is required so that these assemblies show // up in the Load context, which means that we can use ServiceHub and other nice things. // // The versions here need to match what the build is producing. If you change the version numbers // for the Blazor assemblies, this needs to change as well. [assembly: ProvideBindingRedirection( AssemblyName = "Microsoft.AspNetCore.Blazor.Razor.Extensions", GenerateCodeBase = true, PublicKeyToken = "", OldVersionLowerBound = "0.0.0.0", OldVersionUpperBound = "0.7.0.0", NewVersion = "0.7.0.0")] [assembly: ProvideBindingRedirection( AssemblyName = "Microsoft.VisualStudio.LanguageServices.Blazor", GenerateCodeBase = true, PublicKeyToken = "", OldVersionLowerBound = "0.0.0.0", OldVersionUpperBound = "0.7.0.0", NewVersion = "0.7.0.0")] [assembly: ProvideBindingRedirection( AssemblyName = "AngleSharp", PublicKeyToken = "", OldVersionLowerBound = "0.0.0.0", OldVersionUpperBound = "0.9.9.0", NewVersion = "0.9.9.0")]
// 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 Microsoft.VisualStudio.Shell; // Add binding redirects for each assembly we ship in VS. This is required so that these assemblies show // up in the Load context, which means that we can use ServiceHub and other nice things. // // The versions here need to match what the build is producing. If you change the version numbers // for the Blazor assemblies, this needs to change as well. [assembly: ProvideBindingRedirection( AssemblyName = "Microsoft.AspNetCore.Blazor.Razor.Extensions", GenerateCodeBase = true, PublicKeyToken = "", OldVersionLowerBound = "0.0.0.0", OldVersionUpperBound = "0.6.0.0", NewVersion = "0.6.0.0")] [assembly: ProvideBindingRedirection( AssemblyName = "Microsoft.VisualStudio.LanguageServices.Blazor", GenerateCodeBase = true, PublicKeyToken = "", OldVersionLowerBound = "0.0.0.0", OldVersionUpperBound = "0.6.0.0", NewVersion = "0.6.0.0")] [assembly: ProvideBindingRedirection( AssemblyName = "AngleSharp", PublicKeyToken = "", OldVersionLowerBound = "0.0.0.0", OldVersionUpperBound = "0.9.9.0", NewVersion = "0.9.9.0")]
apache-2.0
C#
a9fb79bda5f9283ec7d09d8d32d96d7a5cb6b6df
Add methods
fredatgithub/UsefulFunctions
CodeGeneration/CodeFile.cs
CodeGeneration/CodeFile.cs
using System; using System.Collections.Generic; namespace CodeGeneration { internal class CodeFile { private List<string> ListOfUsing; private Dictionary<string, string> usingRequired; private string carriageReturn = Environment.NewLine; private const string usingToken = "using"; private const string space = " "; private const string semiColon = ";"; private const string systemtoken = "System"; private const string openCurlyBrace = "{"; private const string closeCurlyBrace = "}"; private byte tabulation = 2; private const string openSquareBracket = "["; private const string closeSquareBracket = "]"; private const string openParenthesis = "("; private const string closeParenthesis = ")"; private const string openCloseParenthesis = "()"; private const string testClass = "[TestClass]"; private const string testMethod = "[TestMethod]"; private const string testMethodOnly = "TestMethod"; private const string underScore = "_"; private const string period = "."; private const string trueToken = "true"; private const string falseToken = "false"; private const string publictoken = "public"; private const string voidToken = "void"; private const string assertToken = "Assert"; private const string areEqualToken = "AreEqual"; private const string areNotEqualToken = "AreNotEqual"; private const string isTrueToken = "IsTrue"; private const string isFalseToken = "IsFalse"; private const string areNotSameToken = "AreNotSame"; private const string areSameToken = "AreSame"; private const string equalsToken = "Equals"; private const string failToken = "Fail"; private const string inconclusiveToken = "Inconclusive"; private const string isInstanceOfTypeToken = "IsInstanceOfType"; private const string isNotInstnaceOfTypeToken = "IsNotInstanceOfType"; private const string isNotNulToken = "IsNotNull"; private const string isNullToken = "IsNull"; private const string ReferenceEqualsToken = "ReferenceEquals"; private const string replaceNullCharsToken = "ReplaceNullChars"; private const string publicClass = "public class UnitTestMethodsString"; public string Name { get; set; } public string FileName { get; set; } public string Code { get; set; } public CodeFile(string name = "untitled name", string fileName = "untitledCode.cs") { Name = name; FileName = fileName; ListOfUsing = new List<string>(); Code = string.Empty; } public void Add(string tag) { } public void AddUsing(string usingToken) { } public void VerifyUsingDependance() { } public override string ToString() { string result = string.Empty; // add all the using if (ListOfUsing.Count != 0) { foreach (string item in ListOfUsing) { result += item + carriageReturn; } } return result + Code; } } }
using System; using System.Collections.Generic; namespace CodeGeneration { internal class CodeFile { private List<string> ListOfUsing; private Dictionary<string, string> usingRequired; private string carriageReturn = Environment.NewLine; private const string usingToken = "using"; private const string space = " "; private const string semiColon = ";"; private const string systemtoken = "System"; private const string openCurlyBrace = "{"; private const string closeCurlyBrace = "}"; private byte tabulation = 2; private const string openSquareBracket = "["; private const string closeSquareBracket = "]"; private const string openParenthesis = "("; private const string closeParenthesis = ")"; private const string openCloseParenthesis = "()"; private const string testClass = "[TestClass]"; private const string testMethod = "[TestMethod]"; private const string testMethodOnly = "TestMethod"; private const string underScore = "_"; private const string period = "."; private const string trueToken = "true"; private const string falseToken = "false"; private const string publictoken = "public"; private const string voidToken = "void"; private const string assertToken = "Assert"; private const string areEqualToken = "AreEqual"; private const string areNotEqualToken = "AreNotEqual"; private const string isTrueToken = "IsTrue"; private const string isFalseToken = "IsFalse"; private const string areNotSameToken = "AreNotSame"; private const string areSameToken = "AreSame"; private const string equalsToken = "Equals"; private const string failToken = "Fail"; private const string inconclusiveToken = "Inconclusive"; private const string isInstanceOfTypeToken = "IsInstanceOfType"; private const string isNotInstnaceOfTypeToken = "IsNotInstanceOfType"; private const string isNotNulToken = "IsNotNull"; private const string isNullToken = "IsNull"; private const string ReferenceEqualsToken = "ReferenceEquals"; private const string replaceNullCharsToken = "ReplaceNullChars"; private const string publicClass = "public class UnitTestMethodsString"; public string Name { get; set; } public string FileName { get; set; } public string Code { get; set; } public CodeFile(string name = "untitled name", string fileName = "untitledCode.cs") { Name = name; FileName = fileName; ListOfUsing = new List<string>(); Code = string.Empty; } public void Add(string tag) { } public override string ToString() { string result = string.Empty; // add all the using if (ListOfUsing.Count != 0) { foreach (string item in ListOfUsing) { result += item + carriageReturn; } } return result + Code; } } }
mit
C#
bde8286ecbc9fc93c9b329b21e83eef0be0be702
add iequatable for neurongene
jobeland/NeuralNetwork
NeuralNetwork/NeuralNetwork/Genes/NeuronGene.cs
NeuralNetwork/NeuralNetwork/Genes/NeuronGene.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ArtificialNeuralNetwork.Genes { public class NeuronGene : IEquatable<NeuronGene> { public SomaGene Soma; public AxonGene Axon; #region Equality Members /// <summary> /// Returns true if the fields of the NeuronGene objects are the same. /// </summary> /// <param name="obj">The NeuronGene object to compare with.</param> /// <returns> /// True if the fields of the NeuronGene objects are the same; false otherwise. /// </returns> public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return false; } return Equals(obj as NeuronGene); } /// <summary> /// Returns true if the fields of the NeuronGene objects are the same. /// </summary> /// <param name="NeuronGene">The NeuronGene object to compare with.</param> /// <returns> /// True if the fields of the NeuronGene objects are the same; false otherwise. /// </returns> public bool Equals(NeuronGene neuronGene) { if (neuronGene == null) { return false; } if (neuronGene.Axon != Axon || neuronGene.Soma != Soma) { return false; } return true; } /// <summary> /// Returns true if the fields of the NeuronGene objects are the same. /// </summary> /// <param name="a">The NeuronGene object to compare.</param> /// <param name="b">The NeuronGene object to compare.</param> /// <returns> /// True if the objects are the same, are both null, or have the same values; /// false otherwise. /// </returns> public static bool operator ==(NeuronGene a, NeuronGene b) { // If both are null, or both are same instance, return true. if (ReferenceEquals(a, b)) { return true; } // If one or the other is null, return false. if (ReferenceEquals(a, null) || ReferenceEquals(b, null)) { return false; } return a.Equals(b); } public static bool operator !=(NeuronGene a, NeuronGene b) { return !(a == b); } // Following this algorithm: http://stackoverflow.com/a/263416 /// <summary> /// Returns the hash code of the NeuronGene. /// </summary> /// <returns>The hash code of the NeuronGene.</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hash = (int)2166136261; hash = hash * 16777619 ^ Axon.GetHashCode() ^ Soma.GetHashCode(); return hash; } } #endregion } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ArtificialNeuralNetwork.Genes { public class NeuronGene { public SomaGene Soma; public AxonGene Axon; } }
mit
C#
a2722d6f01c836f9479c2b056e93c3a9d1c1b9f7
Update AddWorkbookScopedNamedRange.cs
maria-shahid-aspose/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,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET
Examples/CSharp/Articles/WorkbookScopedNamedRanges/AddWorkbookScopedNamedRange.cs
Examples/CSharp/Articles/WorkbookScopedNamedRanges/AddWorkbookScopedNamedRange.cs
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Articles.WorkbookScopedNamedRanges { public class AddWorkbookScopedNamedRange { public static void Main() { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Create a new Workbook object Workbook workbook = new Workbook(); //get first worksheet of the workbook Worksheet sheet = workbook.Worksheets[0]; //Get worksheet's cells collection Cells cells = sheet.Cells; //Create a range of Cells from Cell A1 to C10 Range workbookScope = cells.CreateRange("A1", "C10"); //Assign the nsame to workbook scope named range workbookScope.Name = "workbookScope"; //save the workbook workbook.Save(dataDir+ "WorkbookScope.out.xlsx"); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; namespace Aspose.Cells.Examples.Articles.WorkbookScopedNamedRanges { public class AddWorkbookScopedNamedRange { public static void Main() { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Create a new Workbook object Workbook workbook = new Workbook(); //get first worksheet of the workbook Worksheet sheet = workbook.Worksheets[0]; //Get worksheet's cells collection Cells cells = sheet.Cells; //Create a range of Cells from Cell A1 to C10 Range workbookScope = cells.CreateRange("A1", "C10"); //Assign the nsame to workbook scope named range workbookScope.Name = "workbookScope"; //save the workbook workbook.Save(dataDir+ "WorkbookScope.out.xlsx"); } } }
mit
C#
c2efa9ff2ee676c899f566c495a40513a147cb98
fix deadlock, rework command system
uwx/DSharpPlus,uwx/DSharpPlus
DSharpPlus/AssemblyInfo.cs
DSharpPlus/AssemblyInfo.cs
using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Sharpbott")] [assembly: InternalsVisibleTo("Sharpbott.MSTest")]
using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Sharpbott.MSTest")]
mit
C#
0d3a492a18537a872c8793c2e28cf570a05bb645
replace obsolete deviceidiom
charlenni/Mapsui,charlenni/Mapsui
Samples/Mapsui.Samples.Maui.MapView/App.xaml.cs
Samples/Mapsui.Samples.Maui.MapView/App.xaml.cs
using System; using System.Diagnostics; using Mapsui.Logging; using Microsoft.Maui.Controls; using Microsoft.Maui.Devices; using Application = Microsoft.Maui.Controls.Application; using LogLevel = Mapsui.Logging.LogLevel; namespace Mapsui.Samples.Maui { public partial class App : Application { public App() { InitializeComponent(); Logger.LogDelegate += LogMethod; if (DeviceInfo.Idiom == DeviceIdiom.Phone) MainPage = new NavigationPage(new MainPage()); else MainPage = new MainPageLarge(); } private void LogMethod(LogLevel logLevel, string message, Exception? exception) { Debug.WriteLine($"{logLevel}: {message}, {exception}"); } } }
using System; using System.Diagnostics; using Mapsui.Logging; using Microsoft.Maui.Controls; using Application = Microsoft.Maui.Controls.Application; namespace Mapsui.Samples.Maui { public partial class App : Application { public App() { InitializeComponent(); Logger.LogDelegate += LogMethod; if (Device.Idiom == TargetIdiom.Phone) MainPage = new NavigationPage(new MainPage()); else MainPage = new MainPageLarge(); } private void LogMethod(LogLevel logLevel, string message, Exception? exception) { Debug.WriteLine($"{logLevel}: {message}, {exception}"); } } }
mit
C#
a6e16413ca4b3cf72a6c40a5859a975250f3ad95
Update MongoUnitOfWorkFactory.cs
tiksn/TIKSN-Framework
TIKSN.Core/Data/Mongo/MongoUnitOfWorkFactory.cs
TIKSN.Core/Data/Mongo/MongoUnitOfWorkFactory.cs
using System; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; namespace TIKSN.Data.Mongo { public class MongoUnitOfWorkFactory : IMongoUnitOfWorkFactory { private readonly IMongoClientProvider _mongoClientProvider; private readonly IServiceProvider _serviceProvider; public MongoUnitOfWorkFactory(IMongoClientProvider mongoClientProvider, IServiceProvider serviceProvider) { this._mongoClientProvider = mongoClientProvider ?? throw new ArgumentNullException(nameof(mongoClientProvider)); this._serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); } public async Task<IMongoUnitOfWork> CreateAsync(CancellationToken cancellationToken) { var mongoClient = this._mongoClientProvider.GetMongoClient(); var clientSessionHandle = await mongoClient.StartSessionAsync(null, cancellationToken); var serviceScope = this._serviceProvider.CreateScope(); var mongoClientSessionStore = serviceScope.ServiceProvider.GetRequiredService<IMongoClientSessionStore>(); mongoClientSessionStore.SetClientSessionHandle(clientSessionHandle); clientSessionHandle.StartTransaction(); return new MongoUnitOfWork(clientSessionHandle, serviceScope); } } }
using System; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using MongoDB.Driver; namespace TIKSN.Data.Mongo { public class MongoUnitOfWorkFactory : IMongoUnitOfWorkFactory { private readonly IMongoClientProvider _mongoClientProvider; private readonly IServiceProvider _serviceProvider; public MongoUnitOfWorkFactory(IMongoClientProvider mongoClientProvider, IServiceProvider serviceProvider) { _mongoClientProvider = mongoClientProvider ?? throw new ArgumentNullException(nameof(mongoClientProvider)); _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); } public async Task<IMongoUnitOfWork> CreateAsync(CancellationToken cancellationToken) { var mongoClient = _mongoClientProvider.GetMongoClient(); var clientSessionHandle = await mongoClient.StartSessionAsync(options: null, cancellationToken: cancellationToken); var serviceScope = _serviceProvider.CreateScope(); var mongoClientSessionStore = serviceScope.ServiceProvider.GetRequiredService<IMongoClientSessionStore>(); mongoClientSessionStore.SetClientSessionHandle(clientSessionHandle); clientSessionHandle.StartTransaction(); return new MongoUnitOfWork(clientSessionHandle, serviceScope); } } }
mit
C#
9e784481feef0293f708d6dc62695c3564d32ef4
Hide clip item list on click
kixx/clipm
ClipM/ClipListForm.cs
ClipM/ClipListForm.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ClipM { public partial class ClipListForm : Form { private BindingOrderedSet<string> clipList; public ClipListForm() { InitializeComponent(); } public void SetBinding(BindingOrderedSet<string> clipList) { this.clipList = clipList; lbClipItems.DataSource = clipList.getBindingList(); } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if(keyData == Keys.Escape) { Hide(); return true; } return base.ProcessCmdKey(ref msg, keyData); } private void clipListBox_Click(object sender, EventArgs e) { if(sender is ListBox) { ListBox lb = (ListBox) sender; selectOrAddItemFromClipList(lb); this.Hide(); } } private void lbClipItems_KeyPress(object sender, KeyPressEventArgs e) { if(sender is ListBox) { ListBox lb = (ListBox)sender; if(e.KeyChar == (char)Keys.Return) { selectOrAddItemFromClipList(lb); this.Hide(); } } } private void selectOrAddItemFromClipList(ListBox list) { string selectedItem = list.GetItemText(list.SelectedItem); if (selectedItem != "") { clipList.Remove(selectedItem); clipList.Insert(selectedItem); list.SetSelected(0, true); Clipboard.SetText(selectedItem); } } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ClipM { public partial class ClipListForm : Form { private BindingOrderedSet<string> clipList; public ClipListForm() { InitializeComponent(); } public void SetBinding(BindingOrderedSet<string> clipList) { this.clipList = clipList; lbClipItems.DataSource = clipList.getBindingList(); } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if(keyData == Keys.Escape) { Hide(); return true; } return base.ProcessCmdKey(ref msg, keyData); } private void clipListBox_Click(object sender, EventArgs e) { if(sender is ListBox) { ListBox lb = (ListBox) sender; selectOrAddItemFromClipList(lb); } } private void lbClipItems_KeyPress(object sender, KeyPressEventArgs e) { if(sender is ListBox) { ListBox lb = (ListBox)sender; if(e.KeyChar == (char)Keys.Return) { selectOrAddItemFromClipList(lb); this.Hide(); } } } private void selectOrAddItemFromClipList(ListBox list) { string selectedItem = list.GetItemText(list.SelectedItem); if (selectedItem != "") { clipList.Remove(selectedItem); clipList.Insert(selectedItem); list.SetSelected(0, true); Clipboard.SetText(selectedItem); } } } }
apache-2.0
C#
c52f490d9e007293e1b261e1f4bfc0b4c6bfbe52
bump version
0x53A/PropertyChanged,Fody/PropertyChanged,user1568891/PropertyChanged
CommonAssemblyInfo.cs
CommonAssemblyInfo.cs
using System.Reflection; [assembly: AssemblyTitle("PropertyChanged")] [assembly: AssemblyProduct("PropertyChanged")] [assembly: AssemblyVersion("1.40.0.0")] [assembly: AssemblyFileVersion("1.40.0.0")]
using System.Reflection; [assembly: AssemblyTitle("PropertyChanged")] [assembly: AssemblyProduct("PropertyChanged")] [assembly: AssemblyVersion("1.39.0.0")] [assembly: AssemblyFileVersion("1.39.0.0")]
mit
C#
96aec5c72dfc36b8914866368009235a29cfac66
Add roles to MembershipUserIdentity.Claims
kentcb/BrightstarDB,dharmatech/BrightstarDB,BrightstarDB/BrightstarDB,BrightstarDB/BrightstarDB,kentcb/BrightstarDB,dharmatech/BrightstarDB,dharmatech/BrightstarDB,BrightstarDB/BrightstarDB,dharmatech/BrightstarDB,kentcb/BrightstarDB,dharmatech/BrightstarDB,kentcb/BrightstarDB,BrightstarDB/BrightstarDB,dharmatech/BrightstarDB
src/core/BrightstarDB.Server.AspNet/Authentication/MembershipUserIdentity.cs
src/core/BrightstarDB.Server.AspNet/Authentication/MembershipUserIdentity.cs
using System; using System.Collections.Generic; using System.Web.Security; using Nancy.Security; namespace BrightstarDB.Server.AspNet.Authentication { public class MembershipUserIdentity : IUserIdentity { private readonly MembershipUser _user; private readonly string[] _roles; public MembershipUserIdentity(MembershipUser user) { _user = user; if (Roles.Enabled) { _roles = Roles.GetRolesForUser(user.UserName); } } public string UserName { get { return _user.UserName; } } public IEnumerable<string> Claims { get { return _roles; } } } }
using System; using System.Collections.Generic; using System.Web.Security; using Nancy.Security; namespace BrightstarDB.Server.AspNet.Authentication { public class MembershipUserIdentity : IUserIdentity { private readonly MembershipUser _user; public MembershipUserIdentity(MembershipUser user) { _user = user; } public string UserName { get { return _user.UserName; } } public IEnumerable<string> Claims { get { try { return Roles.GetRolesForUser(_user.UserName); } catch (Exception) { return new string[0]; } } } } }
mit
C#
98db7f534ca4988a5a63e57f191ac4994ee9e3f6
Update PartialConfigurationFluentValidatorBase.cs
tiksn/TIKSN-Framework
TIKSN.Core/Configuration/Validator/PartialConfigurationFluentValidatorBase.cs
TIKSN.Core/Configuration/Validator/PartialConfigurationFluentValidatorBase.cs
using FluentValidation; namespace TIKSN.Configuration.Validator { public abstract class PartialConfigurationFluentValidatorBase<T> : AbstractValidator<T>, IPartialConfigurationValidator<T> { public void ValidateConfiguration(T instance) { try { this.ValidateAndThrow(instance); } catch (ValidationException ex) { throw new ConfigurationValidationException(ex.Message, ex); } } } }
using FluentValidation; namespace TIKSN.Configuration.Validator { public abstract class PartialConfigurationFluentValidatorBase<T> : AbstractValidator<T>, IPartialConfigurationValidator<T> { public void ValidateConfiguration(T instance) { try { this.ValidateAndThrow(instance); } catch (ValidationException ex) { throw new ConfigurationValidationException(ex.Message, ex); } } } }
mit
C#
2c308b37ee671baec40b2f9c7e78987aeb6751e4
remove comments for obsoleted code
ryancyq/aspnetboilerplate,luchaoshuai/aspnetboilerplate,luchaoshuai/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ryancyq/aspnetboilerplate
src/Abp.AspNetCore/AspNetCore/Configuration/IAbpAspNetCoreConfiguration.cs
src/Abp.AspNetCore/AspNetCore/Configuration/IAbpAspNetCoreConfiguration.cs
using System; using System.Collections.Generic; using System.Reflection; using Abp.AspNetCore.Mvc.Results.Caching; using Abp.Domain.Uow; using Abp.Web.Models; using Microsoft.AspNetCore.Routing; namespace Abp.AspNetCore.Configuration { public interface IAbpAspNetCoreConfiguration { WrapResultAttribute DefaultWrapResultAttribute { get; } IClientCacheAttribute DefaultClientCacheAttribute { get; set; } UnitOfWorkAttribute DefaultUnitOfWorkAttribute { get; } List<Type> FormBodyBindingIgnoredTypes { get; } /// <summary> /// Default: true. /// </summary> bool IsValidationEnabledForControllers { get; set; } /// <summary> /// Used to enable/disable auditing for MVC controllers. /// Default: true. /// </summary> bool IsAuditingEnabled { get; set; } /// <summary> /// Default: true. /// </summary> bool SetNoCacheForAjaxResponses { get; set; } /// <summary> /// Default: false. /// </summary> bool UseMvcDateTimeFormatForAppServices { get; set; } /// <summary> /// Used to add route config for modules. /// </summary> List<Action<IEndpointRouteBuilder>> EndpointConfiguration { get; } AbpControllerAssemblySettingBuilder CreateControllersForAppServices( Assembly assembly, string moduleName = AbpControllerAssemblySetting.DefaultServiceModuleName, bool useConventionalHttpVerbs = true ); } }
using System; using System.Collections.Generic; using System.Reflection; using Abp.AspNetCore.Mvc.Results.Caching; using Abp.Domain.Uow; using Abp.Web.Models; using Microsoft.AspNetCore.Routing; namespace Abp.AspNetCore.Configuration { public interface IAbpAspNetCoreConfiguration { WrapResultAttribute DefaultWrapResultAttribute { get; } IClientCacheAttribute DefaultClientCacheAttribute { get; set; } UnitOfWorkAttribute DefaultUnitOfWorkAttribute { get; } List<Type> FormBodyBindingIgnoredTypes { get; } /// <summary> /// Default: true. /// </summary> bool IsValidationEnabledForControllers { get; set; } /// <summary> /// Used to enable/disable auditing for MVC controllers. /// Default: true. /// </summary> bool IsAuditingEnabled { get; set; } /// <summary> /// Default: true. /// </summary> bool SetNoCacheForAjaxResponses { get; set; } /// <summary> /// Default: false. /// </summary> bool UseMvcDateTimeFormatForAppServices { get; set; } /// <summary> /// Used to add route config for modules. /// </summary> //[Obsolete("Use EndpointConfiguration instead !")] //List<Action<IRouteBuilder>> RouteConfiguration { get; } /// <summary> /// Used to add route config for modules. /// </summary> List<Action<IEndpointRouteBuilder>> EndpointConfiguration { get; } AbpControllerAssemblySettingBuilder CreateControllersForAppServices( Assembly assembly, string moduleName = AbpControllerAssemblySetting.DefaultServiceModuleName, bool useConventionalHttpVerbs = true ); } }
mit
C#
eb8f01e2854b6e535c0affcbb9a51cd079b7e72f
Fix Test Method Attribute
imcarolwang/wcf,dotnet/wcf,mconnew/wcf,StephenBonikowsky/wcf,dotnet/wcf,mconnew/wcf,imcarolwang/wcf,mconnew/wcf,dotnet/wcf,StephenBonikowsky/wcf,imcarolwang/wcf
src/System.ServiceModel.Security/tests/ServiceModel/SecurityKeyTypeTest.cs
src/System.ServiceModel.Security/tests/ServiceModel/SecurityKeyTypeTest.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.IdentityModel.Tokens; using Infrastructure.Common; using Xunit; public static class SecurityKeyTypeTest { [WcfFact] public static void Get_EnumMembers_Test() { SecurityKeyType sk = SecurityKeyType.SymmetricKey; Assert.Equal(SecurityKeyType.SymmetricKey, sk); SecurityKeyType ak = SecurityKeyType.AsymmetricKey; Assert.Equal(SecurityKeyType.AsymmetricKey, ak); SecurityKeyType bk = SecurityKeyType.BearerKey; Assert.Equal(SecurityKeyType.BearerKey, bk); } [WcfTheory] [InlineData(SecurityKeyType.SymmetricKey, 0)] [InlineData(SecurityKeyType.AsymmetricKey, 1)] [InlineData(SecurityKeyType.BearerKey, 2)] public static void TypeConvert_EnumToInt_Test(SecurityKeyType key, int value) { Assert.Equal((int)key, value); } }
// 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.IdentityModel.Tokens; using Infrastructure.Common; using Xunit; public static class SecurityKeyTypeTest { [WcfTheory] public static void Get_EnumMembers_Test() { SecurityKeyType sk = SecurityKeyType.SymmetricKey; Assert.Equal(SecurityKeyType.SymmetricKey, sk); SecurityKeyType ak = SecurityKeyType.AsymmetricKey; Assert.Equal(SecurityKeyType.AsymmetricKey, ak); SecurityKeyType bk = SecurityKeyType.BearerKey; Assert.Equal(SecurityKeyType.BearerKey, bk); } [WcfTheory] [InlineData(SecurityKeyType.SymmetricKey, 0)] [InlineData(SecurityKeyType.AsymmetricKey, 1)] [InlineData(SecurityKeyType.BearerKey, 2)] public static void TypeConvert_EnumToInt_Test(SecurityKeyType key, int value) { Assert.Equal((int)key, value); } }
mit
C#
902d608f3b8837728eac5bc3171a56e82cafd268
Update DynamicFileInfo.cs
dotnet/roslyn,gafter/roslyn,wvdd007/roslyn,AlekseyTs/roslyn,sharwell/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,brettfo/roslyn,davkean/roslyn,jasonmalinowski/roslyn,abock/roslyn,abock/roslyn,heejaechang/roslyn,dotnet/roslyn,eriawan/roslyn,genlu/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,genlu/roslyn,abock/roslyn,panopticoncentral/roslyn,KirillOsenkov/roslyn,brettfo/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,agocke/roslyn,davkean/roslyn,jmarolf/roslyn,physhi/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,ErikSchierboom/roslyn,tannergooding/roslyn,heejaechang/roslyn,heejaechang/roslyn,weltkante/roslyn,panopticoncentral/roslyn,nguerrera/roslyn,AmadeusW/roslyn,agocke/roslyn,tmat/roslyn,diryboy/roslyn,bartdesmet/roslyn,reaction1989/roslyn,sharwell/roslyn,AmadeusW/roslyn,nguerrera/roslyn,AmadeusW/roslyn,nguerrera/roslyn,KevinRansom/roslyn,physhi/roslyn,aelij/roslyn,brettfo/roslyn,mgoertz-msft/roslyn,stephentoub/roslyn,panopticoncentral/roslyn,eriawan/roslyn,tmat/roslyn,KirillOsenkov/roslyn,agocke/roslyn,reaction1989/roslyn,wvdd007/roslyn,shyamnamboodiripad/roslyn,aelij/roslyn,KevinRansom/roslyn,aelij/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,eriawan/roslyn,reaction1989/roslyn,AlekseyTs/roslyn,genlu/roslyn,mavasani/roslyn,mavasani/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,diryboy/roslyn,mavasani/roslyn,wvdd007/roslyn,diryboy/roslyn,tannergooding/roslyn,jmarolf/roslyn,stephentoub/roslyn,davkean/roslyn,sharwell/roslyn,tmat/roslyn,dotnet/roslyn,gafter/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,shyamnamboodiripad/roslyn,gafter/roslyn,physhi/roslyn,jmarolf/roslyn,stephentoub/roslyn,mgoertz-msft/roslyn
src/Workspaces/Core/Portable/Workspace/Host/SourceFiles/DynamicFileInfo.cs
src/Workspaces/Core/Portable/Workspace/Host/SourceFiles/DynamicFileInfo.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.CodeAnalysis.Host { /// <summary> /// provides info on the given file /// /// this will be used to provide dynamic content such as generated content from cshtml to workspace /// we acquire this from <see cref="IDynamicFileInfoProvider"/> exposed from external components such as razor for cshtml /// </summary> internal sealed class DynamicFileInfo { public DynamicFileInfo(string filePath, SourceCodeKind sourceCodeKind, TextLoader textLoader, IDocumentServiceProvider documentServiceProvider) { FilePath = filePath; SourceCodeKind = sourceCodeKind; TextLoader = textLoader; DocumentServiceProvider = documentServiceProvider; } /// <summary> /// for now, return null. in future, we will use this to get right options from editorconfig /// </summary> public string FilePath { get; } /// <summary> /// return <see cref="SourceCodeKind"/> for this file /// </summary> public SourceCodeKind SourceCodeKind { get; } /// <summary> /// return <see cref="TextLoader"/> to load content for the dynamic file /// </summary> public TextLoader TextLoader { get; } /// <summary> /// return <see cref="IDocumentServiceProvider"/> for the content it provided /// </summary> public IDocumentServiceProvider DocumentServiceProvider { get; } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.CodeAnalysis.Host { /// <summary> /// provides info on the given file /// /// this will be used to provide dynamic content such as generated content from cshtml to workspace /// we acquire this from <see cref="IDynamicFileInfoProvider"/> exposed from external components such as razor for cshtml /// </summary> internal sealed class DynamicFileInfo { public DynamicFileInfo(string filePath, SourceCodeKind sourceCodeKind, TextLoader textLoader, IDocumentServiceProvider documentServiceProvider) { FilePath = filePath; SourceCodeKind = SourceCodeKind; TextLoader = textLoader; DocumentServiceProvider = documentServiceProvider; } /// <summary> /// for now, return null. in future, we will use this to get right options from editorconfig /// </summary> public string FilePath { get; } /// <summary> /// return <see cref="SourceCodeKind"/> for this file /// </summary> public SourceCodeKind SourceCodeKind { get; } /// <summary> /// return <see cref="TextLoader"/> to load content for the dynamic file /// </summary> public TextLoader TextLoader { get; } /// <summary> /// return <see cref="IDocumentServiceProvider"/> for the content it provided /// </summary> public IDocumentServiceProvider DocumentServiceProvider { get; } } }
mit
C#
677c02a897ce2480c09f0331948c46a219c3f92a
fix compile
JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity
resharper/resharper-unity/src/CSharp/Daemon/Stages/Highlightings/AbstractUnityGutterMark.cs
resharper/resharper-unity/src/CSharp/Daemon/Stages/Highlightings/AbstractUnityGutterMark.cs
using System.Collections.Generic; using JetBrains.Application.UI.Controls.BulbMenu.Anchors; using JetBrains.Application.UI.Controls.BulbMenu.Items; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Errors; using JetBrains.ReSharper.Resources.Shell; using JetBrains.TextControl.DocumentMarkup; using JetBrains.UI.Icons; using JetBrains.Util; namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.Highlightings { // This class describes the UI of a highlight (gutter icon), while an IHighlighting // is an instance of a highlight at a specific location in a document. The IHighlighting // instance refers to this highlighter's attribute ID to wire up the UI public class AbstractUnityGutterMark : IconGutterMarkType { protected AbstractUnityGutterMark(IconId id) : base(id) { } public override IAnchor Priority => BulbMenuAnchors.PermanentBackgroundItems; public override IEnumerable<BulbMenuItem> GetBulbMenuItems(IHighlighter highlighter) { var solution = Shell.Instance.GetComponent<SolutionsManager>().Solution; if (solution == null) return EmptyList<BulbMenuItem>.InstanceList; var daemon = solution.GetComponent<IDaemon>(); var highlighting = daemon.GetHighlighting(highlighter); if (highlighting != null) { var items = (highlighting as UnityGutterMarkInfo)?.Actions ?? (highlighting as UnityHotGutterMarkInfo)?.Actions; if (items != null) return items; } return EmptyList<BulbMenuItem>.InstanceList; } } }
using System.Collections.Generic; using JetBrains.Application.UI.Controls.BulbMenu.Anchors; using JetBrains.Application.UI.Controls.BulbMenu.Items; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Errors; using JetBrains.ReSharper.Resources.Shell; using JetBrains.TextControl.DocumentMarkup; using JetBrains.UI.Icons; using JetBrains.Util; namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.Highlightings { // This class describes the UI of a highlight (gutter icon), while an IHighlighting // is an instance of a highlight at a specific location in a document. The IHighlighting // instance refers to this highlighter's attribute ID to wire up the UI public class AbstractUnityGutterMark : IconGutterMarkType { protected AbstractUnityGutterMark(IconId id) : base(id) { } public override IAnchor Anchor => BulbMenuAnchors.PermanentBackgroundItems; public override IEnumerable<BulbMenuItem> GetBulbMenuItems(IHighlighter highlighter) { var solution = Shell.Instance.GetComponent<SolutionsManager>().Solution; if (solution == null) return EmptyList<BulbMenuItem>.InstanceList; var daemon = solution.GetComponent<IDaemon>(); var highlighting = daemon.GetHighlighting(highlighter); if (highlighting != null) { var items = (highlighting as UnityGutterMarkInfo)?.Actions ?? (highlighting as UnityHotGutterMarkInfo)?.Actions; if (items != null) return items; } return EmptyList<BulbMenuItem>.InstanceList; } } }
apache-2.0
C#
28239c4a513ded1dfcc5c9a4845c171ef35b70e1
Fix to allow plugin to start up disabled as default
qianlifeng/Wox,qianlifeng/Wox,qianlifeng/Wox,Wox-launcher/Wox,Wox-launcher/Wox
Wox.Infrastructure/UserSettings/PluginSettings.cs
Wox.Infrastructure/UserSettings/PluginSettings.cs
using System.Collections.Generic; using Wox.Plugin; namespace Wox.Infrastructure.UserSettings { public class PluginsSettings : BaseModel { public string PythonDirectory { get; set; } public Dictionary<string, Plugin> Plugins { get; set; } = new Dictionary<string, Plugin>(); public void UpdatePluginSettings(List<PluginMetadata> metadatas) { foreach (var metadata in metadatas) { if (Plugins.ContainsKey(metadata.ID)) { var settings = Plugins[metadata.ID]; if (settings.ActionKeywords?.Count > 0) { metadata.ActionKeywords = settings.ActionKeywords; metadata.ActionKeyword = settings.ActionKeywords[0]; } metadata.Disabled = settings.Disabled; } else { Plugins[metadata.ID] = new Plugin { ID = metadata.ID, Name = metadata.Name, ActionKeywords = metadata.ActionKeywords, Disabled = metadata.Disabled }; } } } } public class Plugin { public string ID { get; set; } public string Name { get; set; } public List<string> ActionKeywords { get; set; } public bool Disabled { get; set; } } }
using System.Collections.Generic; using Wox.Plugin; namespace Wox.Infrastructure.UserSettings { public class PluginsSettings : BaseModel { public string PythonDirectory { get; set; } public Dictionary<string, Plugin> Plugins { get; set; } = new Dictionary<string, Plugin>(); public void UpdatePluginSettings(List<PluginMetadata> metadatas) { foreach (var metadata in metadatas) { if (Plugins.ContainsKey(metadata.ID)) { var settings = Plugins[metadata.ID]; if (settings.ActionKeywords?.Count > 0) { metadata.ActionKeywords = settings.ActionKeywords; metadata.ActionKeyword = settings.ActionKeywords[0]; } metadata.Disabled = settings.Disabled; } else { Plugins[metadata.ID] = new Plugin { ID = metadata.ID, Name = metadata.Name, ActionKeywords = metadata.ActionKeywords, Disabled = false }; } } } } public class Plugin { public string ID { get; set; } public string Name { get; set; } public List<string> ActionKeywords { get; set; } public bool Disabled { get; set; } } }
mit
C#
8066ddecdeb8a01d5f9a9bc30bf46d4ae4ed90bb
Bump version.
FacilityApi/Facility
SolutionInfo.cs
SolutionInfo.cs
using System.Reflection; [assembly: AssemblyVersion("0.4.0.0")] [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright 2016 Ed Ball")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
using System.Reflection; [assembly: AssemblyVersion("0.3.0.0")] [assembly: AssemblyCompany("")] [assembly: AssemblyCopyright("Copyright 2016 Ed Ball")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
mit
C#
1d832a62eecc306869f58b2d68ab0c7ba707c003
Add OrderingDomainException when the order doesn't exist with id orderId
productinfo/eShopOnContainers,productinfo/eShopOnContainers,TypeW/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,dotnet-architecture/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,TypeW/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,albertodall/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,TypeW/eShopOnContainers,skynode/eShopOnContainers,albertodall/eShopOnContainers,TypeW/eShopOnContainers,albertodall/eShopOnContainers,andrelmp/eShopOnContainers,skynode/eShopOnContainers,skynode/eShopOnContainers,dotnet-architecture/eShopOnContainers,productinfo/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,dotnet-architecture/eShopOnContainers,TypeW/eShopOnContainers,skynode/eShopOnContainers,skynode/eShopOnContainers,andrelmp/eShopOnContainers,andrelmp/eShopOnContainers
src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs
src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs
using Microsoft.EntityFrameworkCore; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork; using Ordering.Domain.Exceptions; using System; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories { public class OrderRepository : IOrderRepository { private readonly OrderingContext _context; public IUnitOfWork UnitOfWork { get { return _context; } } public OrderRepository(OrderingContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); } public Order Add(Order order) { return _context.Orders.Add(order).Entity; } public async Task<Order> GetAsync(int orderId) { return await _context.Orders.FindAsync(orderId) ?? throw new OrderingDomainException($"Not able to get the order. Reason: no valid orderId: {orderId}"); } public void Update(Order order) { _context.Entry(order).State = EntityState.Modified; } } }
using Microsoft.EntityFrameworkCore; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork; using System; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories { public class OrderRepository : IOrderRepository { private readonly OrderingContext _context; public IUnitOfWork UnitOfWork { get { return _context; } } public OrderRepository(OrderingContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); } public Order Add(Order order) { return _context.Orders.Add(order).Entity; } public async Task<Order> GetAsync(int orderId) { return await _context.Orders.FindAsync(orderId); } public void Update(Order order) { _context.Entry(order).State = EntityState.Modified; } } }
mit
C#
ce2e26c04f1f926560f49bd0d2388b64e0dfb747
build fix
thefex/Xamarin.FileExplorer
Xamarin.iOS.FileExplorer/Xamarin.iOS.FileExplorer/ViewControllers/DirectoryViewController.cs
Xamarin.iOS.FileExplorer/Xamarin.iOS.FileExplorer/ViewControllers/DirectoryViewController.cs
using System; using Foundation; using UIKit; using Xamarin.iOS.FileExplorer.Data; using Xamarin.iOS.FileExplorer.PresentationController; using Xamarin.iOS.FileExplorer.ViewModels; namespace Xamarin.iOS.FileExplorer.ViewControllers { public class DirectoryViewController : UIViewController, IUISearchBarDelegate { private DirectoryViewModel viewModel; private UISearchController searchController; private DirectoryContentViewController searchResultsViewController; private DirectoryContentViewModel searchResultsViewModel; private DirectoryContentViewController directoryContentViewController; private DirectoryContentViewModel directoryContentViewModel; public DirectoryViewController(DirectoryViewModel directoryViewModel) { viewModel = directoryViewModel; searchResultsViewModel = viewModel.BuildDirectoryContentViewModel(); searchResultsViewController = new DirectoryContentViewController(searchResultsViewModel); searchController = new UISearchController(searchResultsViewController); //searchController.SearchResultsUpdater = searchResultsViewController; directoryContentViewModel = viewModel.BuildDirectoryContentViewModel(); directoryContentViewController = new DirectoryContentViewController(directoryContentViewModel); } public DirectoryViewController(NSCoder coder) : base(coder) { } protected DirectoryViewController(NSObjectFlag t) : base(t) { } protected internal DirectoryViewController(IntPtr handle) : base(handle) { } public DirectoryViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { } public override void ViewDidLoad() { base.ViewDidLoad(); ExtendedLayoutIncludesOpaqueBars = false; EdgesForExtendedLayout = UIRectEdge.None; SetupSearchBarController(); AddChildViewController(directoryContentViewController); NavigationItem.RightBarButtonItem = directoryContentViewController.NavigationItem.RightBarButtonItem; NavigationItem.Title = directoryContentViewController.NavigationItem.Title; Add(directoryContentViewController.View); SetupLeftBarButtonItem(); } private void SetupSearchBarController() { var searchBar = searchController.SearchBar; searchBar.SizeToFit(); searchBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; searchBar.Delegate = this; View.Add(searchBar); NavigationItem.RightBarButtonItems = directoryContentViewController.NavigationItem.RightBarButtonItems; } private void SetupLeftBarButtonItem() { if (!viewModel.FinishButtonHidden) NavigationItem.LeftBarButtonItem = new UIBarButtonItem(viewModel.FinishButtonTitle, UIBarButtonItemStyle.Plain, (e, a) => { HandleFinishTapButton(); }); } public bool IsSearchControllerActive { get { return searchController.Active; } set { searchController.Active = value; } } private void HandleFinishTapButton() { Delegate?.Finished(this); } [Export("searchBarTextDidBeginEditing:")] public void DidBeginTextEditing(UISearchBar searchBar) { directoryContentViewController.SetEditing(false, true); searchResultsViewModel.SortMode = directoryContentViewModel.SortMode; } public IDirectoryViewControllerDelegate Delegate { get; set; } } }
using System; using Foundation; using UIKit; using Xamarin.iOS.FileExplorer.Data; using Xamarin.iOS.FileExplorer.PresentationController; using Xamarin.iOS.FileExplorer.ViewModels; namespace Xamarin.iOS.FileExplorer.ViewControllers { public class DirectoryViewController : UIViewController, IUISearchBarDelegate, IDirectoryViewControllerDelegate { private DirectoryViewModel viewModel; private UISearchController searchController; private DirectoryContentViewController searchResultsViewController; private DirectoryContentViewModel searchResultsViewModel; private DirectoryContentViewController directoryContentViewController; private DirectoryContentViewModel directoryContentViewModel; public DirectoryViewController(DirectoryViewModel directoryViewModel) { viewModel = directoryViewModel; searchResultsViewModel = viewModel.BuildDirectoryContentViewModel(); searchResultsViewController = new DirectoryContentViewController(searchResultsViewModel); searchController = new UISearchController(searchResultsViewController); //searchController.SearchResultsUpdater = searchResultsViewController; directoryContentViewModel = viewModel.BuildDirectoryContentViewModel(); directoryContentViewController = new DirectoryContentViewController(directoryContentViewModel); } public DirectoryViewController(NSCoder coder) : base(coder) { } protected DirectoryViewController(NSObjectFlag t) : base(t) { } protected internal DirectoryViewController(IntPtr handle) : base(handle) { } public DirectoryViewController(string nibName, NSBundle bundle) : base(nibName, bundle) { } public override void ViewDidLoad() { base.ViewDidLoad(); ExtendedLayoutIncludesOpaqueBars = false; EdgesForExtendedLayout = UIRectEdge.None; SetupSearchBarController(); AddChildViewController(directoryContentViewController); NavigationItem.RightBarButtonItem = directoryContentViewController.NavigationItem.RightBarButtonItem; NavigationItem.Title = directoryContentViewController.NavigationItem.Title; Add(directoryContentViewController.View); SetupLeftBarButtonItem(); } private void SetupSearchBarController() { var searchBar = searchController.SearchBar; searchBar.SizeToFit(); searchBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; searchBar.Delegate = this; View.Add(searchBar); NavigationItem.RightBarButtonItems = directoryContentViewController.NavigationItem.RightBarButtonItems; } private void SetupLeftBarButtonItem() { if (!viewModel.FinishButtonHidden) NavigationItem.LeftBarButtonItem = new UIBarButtonItem(viewModel.FinishButtonTitle, UIBarButtonItemStyle.Plain, (e, a) => { HandleFinishTapButton(); }); } public bool IsSearchControllerActive { get { return searchController.Active; } set { searchController.Active = value; } } private void HandleFinishTapButton() { Delegate?.Finished(this); } [Export("searchBarTextDidBeginEditing:")] public void DidBeginTextEditing(UISearchBar searchBar) { directoryContentViewController.SetEditing(false, true); searchResultsViewModel.SortMode = directoryContentViewModel.SortMode; } public IDirectoryViewControllerDelegate Delegate { get; set; } } }
mit
C#
1d2b532b0828992c09cfa621599c503db09e307f
Use exponential backoff for Google Contact Api
aluxnimm/outlookcaldavsynchronizer
CalDavSynchronizer/Implementation/GoogleContacts/GoogleApiOperationExecutor.cs
CalDavSynchronizer/Implementation/GoogleContacts/GoogleApiOperationExecutor.cs
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/) // Copyright (c) 2015 Gerhard Zehetbauer // Copyright (c) 2015 Alexander Nimmervoll // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net; using System.Text; using System.Threading; using System.Threading.Tasks; using Google.Contacts; using Google.GData.Client; using log4net; namespace CalDavSynchronizer.Implementation.GoogleContacts { class GoogleApiOperationExecutor : IGoogleApiOperationExecutor { private static readonly ILog s_logger = LogManager.GetLogger (System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); readonly ContactsRequest _contactFacade; const int c_exponentialBackoffBaseMilliseconds = 100; const int c_exponentialBackoffMaxRetries = 6; private readonly Random _exponentialBackoffRandom = new Random(); public GoogleApiOperationExecutor (ContactsRequest contactFacade) { if (contactFacade == null) throw new ArgumentNullException (nameof (contactFacade)); _contactFacade = contactFacade; } public T Execute<T> (Func<ContactsRequest, T> operation) { for (int retryCount = 0;; retryCount++) { try { return operation (_contactFacade); } catch (GDataRequestException x) when ((((x.InnerException as WebException) ?.Response as HttpWebResponse) ?.StatusCode == HttpStatusCode.ServiceUnavailable) && retryCount < c_exponentialBackoffMaxRetries) { var sleepMilliseconds = (int) Math.Pow (2, retryCount) * c_exponentialBackoffBaseMilliseconds + _exponentialBackoffRandom.Next (c_exponentialBackoffBaseMilliseconds); s_logger.Warn ($"Retrying operation in ${sleepMilliseconds}ms."); Thread.Sleep (sleepMilliseconds); } } } public void Execute (Action<ContactsRequest> operation) { Execute (f => { operation (f); return 0; }); } } }
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/) // Copyright (c) 2015 Gerhard Zehetbauer // Copyright (c) 2015 Alexander Nimmervoll // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Google.Contacts; using log4net; namespace CalDavSynchronizer.Implementation.GoogleContacts { class GoogleApiOperationExecutor : IGoogleApiOperationExecutor { private static readonly ILog s_logger = LogManager.GetLogger (System.Reflection.MethodBase.GetCurrentMethod ().DeclaringType); readonly ContactsRequest _contactFacade; public GoogleApiOperationExecutor (ContactsRequest contactFacade) { if (contactFacade == null) throw new ArgumentNullException (nameof (contactFacade)); _contactFacade = contactFacade; } public T Execute<T> (Func<ContactsRequest, T> operation) { return operation (_contactFacade); } public void Execute (Action<ContactsRequest> operation) { Execute (f => { operation (f); return 0; }); } } }
agpl-3.0
C#
7f555e74c207aac102a5bda8ed6d8c0b2c860e1f
Update Nothing.cs
gregoryyoung/nothing
Unit/Nothing.cs
Unit/Nothing.cs
namespace Unit { /// <summary> /// This class should be used instead of void for return types. /// </summary> public class Nothing { public static readonly Nothing Instance = new Nothing(); private Nothing() { } public override string ToString() => "Nothing"; } }
namespace Unit { /// <summary> /// This class should be used instead of void for return types. /// </summary> public class Nothing { public static readonly Nothing Instance = new Nothing(); private Nothing() { } public override string ToString() { return "Nothing"; } } }
unlicense
C#
d4151f302570c9c2ea2cd3e6d143cb99cdd24efe
Check if tree is mirror. Improved logics.
Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews
LeetCode/simmetric_tree.cs
LeetCode/simmetric_tree.cs
using System; class Node { public Node(int val, Node left, Node right) { Value = val; Left = left; Right = right; } public int Value { get; private set; } public Node Left { get; private set; } public Node Right { get; private set; } } class Program{ static bool IsMirror(Node left, Node right) { if (left == null || right == null) { return left == null && right == null; } return ((left.Value == right.Value) && IsMirror(left.Right, right.Left) && IsMirror(left.Left, right.Right)); } static void Main() { Node root = new Node(1, new Node(2, new Node(3, null, null), new Node(4, null, null)), new Node(2, new Node(4, null, null), new Node(3, null, null))); Node unroot = new Node(1, new Node(2, null, new Node(4, null, null)), new Node(2, null, new Node(4, null, null))); Console.WriteLine("First {0}", IsMirror(root.Left, root.Right)); Console.WriteLine("Second {0}", IsMirror(unroot.Left, unroot.Right)); } }
using System; class Node { public Node(int val, Node left, Node right) { Value = val; Left = left; Right = right; } public int Value { get; private set; } public Node Left { get; private set; } public Node Right { get; private set; } } class Program{ static bool IsMirror(Node left, Node right) { if (left == null && right == null) { return true; } if (left == null && right != null || left != null && right == null) { return false; } return ((left.Value == right.Value) && IsMirror(left.Right, right.Left) && IsMirror(left.Left, right.Right)); } static void Main() { Node root = new Node(1, new Node(2, new Node(3, null, null), new Node(4, null, null)), new Node(2, new Node(4, null, null), new Node(3, null, null))); Node unroot = new Node(1, new Node(2, null, new Node(4, null, null)), new Node(2, null, new Node(4, null, null))); Console.WriteLine("First {0}", IsMirror(root.Left, root.Right)); Console.WriteLine("Second {0}", IsMirror(unroot.Left, unroot.Right)); } }
mit
C#
aadf03632772779c244d92c631de58c1a37e4f8b
Fix Startup
amweiss/WeatherLink
src/WeatherLink/Startup.cs
src/WeatherLink/Startup.cs
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.PlatformAbstractions; using Swashbuckle.Swagger.Model; using System.IO; using WeatherLink.Models; using WeatherLink.Services; namespace WeatherLink { internal class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath($"{env.ContentRootPath}/src/WeatherLink") .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseStaticFiles(); app.UseMvc(); app.UseSwagger(); app.UseSwaggerUi(); } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services services.AddMvc(); services.AddOptions(); // Add custom services services.Configure<WeatherLinkSettings>(Configuration); services.AddTransient<ITrafficAdviceService, WeatherBasedTrafficAdviceService>(); services.AddTransient<IGeocodeService, GoogleMapsGeocodeService>(); services.AddTransient<IDistanceToDurationService, GoogleMapsDistanceToDurationService>(); services.AddTransient<IDarkSkyService, HourlyAndMinutelyDarkSkyService>(); // Configure swagger services.AddSwaggerGen(); services.ConfigureSwaggerGen(options => { options.SingleApiVersion(new Info { Version = "v1", Title = "Weather Link", Description = "An API to get weather based advice.", TermsOfService = "None" }); options.IncludeXmlComments(GetXmlCommentsPath()); options.DescribeAllEnumsAsStrings(); }); } private string GetXmlCommentsPath() { var app = PlatformServices.Default.Application; return Path.Combine(app.ApplicationBasePath, Path.ChangeExtension(app.ApplicationName, "xml")); } } }
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.PlatformAbstractions; using Swashbuckle.Swagger.Model; using System.IO; using WeatherLink.Models; using WeatherLink.Services; namespace WeatherLink { internal 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; } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseStaticFiles(); app.UseMvc(); app.UseSwagger(); app.UseSwaggerUi(); } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services services.AddMvc(); services.AddOptions(); // Add custom services services.Configure<WeatherLinkSettings>(Configuration); services.AddTransient<ITrafficAdviceService, WeatherBasedTrafficAdviceService>(); services.AddTransient<IGeocodeService, GoogleMapsGeocodeService>(); services.AddTransient<IDistanceToDurationService, GoogleMapsDistanceToDurationService>(); services.AddTransient<IDarkSkyService, HourlyAndMinutelyDarkSkyService>(); // Configure swagger services.AddSwaggerGen(); services.ConfigureSwaggerGen(options => { options.SingleApiVersion(new Info { Version = "v1", Title = "Weather Link", Description = "An API to get weather based advice.", TermsOfService = "None" }); options.IncludeXmlComments(GetXmlCommentsPath()); options.DescribeAllEnumsAsStrings(); }); } private string GetXmlCommentsPath() { var app = PlatformServices.Default.Application; return Path.Combine(app.ApplicationBasePath, Path.ChangeExtension(app.ApplicationName, "xml")); } } }
mit
C#
aa672cd59d284c7a757ccfa2327f50df0fd306fd
Update test for possible sizes
verybadcat/CSharpMath
CSharpMath.Xaml.Tests.NuGet/Test.cs
CSharpMath.Xaml.Tests.NuGet/Test.cs
namespace CSharpMath.Xaml.Tests.NuGet { using Avalonia; using SkiaSharp; using Forms; public class Program { static string File(string platform, [System.Runtime.CompilerServices.CallerFilePath] string thisDir = "") => System.IO.Path.Combine(thisDir, "..", $"Test.{platform}.png"); [Xunit.Fact] public void TestImage() { global::Avalonia.Skia.SkiaPlatform.Initialize(); Xamarin.Forms.Device.PlatformServices = new Xamarin.Forms.Core.UnitTests.MockPlatformServices(); using (var forms = System.IO.File.OpenWrite(File(nameof(Forms)))) new Forms.MathView { LaTeX = "1" }.Painter.DrawAsStream()?.CopyTo(forms); using (var avalonia = System.IO.File.OpenWrite(File(nameof(Avalonia)))) new Avalonia.MathView { LaTeX = "1" }.Painter.DrawAsPng(avalonia); using (var forms = System.IO.File.OpenRead(File(nameof(Forms)))) Xunit.Assert.Contains(new[] { 344, 797 }, forms.Length); // 797 on Mac, 344 on Ubuntu using (var avalonia = System.IO.File.OpenRead(File(nameof(Avalonia)))) Xunit.Assert.Equal(344, avalonia.Length); } } }
namespace CSharpMath.Xaml.Tests.NuGet { using Avalonia; using SkiaSharp; using Forms; public class Program { static string File(string platform, [System.Runtime.CompilerServices.CallerFilePath] string thisDir = "") => System.IO.Path.Combine(thisDir, "..", $"Test.{platform}.png"); [Xunit.Fact] public void TestImage() { global::Avalonia.Skia.SkiaPlatform.Initialize(); Xamarin.Forms.Device.PlatformServices = new Xamarin.Forms.Core.UnitTests.MockPlatformServices(); using (var forms = System.IO.File.OpenWrite(File(nameof(Forms)))) new Forms.MathView { LaTeX = "1" }.Painter.DrawAsStream()?.CopyTo(forms); using (var avalonia = System.IO.File.OpenWrite(File(nameof(Avalonia)))) new Avalonia.MathView { LaTeX = "1" }.Painter.DrawAsPng(avalonia); using (var forms = System.IO.File.OpenRead(File(nameof(Forms)))) Xunit.Assert.Equal(797, forms.Length); using (var avalonia = System.IO.File.OpenRead(File(nameof(Avalonia)))) Xunit.Assert.Equal(344, avalonia.Length); } } }
mit
C#
a0e0ec88569487b34c8aa367b68674236d497c6f
bump ver
AntonyCorbett/OnlyT,AntonyCorbett/OnlyT
SolutionInfo.cs
SolutionInfo.cs
using System.Reflection; [assembly: AssemblyCompany("SoundBox")] [assembly: AssemblyProduct("OnlyT")] [assembly: AssemblyCopyright("Copyright © 2019, 2020 Antony Corbett")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.3.0.6")]
using System.Reflection; [assembly: AssemblyCompany("SoundBox")] [assembly: AssemblyProduct("OnlyT")] [assembly: AssemblyCopyright("Copyright © 2019, 2020 Antony Corbett")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.3.0.5")]
mit
C#
d465fd8c12e72c332ae713e6243bb7d508657b5b
use httpContext variable in GetComputerName method
aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate
src/Abp.AspNetCore/AspNetCore/Mvc/Auditing/HttpContextClientInfoProvider.cs
src/Abp.AspNetCore/AspNetCore/Mvc/Auditing/HttpContextClientInfoProvider.cs
using System; using Abp.Auditing; using Castle.Core.Logging; using Microsoft.AspNetCore.Http; using Abp.Extensions; using System.Net; namespace Abp.AspNetCore.Mvc.Auditing { public class HttpContextClientInfoProvider : IClientInfoProvider { public string BrowserInfo => GetBrowserInfo(); public string ClientIpAddress => GetClientIpAddress(); public string ComputerName => GetComputerName(); public ILogger Logger { get; set; } private readonly IHttpContextAccessor _httpContextAccessor; /// <summary> /// Creates a new <see cref="HttpContextClientInfoProvider"/>. /// </summary> public HttpContextClientInfoProvider(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; Logger = NullLogger.Instance; } protected virtual string GetBrowserInfo() { var httpContext = _httpContextAccessor.HttpContext; return httpContext?.Request?.Headers?["User-Agent"]; } protected virtual string GetClientIpAddress() { try { var httpContext = _httpContextAccessor.HttpContext; return httpContext?.Connection?.RemoteIpAddress?.ToString(); } catch (Exception ex) { Logger.Warn(ex.ToString()); } return null; } protected virtual string GetComputerName() { try { var httpContext = _httpContextAccessor.HttpContext; return Dns.GetHostEntry(httpContext?.Connection?.RemoteIpAddress).HostName; } catch (Exception ex) { Logger.Warn(ex.ToString()); } return null; } } }
using System; using Abp.Auditing; using Castle.Core.Logging; using Microsoft.AspNetCore.Http; using Abp.Extensions; using System.Net; namespace Abp.AspNetCore.Mvc.Auditing { public class HttpContextClientInfoProvider : IClientInfoProvider { public string BrowserInfo => GetBrowserInfo(); public string ClientIpAddress => GetClientIpAddress(); public string ComputerName => GetComputerName(); public ILogger Logger { get; set; } private readonly IHttpContextAccessor _httpContextAccessor; /// <summary> /// Creates a new <see cref="HttpContextClientInfoProvider"/>. /// </summary> public HttpContextClientInfoProvider(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; Logger = NullLogger.Instance; } protected virtual string GetBrowserInfo() { var httpContext = _httpContextAccessor.HttpContext; return httpContext?.Request?.Headers?["User-Agent"]; } protected virtual string GetClientIpAddress() { try { var httpContext = _httpContextAccessor.HttpContext; return httpContext?.Connection?.RemoteIpAddress?.ToString(); } catch (Exception ex) { Logger.Warn(ex.ToString()); } return null; } protected virtual string GetComputerName() { try { var httpContext = _httpContextAccessor.HttpContext; return Dns.GetHostEntry(_httpContextAccessor?.HttpContext?.Connection?.RemoteIpAddress).HostName; } catch (Exception ex) { Logger.Warn(ex.ToString()); } return null; } } }
mit
C#
85a789c2e8dc81486a176bf0aabab2c4b609b60a
update MethodInfoExtensions
AspectCore/AspectCore-Framework,AspectCore/Abstractions,AspectCore/AspectCore-Framework,AspectCore/Lite
src/AspectCore.Lite/Extensions/MethodInfoExtensions.cs
src/AspectCore.Lite/Extensions/MethodInfoExtensions.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace AspectCore.Lite.Extensions { internal static class MethodInfoExtensions { internal static bool IsAsync(this MethodInfo methodInfo) { if (methodInfo == null) throw new ArgumentNullException(nameof(methodInfo)); Type returnType = methodInfo.ReturnType; if (returnType == typeof(Task) || typeof(Task).GetTypeInfo().IsAssignableFrom(returnType)) return true; return false; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace AspectCore.Lite.Extensions { internal static class MethodInfoExtensions { internal static bool IsAsync(this MethodInfo methodInfo) { if (methodInfo == null) throw new ArgumentNullException(nameof(methodInfo)); Type returnType = methodInfo.ReturnType; if (!(returnType == typeof(void) || typeof(Task).GetTypeInfo().IsAssignableFrom(returnType))) return false; return methodInfo.IsDefined(typeof(AsyncStateMachineAttribute)); } } }
mit
C#
22dbd96913a82ac1ad3a3859574d855b4d6786e1
Update FileFinder.cs
SimonCropp/CaptureSnippets
src/CaptureSnippetsSimple/Shared/Reading/FileFinder.cs
src/CaptureSnippetsSimple/Shared/Reading/FileFinder.cs
using System.Collections.Generic; using System.IO; using System.Linq; using CaptureSnippets; class FileFinder { DirectoryFilter directoryFilter; FileFilter fileFilter; public FileFinder(DirectoryFilter directoryFilter, FileFilter fileFilter) { this.directoryFilter = directoryFilter; this.fileFilter = fileFilter; } public bool IncludeDirectory(string directoryPath) { var fileName = Path.GetFileName(directoryPath); if (fileName.StartsWith(".")) { return false; } if (Exclusions.ShouldExcludeDirectory(fileName)) { return false; } if (directoryFilter == null) { return true; } return directoryFilter(directoryPath); } bool IncludeFile(string path) { var fileName = Path.GetFileName(path); if (fileName.StartsWith(".")) { return false; } var extension = Path.GetExtension(fileName); if (extension == string.Empty) { return false; } if (Exclusions.ShouldExcludeExtension(extension.Substring(1))) { return false; } if (fileFilter == null) { return true; } return fileFilter(path); } public List<string> FindFiles(string directoryPath) { var files = new List<string>(); FindFiles(directoryPath, files); return files; } void FindFiles(string directoryPath, List<string> files) { foreach (var file in Directory.EnumerateFiles(directoryPath) .Where(IncludeFile)) { files.Add(file); } foreach (var subDirectory in Directory.EnumerateDirectories(directoryPath) .Where(IncludeDirectory)) { FindFiles(subDirectory, files); } } }
using System.Collections.Generic; using System.IO; using System.Linq; using CaptureSnippets; class FileFinder { DirectoryFilter directoryFilter; FileFilter fileFilter; public FileFinder(DirectoryFilter directoryFilter, FileFilter fileFilter) { this.directoryFilter = directoryFilter; this.fileFilter = fileFilter; } public bool IncludeDirectory(string directoryPath) { var fileName = Path.GetFileName(directoryPath); if (fileName.StartsWith(".")) { return false; } if (Exclusions.ShouldExcludeDirectory(fileName)) { return false; } if (directoryFilter == null) { return true; } return directoryFilter(directoryPath); } bool IncludeFile(string path) { var fileName = Path.GetFileName(path); if (fileName.StartsWith(".")) { return false; } var extension = Path.GetExtension(fileName); if (extension == string.Empty) { return false; } if (Exclusions.ShouldExcludeExtension(extension.Substring(1))) { return false; } if (fileFilter == null) { return true; } return fileFilter(path); } public List<string> FindFiles(string directoryPath) { var files = new List<string>(); FindFiles(directoryPath, files); return files; } void FindFiles(string directoryPath, List<string> files) { foreach (var file in Directory.EnumerateFiles(directoryPath) .Where(IncludeFile)) { files.Add(file); } foreach (var subDirectory in Directory.EnumerateDirectories(directoryPath) .Where(IncludeDirectory)) { FindFiles(subDirectory, files); } } }
mit
C#
ee1112c86afd4f8742b0d048a2f4ee9ca39298ac
Change password view
jorgebay/nearforums,jorgebay/nearforums,jorgebay/nearforums
solution/NearForums.Web.Output/Views/FormsAuthentication/ChangePassword.cshtml
solution/NearForums.Web.Output/Views/FormsAuthentication/ChangePassword.cshtml
@{ ViewBag.Title = "Change Password"; } @section Head{ <script src= "@Url.Content("~/Scripts/jquery-1.3.2.js")" type="text/javascript"></script> } <ul class="path floatContainer"> <li class="first">@Html.ActionLink("Forums", "List", "Forums")</li> </ul> <h1>@ViewBag.Title</h1> @Html.ValidationSummary("<h3>Please check the following errors:</h3>", new Dictionary<string, object>(), null) @using (Html.BeginForm()) { <fieldset> <legend>Use the form below to create a new account</legend> <div class="formItem floatContainer"> <label for="currentPassword">Current password</label> @Html.Password("currentPassword") </div> <div class="formItem floatContainer"> <label for="newPassword">New password</label> @Html.Password("newPassword") <span class="note">New passwords are required to be a minimum of @ViewData["PasswordLength"] characters in length.</span> </div> <div class="formItem floatContainer"> <label for="confirmPassword">Confirm new password:</label> @Html.Password("confirmPassword") </div> <div class="formItem buttons"> <input type="submit" class="button" value="Change Password" /> </div> </fieldset> } <div id="PasswordChangeSuccess"> </div> @*<script language="JavaScript" type="text/javascript"> $(document).ready(function () { $("#changePwdForm").submit(function () { var f = $("#changePwdForm"); var url = f.attr("action"); var formData = f.serialize(); $.post(url, formData, function (data) { $("#PasswordChangeSuccess").html(data); }); return false; }); }); </script>*@
@{ ViewBag.Title = "ChangePassword"; } @section Head{ <script src= "@Url.Content("~/Scripts/jquery-1.3.2.js")" type="text/javascript"></script> } <ul class="path floatContainer"> <li class="first">@Html.ActionLink("Forums", "List", "Forums")</li> </ul> <h2> Change Password</h2> <p> Use the form below to change your password. </p> <p> New passwords are required to be a minimum of @Html.Encode(ViewData["PasswordLength"]) characters in length. </p> @Html.ValidationSummary("Password change was unsuccessful. Please correct the errors and try again.") <form id="changePwdForm" action="@Url.Action("ChangePassword")" method="post"> <table> <tr> <td align="right"> <label for="currentPassword"> Current password:</label> </td> <td> @Html.Password("currentPassword") @Html.ValidationMessage("currentPassword") </td> </tr> <tr> <td align="right"> <label for="newPassword"> New password:</label> </td> <td> @Html.Password("newPassword") @Html.ValidationMessage("newPassword") </td> </tr> <tr> <td align="right"> <label for="confirmPassword"> Confirm new password:</label> </td> <td> @Html.Password("confirmPassword") @Html.ValidationMessage("confirmPassword") </td> </tr> <tr align="right"> <td colspan="2" align="right"> <input type="submit" class="button" value="Change Password" /> </td> </tr> </table> <div id="PasswordChangeSuccess"> </div> </form> @*<script language="JavaScript" type="text/javascript"> $(document).ready(function () { $("#changePwdForm").submit(function () { var f = $("#changePwdForm"); var url = f.attr("action"); var formData = f.serialize(); $.post(url, formData, function (data) { $("#PasswordChangeSuccess").html(data); }); return false; }); }); </script>*@
mit
C#
7517ccea386d06b33f1fe9ca1432ba1b18c93f3a
Fix TestOptionSet
mgoertz-msft/roslyn,jmarolf/roslyn,KevinRansom/roslyn,jmarolf/roslyn,brettfo/roslyn,stephentoub/roslyn,diryboy/roslyn,genlu/roslyn,genlu/roslyn,weltkante/roslyn,tmat/roslyn,sharwell/roslyn,physhi/roslyn,bartdesmet/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,wvdd007/roslyn,eriawan/roslyn,mavasani/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,brettfo/roslyn,panopticoncentral/roslyn,heejaechang/roslyn,mavasani/roslyn,tannergooding/roslyn,shyamnamboodiripad/roslyn,aelij/roslyn,genlu/roslyn,jmarolf/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,AmadeusW/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,AlekseyTs/roslyn,tannergooding/roslyn,physhi/roslyn,davkean/roslyn,davkean/roslyn,dotnet/roslyn,panopticoncentral/roslyn,diryboy/roslyn,gafter/roslyn,shyamnamboodiripad/roslyn,mgoertz-msft/roslyn,sharwell/roslyn,AmadeusW/roslyn,heejaechang/roslyn,gafter/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,sharwell/roslyn,davkean/roslyn,weltkante/roslyn,panopticoncentral/roslyn,gafter/roslyn,jasonmalinowski/roslyn,ErikSchierboom/roslyn,wvdd007/roslyn,bartdesmet/roslyn,reaction1989/roslyn,tmat/roslyn,stephentoub/roslyn,KirillOsenkov/roslyn,aelij/roslyn,jasonmalinowski/roslyn,aelij/roslyn,dotnet/roslyn,reaction1989/roslyn,physhi/roslyn,heejaechang/roslyn,AmadeusW/roslyn,tmat/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,wvdd007/roslyn,dotnet/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,ErikSchierboom/roslyn,brettfo/roslyn,eriawan/roslyn
src/VisualStudio/Core/Test.Next/Mocks/TestOptionSet.cs
src/VisualStudio/Core/Test.Next/Mocks/TestOptionSet.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.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Options; using Roslyn.Utilities; namespace Roslyn.VisualStudio.Next.UnitTests.Mocks { internal class TestOptionSet : OptionSet { private readonly ImmutableDictionary<OptionKey, object> _values; public TestOptionSet() { _values = ImmutableDictionary<OptionKey, object>.Empty; } private TestOptionSet(ImmutableDictionary<OptionKey, object> values) { _values = values; } private protected override object GetOptionCore(OptionKey optionKey) { Contract.ThrowIfFalse(_values.TryGetValue(optionKey, out var value)); return value; } public override OptionSet WithChangedOption(OptionKey optionAndLanguage, object value) { return new TestOptionSet(_values.SetItem(optionAndLanguage, value)); } internal override IEnumerable<OptionKey> GetChangedOptions(OptionSet optionSet) { foreach (var kvp in _values) { var currentValue = optionSet.GetOption(kvp.Key); if (!object.Equals(currentValue, kvp.Value)) { yield return kvp.Key; } } } } }
// 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.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Options; using Roslyn.Utilities; namespace Roslyn.VisualStudio.Next.UnitTests.Mocks { internal class TestOptionSet : OptionSet { private readonly ImmutableDictionary<OptionKey, object> _values; public TestOptionSet() { _values = ImmutableDictionary<OptionKey, object>.Empty; } private TestOptionSet(ImmutableDictionary<OptionKey, object> values) { _values = values; } public override object GetOption(OptionKey optionKey) { Contract.ThrowIfFalse(_values.TryGetValue(optionKey, out var value)); return value; } public override OptionSet WithChangedOption(OptionKey optionAndLanguage, object value) { return new TestOptionSet(_values.SetItem(optionAndLanguage, value)); } internal override IEnumerable<OptionKey> GetChangedOptions(OptionSet optionSet) { foreach (var kvp in _values) { var currentValue = optionSet.GetOption(kvp.Key); if (!object.Equals(currentValue, kvp.Value)) { yield return kvp.Key; } } } } }
mit
C#
c935dbae44fd1f4f80faf03a8322b7502ccc0e31
Revert the hard coded name check for SBD incremental analyzer as unit test team has moved to IUnitTestingIncrementalAnalyzer
stephentoub/roslyn,aelij/roslyn,aelij/roslyn,physhi/roslyn,agocke/roslyn,gafter/roslyn,heejaechang/roslyn,wvdd007/roslyn,jmarolf/roslyn,diryboy/roslyn,weltkante/roslyn,panopticoncentral/roslyn,KevinRansom/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,jmarolf/roslyn,mavasani/roslyn,panopticoncentral/roslyn,shyamnamboodiripad/roslyn,AlekseyTs/roslyn,genlu/roslyn,AlekseyTs/roslyn,brettfo/roslyn,agocke/roslyn,genlu/roslyn,aelij/roslyn,KevinRansom/roslyn,tannergooding/roslyn,wvdd007/roslyn,eriawan/roslyn,mgoertz-msft/roslyn,stephentoub/roslyn,KirillOsenkov/roslyn,AlekseyTs/roslyn,KirillOsenkov/roslyn,tmat/roslyn,eriawan/roslyn,tmat/roslyn,reaction1989/roslyn,AmadeusW/roslyn,gafter/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,mgoertz-msft/roslyn,davkean/roslyn,weltkante/roslyn,AmadeusW/roslyn,heejaechang/roslyn,sharwell/roslyn,jmarolf/roslyn,davkean/roslyn,davkean/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,tmat/roslyn,gafter/roslyn,KirillOsenkov/roslyn,dotnet/roslyn,tannergooding/roslyn,brettfo/roslyn,eriawan/roslyn,reaction1989/roslyn,mavasani/roslyn,physhi/roslyn,dotnet/roslyn,abock/roslyn,ErikSchierboom/roslyn,agocke/roslyn,diryboy/roslyn,physhi/roslyn,abock/roslyn,panopticoncentral/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,shyamnamboodiripad/roslyn,genlu/roslyn,jasonmalinowski/roslyn,tannergooding/roslyn,reaction1989/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,weltkante/roslyn,brettfo/roslyn,diryboy/roslyn,sharwell/roslyn,sharwell/roslyn,mgoertz-msft/roslyn,mavasani/roslyn,heejaechang/roslyn,abock/roslyn,CyrusNajmabadi/roslyn,ErikSchierboom/roslyn
src/Workspaces/Core/Portable/SolutionCrawler/IIncrementalAnalyzerExtensions.cs
src/Workspaces/Core/Portable/SolutionCrawler/IIncrementalAnalyzerExtensions.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.ExternalAccess.UnitTesting; using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.SolutionCrawler { internal static partial class IIncrementalAnalyzerExtensions { public static BackgroundAnalysisScope GetOverriddenBackgroundAnalysisScope(this IIncrementalAnalyzer incrementalAnalyzer, OptionSet options, BackgroundAnalysisScope defaultBackgroundAnalysisScope) { // Unit testing analyzer has special semantics for analysis scope. if (incrementalAnalyzer is UnitTestingIncrementalAnalyzer unitTestingAnalyzer) { return unitTestingAnalyzer.GetBackgroundAnalysisScope(options); } return defaultBackgroundAnalysisScope; } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.ExternalAccess.UnitTesting; using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.SolutionCrawler { internal static partial class IIncrementalAnalyzerExtensions { public static BackgroundAnalysisScope GetOverriddenBackgroundAnalysisScope(this IIncrementalAnalyzer incrementalAnalyzer, OptionSet options, BackgroundAnalysisScope defaultBackgroundAnalysisScope) { // Unit testing analyzer has special semantics for analysis scope. if (incrementalAnalyzer is UnitTestingIncrementalAnalyzer unitTestingAnalyzer) { return unitTestingAnalyzer.GetBackgroundAnalysisScope(options); } // TODO: Remove the below if statement once SourceBasedTestDiscoveryIncrementalAnalyzer has been switched to UnitTestingIncrementalAnalyzer if (incrementalAnalyzer.GetType().FullName == "Microsoft.CodeAnalysis.UnitTesting.SourceBasedTestDiscovery.SourceBasedTestDiscoveryIncrementalAnalyzer") { return BackgroundAnalysisScope.FullSolution; } return defaultBackgroundAnalysisScope; } } }
mit
C#
635b283d05d1df14588259da6b6a1ae05a9d4639
Update Messages to correct location
ShammyLevva/FTAnalyzer,ShammyLevva/FTAnalyzer,ShammyLevva/FTAnalyzer
FTAnalyser/SharedAssemblyVersion.cs
FTAnalyser/SharedAssemblyVersion.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ [assembly: System.Reflection.AssemblyInformationalVersion("1.2.0.5b2eaa85")] [assembly: System.Reflection.AssemblyVersion("1.2.0")] [assembly: System.Reflection.AssemblyFileVersion("1.2.0")]
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ [assembly: System.Reflection.AssemblyInformationalVersion("1.2.0.c6b5bf2a")] [assembly: System.Reflection.AssemblyVersion("1.2.0")] [assembly: System.Reflection.AssemblyFileVersion("1.2.0")]
apache-2.0
C#
75718ab6e412e48f928fabc774822596cbf7cd9d
Fix TrimStringBinder for .NET 4.0
Soul-Master/higgs,Soul-Master/higgs,Soul-Master/higgs,Soul-Master/higgs
Higgs.Web.Net40/TrimStringBinder.cs
Higgs.Web.Net40/TrimStringBinder.cs
using System.Web.Mvc; namespace Higgs.Web { public class TrimModelBinder : DefaultModelBinder { protected override void SetProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, System.ComponentModel.PropertyDescriptor propertyDescriptor, object value) { if (propertyDescriptor.PropertyType == typeof(string)) { var stringValue = (string)value; if (!string.IsNullOrEmpty(stringValue)) stringValue = stringValue.Trim(); value = stringValue; } base.SetProperty(controllerContext, bindingContext, propertyDescriptor, value); } } }
using System.Web.Mvc; namespace Higgs.Web { public class TrimStringBinder : IModelBinder { public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { var valueResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); if (valueResult == null || string.IsNullOrEmpty(valueResult.AttemptedValue)) { bindingContext.Model = null; } else { bindingContext.Model = valueResult.AttemptedValue.Trim(); } return true; } } }
mit
C#
bb032508bd0c6802b53bd8c50617f0791ea9bd19
Add comment explaining why we use scale
ppy/osu,Drezi126/osu,smoogipooo/osu,ZLima12/osu,DrabWeb/osu,naoey/osu,NeoAdonis/osu,naoey/osu,peppy/osu,EVAST9919/osu,peppy/osu-new,NeoAdonis/osu,2yangk23/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,EVAST9919/osu,johnneijzen/osu,peppy/osu,ppy/osu,DrabWeb/osu,naoey/osu,Frontear/osuKyzer,johnneijzen/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,Damnae/osu,ZLima12/osu,smoogipoo/osu,DrabWeb/osu,2yangk23/osu,Nabile-Rahmani/osu
osu.Game/Graphics/Containers/ConstrainedIconContainer.cs
osu.Game/Graphics/Containers/ConstrainedIconContainer.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 System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; namespace osu.Game.Graphics.Containers { /// <summary> /// Display an icon that is constrained to a physical region on screen. /// </summary> public class ConstrainedIconContainer : CompositeDrawable { public Drawable Icon { get { return InternalChild; } set { InternalChild = value; } } /// <summary> /// Determines an edge effect of this <see cref="Container"/>. /// Edge effects are e.g. glow or a shadow. /// Only has an effect when <see cref="CompositeDrawable.Masking"/> is true. /// </summary> public new EdgeEffectParameters EdgeEffect { get { return base.EdgeEffect; } set { base.EdgeEffect = value; } } protected override void Update() { base.Update(); if (InternalChildren.Count > 0 && InternalChild.DrawSize.X > 0) { // We're modifying scale here for a few reasons // - Guarantees correctness if BorderWidth is being used // - If we were to use RelativeSize/FillMode, we'd need to set the Icon's RelativeSizeAxes directly. // We can't do this because we would need access to AutoSizeAxes to set it to none. // Other issues come up along the way too, so it's not a good solution. var fitScale = Math.Min(DrawSize.X / InternalChild.DrawSize.X, DrawSize.Y / InternalChild.DrawSize.Y); InternalChild.Scale = new Vector2(fitScale); InternalChild.Anchor = Anchor.Centre; InternalChild.Origin = Anchor.Centre; } } public ConstrainedIconContainer() { Masking = true; } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; namespace osu.Game.Graphics.Containers { /// <summary> /// Display an icon that is constrained to a physical region on screen. /// </summary> public class ConstrainedIconContainer : CompositeDrawable { public Drawable Icon { get { return InternalChild; } set { InternalChild = value; } } /// <summary> /// Determines an edge effect of this <see cref="Container"/>. /// Edge effects are e.g. glow or a shadow. /// Only has an effect when <see cref="CompositeDrawable.Masking"/> is true. /// </summary> public new EdgeEffectParameters EdgeEffect { get { return base.EdgeEffect; } set { base.EdgeEffect = value; } } protected override void Update() { base.Update(); if (InternalChildren.Count > 0 && InternalChild.DrawSize.X > 0) { var fitScale = Math.Min(DrawSize.X / InternalChild.DrawSize.X, DrawSize.Y / InternalChild.DrawSize.Y); InternalChild.Scale = new Vector2(fitScale); InternalChild.Anchor = Anchor.Centre; InternalChild.Origin = Anchor.Centre; } } public ConstrainedIconContainer() { Masking = true; } } }
mit
C#
65112348041cffc6df4c625c65c914bc03a669f7
Fix catch spinners not being allowed for conversion
peppy/osu,ppy/osu,johnneijzen/osu,peppy/osu-new,NeoAdonis/osu,ZLima12/osu,DrabWeb/osu,ZLima12/osu,UselessToucan/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,johnneijzen/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,smoogipooo/osu,smoogipoo/osu,peppy/osu,2yangk23/osu,ppy/osu,peppy/osu,EVAST9919/osu,EVAST9919/osu,DrabWeb/osu,DrabWeb/osu,2yangk23/osu,UselessToucan/osu
osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs
osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects.Legacy.Catch { /// <summary> /// Legacy osu!catch Spinner-type, used for parsing Beatmaps. /// </summary> internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasXPosition, IHasCombo { public double EndTime { get; set; } public double Duration => EndTime - StartTime; public float X => 256; // Required for CatchBeatmapConverter public bool NewCombo { get; set; } public int ComboOffset { get; set; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects.Legacy.Catch { /// <summary> /// Legacy osu!catch Spinner-type, used for parsing Beatmaps. /// </summary> internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasCombo { public double EndTime { get; set; } public double Duration => EndTime - StartTime; public bool NewCombo { get; set; } public int ComboOffset { get; set; } } }
mit
C#
6da44987714f1351034008bfaa43beb4fe9e16df
Update test
sakapon/Samples-2014,sakapon/Samples-2014,sakapon/Samples-2014
MonadSample/MonadConsole/Program.cs
MonadSample/MonadConsole/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MonadConsole { class Program { static void Main(string[] args) { MonadTest(); MaybeTest(); FlowTest(); } static void MonadTest() { var r1 = from x in 0.ToMonad() select x; var r2 = from x in 1.ToMonad() from y in 2.ToMonad() select x + y; } static void MaybeTest() { var r1 = from x in 2.ToMaybe() where x % 3 == 1 select x + 1; var r2 = Add(1, 2); var r3 = Add(2, 1); var r4 = Add(1, Maybe<int>.None); } static Maybe<int> Add(Maybe<int> x, Maybe<int> y) { return from _x in x from _y in y where _x < _y select _x + _y; } static void FlowTest() { var r1 = from x in 1.ToFlow() from y in 0.ToFlow() select x / y; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MonadConsole { class Program { static void Main(string[] args) { MonadTest(); MaybeTest(); FlowTest(); } static void MonadTest() { var r1 = from x in 0.ToMonad() select x; var r2 = from x in 1.ToMonad() from y in 2.ToMonad() select x + y; } static void MaybeTest() { var r1 = from x in 2.ToMaybe() where x % 3 == 1 select x + 1; var r2 = from x in 1.ToMaybe() from y in 2.ToMaybe() where x % 3 == 1 select x + y; } static void FlowTest() { var r1 = from x in 1.ToFlow() from y in 0.ToFlow() select x / y; } } }
mit
C#
f1950173abbdb07f7f777d76c696be0a7589989c
Fix this
CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos
source/Cosmos.Core_Asm/GCImplementation/GetPointerAsm.cs
source/Cosmos.Core_Asm/GCImplementation/GetPointerAsm.cs
using XSharp.Assembler; using IL2CPU.API; using XSharp; using CPUx86 = XSharp.Assembler.x86; using static XSharp.XSRegisters; namespace Cosmos.Core_Asm.GCImplementation { class GetPointerAsm : AssemblerMethod { public override void AssembleNew(Assembler aAssembler, object aMethodInfo) { XS.Set(BX, BX); // we get the object as an object size 4 and we just leave it as a uint* // so this is just an illegal cast XS.Set(EAX, EBP, sourceDisplacement: 12); XS.Push(EAX); } } }
using XSharp.Assembler; using IL2CPU.API; using XSharp; using CPUx86 = XSharp.Assembler.x86; namespace Cosmos.Core_Asm.GCImplementation { class GetPointerAsm : AssemblerMethod { public override void AssembleNew(Assembler aAssembler, object aMethodInfo) { // we get the object as an object size 8 and we just leave it as a uint* // so this is just an illegal cast XS.Set(EAX, EBP, sourceDisplacement: 12); XS.Push(EAX); XS.Set(EAX, EBP, sourceDisplacement: 16); XS.Push(EAX); } } }
bsd-3-clause
C#
070bba8ad4dfae6dc0a0e1df438592960365c35e
Add event name in localization\n\nCommit migrated from https://github.com/dotnet/extensions/commit/d2b1ad3d233a0750647ed2c73343a293f08c5709
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Localization/Localization/src/Internal/ResourceManagerStringLocalizerLoggerExtensions.cs
src/Localization/Localization/src/Internal/ResourceManagerStringLocalizerLoggerExtensions.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.Globalization; using Microsoft.Extensions.Logging; namespace Microsoft.Extensions.Localization.Internal { internal static class ResourceManagerStringLocalizerLoggerExtensions { private static readonly Action<ILogger, string, string, CultureInfo, Exception> _searchedLocation; static ResourceManagerStringLocalizerLoggerExtensions() { _searchedLocation = LoggerMessage.Define<string, string, CultureInfo>( LogLevel.Debug, new EventId(1, "SearchedLocation"), $"{nameof(ResourceManagerStringLocalizer)} searched for '{{Key}}' in '{{LocationSearched}}' with culture '{{Culture}}'."); } public static void SearchedLocation(this ILogger logger, string key, string searchedLocation, CultureInfo culture) { _searchedLocation(logger, key, searchedLocation, culture, null); } } }
// 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.Globalization; using Microsoft.Extensions.Logging; namespace Microsoft.Extensions.Localization.Internal { internal static class ResourceManagerStringLocalizerLoggerExtensions { private static readonly Action<ILogger, string, string, CultureInfo, Exception> _searchedLocation; static ResourceManagerStringLocalizerLoggerExtensions() { _searchedLocation = LoggerMessage.Define<string, string, CultureInfo>( LogLevel.Debug, 1, $"{nameof(ResourceManagerStringLocalizer)} searched for '{{Key}}' in '{{LocationSearched}}' with culture '{{Culture}}'."); } public static void SearchedLocation(this ILogger logger, string key, string searchedLocation, CultureInfo culture) { _searchedLocation(logger, key, searchedLocation, culture, null); } } }
apache-2.0
C#
59a72d599e80e3351e298d6a4c90c5b4b5cd780d
Fix GroupBrandingContentfulFactory
smbc-digital/iag-contentapi
src/StockportContentApi/ContentfulFactories/GroupFactories/GroupBrandingContentfulFactory.cs
src/StockportContentApi/ContentfulFactories/GroupFactories/GroupBrandingContentfulFactory.cs
using Microsoft.AspNetCore.Http; using StockportContentApi.ContentfulModels; using StockportContentApi.Model; using StockportContentApi.Utils; namespace StockportContentApi.ContentfulFactories.GroupFactories { public class GroupBrandingContentfulFactory : IContentfulFactory<ContentfulGroupBranding, GroupBranding> { private readonly IHttpContextAccessor _httpContextAccessor; public GroupBrandingContentfulFactory(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; } public GroupBranding ToModel(ContentfulGroupBranding entry) { var file = new MediaAsset(); if (entry != null && entry.File != null && entry.File.File != null) { file = new MediaAsset { Url = entry.File.File.Url, Description = entry.File.Description }; } return new GroupBranding(entry.Title, entry.Text, file, entry.Url).StripData(_httpContextAccessor); } } }
using Microsoft.AspNetCore.Http; using StockportContentApi.ContentfulModels; using StockportContentApi.Model; using StockportContentApi.Utils; namespace StockportContentApi.ContentfulFactories.GroupFactories { public class GroupBrandingContentfulFactory : IContentfulFactory<ContentfulGroupBranding, GroupBranding> { private readonly IHttpContextAccessor _httpContextAccessor; public GroupBrandingContentfulFactory(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; } public GroupBranding ToModel(ContentfulGroupBranding entry) { var file = new MediaAsset(); if (entry != null && entry.File != null) { file = new MediaAsset { Url = entry.File.File.Url, Description = entry.File.Description }; } return new GroupBranding(entry.Title, entry.Text, file, entry.Url).StripData(_httpContextAccessor); } } }
mit
C#
bdf8cf2ee9d9bf3df2cc33c2c717e9db1638e2f7
Fix text of error message
KpdApps/KpdApps.Common.MsCrm2015
PluginState.cs
PluginState.cs
using System; using Microsoft.Xrm.Sdk; namespace KpdApps.Common.MsCrm2015 { public class PluginState { public virtual IServiceProvider Provider { get; private set; } private IPluginExecutionContext _context; public virtual IPluginExecutionContext Context => _context ?? (_context = (IPluginExecutionContext)Provider.GetService(typeof(IPluginExecutionContext))); private IOrganizationService _service; public virtual IOrganizationService Service { get { if (_service != null) return _service; IOrganizationServiceFactory factory = (IOrganizationServiceFactory)Provider.GetService(typeof(IOrganizationServiceFactory)); _service = factory.CreateOrganizationService(this.Context.UserId); return _service; } } private ITracingService _tracingService; public virtual ITracingService TracingService { get { if (_tracingService != null) return _tracingService; _tracingService = (ITracingService)Provider.GetService(typeof(ITracingService)); return _tracingService; } } public PluginState(IServiceProvider provider) { if (provider == null) throw new ArgumentNullException(nameof(provider)); Provider = provider; } public T GetTarget<T>() where T : class { if (Context.InputParameters.Contains("Target")) { return (T)Context.InputParameters["Target"]; } return default(T); ; } public Entity TryGetPostImage(string name) { if (Context.PostEntityImages.Contains(name)) return Context.PostEntityImages[name]; return null; } public Entity GetPostImage(string name) { var image = TryGetPostImage(name); if (image == null) throw new ApplicationException($"Post-image with name \"{name}\" not found."); return image; } public Entity TryGetPreImage(string name) { if (Context.PreEntityImages.Contains(name)) return Context.PreEntityImages[name]; return null; } public Entity GetPreImage(string name) { var image = TryGetPreImage(name); if (image == null) throw new ApplicationException($"Pre-image with name \"{name}\" not found."); return image; } } }
using System; using Microsoft.Xrm.Sdk; namespace KpdApps.Common.MsCrm2015 { public class PluginState { public virtual IServiceProvider Provider { get; private set; } private IPluginExecutionContext _context; public virtual IPluginExecutionContext Context => _context ?? (_context = (IPluginExecutionContext)Provider.GetService(typeof(IPluginExecutionContext))); private IOrganizationService _service; public virtual IOrganizationService Service { get { if (_service != null) return _service; IOrganizationServiceFactory factory = (IOrganizationServiceFactory)Provider.GetService(typeof(IOrganizationServiceFactory)); _service = factory.CreateOrganizationService(this.Context.UserId); return _service; } } private ITracingService _tracingService; public virtual ITracingService TracingService { get { if (_tracingService != null) return _tracingService; _tracingService = (ITracingService)Provider.GetService(typeof(ITracingService)); return _tracingService; } } public PluginState(IServiceProvider provider) { if (provider == null) throw new ArgumentNullException(nameof(provider)); Provider = provider; } public T GetTarget<T>() where T : class { if (Context.InputParameters.Contains("Target")) { return (T)Context.InputParameters["Target"]; } return default(T); ; } public Entity TryGetPostImage(string name) { if (Context.PostEntityImages.Contains(name)) return Context.PostEntityImages[name]; return null; } public Entity GetPostImage(string name) { var image = TryGetPostImage(name); if (image == null) throw new ApplicationException($"Post-image with {name} not found."); return image; } public Entity TryGetPreImage(string name) { if (Context.PreEntityImages.Contains(name)) return Context.PreEntityImages[name]; return null; } public Entity GetPreImage(string name) { var image = TryGetPreImage(name); if (image == null) throw new ApplicationException($"Pre-image with name {name} not found."); return image; } } }
mit
C#
e53d9631443c3cf278244e463ba1e6b41394b842
Bump version number.
adz21c/miles
VersionInfo.cs
VersionInfo.cs
using System.Reflection; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyCompany("Adam Burton")] [assembly: AssemblyProduct("Miles")] [assembly: AssemblyCopyright("Copyright © Adam Burton 2016")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("0.5.0.0")]
using System.Reflection; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyCompany("Adam Burton")] [assembly: AssemblyProduct("Miles")] [assembly: AssemblyCopyright("Copyright © Adam Burton 2016")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("0.4.0.0")]
apache-2.0
C#
992408e0e67668d6a68ffd08c40412d529ee3a70
Bump version
adz21c/miles
VersionInfo.cs
VersionInfo.cs
using System.Reflection; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyCompany("Adam Burton")] [assembly: AssemblyProduct("Miles")] [assembly: AssemblyCopyright("Copyright © Adam Burton 2016")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("0.6.0.0")]
using System.Reflection; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyCompany("Adam Burton")] [assembly: AssemblyProduct("Miles")] [assembly: AssemblyCopyright("Copyright © Adam Burton 2016")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("0.5.0.0")]
apache-2.0
C#
b02b3c61c4c8cfe85a77644e4bada62a67c562fd
change the version
shabtaisharon/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,RachelTucker/ds3_net_sdk,SpectraLogic/ds3_net_sdk,shabtaisharon/ds3_net_sdk,shabtaisharon/ds3_net_sdk
VersionInfo.cs
VersionInfo.cs
/* * ****************************************************************************** * Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * **************************************************************************** */ using System.Reflection; // 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("3.5.1.0")] [assembly: AssemblyFileVersion("3.5.1.0")]
/* * ****************************************************************************** * Copyright 2014-2017 Spectra Logic Corporation. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * **************************************************************************** */ using System.Reflection; // 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("3.5.0.0")] [assembly: AssemblyFileVersion("3.5.0.0")]
apache-2.0
C#
bbb6cbc9d74fe39f00fd71d2a3c110636c086318
Use nameof expression
markembling/MarkEmbling.Utils,markembling/MarkEmbling.Utilities
src/MarkEmbling.Utils/Extensions/EnumerableExtensions.cs
src/MarkEmbling.Utils/Extensions/EnumerableExtensions.cs
using System; using System.Collections.Generic; using System.Linq; namespace MarkEmbling.Utils.Extensions { public static class EnumerableExtensions { /// <summary> /// Return a shuffled version of an IEnumerable collection /// /// This method internally buffers source using ToList and thus will trigger /// any deferred linq execution. Based upon http://stackoverflow.com/questions/273313/randomize-a-listt/1262619#1262619 /// </summary> /// <typeparam name="T">Collection type</typeparam> /// <param name="source">Source collection</param> /// <param name="rng">Random number generator</param> /// <returns>Collection containing the shuffled contents of source</returns> public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng) { if (source == null) throw new ArgumentNullException(nameof(source)); if (rng == null) throw new ArgumentNullException(nameof(rng)); var buffer = source.ToList(); // Buffer the entire collection so we can shuffle it. Breaks linq deferral though. int k = buffer.Count; while (k > 1) { k--; int k2 = rng.Next(k + 1); T temp = buffer[k2]; buffer[k2] = buffer[k]; buffer[k] = temp; } return buffer; } /// <summary> /// Return a shuffled version of an IEnumerable collection /// /// This method internally buffers source using ToList and thus will trigger /// any deferred linq execution. It will create an instance of System.Random /// to handle the randomness of the shuffling; if you'd like to provide your /// own, use the overload which takes a System.Random. /// </summary> /// <typeparam name="T">Collection type</typeparam> /// <param name="source">Source collection</param> /// <returns>Collection containing the shuffled contents of source</returns> public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source) { return source.Shuffle(new Random()); } } }
using System; using System.Collections.Generic; using System.Linq; namespace MarkEmbling.Utils.Extensions { public static class EnumerableExtensions { /// <summary> /// Return a shuffled version of an IEnumerable collection /// /// This method internally buffers source using ToList and thus will trigger /// any deferred linq execution. Based upon http://stackoverflow.com/questions/273313/randomize-a-listt/1262619#1262619 /// </summary> /// <typeparam name="T">Collection type</typeparam> /// <param name="source">Source collection</param> /// <param name="rng">Random number generator</param> /// <returns>Collection containing the shuffled contents of source</returns> public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng) { if (source == null) throw new ArgumentNullException("source"); if (rng == null) throw new ArgumentNullException("rng"); var buffer = source.ToList(); // Buffer the entire collection so we can shuffle it. Breaks linq deferral though. int k = buffer.Count; while (k > 1) { k--; int k2 = rng.Next(k + 1); T temp = buffer[k2]; buffer[k2] = buffer[k]; buffer[k] = temp; } return buffer; } /// <summary> /// Return a shuffled version of an IEnumerable collection /// /// This method internally buffers source using ToList and thus will trigger /// any deferred linq execution. It will create an instance of System.Random /// to handle the randomness of the shuffling; if you'd like to provide your /// own, use the overload which takes a System.Random. /// </summary> /// <typeparam name="T">Collection type</typeparam> /// <param name="source">Source collection</param> /// <returns>Collection containing the shuffled contents of source</returns> public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source) { return source.Shuffle(new Random()); } } }
mit
C#
f4da788893e1df3bcada5fb778efba9cd57ee761
add a ToString to the Status to see more when an exception throws
PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer
StandUpTimer.Web.Contract/Status.cs
StandUpTimer.Web.Contract/Status.cs
namespace StandUpTimer.Web.Contract { public class Status { public const string DateTimeFormat = "yyyy, M, d, H, m, s, 0"; public string DateTime { get; set; } public DeskState DeskState { get; set; } public override string ToString() { return DeskState.ToString(); } } }
namespace StandUpTimer.Web.Contract { public class Status { public const string DateTimeFormat = "yyyy, M, d, H, m, s, 0"; public string DateTime { get; set; } public DeskState DeskState { get; set; } } }
mit
C#
2c942fc110950f7522c47e3cdf6d92cfef29d9fb
Rewrite AddPhoneNumber form markup
peterblazejewicz/aspnet-5-bootstrap-4,peterblazejewicz/aspnet-5-bootstrap-4
WebApplication/Views/Manage/AddPhoneNumber.cshtml
WebApplication/Views/Manage/AddPhoneNumber.cshtml
@model AddPhoneNumberViewModel @{ ViewData["Title"] = "Add Phone Number"; } <h2>@ViewData["Title"].</h2> <form asp-controller="Manage" asp-action="AddPhoneNumber" method="post" role="form"> <h4>Add a phone number.</h4> <hr /> <div asp-validation-summary="ValidationSummary.All" class="text-danger"></div> <fieldset> <div class="form-group row"> <label asp-for="PhoneNumber" class="col-md-2 control-label"></label> <div class="col-md-10"> <input asp-for="PhoneNumber" class="form-control" /> <span asp-validation-for="PhoneNumber" class="text-danger"></span> </div> </div> <div class="form-group row"> <div class="col-md-offset-2 col-md-10"> <button type="submit" class="btn btn-primary">Send verification code</button> </div> </div> </fieldset> </form> @section Scripts { @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } }
@model AddPhoneNumberViewModel @{ ViewData["Title"] = "Add Phone Number"; } <h2>@ViewData["Title"].</h2> <form asp-controller="Manage" asp-action="AddPhoneNumber" method="post" role="form"> <h4>Add a phone number.</h4> <hr /> <div asp-validation-summary="ValidationSummary.All" class="text-danger"></div> <div class="form-group"> <label asp-for="PhoneNumber" class="col-md-2 control-label"></label> <div class="col-md-10"> <input asp-for="PhoneNumber" class="form-control" /> <span asp-validation-for="PhoneNumber" class="text-danger"></span> </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <button type="submit" class="btn btn-default">Send verification code</button> </div> </div> </form> @section Scripts { @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } }
mit
C#
220e532ba681d2afafc1b7e0d2237e8d0c37efbd
Correct edge version and url selector
rosolko/WebDriverManager.Net
WebDriverManager/DriverConfigs/Impl/EdgeConfig.cs
WebDriverManager/DriverConfigs/Impl/EdgeConfig.cs
using System.Linq; using System.Net; using AngleSharp; using AngleSharp.Parser.Html; namespace WebDriverManager.DriverConfigs.Impl { public class EdgeConfig : IDriverConfig { public virtual string GetName() { return "Edge"; } public virtual string GetUrl32() { return GetUrl(); } public virtual string GetUrl64() { return GetUrl32(); } public virtual string GetBinaryName() { return "MicrosoftWebDriver.exe"; } public virtual string GetLatestVersion() { using (var client = new WebClient()) { var htmlCode = client.DownloadString("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver"); var parser = new HtmlParser(Configuration.Default.WithDefaultLoader()); var document = parser.Parse(htmlCode); var version = document.QuerySelectorAll(".driver-download > a + p") .Select(element => element.TextContent) .FirstOrDefault() ?.Split(' ')[1] .Split(' ')[0]; return version; } } public virtual string GetUrl() { using (var client = new WebClient()) { var htmlCode = client.DownloadString("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver"); var parser = new HtmlParser(Configuration.Default.WithDefaultLoader()); var document = parser.Parse(htmlCode); var url = document.QuerySelectorAll(".driver-download > a") .Select(element => element.Attributes.GetNamedItem("href")) .FirstOrDefault() ?.Value; return url; } } } }
using System.Linq; using System.Net; using AngleSharp; using AngleSharp.Parser.Html; namespace WebDriverManager.DriverConfigs.Impl { public class EdgeConfig : IDriverConfig { public virtual string GetName() { return "Edge"; } public virtual string GetUrl32() { return GetUrl(); } public virtual string GetUrl64() { return GetUrl32(); } public virtual string GetBinaryName() { return "MicrosoftWebDriver.exe"; } public virtual string GetLatestVersion() { using (var client = new WebClient()) { var htmlCode = client.DownloadString("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver"); var parser = new HtmlParser(Configuration.Default.WithDefaultLoader()); var document = parser.Parse(htmlCode); var version = document.QuerySelectorAll("[class='driver-download'] a + p") .Select(element => element.TextContent) .FirstOrDefault() ?.Split(' ')[1] .Split(' ')[0]; return version; } } public virtual string GetUrl() { using (var client = new WebClient()) { var htmlCode = client.DownloadString("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver"); var parser = new HtmlParser(Configuration.Default.WithDefaultLoader()); var document = parser.Parse(htmlCode); var url = document.QuerySelectorAll("[class='driver-download'] a") .Select(element => element.Attributes.GetNamedItem("href")) .FirstOrDefault() ?.Value; return url; } } } }
mit
C#
c97fe1afe797d56a800295151078e979828a02f7
fix unit test by ignoring unmapped destination members
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EmployerAccounts/Mappings/AccountMappings.cs
src/SFA.DAS.EmployerAccounts/Mappings/AccountMappings.cs
using AutoMapper; using SFA.DAS.Authorization; using SFA.DAS.EmployerAccounts.Api.Types; using SFA.DAS.EmployerAccounts.Dtos; using SFA.DAS.EmployerAccounts.Models.Account; namespace SFA.DAS.EmployerAccounts.Mappings { public class AccountMappings : Profile { public AccountMappings() { CreateMap<Account, AccountContext>(); CreateMap<Account, AccountDto>(); CreateMap<Account, AccountDetailViewModel>() .ForMember(target => target.AccountId, opt => opt.MapFrom(src => src.Id)) .ForMember(target => target.HashedAccountId, opt => opt.MapFrom(src => src.HashedId)) .ForMember(target => target.PublicHashedAccountId, opt => opt.MapFrom(src => src.PublicHashedId)) .ForMember(target => target.DateRegistered, opt => opt.MapFrom(src => src.CreatedDate)) .ForMember(target => target.DasAccountName, opt => opt.MapFrom(src => src.Name)) .ForAllOtherMembers(opt => opt.Ignore()); } } }
using AutoMapper; using SFA.DAS.Authorization; using SFA.DAS.EmployerAccounts.Api.Types; using SFA.DAS.EmployerAccounts.Dtos; using SFA.DAS.EmployerAccounts.Models.Account; namespace SFA.DAS.EmployerAccounts.Mappings { public class AccountMappings : Profile { public AccountMappings() { CreateMap<Account, AccountContext>(); CreateMap<Account, AccountDto>(); CreateMap<Account, AccountDetailViewModel>() .ForMember(target => target.AccountId, opt => opt.MapFrom(src => src.Id)) .ForMember(target => target.HashedAccountId, opt => opt.MapFrom(src => src.HashedId)) .ForMember(target => target.PublicHashedAccountId, opt => opt.MapFrom(src => src.PublicHashedId)) .ForMember(target => target.DateRegistered, opt => opt.MapFrom(src => src.CreatedDate)) .ForMember(target => target.DasAccountName, opt => opt.MapFrom(src => src.Name)); } } }
mit
C#
924008367834b550a99a0d613a722137a32fd4b6
Increment version
ibrahimbensalah/Xania.AspNet,ibrahimbensalah/Xania.AspNet,ibrahimbensalah/Xania.AspNet
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Xania.AspNet.Simulator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xania Software")] [assembly: AssemblyProduct("Xania.AspNet.Simulator")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("50be2f4c-4f81-4abc-8b84-b8069311802a")] // 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.6")] [assembly: AssemblyFileVersion("1.0.0.1")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Xania.AspNet.Simulator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Xania.AspNet.Simulator")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("50be2f4c-4f81-4abc-8b84-b8069311802a")] // 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.5")] [assembly: AssemblyFileVersion("1.0.0.1")]
mit
C#
fa857ff2f36e9dec034a74a9552cbd4b300ddabb
Update copyright and version
hartez/PneumaticTube
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PneumaticTube")] [assembly: AssemblyDescription("Command line Dropbox uploader for Windows")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CodeWise LLC")] [assembly: AssemblyProduct("PneumaticTube")] [assembly: AssemblyCopyright("Copyright © CodeWise LLC and E.Z. Hart 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("2502610f-3a6b-45ab-816e-81e2347d4e33")] // 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")]
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("PneumaticTube")] [assembly: AssemblyDescription("Command line Dropbox uploader for Windows")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CodeWise LLC")] [assembly: AssemblyProduct("PneumaticTube")] [assembly: AssemblyCopyright("Copyright © CodeWise LLC and E.Z. Hart 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("2502610f-3a6b-45ab-816e-81e2347d4e33")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.2.0.0")] [assembly: AssemblyFileVersion("1.2.0.0")]
mit
C#
c0d84aa54d6639a73bdcc7ba3125220d24f20af8
Update AssemblyInfo
GuildMasterInfinite/VulkanInfo-GUI
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("VulkanInfo GUI")] [assembly: AssemblyDescription("Small program to obtain information from the Vulkan Runtime.")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: AssemblyProduct("Graphical User Interface for VulkanInfo")] [assembly: AssemblyCopyright("Copyright © 2016 - 2017")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: AssemblyVersion("1.1.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("VulkanInfo GUI")] [assembly: AssemblyDescription("Small program to obtain information from the Vulkan Runtime.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Graphical User Interface for VulkanInfo")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("c84defb0-0c87-4779-a1cd-33345e9996ce")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
974e05b91ec0178cf42758d974588898195b29b3
Update AssemblyInfo.cs
gandarez/visualstudio-wakatime,crushjz/visualstudio-wakatime,CodeCavePro/visualstudio-wakatime,iwhp/visualstudio-wakatime,pritianka/VS,wakatime/visualstudio-wakatime,CodeCavePro/wakatime-sharp,lydonchandra/visualstudio-wakatime
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Resources; 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("VSPackageWakaTime")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("WakaTime")] [assembly: AssemblyProduct("VSPackageWakaTime")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(false)] [assembly: NeutralResourcesLanguage("en-US")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("VSPackageWakaTime_IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")] [assembly: InternalsVisibleTo("VSPackageWakaTime_UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")]
using System; using System.Reflection; using System.Resources; 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("VSPackageWakaTime")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Wakatime")] [assembly: AssemblyProduct("VSPackageWakaTime")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(false)] [assembly: NeutralResourcesLanguage("en-US")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("VSPackageWakaTime_IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")] [assembly: InternalsVisibleTo("VSPackageWakaTime_UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")]
bsd-3-clause
C#
292e7ceb273f3c6e6590ded3c7ca6e2497eb1e03
make replay mode a command-line option
Screenary/Screenary
Server/Main.cs
Server/Main.cs
using System; using Screenary; using System.IO; using System.Text; using System.Threading; namespace Screenary.Server { class MainClass { public static string replayFile; public static bool replayMode = false; public static string WorkingDirectory; public static void Main(string[] args) { WorkingDirectory = Directory.GetCurrentDirectory(); if (!WorkingDirectory.EndsWith("/")) WorkingDirectory += "/"; if (args[0].Equals("--replay") && (args.Length > 1)) { replayFile = args[1].ToString(); Console.WriteLine("Replay Mode, using {0}", replayFile); replayMode = true; } BroadcasterServer server = new BroadcasterServer("127.0.0.1", 4489); if (replayMode) { PcapReader pcap = new PcapReader(File.OpenRead(replayFile)); foreach (PcapRecord record in pcap) { PDU pdu = new PDU(record.Buffer, 0, 1); server.addPDU(pdu); } } while (true) { Thread.Sleep(10); } } } }
using System; using Screenary; using System.IO; using System.Text; using System.Threading; namespace Screenary.Server { class MainClass { public static string WorkingDirectory; public static void Main(string[] args) { WorkingDirectory = Directory.GetCurrentDirectory(); if (!WorkingDirectory.EndsWith("/")) WorkingDirectory += "/"; Directory.SetCurrentDirectory(WorkingDirectory + "../../"); BroadcasterServer server = new BroadcasterServer("127.0.0.1", 4489); PcapReader pcap = new PcapReader(File.OpenRead("data/ferrari.pcap")); foreach (PcapRecord record in pcap) { PDU pdu = new PDU(record.Buffer, 0, 1); server.addPDU(pdu); } while (true) { Thread.Sleep(10); } } } }
apache-2.0
C#
1eb5afcc719e0145bf1dbbd62669413fd80e2d61
删除 IJsonIgnoreNull 接口
mc7246/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,mc7246/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,lishewen/WeiXinMPSDK,lishewen/WeiXinMPSDK,lishewen/WeiXinMPSDK,mc7246/WeiXinMPSDK
src/Senparc.Weixin/Senparc.Weixin/Entities/EntityBase.cs
src/Senparc.Weixin/Senparc.Weixin/Entities/EntityBase.cs
#region Apache License Version 2.0 /*---------------------------------------------------------------- Copyright 2018 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd. 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. Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md ----------------------------------------------------------------*/ #endregion Apache License Version 2.0 /*---------------------------------------------------------------- Copyright (C) 2018 Senparc 文件名:EntityBase.cs 文件功能描述:EntityBase 创建标识:Senparc - 20150928 修改标识:Senparc - 20161012 修改描述:v4.8.1 添加IJsonEnumString ----------------------------------------------------------------*/ namespace Senparc.Weixin.Entities { /// <summary> /// 所有微信自定义实体的基础接口 /// </summary> public interface IEntityBase { } //public class EntityBase : IEntityBase //{ //} ///// <summary> ///// 接口:生成JSON时忽略NULL对象 ///// </summary> //public interface IJsonIgnoreNull : IEntityBase //{ //} ///// <summary> ///// 生成JSON时忽略NULL对象 ///// </summary> //public class JsonIgnoreNull : IJsonIgnoreNull //{ //} ///// <summary> ///// 接口:类中有枚举在序列化的时候,需要转成字符串 ///// </summary> //public interface IJsonEnumString : IEntityBase //{ //} }
#region Apache License Version 2.0 /*---------------------------------------------------------------- Copyright 2018 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd. 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. Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md ----------------------------------------------------------------*/ #endregion Apache License Version 2.0 /*---------------------------------------------------------------- Copyright (C) 2018 Senparc 文件名:EntityBase.cs 文件功能描述:EntityBase 创建标识:Senparc - 20150928 修改标识:Senparc - 20161012 修改描述:v4.8.1 添加IJsonEnumString ----------------------------------------------------------------*/ namespace Senparc.Weixin.Entities { /// <summary> /// 所有微信自定义实体的基础接口 /// </summary> public interface IEntityBase { } //public class EntityBase : IEntityBase //{ //} /// <summary> /// 接口:生成JSON时忽略NULL对象 /// </summary> public interface IJsonIgnoreNull : IEntityBase { } /// <summary> /// 生成JSON时忽略NULL对象 /// </summary> public class JsonIgnoreNull : IJsonIgnoreNull { } /// <summary> /// 接口:类中有枚举在序列化的时候,需要转成字符串 /// </summary> public interface IJsonEnumString : IEntityBase { } }
apache-2.0
C#
acd00e291f304cd225f81afd5e8db57c5a88849c
Fix the comment
punker76/Espera,flagbug/Espera
Espera/Espera.Core/Management/LibraryFileWriter.cs
Espera/Espera.Core/Management/LibraryFileWriter.cs
using Rareform.Validation; using System; using System.Collections.Generic; using System.IO; namespace Espera.Core.Management { public class LibraryFileWriter : ILibraryWriter { private readonly string targetPath; public LibraryFileWriter(string targetPath) { if (targetPath == null) Throw.ArgumentNullException(() => targetPath); this.targetPath = targetPath; } public void Write(IEnumerable<LocalSong> songs, IEnumerable<Playlist> playlists, string songSourcePath) { // Create a temporary file, write the library to it, then delete the original library // file and rename the new one. This ensures that there is a minimum possibility of // things going wrong, for example if the process is killed mid-writing. string tempFilePath = Path.Combine(Path.GetDirectoryName(this.targetPath), Guid.NewGuid().ToString()); using (FileStream targetStream = File.Create(tempFilePath)) { LibraryWriter.Write(songs, playlists, songSourcePath, targetStream); } File.Delete(this.targetPath); File.Move(tempFilePath, this.targetPath); } } }
using Rareform.Validation; using System; using System.Collections.Generic; using System.IO; namespace Espera.Core.Management { public class LibraryFileWriter : ILibraryWriter { private readonly string targetPath; public LibraryFileWriter(string targetPath) { if (targetPath == null) Throw.ArgumentNullException(() => targetPath); this.targetPath = targetPath; } public void Write(IEnumerable<LocalSong> songs, IEnumerable<Playlist> playlists, string songSourcePath) { // Create a temporary file, write the library it, then delete the original library file // and rename our new one. This ensures that there is a minimum possibility of things // going wrong, for example if the process is killed mid-writing. string tempFilePath = Path.Combine(Path.GetDirectoryName(this.targetPath), Guid.NewGuid().ToString()); using (FileStream targetStream = File.Create(tempFilePath)) { LibraryWriter.Write(songs, playlists, songSourcePath, targetStream); } File.Delete(this.targetPath); File.Move(tempFilePath, this.targetPath); } } }
mit
C#
c20f393cd60ececcf01210b6ac27d5b24d885822
Fix the dock action
AshRolls/GalaxyGen
GalaxyGen/Engine/Ai/Goap/Actions/GoapDockAction.cs
GalaxyGen/Engine/Ai/Goap/Actions/GoapDockAction.cs
using GalaxyGen.Engine.Controllers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GalaxyGen.Engine.Ai.Goap.Actions { public class GoapDockAction : GoapAction { private bool _docked = false; private bool _requestSent = false; public GoapDockAction() { addPrecondition("isDocked", false); addEffect("isDocked", true); } public override void reset() { _docked = false; _requestSent = false; } public override bool isDone() { return _docked == true; } public override bool requiresInRange() { return true; } public override bool checkProceduralPrecondition(object agent) { target = 4; return true; } public override bool perform(object agent) { GoapAgent ag = (GoapAgent)agent; if (ag.stateProvider.CurrentShipIsDocked) _docked = true; else if (!ag.stateProvider.CurrentShipIsDocked && !_requestSent) { ag.actionProvider.RequestDock(); _requestSent = true; } return true; } } }
using GalaxyGen.Engine.Controllers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GalaxyGen.Engine.Ai.Goap.Actions { public class GoapDockAction : GoapAction { private bool _docked = false; private bool _requestSent = false; public GoapDockAction() { addPrecondition("isDocked", false); addEffect("isDocked", true); } public override void reset() { _docked = false; _requestSent = false; } public override bool isDone() { return _docked == true; } public override bool requiresInRange() { return true; } public override bool checkProceduralPrecondition(object agent) { target = 4; return true; } public override bool perform(object agent) { GoapAgent ag = (GoapAgent)agent; if (ag.stateProvider.CurrentShipIsDocked) _docked = true; else if (ag.stateProvider.CurrentShipIsDocked && !_requestSent) { ag.actionProvider.RequestDock(); _requestSent = true; } return true; } } }
mit
C#
a53e4e3df3532ea9e60db600d590d1c5f94c204f
change assembly info
Efimster/HelperExtensionsLibrary
HelperExtensionsLibrary/Properties/AssemblyInfo.cs
HelperExtensionsLibrary/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("HelperExtensionsLibrary")] [assembly: AssemblyDescription("The library of helper extensions useful in any project")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Efimster")] [assembly: AssemblyProduct("HelperExtensionsLibrary")] [assembly: AssemblyCopyright("Copyright 2013 (c) Efimster https://github.com/Efimster")] [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("56c8e940-8d1c-432c-bf25-f1b85004e8fd")] [assembly: InternalsVisibleTo("HelperExtensionsLibrary.Fixture")] // 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.3")] [assembly: AssemblyFileVersion("1.0.0.3")]
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("HelperExtensionsLibrary")] [assembly: AssemblyDescription("The library of helper extensions useful in any project")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Efimster")] [assembly: AssemblyProduct("HelperExtensionsLibrary")] [assembly: AssemblyCopyright("Efimster@gmail.com")] [assembly: AssemblyTrademark("Copyright 2013 (c) Efimster")] [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("56c8e940-8d1c-432c-bf25-f1b85004e8fd")] [assembly: InternalsVisibleTo("HelperExtensionsLibrary.Fixture")] // 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.3")] [assembly: AssemblyFileVersion("1.0.0.3")]
mit
C#
10343e4ae684a7336367aa5b5fbc51082dfbf539
Bump v1.0.17
karronoli/tiny-sato
TinySato/Properties/AssemblyInfo.cs
TinySato/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("TinySato")] [assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TinySato")] [assembly: AssemblyCopyright("Copyright 2016 karronoli")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: [assembly: AssemblyVersion("1.0.17.*")] [assembly: AssemblyFileVersion("1.0.17")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("TinySato")] [assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TinySato")] [assembly: AssemblyCopyright("Copyright 2016 karronoli")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: [assembly: AssemblyVersion("1.0.16.1")] [assembly: AssemblyFileVersion("1.0.16")]
apache-2.0
C#
767d54049e642360cb214872cf3ce54124a9a79a
Simplify attribute specification
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Crypto/CryptoGuards.cs
WalletWasabi/Crypto/CryptoGuards.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using WalletWasabi.Crypto.Groups; namespace WalletWasabi.Crypto { public static class CryptoGuard { [DebuggerStepThrough] public static GroupElement NotInfinity(string parameterName, GroupElement groupElement) => groupElement.IsInfinity switch { true => throw new ArgumentException("Point at infinity is not a valid value.", parameterName), false => groupElement }; [DebuggerStepThrough] public static IEnumerable<GroupElement> NotInfinity(string parameterName, IEnumerable<GroupElement> groupElements) => groupElements.Select((ge, i) => NotInfinity($"{parameterName}[{i}]", ge)); } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using WalletWasabi.Crypto.Groups; namespace WalletWasabi.Crypto { public static class CryptoGuard { [DebuggerStepThroughAttribute] public static GroupElement NotInfinity(string parameterName, GroupElement groupElement) => groupElement.IsInfinity switch { true => throw new ArgumentException("Point at infinity is not a valid value.", parameterName), false => groupElement }; [DebuggerStepThroughAttribute] public static IEnumerable<GroupElement> NotInfinity(string parameterName, IEnumerable<GroupElement> groupElements) => groupElements.Select((ge, i) => NotInfinity($"{parameterName}[{i}]", ge)); } }
mit
C#
b02a62ec5c66e226d0dd31467ddecd435e28bd61
Undo httpclient helper refactor
Daniele122898/SoraBot-v2,Daniele122898/SoraBot-v2
SoraBot/SoraBot.Services/Utils/HttpClientHelper.cs
SoraBot/SoraBot.Services/Utils/HttpClientHelper.cs
using System; using System.IO; using System.Net.Http; using System.Threading.Tasks; namespace SoraBot.Services.Utils { public class HttpClientHelper : IDisposable { public HttpClient HttpClient { get; private set; } public HttpClientHelper() { this.HttpClient = new HttpClient(); } /// <summary> /// Downloads a File and saves it to the given path. /// Might throw an exception if there's a failure at any stage /// </summary> public async Task DownloadAndSaveFile(Uri url, string path) { using var request = new HttpRequestMessage(HttpMethod.Get, url); using var resp = await HttpClient.SendAsync(request).ConfigureAwait(false); await using Stream contentStream = await resp.Content.ReadAsStreamAsync().ConfigureAwait(false); await using var stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, 3145728, true); await contentStream.CopyToAsync(stream).ConfigureAwait(false); await contentStream.FlushAsync().ConfigureAwait(false); await stream.FlushAsync().ConfigureAwait(false); } public async Task<Stream> DownloadFileAsStream(Uri url) { using var request = new HttpRequestMessage(HttpMethod.Get, url); using var resp = await HttpClient.SendAsync(request).ConfigureAwait(false); return await resp.Content.ReadAsStreamAsync().ConfigureAwait(false); } public void Dispose() { HttpClient?.Dispose(); } } }
using System; using System.IO; using System.Net.Http; using System.Threading.Tasks; namespace SoraBot.Services.Utils { public class HttpClientHelper : IDisposable { public HttpClient HttpClient { get; private set; } public HttpClientHelper() { this.HttpClient = new HttpClient(); } /// <summary> /// Downloads a File and saves it to the given path. /// Might throw an exception if there's a failure at any stage /// </summary> public async Task DownloadAndSaveFile(Uri url, string path) { var contentStream = await this.DownloadFileAsStream(url).ConfigureAwait(false); await using var stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, 3145728, true); await contentStream.CopyToAsync(stream).ConfigureAwait(false); await contentStream.FlushAsync().ConfigureAwait(false); await stream.FlushAsync().ConfigureAwait(false); await contentStream.DisposeAsync(); } public async Task<Stream> DownloadFileAsStream(Uri url) { using var request = new HttpRequestMessage(HttpMethod.Get, url); using var resp = await HttpClient.SendAsync(request).ConfigureAwait(false); return await resp.Content.ReadAsStreamAsync().ConfigureAwait(false); } public void Dispose() { HttpClient?.Dispose(); } } }
agpl-3.0
C#
b1324394b63f699315457abc7d33d1129fddf609
Remove unused y field from VineGenerator
cooperra/ld34-beanstalkers-extreme
Assets/Scripts/Beanstalk/VineGenerator.cs
Assets/Scripts/Beanstalk/VineGenerator.cs
using UnityEngine; using System.Collections; public class VineGenerator : MainBehaviour { public Transform VinePoint; public float Rate = .25f; public float DownwardSpeed = -5.0f; private LineRenderer _line; private float _lastCreated = 0.0f; private int _points = 0; void Start(){ _line = GetComponent<LineRenderer>(); } protected override void FixedGameUpdate(){ if(GameTime >= _lastCreated + Rate){ _points++; _line.SetVertexCount(_points); //if(_points - 1 == 0) _line.SetPosition(_points - 1, VinePoint.position); //else //_line.SetPosition(_points - 1, VinePoint.position - new Vector3(0, y, 0)); _lastCreated = GameTime; } } }
using UnityEngine; using System.Collections; public class VineGenerator : MainBehaviour { public Transform VinePoint; public float Rate = .25f; public float DownwardSpeed = -5.0f; private LineRenderer _line; private float _lastCreated = 0.0f; private int _points = 0; private float y = 0; void Start(){ _line = GetComponent<LineRenderer>(); } protected override void FixedGameUpdate(){ y -= DownwardSpeed * Time.deltaTime; if(GameTime >= _lastCreated + Rate){ _points++; _line.SetVertexCount(_points); //if(_points - 1 == 0) _line.SetPosition(_points - 1, VinePoint.position); //else //_line.SetPosition(_points - 1, VinePoint.position - new Vector3(0, y, 0)); _lastCreated = GameTime; } } }
mit
C#
f2149aa353c09989c14a74912093944c2188f46b
Update Note.cs
CarmelSoftware/MVCDataRepositoryXML
Models/Note.cs
Models/Note.cs
public class Note { public int ID { get; set; } public string To { get; set; } public string From { get; set; } public string Heading { get; set; } public string Body { get; set; } }
/// Note.cs
mit
C#
dc8d989ee9d552eee671ddbc30859195962afeaa
add test for IPNetwork
WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common
test/WeihanLi.Common.Test/HelpersTest/NetHelperTest.cs
test/WeihanLi.Common.Test/HelpersTest/NetHelperTest.cs
using System.Net; using WeihanLi.Common.Helpers; using Xunit; namespace WeihanLi.Common.Test.HelpersTest { public class NetHelperTest { [Theory] [InlineData("10.0.0.135", true)] [InlineData("192.168.0.185", true)] [InlineData("172.16.0.125", true)] [InlineData("172.105.192.135", false)] [InlineData("23.100.91.85", false)] public void PrivateIPTest(string ip, bool isPrivate) { Assert.Equal(isPrivate, NetHelper.IsPrivateIP(ip)); } [Theory] [InlineData("192.168.0.0/16", "192.168.0.185", true)] [InlineData("192.168.0.0/16", "172.16.0.125", false)] [InlineData("23.100.91.85", "23.100.91.85", true)] public void IPNetworkTest(string cidr, string ip, bool contains) { Assert.Equal(contains, new IPNetwork(cidr).Contains(IPAddress.Parse(ip))); } } }
using WeihanLi.Common.Helpers; using Xunit; namespace WeihanLi.Common.Test.HelpersTest { public class NetHelperTest { [Theory] [InlineData("10.0.0.135", true)] [InlineData("192.168.0.185", true)] [InlineData("172.16.0.125", true)] [InlineData("172.105.192.135", false)] [InlineData("23.100.91.85", false)] public void PrivateIPTest(string ip, bool isPrivate) { Assert.Equal(NetHelper.IsPrivateIP(ip), isPrivate); } } }
mit
C#
e252bb3848361e96e9d1d92183aa41e7c263a6e1
remove async from return value
octoblu/meshblu-connector-skype,octoblu/meshblu-connector-skype
src/csharp/join-meeting.cs
src/csharp/join-meeting.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Lync.Model; using Microsoft.Lync.Model.Conversation; using Microsoft.Lync.Model.Conversation.Sharing; using Microsoft.Lync.Model.Conversation.AudioVideo; using Microsoft.Lync.Model.Extensibility; public class Startup { public async Task<ConversationWindow> StartConversation(string joinUrl, long parentHwnd) { Automation automation = LyncClient.GetAutomation(); return Task<ConversationWindow>.Factory.FromAsync( automation.BeginStartConversation, automation.EndStartConversation, joinUrl, parentHwnd, null // args passed to automation.BeginStartConversation ); } public async Task<object> Invoke(string joinUrl) { joinUrl = joinUrl + '?'; var conversationWindow = await StartConversation(joinUrl, 0); var tcs = new TaskCompletionSource<bool>(); conversationWindow.Conversation.StateChanged += (sender, e) => { if (e.NewState.ToString() != "Active") return; tcs.TrySetResult(true); }; await tcs.Task; conversationWindow.ShowContent(); conversationWindow.ShowFullScreen(0); return conversationWindow.Conversation.Properties[ConversationProperty.Id].ToString(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Lync.Model; using Microsoft.Lync.Model.Conversation; using Microsoft.Lync.Model.Conversation.Sharing; using Microsoft.Lync.Model.Conversation.AudioVideo; using Microsoft.Lync.Model.Extensibility; public class Startup { public async Task<ConversationWindow> StartConversation(string joinUrl, long parentHwnd) { Automation automation = LyncClient.GetAutomation(); return await Task<ConversationWindow>.Factory.FromAsync( automation.BeginStartConversation, automation.EndStartConversation, joinUrl, parentHwnd, null // args passed to automation.BeginStartConversation ); } public async Task<object> Invoke(string joinUrl) { joinUrl = joinUrl + '?'; var conversationWindow = await StartConversation(joinUrl, 0); var tcs = new TaskCompletionSource<bool>(); conversationWindow.Conversation.StateChanged += (sender, e) => { if (e.NewState.ToString() != "Active") return; tcs.TrySetResult(true); }; await tcs.Task; conversationWindow.ShowContent(); conversationWindow.ShowFullScreen(0); return conversationWindow.Conversation.Properties[ConversationProperty.Id].ToString(); } }
mit
C#
c772fba11024c2da9aca100531cfa11f52fee53c
Remove dependency on threading.
bigfont/StackOverflow,bigfont/StackOverflow,bigfont/StackOverflow,bigfont/StackOverflow
AspNetCoreServerSentEvents/Program.cs
AspNetCoreServerSentEvents/Program.cs
using System; using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; namespace ServerSentEventSample { public class Program { public void ConfigureServices(IServiceCollection services) { services.AddDirectoryBrowser(); } public void Configure(IApplicationBuilder app, IHostingEnvironment host) { app.UseFileServer(new FileServerOptions { EnableDirectoryBrowsing = true }); app.Use(async (context, next) => { if (context.Request.Path.ToString().Contains("sse")) { var response = context.Response; response.Headers.Add("Content-Type", "text/event-stream"); await response.WriteAsync($"data: First message...\r\r"); var i = 0; while (true) { await Task.Delay(5 * 1000); await response .WriteAsync($"data: Message{i++} at {DateTime.Now}\r\r"); } } }); } public static void Main(string[] args) { Console.WriteLine("Hello World!"); var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseWebRoot(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")) .UseStartup<Program>() .Build(); host.Run(); } } }
using System; using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; namespace ServerSentEventSample { public class Program { public void ConfigureServices(IServiceCollection services) { services.AddDirectoryBrowser(); } public void Configure(IApplicationBuilder app, IHostingEnvironment host) { app.UseFileServer(new FileServerOptions { EnableDirectoryBrowsing = true }); app.Use(async (context, next) => { if (context.Request.Path.ToString().Contains("sse")) { var response = context.Response; response.Headers.Add("Content-Type", "text/event-stream"); await response.WriteAsync($"data: First message...\r\r"); var i = 0; while (true) { await Task.Delay(5 * 1000); await response .WriteAsync($"data: Message{i++} at {DateTime.Now}\r\r"); } } }); } public static void Main(string[] args) { Console.WriteLine("Hello World!"); var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseWebRoot(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")) .UseStartup<Program>() .Build(); host.Run(); } } }
mit
C#
f684a3d9e31391731f4f6f9c4d3ae014b8576505
Fix issue in NamedPipeServerStream.GetImpersonationUserName() (#37676)
krk/coreclr,poizan42/coreclr,krk/coreclr,wtgodbe/coreclr,wtgodbe/coreclr,wtgodbe/coreclr,wtgodbe/coreclr,poizan42/coreclr,cshung/coreclr,cshung/coreclr,krk/coreclr,krk/coreclr,krk/coreclr,cshung/coreclr,poizan42/coreclr,cshung/coreclr,wtgodbe/coreclr,krk/coreclr,cshung/coreclr,poizan42/coreclr,poizan42/coreclr,cshung/coreclr,wtgodbe/coreclr,poizan42/coreclr
src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs
src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryEx.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 Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; internal partial class Interop { internal partial class Kernel32 { internal const int LOAD_LIBRARY_AS_DATAFILE = 0x00000002; internal const int LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800; [DllImport(Libraries.Kernel32, EntryPoint = "LoadLibraryExW", CharSet = CharSet.Unicode, SetLastError = true)] internal static extern SafeLibraryHandle LoadLibraryEx(string libFilename, IntPtr reserved, int flags); } }
// 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 Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; internal partial class Interop { internal partial class Kernel32 { internal const int LOAD_LIBRARY_AS_DATAFILE = 0x00000002; [DllImport(Libraries.Kernel32, EntryPoint = "LoadLibraryExW", CharSet = CharSet.Unicode, SetLastError = true)] internal static extern SafeLibraryHandle LoadLibraryEx(string libFilename, IntPtr reserved, int flags); } }
mit
C#
ea9cb0e3c89582dc6ec06496ef27418b26fa2167
Disable unwanted lazy loading during query execution
azabluda/InfoCarrier.Core
Query/Internal/InfoCarrierQueryContext.cs
Query/Internal/InfoCarrierQueryContext.cs
namespace InfoCarrier.Core.Client.Query.Internal { using System; using Common; using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.Query.Internal; public class InfoCarrierQueryContext : QueryContext { public InfoCarrierQueryContext( Func<IQueryBuffer> createQueryBuffer, ServerContext serverContext, IStateManager stateManager, IConcurrencyDetector concurrencyDetector) : base( createQueryBuffer, stateManager, concurrencyDetector) { this.ServerContext = serverContext; } public ServerContext ServerContext { get; } public override void StartTracking(object entity, EntityTrackingInfo entityTrackingInfo) { using (new PropertyLoadController(this.ServerContext.DataContext, enableLoading: false)) { base.StartTracking(entity, entityTrackingInfo); } } } }
namespace InfoCarrier.Core.Client.Query.Internal { using System; using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.Query.Internal; public class InfoCarrierQueryContext : QueryContext { public InfoCarrierQueryContext( Func<IQueryBuffer> createQueryBuffer, ServerContext serverContext, IStateManager stateManager, IConcurrencyDetector concurrencyDetector) : base( createQueryBuffer, stateManager, concurrencyDetector) { this.ServerContext = serverContext; } public ServerContext ServerContext { get; } } }
mit
C#